diff -r 34716fd837a4 -r be944660c56a wp/wp-includes/js/dist/block-library.js --- a/wp/wp-includes/js/dist/block-library.js Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-includes/js/dist/block-library.js Wed Sep 21 18:19:35 2022 +0200 @@ -82,51 +82,462 @@ /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 436); +/******/ return __webpack_require__(__webpack_require__.s = "K51g"); /******/ }) /************************************************************************/ /******/ ({ -/***/ 0: +/***/ "1CF3": /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["element"]; }()); - -/***/ }), - -/***/ 1: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["i18n"]; }()); - -/***/ }), - -/***/ 10: +(function() { module.exports = window["wp"]["dom"]; }()); + +/***/ }), + +/***/ "1K8p": +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) 2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule normalizeWheel + * @typechecks + */ + + + +var UserAgent_DEPRECATED = __webpack_require__("jrfk"); + +var isEventSupported = __webpack_require__("ez49"); + + +// Reasonable defaults +var PIXEL_STEP = 10; +var LINE_HEIGHT = 40; +var PAGE_HEIGHT = 800; + +/** + * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is + * complicated, thus this doc is long and (hopefully) detailed enough to answer + * your questions. + * + * If you need to react to the mouse wheel in a predictable way, this code is + * like your bestest friend. * hugs * + * + * As of today, there are 4 DOM event types you can listen to: + * + * 'wheel' -- Chrome(31+), FF(17+), IE(9+) + * 'mousewheel' -- Chrome, IE(6+), Opera, Safari + * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! + * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 + * + * So what to do? The is the best: + * + * normalizeWheel.getEventType(); + * + * In your event callback, use this code to get sane interpretation of the + * deltas. This code will return an object with properties: + * + * spinX -- normalized spin speed (use for zoom) - x plane + * spinY -- " - y plane + * pixelX -- normalized distance (to pixels) - x plane + * pixelY -- " - y plane + * + * Wheel values are provided by the browser assuming you are using the wheel to + * scroll a web page by a number of lines or pixels (or pages). Values can vary + * significantly on different platforms and browsers, forgetting that you can + * scroll at different speeds. Some devices (like trackpads) emit more events + * at smaller increments with fine granularity, and some emit massive jumps with + * linear speed or acceleration. + * + * This code does its best to normalize the deltas for you: + * + * - spin is trying to normalize how far the wheel was spun (or trackpad + * dragged). This is super useful for zoom support where you want to + * throw away the chunky scroll steps on the PC and make those equal to + * the slow and smooth tiny steps on the Mac. Key data: This code tries to + * resolve a single slow step on a wheel to 1. + * + * - pixel is normalizing the desired scroll delta in pixel units. You'll + * get the crazy differences between browsers, but at least it'll be in + * pixels! + * + * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This + * should translate to positive value zooming IN, negative zooming OUT. + * This matches the newer 'wheel' event. + * + * Why are there spinX, spinY (or pixels)? + * + * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn + * with a mouse. It results in side-scrolling in the browser by default. + * + * - spinY is what you expect -- it's the classic axis of a mouse wheel. + * + * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and + * probably is by browsers in conjunction with fancy 3D controllers .. but + * you know. + * + * Implementation info: + * + * Examples of 'wheel' event if you scroll slowly (down) by one step with an + * average mouse: + * + * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) + * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) + * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) + * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) + * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) + * + * On the trackpad: + * + * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) + * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) + * + * On other/older browsers.. it's more complicated as there can be multiple and + * also missing delta values. + * + * The 'wheel' event is more standard: + * + * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents + * + * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and + * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain + * backward compatibility with older events. Those other values help us + * better normalize spin speed. Example of what the browsers provide: + * + * | event.wheelDelta | event.detail + * ------------------+------------------+-------------- + * Safari v5/OS X | -120 | 0 + * Safari v5/Win7 | -120 | 0 + * Chrome v17/OS X | -120 | 0 + * Chrome v17/Win7 | -120 | 0 + * IE9/Win7 | -120 | undefined + * Firefox v4/OS X | undefined | 1 + * Firefox v4/Win7 | undefined | 3 + * + */ +function normalizeWheel(/*object*/ event) /*object*/ { + var sX = 0, sY = 0, // spinX, spinY + pX = 0, pY = 0; // pixelX, pixelY + + // Legacy + if ('detail' in event) { sY = event.detail; } + if ('wheelDelta' in event) { sY = -event.wheelDelta / 120; } + if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120; } + if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120; } + + // side scrolling on FF with DOMMouseScroll + if ( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { + sX = sY; + sY = 0; + } + + pX = sX * PIXEL_STEP; + pY = sY * PIXEL_STEP; + + if ('deltaY' in event) { pY = event.deltaY; } + if ('deltaX' in event) { pX = event.deltaX; } + + if ((pX || pY) && event.deltaMode) { + if (event.deltaMode == 1) { // delta in LINE units + pX *= LINE_HEIGHT; + pY *= LINE_HEIGHT; + } else { // delta in PAGE units + pX *= PAGE_HEIGHT; + pY *= PAGE_HEIGHT; + } + } + + // Fall-back if spin cannot be determined + if (pX && !sX) { sX = (pX < 1) ? -1 : 1; } + if (pY && !sY) { sY = (pY < 1) ? -1 : 1; } + + return { spinX : sX, + spinY : sY, + pixelX : pX, + pixelY : pY }; +} + + +/** + * The best combination if you prefer spinX + spinY normalization. It favors + * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with + * 'wheel' event, making spin speed determination impossible. + */ +normalizeWheel.getEventType = function() /*string*/ { + return (UserAgent_DEPRECATED.firefox()) + ? 'DOMMouseScroll' + : (isEventSupported('wheel')) + ? 'wheel' + : 'mousewheel'; +}; + +module.exports = normalizeWheel; + + +/***/ }), + +/***/ "1Yn1": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +const code = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" +})); +/* harmony default export */ __webpack_exports__["a"] = (code); + + +/***/ }), + +/***/ "1ZqX": /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["blocks"]; }()); - -/***/ }), - -/***/ 100: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["notices"]; }()); - -/***/ }), - -/***/ 103: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["autop"]; }()); - -/***/ }), - -/***/ 105: +(function() { module.exports = window["wp"]["data"]; }()); + +/***/ }), + +/***/ "1iEr": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +const chevronRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" +})); +/* harmony default export */ __webpack_exports__["a"] = (chevronRight); + + +/***/ }), + +/***/ "2gm7": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); + + +/** + * WordPress dependencies + */ + +const chevronLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { + d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" +})); +/* harmony default export */ __webpack_exports__["a"] = (chevronLeft); + + +/***/ }), + +/***/ "4eJC": +/***/ (function(module, exports, __webpack_require__) { + +/** + * Memize options object. + * + * @typedef MemizeOptions + * + * @property {number} [maxSize] Maximum size of the cache. + */ + +/** + * Internal cache entry. + * + * @typedef MemizeCacheNode + * + * @property {?MemizeCacheNode|undefined} [prev] Previous node. + * @property {?MemizeCacheNode|undefined} [next] Next node. + * @property {Array<*>} args Function arguments for cache + * entry. + * @property {*} val Function result. + */ + +/** + * Properties of the enhanced function for controlling cache. + * + * @typedef MemizeMemoizedFunction + * + * @property {()=>void} clear Clear the cache. + */ + +/** + * Accepts a function to be memoized, and returns a new memoized function, with + * optional options. + * + * @template {Function} F + * + * @param {F} fn Function to memoize. + * @param {MemizeOptions} [options] Options object. + * + * @return {F & MemizeMemoizedFunction} Memoized function. + */ +function memize( fn, options ) { + var size = 0; + + /** @type {?MemizeCacheNode|undefined} */ + var head; + + /** @type {?MemizeCacheNode|undefined} */ + var tail; + + options = options || {}; + + function memoized( /* ...args */ ) { + var node = head, + len = arguments.length, + args, i; + + searchCache: while ( node ) { + // Perform a shallow equality test to confirm that whether the node + // under test is a candidate for the arguments passed. Two arrays + // are shallowly equal if their length matches and each entry is + // strictly equal between the two sets. Avoid abstracting to a + // function which could incur an arguments leaking deoptimization. + + // Check whether node arguments match arguments length + if ( node.args.length !== arguments.length ) { + node = node.next; + continue; + } + + // Check whether node arguments match arguments values + for ( i = 0; i < len; i++ ) { + if ( node.args[ i ] !== arguments[ i ] ) { + node = node.next; + continue searchCache; + } + } + + // At this point we can assume we've found a match + + // Surface matched node to head if not already + if ( node !== head ) { + // As tail, shift to previous. Must only shift if not also + // head, since if both head and tail, there is no previous. + if ( node === tail ) { + tail = node.prev; + } + + // Adjust siblings to point to each other. If node was tail, + // this also handles new tail's empty `next` assignment. + /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; + if ( node.next ) { + node.next.prev = node.prev; + } + + node.next = head; + node.prev = null; + /** @type {MemizeCacheNode} */ ( head ).prev = node; + head = node; + } + + // Return immediately + return node.val; + } + + // No cached value found. Continue to insertion phase: + + // Create a copy of arguments (avoid leaking deoptimization) + args = new Array( len ); + for ( i = 0; i < len; i++ ) { + args[ i ] = arguments[ i ]; + } + + node = { + args: args, + + // Generate the result from original function + val: fn.apply( null, args ), + }; + + // Don't need to check whether node is already head, since it would + // have been returned above already if it was + + // Shift existing head down list + if ( head ) { + head.prev = node; + node.next = head; + } else { + // If no head, follows that there's no tail (at initial or reset) + tail = node; + } + + // Trim tail if we're reached max size and are pending cache insertion + if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { + tail = /** @type {MemizeCacheNode} */ ( tail ).prev; + /** @type {MemizeCacheNode} */ ( tail ).next = null; + } else { + size++; + } + + head = node; + + return node.val; + } + + memoized.clear = function() { + head = null; + tail = null; + size = 0; + }; + + if ( false ) {} + + // Ignore reason: There's not a clear solution to create an intersection of + // the function with additional properties, where the goal is to retain the + // function signature of the incoming argument and add control properties + // on the return value. + + // @ts-ignore + return memoized; +} + +module.exports = memize; + + +/***/ }), + +/***/ "A/WM": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2017 Jed Watson. + Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ @@ -156,12 +567,16 @@ } function _parseObject (resultSet, object) { - for (var k in object) { - if (hasOwn.call(object, k)) { - // set value to false instead of deleting it to avoid changing object structure - // https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions - resultSet[k] = !!object[k]; + if (object.toString === Object.prototype.toString) { + for (var k in object) { + if (hasOwn.call(object, k)) { + // set value to false instead of deleting it to avoid changing object structure + // https://www.smashingmagazine.com/2012/11/writing-fast-memory-efficient-javascript/#de-referencing-misconceptions + resultSet[k] = !!object[k]; + } } + } else { + resultSet[object.toString()] = true; } } @@ -238,268 +653,49 @@ /***/ }), -/***/ 11: -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2017 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg) && arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}()); - - -/***/ }), - -/***/ 12: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -/***/ }), - -/***/ 13: -/***/ (function(module, exports) { - -(function() { module.exports = this["React"]; }()); - -/***/ }), - -/***/ 137: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); -/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(15); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__); - - - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - // Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly. - -/* eslint-disable jsdoc/valid-types */ - -/** @typedef {{icon: JSX.Element, size?: number} & import('react').ComponentPropsWithoutRef<'SVG'>} IconProps */ - -/* eslint-enable jsdoc/valid-types */ - -/** - * Return an SVG icon. - * - * @param {IconProps} props icon is the SVG component to render - * size is a number specifiying the icon size in pixels - * Other props will be passed to wrapped SVG component - * - * @return {JSX.Element} Icon component - */ - -function Icon(_ref) { - var icon = _ref.icon, - _ref$size = _ref.size, - size = _ref$size === void 0 ? 24 : _ref$size, - props = Object(_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(_ref, ["icon", "size"]); - - return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__["cloneElement"])(icon, _objectSpread({ - width: size, - height: size - }, props)); -} - -/* harmony default export */ __webpack_exports__["a"] = (Icon); - - -/***/ }), - -/***/ 14: +/***/ "B9Az": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js -var arrayWithHoles = __webpack_require__(38); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js -function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - 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; -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js -var unsupportedIterableToArray = __webpack_require__(29); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js -var nonIterableRest = __webpack_require__(39); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js - - - - -function _slicedToArray(arr, i) { - return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); -} - -/***/ }), - -/***/ 15: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); -/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41); - -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(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; -} - -/***/ }), - -/***/ 155: +// EXTERNAL MODULE: external ["wp","element"] +var external_wp_element_ = __webpack_require__("GRId"); + +// EXTERNAL MODULE: external ["wp","primitives"] +var external_wp_primitives_ = __webpack_require__("Tqx9"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js + + +/** + * WordPress dependencies + */ + +const pencil = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" +})); +/* harmony default export */ var library_pencil = (pencil); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js +/** + * Internal dependencies + */ + +/* harmony default export */ var edit = __webpack_exports__["a"] = (library_pencil); + + +/***/ }), + +/***/ "Bpkj": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); +/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M9 18.6L3.5 13l1-1L9 16.4l9.5-9.9 1 1z" -})); -/* harmony default export */ __webpack_exports__["a"] = (check); - - -/***/ }), - -/***/ 16: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -/***/ }), - -/***/ 177: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); +/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); @@ -507,69 +703,7 @@ * WordPress dependencies */ -var closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13 11.9l3.3-3.4-1.1-1-3.2 3.3-3.2-3.3-1.1 1 3.3 3.4-3.5 3.6 1 1L12 13l3.5 3.5 1-1z" -})); -/* harmony default export */ __webpack_exports__["a"] = (closeSmall); - - -/***/ }), - -/***/ 18: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js -var arrayLikeToArray = __webpack_require__(26); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js - -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); -} -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js -var iterableToArray = __webpack_require__(35); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js -var unsupportedIterableToArray = __webpack_require__(29); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js - - - - -function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); -} - -/***/ }), - -/***/ 180: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { +const link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { @@ -580,211 +714,7 @@ /***/ }), -/***/ 19: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -/***/ }), - -/***/ 2: -/***/ (function(module, exports) { - -(function() { module.exports = this["lodash"]; }()); - -/***/ }), - -/***/ 20: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -/***/ }), - -/***/ 203: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var keyboardReturn = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M16 4h2v9H7v3l-5-4 5-4v3h9V4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (keyboardReturn); - - -/***/ }), - -/***/ 204: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var upload = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (upload); - - -/***/ }), - -/***/ 205: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var linkOff = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z" -})); -/* harmony default export */ __webpack_exports__["a"] = (linkOff); - - -/***/ }), - -/***/ 21: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["keycodes"]; }()); - -/***/ }), - -/***/ 22: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); - -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} -// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); -} - -/***/ }), - -/***/ 23: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); -/* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); -/* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); - - -function _possibleConstructorReturn(self, call) { - if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { - return call; - } - - return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); -} - -/***/ }), - -/***/ 25: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["richText"]; }()); - -/***/ }), - -/***/ 26: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - - return arr2; -} - -/***/ }), - -/***/ 267: +/***/ "FEKF": /***/ (function(module, exports, __webpack_require__) { /*! Fast Average Color | © 2019 Denis Seleznev | MIT License | https://github.com/hcodes/fast-average-color/ */ @@ -1239,388 +1169,35 @@ /***/ }), -/***/ 287: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var alignLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignLeft); - - -/***/ }), - -/***/ 288: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var alignCenter = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignCenter); - - -/***/ }), - -/***/ 289: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var alignRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (alignRight); - - -/***/ }), - -/***/ 29: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); -/* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26); - -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); -} - -/***/ }), - -/***/ 291: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var search = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (search); - - -/***/ }), - -/***/ 292: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var chevronRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronRight); - - -/***/ }), - -/***/ 293: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var chevronLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (chevronLeft); - - -/***/ }), - -/***/ 299: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var pencil = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6zM13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (pencil); - - -/***/ }), - -/***/ 3: +/***/ "FqII": +/***/ (function(module, exports) { + +(function() { module.exports = window["wp"]["date"]; }()); + +/***/ }), + +/***/ "GRId": /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["components"]; }()); - -/***/ }), - -/***/ 300: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var edit = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z" -})); -/* harmony default export */ __webpack_exports__["a"] = (edit); - - -/***/ }), - -/***/ 301: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var code = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" -})); -/* harmony default export */ __webpack_exports__["a"] = (code); - - -/***/ }), - -/***/ 302: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); -/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6); -/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); - - -/** - * WordPress dependencies - */ - -var grid = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "-2 -2 24 24" -}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { - d: "M9 9V3H3v6h6zm8 0V3h-6v6h6zm-8 8v-6H3v6h6zm8 0v-6h-6v6h6z" -})); -/* harmony default export */ __webpack_exports__["a"] = (grid); - - -/***/ }), - -/***/ 31: +(function() { module.exports = window["wp"]["element"]; }()); + +/***/ }), + +/***/ "HSyU": /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["url"]; }()); - -/***/ }), - -/***/ 35: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); -} - -/***/ }), - -/***/ 37: -/***/ (function(module, exports) { - -(function() { module.exports = this["wp"]["deprecated"]; }()); - -/***/ }), - -/***/ 38: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -/***/ }), - -/***/ 39: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - -/***/ }), - -/***/ 4: +(function() { module.exports = window["wp"]["blocks"]; }()); + +/***/ }), + +/***/ "JREk": /***/ (function(module, exports) { -(function() { module.exports = this["wp"]["data"]; }()); - -/***/ }), - -/***/ 40: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); -} - -/***/ }), - -/***/ 41: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", 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; -} - -/***/ }), - -/***/ 43: -/***/ (function(module, exports) { - -(function() { module.exports = this["moment"]; }()); - -/***/ }), - -/***/ 436: +(function() { module.exports = window["wp"]["serverSideRender"]; }()); + +/***/ }), + +/***/ "K51g": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -1628,7 +1205,8 @@ __webpack_require__.r(__webpack_exports__); // EXPORTS -__webpack_require__.d(__webpack_exports__, "registerCoreBlocks", function() { return /* binding */ build_module_registerCoreBlocks; }); +__webpack_require__.d(__webpack_exports__, "__experimentalGetCoreBlocks", function() { return /* binding */ __experimentalGetCoreBlocks; }); +__webpack_require__.d(__webpack_exports__, "registerCoreBlocks", function() { return /* binding */ registerCoreBlocks; }); __webpack_require__.d(__webpack_exports__, "__experimentalRegisterExperimentalCoreBlocks", function() { return /* binding */ __experimentalRegisterExperimentalCoreBlocks; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/paragraph/index.js @@ -1681,18 +1259,18 @@ __webpack_require__.d(build_module_audio_namespaceObject, "settings", function() { return audio_settings; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/button/index.js -var build_module_button_namespaceObject = {}; -__webpack_require__.r(build_module_button_namespaceObject); -__webpack_require__.d(build_module_button_namespaceObject, "metadata", function() { return button_metadata; }); -__webpack_require__.d(build_module_button_namespaceObject, "name", function() { return button_name; }); -__webpack_require__.d(build_module_button_namespaceObject, "settings", function() { return button_settings; }); +var button_namespaceObject = {}; +__webpack_require__.r(button_namespaceObject); +__webpack_require__.d(button_namespaceObject, "metadata", function() { return button_metadata; }); +__webpack_require__.d(button_namespaceObject, "name", function() { return button_name; }); +__webpack_require__.d(button_namespaceObject, "settings", function() { return button_settings; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/buttons/index.js -var buttons_namespaceObject = {}; -__webpack_require__.r(buttons_namespaceObject); -__webpack_require__.d(buttons_namespaceObject, "metadata", function() { return buttons_metadata; }); -__webpack_require__.d(buttons_namespaceObject, "name", function() { return buttons_name; }); -__webpack_require__.d(buttons_namespaceObject, "settings", function() { return buttons_settings; }); +var build_module_buttons_namespaceObject = {}; +__webpack_require__.r(build_module_buttons_namespaceObject); +__webpack_require__.d(build_module_buttons_namespaceObject, "metadata", function() { return buttons_metadata; }); +__webpack_require__.d(build_module_buttons_namespaceObject, "name", function() { return buttons_name; }); +__webpack_require__.d(build_module_buttons_namespaceObject, "settings", function() { return buttons_settings; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/calendar/index.js var build_module_calendar_namespaceObject = {}; @@ -1739,10 +1317,9 @@ // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/embed/index.js var embed_namespaceObject = {}; __webpack_require__.r(embed_namespaceObject); +__webpack_require__.d(embed_namespaceObject, "metadata", function() { return embed_metadata; }); __webpack_require__.d(embed_namespaceObject, "name", function() { return embed_name; }); __webpack_require__.d(embed_namespaceObject, "settings", function() { return embed_settings; }); -__webpack_require__.d(embed_namespaceObject, "common", function() { return embed_common; }); -__webpack_require__.d(embed_namespaceObject, "others", function() { return embed_others; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/file/index.js var build_module_file_namespaceObject = {}; @@ -1779,6 +1356,13 @@ __webpack_require__.d(latest_posts_namespaceObject, "name", function() { return latest_posts_name; }); __webpack_require__.d(latest_posts_namespaceObject, "settings", function() { return latest_posts_settings; }); +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/loginout/index.js +var loginout_namespaceObject = {}; +__webpack_require__.r(loginout_namespaceObject); +__webpack_require__.d(loginout_namespaceObject, "metadata", function() { return loginout_metadata; }); +__webpack_require__.d(loginout_namespaceObject, "name", function() { return loginout_name; }); +__webpack_require__.d(loginout_namespaceObject, "settings", function() { return loginout_settings; }); + // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/list/index.js var build_module_list_namespaceObject = {}; __webpack_require__.r(build_module_list_namespaceObject); @@ -1807,6 +1391,13 @@ __webpack_require__.d(nextpage_namespaceObject, "name", function() { return nextpage_name; }); __webpack_require__.d(nextpage_namespaceObject, "settings", function() { return nextpage_settings; }); +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/page-list/index.js +var page_list_namespaceObject = {}; +__webpack_require__.r(page_list_namespaceObject); +__webpack_require__.d(page_list_namespaceObject, "metadata", function() { return page_list_metadata; }); +__webpack_require__.d(page_list_namespaceObject, "name", function() { return page_list_name; }); +__webpack_require__.d(page_list_namespaceObject, "settings", function() { return page_list_settings; }); + // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/preformatted/index.js var build_module_preformatted_namespaceObject = {}; __webpack_require__.r(build_module_preformatted_namespaceObject); @@ -1870,13 +1461,6 @@ __webpack_require__.d(spacer_namespaceObject, "name", function() { return spacer_name; }); __webpack_require__.d(spacer_namespaceObject, "settings", function() { return spacer_settings; }); -// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/subhead/index.js -var subhead_namespaceObject = {}; -__webpack_require__.r(subhead_namespaceObject); -__webpack_require__.d(subhead_namespaceObject, "metadata", function() { return subhead_metadata; }); -__webpack_require__.d(subhead_namespaceObject, "name", function() { return subhead_name; }); -__webpack_require__.d(subhead_namespaceObject, "settings", function() { return subhead_settings; }); - // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/table/index.js var build_module_table_namespaceObject = {}; __webpack_require__.r(build_module_table_namespaceObject); @@ -1912,12 +1496,12 @@ __webpack_require__.d(tag_cloud_namespaceObject, "name", function() { return tag_cloud_name; }); __webpack_require__.d(tag_cloud_namespaceObject, "settings", function() { return tag_cloud_settings; }); -// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/classic/index.js -var build_module_classic_namespaceObject = {}; -__webpack_require__.r(build_module_classic_namespaceObject); -__webpack_require__.d(build_module_classic_namespaceObject, "metadata", function() { return classic_metadata; }); -__webpack_require__.d(build_module_classic_namespaceObject, "name", function() { return classic_name; }); -__webpack_require__.d(build_module_classic_namespaceObject, "settings", function() { return classic_settings; }); +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/freeform/index.js +var freeform_namespaceObject = {}; +__webpack_require__.r(freeform_namespaceObject); +__webpack_require__.d(freeform_namespaceObject, "metadata", function() { return freeform_metadata; }); +__webpack_require__.d(freeform_namespaceObject, "name", function() { return freeform_name; }); +__webpack_require__.d(freeform_namespaceObject, "settings", function() { return freeform_settings; }); // NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/social-links/index.js var social_links_namespaceObject = {}; @@ -1933,35 +1517,138 @@ __webpack_require__.d(social_link_namespaceObject, "name", function() { return social_link_name; }); __webpack_require__.d(social_link_namespaceObject, "settings", function() { return social_link_settings; }); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules -var toConsumableArray = __webpack_require__(18); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js -var defineProperty = __webpack_require__(5); - -// EXTERNAL MODULE: external {"this":["wp","coreData"]} -var external_this_wp_coreData_ = __webpack_require__(98); - -// EXTERNAL MODULE: external {"this":["wp","notices"]} -var external_this_wp_notices_ = __webpack_require__(100); - -// EXTERNAL MODULE: external {"this":["wp","blockEditor"]} -var external_this_wp_blockEditor_ = __webpack_require__(7); - -// EXTERNAL MODULE: external {"this":["wp","blocks"]} -var external_this_wp_blocks_ = __webpack_require__(10); - -// EXTERNAL MODULE: external {"this":"lodash"} -var external_this_lodash_ = __webpack_require__(2); - -// EXTERNAL MODULE: external {"this":["wp","i18n"]} -var external_this_wp_i18n_ = __webpack_require__(1); - -// EXTERNAL MODULE: external {"this":["wp","element"]} -var external_this_wp_element_ = __webpack_require__(0); - -// EXTERNAL MODULE: external {"this":["wp","primitives"]} -var external_this_wp_primitives_ = __webpack_require__(6); +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-logo/index.js +var build_module_site_logo_namespaceObject = {}; +__webpack_require__.r(build_module_site_logo_namespaceObject); +__webpack_require__.d(build_module_site_logo_namespaceObject, "metadata", function() { return site_logo_metadata; }); +__webpack_require__.d(build_module_site_logo_namespaceObject, "name", function() { return site_logo_name; }); +__webpack_require__.d(build_module_site_logo_namespaceObject, "settings", function() { return site_logo_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-tagline/index.js +var site_tagline_namespaceObject = {}; +__webpack_require__.r(site_tagline_namespaceObject); +__webpack_require__.d(site_tagline_namespaceObject, "metadata", function() { return site_tagline_metadata; }); +__webpack_require__.d(site_tagline_namespaceObject, "name", function() { return site_tagline_name; }); +__webpack_require__.d(site_tagline_namespaceObject, "settings", function() { return site_tagline_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/site-title/index.js +var site_title_namespaceObject = {}; +__webpack_require__.r(site_title_namespaceObject); +__webpack_require__.d(site_title_namespaceObject, "metadata", function() { return site_title_metadata; }); +__webpack_require__.d(site_title_namespaceObject, "name", function() { return site_title_name; }); +__webpack_require__.d(site_title_namespaceObject, "settings", function() { return site_title_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query/index.js +var query_namespaceObject = {}; +__webpack_require__.r(query_namespaceObject); +__webpack_require__.d(query_namespaceObject, "metadata", function() { return query_metadata; }); +__webpack_require__.d(query_namespaceObject, "name", function() { return query_name; }); +__webpack_require__.d(query_namespaceObject, "settings", function() { return query_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-template/index.js +var post_template_namespaceObject = {}; +__webpack_require__.r(post_template_namespaceObject); +__webpack_require__.d(post_template_namespaceObject, "metadata", function() { return post_template_metadata; }); +__webpack_require__.d(post_template_namespaceObject, "name", function() { return post_template_name; }); +__webpack_require__.d(post_template_namespaceObject, "settings", function() { return post_template_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-title/index.js +var query_title_namespaceObject = {}; +__webpack_require__.r(query_title_namespaceObject); +__webpack_require__.d(query_title_namespaceObject, "metadata", function() { return query_title_metadata; }); +__webpack_require__.d(query_title_namespaceObject, "name", function() { return query_title_name; }); +__webpack_require__.d(query_title_namespaceObject, "settings", function() { return query_title_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination/index.js +var build_module_query_pagination_namespaceObject = {}; +__webpack_require__.r(build_module_query_pagination_namespaceObject); +__webpack_require__.d(build_module_query_pagination_namespaceObject, "metadata", function() { return query_pagination_metadata; }); +__webpack_require__.d(build_module_query_pagination_namespaceObject, "name", function() { return query_pagination_name; }); +__webpack_require__.d(build_module_query_pagination_namespaceObject, "settings", function() { return query_pagination_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-next/index.js +var build_module_query_pagination_next_namespaceObject = {}; +__webpack_require__.r(build_module_query_pagination_next_namespaceObject); +__webpack_require__.d(build_module_query_pagination_next_namespaceObject, "metadata", function() { return query_pagination_next_metadata; }); +__webpack_require__.d(build_module_query_pagination_next_namespaceObject, "name", function() { return query_pagination_next_name; }); +__webpack_require__.d(build_module_query_pagination_next_namespaceObject, "settings", function() { return query_pagination_next_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-numbers/index.js +var build_module_query_pagination_numbers_namespaceObject = {}; +__webpack_require__.r(build_module_query_pagination_numbers_namespaceObject); +__webpack_require__.d(build_module_query_pagination_numbers_namespaceObject, "metadata", function() { return query_pagination_numbers_metadata; }); +__webpack_require__.d(build_module_query_pagination_numbers_namespaceObject, "name", function() { return query_pagination_numbers_name; }); +__webpack_require__.d(build_module_query_pagination_numbers_namespaceObject, "settings", function() { return query_pagination_numbers_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/query-pagination-previous/index.js +var build_module_query_pagination_previous_namespaceObject = {}; +__webpack_require__.r(build_module_query_pagination_previous_namespaceObject); +__webpack_require__.d(build_module_query_pagination_previous_namespaceObject, "metadata", function() { return query_pagination_previous_metadata; }); +__webpack_require__.d(build_module_query_pagination_previous_namespaceObject, "name", function() { return query_pagination_previous_name; }); +__webpack_require__.d(build_module_query_pagination_previous_namespaceObject, "settings", function() { return query_pagination_previous_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-title/index.js +var build_module_post_title_namespaceObject = {}; +__webpack_require__.r(build_module_post_title_namespaceObject); +__webpack_require__.d(build_module_post_title_namespaceObject, "metadata", function() { return post_title_metadata; }); +__webpack_require__.d(build_module_post_title_namespaceObject, "name", function() { return post_title_name; }); +__webpack_require__.d(build_module_post_title_namespaceObject, "settings", function() { return post_title_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-content/index.js +var build_module_post_content_namespaceObject = {}; +__webpack_require__.r(build_module_post_content_namespaceObject); +__webpack_require__.d(build_module_post_content_namespaceObject, "metadata", function() { return post_content_metadata; }); +__webpack_require__.d(build_module_post_content_namespaceObject, "name", function() { return post_content_name; }); +__webpack_require__.d(build_module_post_content_namespaceObject, "settings", function() { return post_content_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-date/index.js +var build_module_post_date_namespaceObject = {}; +__webpack_require__.r(build_module_post_date_namespaceObject); +__webpack_require__.d(build_module_post_date_namespaceObject, "metadata", function() { return post_date_metadata; }); +__webpack_require__.d(build_module_post_date_namespaceObject, "name", function() { return post_date_name; }); +__webpack_require__.d(build_module_post_date_namespaceObject, "settings", function() { return post_date_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-excerpt/index.js +var build_module_post_excerpt_namespaceObject = {}; +__webpack_require__.r(build_module_post_excerpt_namespaceObject); +__webpack_require__.d(build_module_post_excerpt_namespaceObject, "metadata", function() { return post_excerpt_metadata; }); +__webpack_require__.d(build_module_post_excerpt_namespaceObject, "name", function() { return post_excerpt_name; }); +__webpack_require__.d(build_module_post_excerpt_namespaceObject, "settings", function() { return post_excerpt_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-featured-image/index.js +var build_module_post_featured_image_namespaceObject = {}; +__webpack_require__.r(build_module_post_featured_image_namespaceObject); +__webpack_require__.d(build_module_post_featured_image_namespaceObject, "metadata", function() { return post_featured_image_metadata; }); +__webpack_require__.d(build_module_post_featured_image_namespaceObject, "name", function() { return post_featured_image_name; }); +__webpack_require__.d(build_module_post_featured_image_namespaceObject, "settings", function() { return post_featured_image_settings; }); + +// NAMESPACE OBJECT: ./node_modules/@wordpress/block-library/build-module/post-terms/index.js +var post_terms_namespaceObject = {}; +__webpack_require__.r(post_terms_namespaceObject); +__webpack_require__.d(post_terms_namespaceObject, "metadata", function() { return post_terms_metadata; }); +__webpack_require__.d(post_terms_namespaceObject, "name", function() { return post_terms_name; }); +__webpack_require__.d(post_terms_namespaceObject, "settings", function() { return post_terms_settings; }); + +// EXTERNAL MODULE: external ["wp","coreData"] +var external_wp_coreData_ = __webpack_require__("jZUy"); + +// EXTERNAL MODULE: external ["wp","blockEditor"] +var external_wp_blockEditor_ = __webpack_require__("axFQ"); + +// EXTERNAL MODULE: external ["wp","blocks"] +var external_wp_blocks_ = __webpack_require__("HSyU"); + +// EXTERNAL MODULE: external "lodash" +var external_lodash_ = __webpack_require__("YLtl"); + +// EXTERNAL MODULE: external ["wp","i18n"] +var external_wp_i18n_ = __webpack_require__("l3Sj"); + +// EXTERNAL MODULE: external ["wp","element"] +var external_wp_element_ = __webpack_require__("GRId"); + +// EXTERNAL MODULE: external ["wp","primitives"] +var external_wp_primitives_ = __webpack_require__("Tqx9"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/paragraph.js @@ -1970,41 +1657,36 @@ * WordPress dependencies */ -var paragraph = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const paragraph = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18.3 4H9.9v-.1l-.9.2c-2.3.4-4 2.4-4 4.8s1.7 4.4 4 4.8l.7.1V20h1.5V5.5h2.9V20h1.5V5.5h2.7V4z" })); /* harmony default export */ var library_paragraph = (paragraph); // EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__(11); +var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/deprecated.js - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -var deprecated_supports = { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + +const supports = { className: false }; -var deprecated_blockAttributes = { +const deprecated_blockAttributes = { align: { type: 'string' }, @@ -2039,12 +1721,12 @@ } }; -var deprecated_migrateCustomColorsAndFontSizes = function migrateCustomColorsAndFontSizes(attributes) { +const migrateCustomColorsAndFontSizes = attributes => { if (!attributes.customTextColor && !attributes.customBackgroundColor && !attributes.customFontSize) { return attributes; } - var style = {}; + const style = {}; if (attributes.customTextColor || attributes.customBackgroundColor) { style.color = {}; @@ -2064,14 +1746,14 @@ }; } - return _objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor', 'customFontSize']), { - style: style - }); -}; - -var deprecated = [{ - supports: deprecated_supports, - attributes: _objectSpread({}, Object(external_this_lodash_["omit"])(deprecated_blockAttributes, ['style']), { + return { ...Object(external_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor', 'customFontSize']), + style + }; +}; + +const deprecated = [{ + supports, + attributes: { ...Object(external_lodash_["omit"])(deprecated_blockAttributes, ['style']), customTextColor: { type: 'string' }, @@ -2081,36 +1763,42 @@ customFontSize: { type: 'number' } - }), - migrate: deprecated_migrateCustomColorsAndFontSizes, - save: function save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var align = attributes.align, - content = attributes.content, - dropCap = attributes.dropCap, - backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor, - fontSize = attributes.fontSize, - customFontSize = attributes.customFontSize, - direction = attributes.direction; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var fontSizeClass = Object(external_this_wp_blockEditor_["getFontSizeClass"])(fontSize); - var className = classnames_default()((_classnames = { + }, + migrate: migrateCustomColorsAndFontSizes, + + save({ + attributes + }) { + const { + align, + content, + dropCap, + backgroundColor, + textColor, + customBackgroundColor, + customTextColor, + fontSize, + customFontSize, + direction + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const fontSizeClass = Object(external_wp_blockEditor_["getFontSizeClass"])(fontSize); + const className = classnames_default()({ 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor, - 'has-drop-cap': dropCap - }, Object(defineProperty["a" /* default */])(_classnames, "has-text-align-".concat(align), align), Object(defineProperty["a" /* default */])(_classnames, fontSizeClass, fontSizeClass), Object(defineProperty["a" /* default */])(_classnames, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames, backgroundClass, backgroundClass), _classnames)); - var styles = { + 'has-drop-cap': dropCap, + [`has-text-align-${align}`]: align, + [fontSizeClass]: fontSizeClass, + [textClass]: textClass, + [backgroundClass]: backgroundClass + }); + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor, fontSize: fontSizeClass ? undefined : customFontSize }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "p", style: styles, className: className ? className : undefined, @@ -2118,9 +1806,10 @@ dir: direction }); } -}, { - supports: deprecated_supports, - attributes: _objectSpread({}, Object(external_this_lodash_["omit"])(deprecated_blockAttributes, ['style']), { + +}, { + supports, + attributes: { ...Object(external_lodash_["omit"])(deprecated_blockAttributes, ['style']), customTextColor: { type: 'string' }, @@ -2130,37 +1819,42 @@ customFontSize: { type: 'number' } - }), - migrate: deprecated_migrateCustomColorsAndFontSizes, - save: function save(_ref2) { - var _classnames2; - - var attributes = _ref2.attributes; - var align = attributes.align, - content = attributes.content, - dropCap = attributes.dropCap, - backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor, - fontSize = attributes.fontSize, - customFontSize = attributes.customFontSize, - direction = attributes.direction; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var fontSizeClass = Object(external_this_wp_blockEditor_["getFontSizeClass"])(fontSize); - var className = classnames_default()((_classnames2 = { + }, + migrate: migrateCustomColorsAndFontSizes, + + save({ + attributes + }) { + const { + align, + content, + dropCap, + backgroundColor, + textColor, + customBackgroundColor, + customTextColor, + fontSize, + customFontSize, + direction + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const fontSizeClass = Object(external_wp_blockEditor_["getFontSizeClass"])(fontSize); + const className = classnames_default()({ 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor, - 'has-drop-cap': dropCap - }, Object(defineProperty["a" /* default */])(_classnames2, fontSizeClass, fontSizeClass), Object(defineProperty["a" /* default */])(_classnames2, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames2, backgroundClass, backgroundClass), _classnames2)); - var styles = { + 'has-drop-cap': dropCap, + [fontSizeClass]: fontSizeClass, + [textClass]: textClass, + [backgroundClass]: backgroundClass + }); + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor, fontSize: fontSizeClass ? undefined : customFontSize, textAlign: align }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "p", style: styles, className: className ? className : undefined, @@ -2168,9 +1862,10 @@ dir: direction }); } -}, { - supports: deprecated_supports, - attributes: _objectSpread({}, Object(external_this_lodash_["omit"])(deprecated_blockAttributes, ['style']), { + +}, { + supports, + attributes: { ...Object(external_lodash_["omit"])(deprecated_blockAttributes, ['style']), customTextColor: { type: 'string' }, @@ -2183,103 +1878,122 @@ width: { type: 'string' } - }), - migrate: deprecated_migrateCustomColorsAndFontSizes, - save: function save(_ref3) { - var _classnames3; - - var attributes = _ref3.attributes; - var width = attributes.width, - align = attributes.align, - content = attributes.content, - dropCap = attributes.dropCap, - backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor, - fontSize = attributes.fontSize, - customFontSize = attributes.customFontSize; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var fontSizeClass = fontSize && "is-".concat(fontSize, "-text"); - var className = classnames_default()((_classnames3 = {}, Object(defineProperty["a" /* default */])(_classnames3, "align".concat(width), width), Object(defineProperty["a" /* default */])(_classnames3, 'has-background', backgroundColor || customBackgroundColor), Object(defineProperty["a" /* default */])(_classnames3, 'has-drop-cap', dropCap), Object(defineProperty["a" /* default */])(_classnames3, fontSizeClass, fontSizeClass), Object(defineProperty["a" /* default */])(_classnames3, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames3, backgroundClass, backgroundClass), _classnames3)); - var styles = { + }, + migrate: migrateCustomColorsAndFontSizes, + + save({ + attributes + }) { + const { + width, + align, + content, + dropCap, + backgroundColor, + textColor, + customBackgroundColor, + customTextColor, + fontSize, + customFontSize + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const fontSizeClass = fontSize && `is-${fontSize}-text`; + const className = classnames_default()({ + [`align${width}`]: width, + 'has-background': backgroundColor || customBackgroundColor, + 'has-drop-cap': dropCap, + [fontSizeClass]: fontSizeClass, + [textClass]: textClass, + [backgroundClass]: backgroundClass + }); + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor, fontSize: fontSizeClass ? undefined : customFontSize, textAlign: align }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "p", style: styles, className: className ? className : undefined, value: content }); } -}, { - supports: deprecated_supports, - attributes: Object(external_this_lodash_["omit"])(_objectSpread({}, deprecated_blockAttributes, { + +}, { + supports, + attributes: Object(external_lodash_["omit"])({ ...deprecated_blockAttributes, fontSize: { type: 'number' } - }), ['style']), - save: function save(_ref4) { - var _classnames4; - - var attributes = _ref4.attributes; - var width = attributes.width, - align = attributes.align, - content = attributes.content, - dropCap = attributes.dropCap, - backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - fontSize = attributes.fontSize; - var className = classnames_default()((_classnames4 = {}, Object(defineProperty["a" /* default */])(_classnames4, "align".concat(width), width), Object(defineProperty["a" /* default */])(_classnames4, 'has-background', backgroundColor), Object(defineProperty["a" /* default */])(_classnames4, 'has-drop-cap', dropCap), _classnames4)); - var styles = { - backgroundColor: backgroundColor, + }, ['style']), + + save({ + attributes + }) { + const { + width, + align, + content, + dropCap, + backgroundColor, + textColor, + fontSize + } = attributes; + const className = classnames_default()({ + [`align${width}`]: width, + 'has-background': backgroundColor, + 'has-drop-cap': dropCap + }); + const styles = { + backgroundColor, color: textColor, - fontSize: fontSize, + fontSize, textAlign: align }; - return Object(external_this_wp_element_["createElement"])("p", { + return Object(external_wp_element_["createElement"])("p", { style: styles, className: className ? className : undefined }, content); }, - migrate: function migrate(attributes) { - return deprecated_migrateCustomColorsAndFontSizes(Object(external_this_lodash_["omit"])(_objectSpread({}, attributes, { - customFontSize: Object(external_this_lodash_["isFinite"])(attributes.fontSize) ? attributes.fontSize : undefined, + + migrate(attributes) { + return migrateCustomColorsAndFontSizes(Object(external_lodash_["omit"])({ ...attributes, + customFontSize: Object(external_lodash_["isFinite"])(attributes.fontSize) ? attributes.fontSize : undefined, customTextColor: attributes.textColor && '#' === attributes.textColor[0] ? attributes.textColor : undefined, customBackgroundColor: attributes.backgroundColor && '#' === attributes.backgroundColor[0] ? attributes.backgroundColor : undefined - })), ['fontSize', 'textColor', 'backgroundColor', 'style']); - } -}, { - supports: deprecated_supports, - attributes: _objectSpread({}, deprecated_blockAttributes, { + }), ['fontSize', 'textColor', 'backgroundColor', 'style']); + } + +}, { + supports, + attributes: { ...deprecated_blockAttributes, content: { type: 'string', source: 'html', default: '' } - }), - save: function save(_ref5) { - var attributes = _ref5.attributes; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, attributes.content); - }, - migrate: function migrate(attributes) { + }, + + save({ + attributes + }) { + return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, attributes.content); + }, + + migrate(attributes) { return attributes; } + }]; /* harmony default export */ var paragraph_deprecated = (deprecated); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules -var slicedToArray = __webpack_require__(14); - -// EXTERNAL MODULE: external {"this":["wp","components"]} -var external_this_wp_components_ = __webpack_require__(3); - -// EXTERNAL MODULE: external {"this":["wp","data"]} -var external_this_wp_data_ = __webpack_require__(4); +// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js +var esm_extends = __webpack_require__("wx14"); + +// EXTERNAL MODULE: external ["wp","components"] +var external_wp_components_ = __webpack_require__("tI+e"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-ltr.js @@ -2288,10 +2002,10 @@ * WordPress dependencies */ -var formatLtr = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { +const formatLtr = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M5.52 2h7.43c.55 0 1 .45 1 1s-.45 1-1 1h-1v13c0 .55-.45 1-1 1s-1-.45-1-1V5c0-.55-.45-1-1-1s-1 .45-1 1v12c0 .55-.45 1-1 1s-1-.45-1-1v-5.96h-.43C3.02 11.04 1 9.02 1 6.52S3.02 2 5.52 2zM14 14l5-4-5-4v8z" })); /* harmony default export */ var format_ltr = (formatLtr); @@ -2300,196 +2014,154 @@ - -function edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Browser dependencies - */ - -var edit_window = window, - edit_getComputedStyle = edit_window.getComputedStyle; -var querySelector = window.document.querySelector.bind(document); -var edit_name = 'core/paragraph'; -var PARAGRAPH_DROP_CAP_SELECTOR = 'p.has-drop-cap'; - -function ParagraphRTLToolbar(_ref) { - var direction = _ref.direction, - setDirection = _ref.setDirection; - var isRTL = Object(external_this_wp_data_["useSelect"])(function (select) { - return !!select('core/block-editor').getSettings().isRTL; - }, []); - return isRTL && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +const edit_name = 'core/paragraph'; + +function ParagraphRTLControl({ + direction, + setDirection +}) { + return Object(external_wp_i18n_["isRTL"])() && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarDropdownMenu"], { controls: [{ icon: format_ltr, - title: Object(external_this_wp_i18n_["_x"])('Left to right', 'editor button'), + title: Object(external_wp_i18n_["_x"])('Left to right', 'editor button'), isActive: direction === 'ltr', - onClick: function onClick() { + + onClick() { setDirection(direction === 'ltr' ? undefined : 'ltr'); } + }] }); } -function useDropCap(isDropCap, fontSize, styleFontSize) { - var isDisabled = !Object(external_this_wp_blockEditor_["__experimentalUseEditorFeature"])('typography.dropCap'); - - var _useState = Object(external_this_wp_element_["useState"])(), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - minimumHeight = _useState2[0], - setMinimumHeight = _useState2[1]; - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - return select('core/block-editor').getSettings(); - }), - fontSizes = _useSelect.fontSizes; - - var fontSizeObject = Object(external_this_wp_blockEditor_["getFontSize"])(fontSizes, fontSize, styleFontSize); - Object(external_this_wp_element_["useEffect"])(function () { - if (isDisabled) { - return; - } - - var element = querySelector(PARAGRAPH_DROP_CAP_SELECTOR); - - if (isDropCap && element) { - setMinimumHeight(edit_getComputedStyle(element, 'first-letter').lineHeight); - } else if (minimumHeight) { - setMinimumHeight(undefined); - } - }, [isDisabled, isDropCap, minimumHeight, setMinimumHeight, fontSizeObject.size]); - return [!isDisabled, minimumHeight]; -} - -function ParagraphBlock(_ref2) { - var attributes = _ref2.attributes, - mergeBlocks = _ref2.mergeBlocks, - onReplace = _ref2.onReplace, - onRemove = _ref2.onRemove, - setAttributes = _ref2.setAttributes; - var align = attributes.align, - content = attributes.content, - direction = attributes.direction, - dropCap = attributes.dropCap, - placeholder = attributes.placeholder, - fontSize = attributes.fontSize, - style = attributes.style; - var ref = Object(external_this_wp_element_["useRef"])(); - - var _useDropCap = useDropCap(dropCap, fontSize, style === null || style === void 0 ? void 0 : style.fontSize), - _useDropCap2 = Object(slicedToArray["a" /* default */])(_useDropCap, 2), - isDropCapEnabled = _useDropCap2[0], - dropCapMinimumHeight = _useDropCap2[1]; - - var styles = { +function ParagraphBlock({ + attributes, + mergeBlocks, + onReplace, + onRemove, + setAttributes, + clientId +}) { + const { + align, + content, + direction, + dropCap, + placeholder + } = attributes; + const isDropCapFeatureEnabled = Object(external_wp_blockEditor_["useSetting"])('typography.dropCap'); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()({ + 'has-drop-cap': dropCap, + [`has-text-align-${align}`]: align + }), + style: { + direction + } + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentControl"], { + value: align, + onChange: newAlign => setAttributes({ + align: newAlign + }) + }), Object(external_wp_element_["createElement"])(ParagraphRTLControl, { direction: direction, - minHeight: dropCapMinimumHeight - }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["AlignmentToolbar"], { - value: align, - onChange: function onChange(newAlign) { - return setAttributes({ - align: newAlign - }); - } - }), Object(external_this_wp_element_["createElement"])(ParagraphRTLToolbar, { - direction: direction, - setDirection: function setDirection(newDirection) { - return setAttributes({ - direction: newDirection - }); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, isDropCapEnabled && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Text settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Drop cap'), + setDirection: newDirection => setAttributes({ + direction: newDirection + }) + })), isDropCapFeatureEnabled && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Text settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Drop cap'), checked: !!dropCap, - onChange: function onChange() { - return setAttributes({ - dropCap: !dropCap - }); - }, - help: dropCap ? Object(external_this_wp_i18n_["__"])('Showing large initial letter.') : Object(external_this_wp_i18n_["__"])('Toggle to show a large initial letter.') - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - ref: ref, + onChange: () => setAttributes({ + dropCap: !dropCap + }), + help: dropCap ? Object(external_wp_i18n_["__"])('Showing large initial letter.') : Object(external_wp_i18n_["__"])('Toggle to show a large initial letter.') + }))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], Object(esm_extends["a" /* default */])({ identifier: "content", - tagName: external_this_wp_blockEditor_["__experimentalBlock"].p, - className: classnames_default()(Object(defineProperty["a" /* default */])({ - 'has-drop-cap': dropCap - }, "has-text-align-".concat(align), align)), - style: styles, + tagName: "p" + }, blockProps, { value: content, - onChange: function onChange(newContent) { - return setAttributes({ - content: newContent - }); - }, - onSplit: function onSplit(value) { - if (!value) { - return Object(external_this_wp_blocks_["createBlock"])(edit_name); - } - - return Object(external_this_wp_blocks_["createBlock"])(edit_name, edit_objectSpread({}, attributes, { - content: value - })); + onChange: newContent => setAttributes({ + content: newContent + }), + onSplit: (value, isOriginal) => { + let newAttributes; + + if (isOriginal || value) { + newAttributes = { ...attributes, + content: value + }; + } + + const block = Object(external_wp_blocks_["createBlock"])(edit_name, newAttributes); + + if (isOriginal) { + block.clientId = clientId; + } + + return block; }, onMerge: mergeBlocks, onReplace: onReplace, onRemove: onRemove, - "aria-label": content ? Object(external_this_wp_i18n_["__"])('Paragraph block') : Object(external_this_wp_i18n_["__"])('Empty block; start writing or type forward slash to choose a block'), - placeholder: placeholder || Object(external_this_wp_i18n_["__"])('Start writing or type / to choose a block'), + "aria-label": content ? Object(external_wp_i18n_["__"])('Paragraph block') : Object(external_wp_i18n_["__"])('Empty block; start writing or type forward slash to choose a block'), + "data-empty": content ? false : true, + placeholder: placeholder || Object(external_wp_i18n_["__"])('Type / to choose a block'), __unstableEmbedURLOnPaste: true, __unstableAllowPrefixTransformations: true - })); -} - -/* harmony default export */ var paragraph_edit = (ParagraphBlock); + }))); +} + +/* harmony default export */ var edit = (ParagraphBlock); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -function save_save(_ref) { - var attributes = _ref.attributes; - var align = attributes.align, - content = attributes.content, - dropCap = attributes.dropCap, - direction = attributes.direction; - var className = classnames_default()(Object(defineProperty["a" /* default */])({ - 'has-drop-cap': dropCap - }, "has-text-align-".concat(align), align)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - tagName: "p", - className: className ? className : undefined, - value: content, +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function save({ + attributes +}) { + const { + align, + content, + dropCap, + direction + } = attributes; + const className = classnames_default()({ + 'has-drop-cap': dropCap, + [`has-text-align-${align}`]: align + }); + return Object(external_wp_element_["createElement"])("p", external_wp_blockEditor_["useBlockProps"].save({ + className, dir: direction - }); + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + value: content + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/transforms.js @@ -2501,9 +2173,16 @@ * Internal dependencies */ -var _name$category$attrib = { +const { + name: transforms_name +} = { + apiVersion: 2, name: "core/paragraph", + title: "Paragraph", category: "text", + description: "Start with the building block of all narrative.", + keywords: ["text"], + textdomain: "default", attributes: { align: { type: "string" @@ -2512,7 +2191,8 @@ type: "string", source: "html", selector: "p", - "default": "" + "default": "", + __experimentalRole: "content" }, dropCap: { type: "boolean", @@ -2529,53 +2209,51 @@ supports: { anchor: true, className: false, - lightBlockWrapper: true, - __experimentalColor: { - linkColor: true - }, - __experimentalFontSize: true, - __experimentalLineHeight: true, - __experimentalFeatures: { - typography: { - dropCap: true - } + color: { + link: true + }, + typography: { + fontSize: true, + lineHeight: true }, __experimentalSelector: "p", __unstablePasteTextInline: true - } -}, - transforms_name = _name$category$attrib.name; -var transforms_transforms = { + }, + editorStyle: "wp-block-paragraph-editor", + style: "wp-block-paragraph" +}; +const transforms = { from: [{ type: 'raw', // Paragraph is a fallback and should be matched last. priority: 20, selector: 'p', - schema: function schema(_ref) { - var phrasingContentSchema = _ref.phrasingContentSchema, - isPaste = _ref.isPaste; - return { - p: { - children: phrasingContentSchema, - attributes: isPaste ? [] : ['style', 'id'] - } - }; - }, - transform: function transform(node) { - var attributes = Object(external_this_wp_blocks_["getBlockAttributes"])(transforms_name, node.outerHTML); - - var _ref2 = node.style || {}, - textAlign = _ref2.textAlign; + schema: ({ + phrasingContentSchema, + isPaste + }) => ({ + p: { + children: phrasingContentSchema, + attributes: isPaste ? [] : ['style', 'id'] + } + }), + + transform(node) { + const attributes = Object(external_wp_blocks_["getBlockAttributes"])(transforms_name, node.outerHTML); + const { + textAlign + } = node.style || {}; if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') { attributes.align = textAlign; } - return Object(external_this_wp_blocks_["createBlock"])(transforms_name, attributes); - } + return Object(external_wp_blocks_["createBlock"])(transforms_name, attributes); + } + }] }; -/* harmony default export */ var paragraph_transforms = (transforms_transforms); +/* harmony default export */ var paragraph_transforms = (transforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/paragraph/index.js /** @@ -2594,9 +2272,14 @@ -var paragraph_metadata = { +const paragraph_metadata = { + apiVersion: 2, name: "core/paragraph", + title: "Paragraph", category: "text", + description: "Start with the building block of all narrative.", + keywords: ["text"], + textdomain: "default", attributes: { align: { type: "string" @@ -2605,7 +2288,8 @@ type: "string", source: "html", selector: "p", - "default": "" + "default": "", + __experimentalRole: "content" }, dropCap: { type: "boolean", @@ -2622,33 +2306,30 @@ supports: { anchor: true, className: false, - lightBlockWrapper: true, - __experimentalColor: { - linkColor: true - }, - __experimentalFontSize: true, - __experimentalLineHeight: true, - __experimentalFeatures: { - typography: { - dropCap: true - } + color: { + link: true + }, + typography: { + fontSize: true, + lineHeight: true }, __experimentalSelector: "p", __unstablePasteTextInline: true - } -}; - - -var paragraph_name = paragraph_metadata.name; - -var paragraph_settings = { - title: Object(external_this_wp_i18n_["__"])('Paragraph'), - description: Object(external_this_wp_i18n_["__"])('Start with the building block of all narrative.'), + }, + editorStyle: "wp-block-paragraph-editor", + style: "wp-block-paragraph" +}; + + +const { + name: paragraph_name +} = paragraph_metadata; + +const paragraph_settings = { icon: library_paragraph, - keywords: [Object(external_this_wp_i18n_["__"])('text')], example: { attributes: { - content: Object(external_this_wp_i18n_["__"])('In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'), + content: Object(external_wp_i18n_["__"])('In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'), style: { typography: { fontSize: 28 @@ -2657,23 +2338,29 @@ dropCap: true } }, - __experimentalLabel: function __experimentalLabel(attributes, _ref) { - var context = _ref.context; - + + __experimentalLabel(attributes, { + context + }) { if (context === 'accessibility') { - var content = attributes.content; - return Object(external_this_lodash_["isEmpty"])(content) ? Object(external_this_wp_i18n_["__"])('Empty') : content; - } - }, + const { + content + } = attributes; + return Object(external_lodash_["isEmpty"])(content) ? Object(external_wp_i18n_["__"])('Empty') : content; + } + }, + transforms: paragraph_transforms, deprecated: paragraph_deprecated, - merge: function merge(attributes, attributesToMerge) { + + merge(attributes, attributesToMerge) { return { content: (attributes.content || '') + (attributesToMerge.content || '') }; }, - edit: paragraph_edit, - save: save_save + + edit: edit, + save: save }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/image.js @@ -2683,32 +2370,28 @@ * WordPress dependencies */ -var image_image = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const image_image = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V5c-.1-.3.1-.5.4-.5zm14 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" })); /* harmony default export */ var library_image = (image_image); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js -var esm_extends = __webpack_require__(8); - // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/deprecated.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -var image_deprecated_blockAttributes = { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +const image_deprecated_blockAttributes = { align: { type: 'string' }, @@ -2758,8 +2441,7 @@ type: 'number' }, linkDestination: { - type: 'string', - default: 'none' + type: 'string' }, linkTarget: { type: 'string', @@ -2768,89 +2450,104 @@ attribute: 'target' } }; -var deprecated_deprecated = [{ +const deprecated_deprecated = [{ attributes: image_deprecated_blockAttributes, - save: function save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var url = attributes.url, - alt = attributes.alt, - caption = attributes.caption, - align = attributes.align, - href = attributes.href, - width = attributes.width, - height = attributes.height, - id = attributes.id; - var classes = classnames_default()((_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, "align".concat(align), align), Object(defineProperty["a" /* default */])(_classnames, 'is-resized', width || height), _classnames)); - var image = Object(external_this_wp_element_["createElement"])("img", { + + save({ + attributes + }) { + const { + url, + alt, + caption, + align, + href, + width, + height, + id + } = attributes; + const classes = classnames_default()({ + [`align${align}`]: align, + 'is-resized': width || height + }); + const image = Object(external_wp_element_["createElement"])("img", { src: url, alt: alt, - className: id ? "wp-image-".concat(id) : null, + className: id ? `wp-image-${id}` : null, width: width, height: height }); - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", { className: classes - }, href ? Object(external_this_wp_element_["createElement"])("a", { + }, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, image) : image, !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, image) : image, !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); } + }, { attributes: image_deprecated_blockAttributes, - save: function save(_ref2) { - var attributes = _ref2.attributes; - var url = attributes.url, - alt = attributes.alt, - caption = attributes.caption, - align = attributes.align, - href = attributes.href, - width = attributes.width, - height = attributes.height, - id = attributes.id; - var image = Object(external_this_wp_element_["createElement"])("img", { + + save({ + attributes + }) { + const { + url, + alt, + caption, + align, + href, + width, + height, + id + } = attributes; + const image = Object(external_wp_element_["createElement"])("img", { src: url, alt: alt, - className: id ? "wp-image-".concat(id) : null, + className: id ? `wp-image-${id}` : null, width: width, height: height }); - return Object(external_this_wp_element_["createElement"])("figure", { - className: align ? "align".concat(align) : null - }, href ? Object(external_this_wp_element_["createElement"])("a", { + return Object(external_wp_element_["createElement"])("figure", { + className: align ? `align${align}` : null + }, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, image) : image, !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, image) : image, !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); } + }, { attributes: image_deprecated_blockAttributes, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var url = attributes.url, - alt = attributes.alt, - caption = attributes.caption, - align = attributes.align, - href = attributes.href, - width = attributes.width, - height = attributes.height; - var extraImageProps = width || height ? { - width: width, - height: height + + save({ + attributes + }) { + const { + url, + alt, + caption, + align, + href, + width, + height + } = attributes; + const extraImageProps = width || height ? { + width, + height } : {}; - var image = Object(external_this_wp_element_["createElement"])("img", Object(esm_extends["a" /* default */])({ + const image = Object(external_wp_element_["createElement"])("img", Object(esm_extends["a" /* default */])({ src: url, alt: alt }, extraImageProps)); - var figureStyle = {}; + let figureStyle = {}; if (width) { figureStyle = { - width: width + width }; } else if (align === 'left' || align === 'right') { figureStyle = { @@ -2858,27 +2555,31 @@ }; } - return Object(external_this_wp_element_["createElement"])("figure", { - className: align ? "align".concat(align) : null, + return Object(external_wp_element_["createElement"])("figure", { + className: align ? `align${align}` : null, style: figureStyle - }, href ? Object(external_this_wp_element_["createElement"])("a", { + }, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, image) : image, !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, image) : image, !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); } + }]; /* harmony default export */ var image_deprecated = (deprecated_deprecated); -// EXTERNAL MODULE: external {"this":["wp","blob"]} -var external_this_wp_blob_ = __webpack_require__(44); - -// EXTERNAL MODULE: external {"this":["wp","compose"]} -var external_this_wp_compose_ = __webpack_require__(9); - -// EXTERNAL MODULE: external {"this":["wp","url"]} -var external_this_wp_url_ = __webpack_require__(31); +// EXTERNAL MODULE: external ["wp","blob"] +var external_wp_blob_ = __webpack_require__("xTGt"); + +// EXTERNAL MODULE: external ["wp","data"] +var external_wp_data_ = __webpack_require__("1ZqX"); + +// EXTERNAL MODULE: external ["wp","compose"] +var external_wp_compose_ = __webpack_require__("K9lf"); + +// EXTERNAL MODULE: external ["wp","url"] +var external_wp_url_ = __webpack_require__("Mmq9"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/crop.js @@ -2887,494 +2588,37 @@ * WordPress dependencies */ -var crop_crop = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M17.5 7v8H19V7c0-1.1-.9-2-2-2H9v1.5h8c.3 0 .5.2.5.5zM7 17.5c-.3 0-.5-.2-.5-.5V1H5v4H1v1.5h4V17c0 1.1.9 2 2 2h10.5v4H19v-4h4v-1.5H7z" +const crop_crop = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M16.5 7.8v7H18v-7c0-1-.8-1.8-1.8-1.8h-7v1.5h7c.2 0 .3.1.3.3zm-8.7 8.7c-.1 0-.2-.1-.2-.2V2H6v4H2v1.5h4v8.8c0 1 .8 1.8 1.8 1.8h8.8v4H18v-4h4v-1.5H7.8z" })); /* harmony default export */ var library_crop = (crop_crop); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js -var upload = __webpack_require__(204); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/icons.js - - -/** - * WordPress dependencies - */ - -var embedContentIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z" -})); -var embedAudioIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z" -})); -var embedPhotoIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" -})); -var embedVideoIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z" -})); -var embedTwitterIcon = { - foreground: '#1da1f2', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["G"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z" - }))) -}; -var embedYouTubeIcon = { - foreground: '#ff0000', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z" - })) -}; -var embedFacebookIcon = { - foreground: '#3b5998', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z" - })) -}; -var embedInstagramIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["G"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z" -}))); -var embedWordPressIcon = { - foreground: '#0073AA', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["G"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z" - }))) -}; -var embedSpotifyIcon = { - foreground: '#1db954', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325" - })) -}; -var embedFlickrIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z" -})); -var embedVimeoIcon = { - foreground: '#1ab7ea', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["G"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z" - }))) -}; -var embedRedditIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M22 11.816c0-1.256-1.02-2.277-2.277-2.277-.593 0-1.122.24-1.526.613-1.48-.965-3.455-1.594-5.647-1.69l1.17-3.702 3.18.75c.01 1.027.847 1.86 1.877 1.86 1.035 0 1.877-.84 1.877-1.877 0-1.035-.842-1.877-1.877-1.877-.77 0-1.43.466-1.72 1.13L13.55 3.92c-.204-.047-.4.067-.46.26l-1.35 4.27c-2.317.037-4.412.67-5.97 1.67-.402-.355-.917-.58-1.493-.58C3.02 9.54 2 10.56 2 11.815c0 .814.433 1.523 1.078 1.925-.037.222-.06.445-.06.673 0 3.292 4.01 5.97 8.94 5.97s8.94-2.678 8.94-5.97c0-.214-.02-.424-.052-.632.687-.39 1.154-1.12 1.154-1.964zm-3.224-7.422c.606 0 1.1.493 1.1 1.1s-.493 1.1-1.1 1.1-1.1-.494-1.1-1.1.493-1.1 1.1-1.1zm-16 7.422c0-.827.673-1.5 1.5-1.5.313 0 .598.103.838.27-.85.675-1.477 1.478-1.812 2.36-.32-.274-.525-.676-.525-1.13zm9.183 7.79c-4.502 0-8.165-2.33-8.165-5.193S7.457 9.22 11.96 9.22s8.163 2.33 8.163 5.193-3.663 5.193-8.164 5.193zM20.635 13c-.326-.89-.948-1.7-1.797-2.383.247-.186.55-.3.882-.3.827 0 1.5.672 1.5 1.5 0 .482-.23.91-.586 1.184zm-11.64 1.704c-.76 0-1.397-.616-1.397-1.376 0-.76.636-1.397 1.396-1.397.76 0 1.376.638 1.376 1.398 0 .76-.616 1.376-1.376 1.376zm7.405-1.376c0 .76-.615 1.376-1.375 1.376s-1.4-.616-1.4-1.376c0-.76.64-1.397 1.4-1.397.76 0 1.376.638 1.376 1.398zm-1.17 3.38c.15.152.15.398 0 .55-.675.674-1.728 1.002-3.22 1.002l-.01-.002-.012.002c-1.492 0-2.544-.328-3.218-1.002-.152-.152-.152-.398 0-.55.152-.152.4-.15.55 0 .52.52 1.394.775 2.67.775l.01.002.01-.002c1.276 0 2.15-.253 2.67-.775.15-.152.398-.152.55 0z" -})); -var embedTumblrIcon = { - foreground: '#35465c', - src: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z" - })) -}; -var embedAmazonIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z" -})); -var embedAnimotoIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m.0206909 21 19.8160091-13.07806 3.5831 6.20826z", - fill: "#4bc7ee" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z", - fill: "#d4cdcb" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m.0206909 21 15.2439091-16.38571 4.3029 7.32271z", - fill: "#c3d82e" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z", - fill: "#e4ecb0" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m.0206909 21 19.5468091-9.063 1.6621 2.8344z", - fill: "#209dbd" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m.0206909 21 17.9209091-11.82623 1.6259 2.76323z", - fill: "#7cb3c9" -})); -var embedDailymotionIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { - d: "m12.1479 18.5957c-2.4949 0-4.28131-1.7558-4.28131-4.0658 0-2.2176 1.78641-4.0965 4.09651-4.0965 2.2793 0 4.0349 1.7864 4.0349 4.1581 0 2.2794-1.7556 4.0042-3.8501 4.0042zm8.3521-18.5957-4.5329 1v7c-1.1088-1.41691-2.8028-1.8787-4.8049-1.8787-2.09443 0-3.97329.76993-5.5133 2.27917-1.72483 1.66323-2.6489 3.78863-2.6489 6.16033 0 2.5873.98562 4.8049 2.89526 6.499 1.44763 1.2936 3.17251 1.9402 5.17454 1.9402 1.9713 0 3.4498-.5236 4.8973-1.9402v1.9402h4.5329c0-7.6359 0-15.3641 0-23z", - fill: "#333436" -})); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/core-embeds.js -/** - * Internal dependencies - */ - -/** - * WordPress dependencies - */ - - - -var common = [{ - name: 'core-embed/twitter', - settings: { - title: 'Twitter', - icon: embedTwitterIcon, - keywords: ['tweet', Object(external_this_wp_i18n_["__"])('social')], - description: Object(external_this_wp_i18n_["__"])('Embed a tweet.') - }, - patterns: [/^https?:\/\/(www\.)?twitter\.com\/.+/i] -}, { - name: 'core-embed/youtube', - settings: { - title: 'YouTube', - icon: embedYouTubeIcon, - keywords: [Object(external_this_wp_i18n_["__"])('music'), Object(external_this_wp_i18n_["__"])('video')], - description: Object(external_this_wp_i18n_["__"])('Embed a YouTube video.') - }, - patterns: [/^https?:\/\/((m|www)\.)?youtube\.com\/.+/i, /^https?:\/\/youtu\.be\/.+/i] -}, { - name: 'core-embed/facebook', - settings: { - title: 'Facebook', - icon: embedFacebookIcon, - keywords: [Object(external_this_wp_i18n_["__"])('social')], - description: Object(external_this_wp_i18n_["__"])('Embed a Facebook post.'), - previewable: false - }, - patterns: [/^https?:\/\/www\.facebook.com\/.+/i] -}, { - name: 'core-embed/instagram', - settings: { - title: 'Instagram', - icon: embedInstagramIcon, - keywords: [Object(external_this_wp_i18n_["__"])('image'), Object(external_this_wp_i18n_["__"])('social')], - description: Object(external_this_wp_i18n_["__"])('Embed an Instagram post.') - }, - patterns: [/^https?:\/\/(www\.)?instagr(\.am|am\.com)\/.+/i] -}, { - name: 'core-embed/wordpress', - settings: { - title: 'WordPress', - icon: embedWordPressIcon, - keywords: [Object(external_this_wp_i18n_["__"])('post'), Object(external_this_wp_i18n_["__"])('blog')], - responsive: false, - description: Object(external_this_wp_i18n_["__"])('Embed a WordPress post.') - } -}, { - name: 'core-embed/soundcloud', - settings: { - title: 'SoundCloud', - icon: embedAudioIcon, - keywords: [Object(external_this_wp_i18n_["__"])('music'), Object(external_this_wp_i18n_["__"])('audio')], - description: Object(external_this_wp_i18n_["__"])('Embed SoundCloud content.') - }, - patterns: [/^https?:\/\/(www\.)?soundcloud\.com\/.+/i] -}, { - name: 'core-embed/spotify', - settings: { - title: 'Spotify', - icon: embedSpotifyIcon, - keywords: [Object(external_this_wp_i18n_["__"])('music'), Object(external_this_wp_i18n_["__"])('audio')], - description: Object(external_this_wp_i18n_["__"])('Embed Spotify content.') - }, - patterns: [/^https?:\/\/(open|play)\.spotify\.com\/.+/i] -}, { - name: 'core-embed/flickr', - settings: { - title: 'Flickr', - icon: embedFlickrIcon, - keywords: [Object(external_this_wp_i18n_["__"])('image')], - description: Object(external_this_wp_i18n_["__"])('Embed Flickr content.') - }, - patterns: [/^https?:\/\/(www\.)?flickr\.com\/.+/i, /^https?:\/\/flic\.kr\/.+/i] -}, { - name: 'core-embed/vimeo', - settings: { - title: 'Vimeo', - icon: embedVimeoIcon, - keywords: [Object(external_this_wp_i18n_["__"])('video')], - description: Object(external_this_wp_i18n_["__"])('Embed a Vimeo video.') - }, - patterns: [/^https?:\/\/(www\.)?vimeo\.com\/.+/i] -}]; -var others = [{ - name: 'core-embed/animoto', - settings: { - title: 'Animoto', - icon: embedAnimotoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed an Animoto video.') - }, - patterns: [/^https?:\/\/(www\.)?(animoto|video214)\.com\/.+/i] -}, { - name: 'core-embed/cloudup', - settings: { - title: 'Cloudup', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Cloudup content.') - }, - patterns: [/^https?:\/\/cloudup\.com\/.+/i] -}, { - // Deprecated since CollegeHumor content is now powered by YouTube - name: 'core-embed/collegehumor', - settings: { - title: 'CollegeHumor', - icon: embedVideoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed CollegeHumor content.'), - supports: { - inserter: false - } - }, - patterns: [] -}, { - name: 'core-embed/crowdsignal', - settings: { - title: 'Crowdsignal', - icon: embedContentIcon, - keywords: ['polldaddy', Object(external_this_wp_i18n_["__"])('survey')], - transform: [{ - type: 'block', - blocks: ['core-embed/polldaddy'], - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])('core-embed/crowdsignal', { - content: content - }); - } - }], - description: Object(external_this_wp_i18n_["__"])('Embed Crowdsignal (formerly Polldaddy) content.') - }, - patterns: [/^https?:\/\/((.+\.)?polldaddy\.com|poll\.fm|.+\.survey\.fm)\/.+/i] -}, { - name: 'core-embed/dailymotion', - settings: { - title: 'Dailymotion', - icon: embedDailymotionIcon, - keywords: [Object(external_this_wp_i18n_["__"])('video')], - description: Object(external_this_wp_i18n_["__"])('Embed a Dailymotion video.') - }, - patterns: [/^https?:\/\/(www\.)?dailymotion\.com\/.+/i] -}, { - name: 'core-embed/imgur', - settings: { - title: 'Imgur', - icon: embedPhotoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Imgur content.') - }, - patterns: [/^https?:\/\/(.+\.)?imgur\.com\/.+/i] -}, { - name: 'core-embed/issuu', - settings: { - title: 'Issuu', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Issuu content.') - }, - patterns: [/^https?:\/\/(www\.)?issuu\.com\/.+/i] -}, { - name: 'core-embed/kickstarter', - settings: { - title: 'Kickstarter', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Kickstarter content.') - }, - patterns: [/^https?:\/\/(www\.)?kickstarter\.com\/.+/i, /^https?:\/\/kck\.st\/.+/i] -}, { - name: 'core-embed/meetup-com', - settings: { - title: 'Meetup.com', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Meetup.com content.') - }, - patterns: [/^https?:\/\/(www\.)?meetu(\.ps|p\.com)\/.+/i] -}, { - name: 'core-embed/mixcloud', - settings: { - title: 'Mixcloud', - icon: embedAudioIcon, - keywords: [Object(external_this_wp_i18n_["__"])('music'), Object(external_this_wp_i18n_["__"])('audio')], - description: Object(external_this_wp_i18n_["__"])('Embed Mixcloud content.') - }, - patterns: [/^https?:\/\/(www\.)?mixcloud\.com\/.+/i] -}, { - // Deprecated in favour of the core-embed/crowdsignal block - name: 'core-embed/polldaddy', - settings: { - title: 'Polldaddy', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Polldaddy content.'), - supports: { - inserter: false - } - }, - patterns: [] -}, { - name: 'core-embed/reddit', - settings: { - title: 'Reddit', - icon: embedRedditIcon, - description: Object(external_this_wp_i18n_["__"])('Embed a Reddit thread.') - }, - patterns: [/^https?:\/\/(www\.)?reddit\.com\/.+/i] -}, { - name: 'core-embed/reverbnation', - settings: { - title: 'ReverbNation', - icon: embedAudioIcon, - description: Object(external_this_wp_i18n_["__"])('Embed ReverbNation content.') - }, - patterns: [/^https?:\/\/(www\.)?reverbnation\.com\/.+/i] -}, { - name: 'core-embed/screencast', - settings: { - title: 'Screencast', - icon: embedVideoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Screencast content.') - }, - patterns: [/^https?:\/\/(www\.)?screencast\.com\/.+/i] -}, { - name: 'core-embed/scribd', - settings: { - title: 'Scribd', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Scribd content.') - }, - patterns: [/^https?:\/\/(www\.)?scribd\.com\/.+/i] -}, { - name: 'core-embed/slideshare', - settings: { - title: 'Slideshare', - icon: embedContentIcon, - description: Object(external_this_wp_i18n_["__"])('Embed Slideshare content.') - }, - patterns: [/^https?:\/\/(.+?\.)?slideshare\.net\/.+/i] -}, { - name: 'core-embed/smugmug', - settings: { - title: 'SmugMug', - icon: embedPhotoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed SmugMug content.'), - previewable: false - }, - patterns: [/^https?:\/\/(.+\.)?smugmug\.com\/.*/i] -}, { - // Deprecated in favour of the core-embed/speaker-deck block. - name: 'core-embed/speaker', - settings: { - title: 'Speaker', - icon: embedAudioIcon, - supports: { - inserter: false - } - }, - patterns: [] -}, { - name: 'core-embed/speaker-deck', - settings: { - title: 'Speaker Deck', - icon: embedContentIcon, - transform: [{ - type: 'block', - blocks: ['core-embed/speaker'], - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])('core-embed/speaker-deck', { - content: content - }); - } - }], - description: Object(external_this_wp_i18n_["__"])('Embed Speaker Deck content.') - }, - patterns: [/^https?:\/\/(www\.)?speakerdeck\.com\/.+/i] -}, { - name: 'core-embed/tiktok', - settings: { - title: 'TikTok', - icon: embedVideoIcon, - keywords: [Object(external_this_wp_i18n_["__"])('video')], - description: Object(external_this_wp_i18n_["__"])('Embed a TikTok video.') - }, - patterns: [/^https?:\/\/(www\.)?tiktok\.com\/.+/i] -}, { - name: 'core-embed/ted', - settings: { - title: 'TED', - icon: embedVideoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed a TED video.') - }, - patterns: [/^https?:\/\/(www\.|embed\.)?ted\.com\/.+/i] -}, { - name: 'core-embed/tumblr', - settings: { - title: 'Tumblr', - icon: embedTumblrIcon, - keywords: [Object(external_this_wp_i18n_["__"])('social')], - description: Object(external_this_wp_i18n_["__"])('Embed a Tumblr post.') - }, - patterns: [/^https?:\/\/(www\.)?tumblr\.com\/.+/i] -}, { - name: 'core-embed/videopress', - settings: { - title: 'VideoPress', - icon: embedVideoIcon, - keywords: [Object(external_this_wp_i18n_["__"])('video')], - description: Object(external_this_wp_i18n_["__"])('Embed a VideoPress video.') - }, - patterns: [/^https?:\/\/videopress\.com\/.+/i] -}, { - name: 'core-embed/wordpress-tv', - settings: { - title: 'WordPress.tv', - icon: embedVideoIcon, - description: Object(external_this_wp_i18n_["__"])('Embed a WordPress.tv video.') - }, - patterns: [/^https?:\/\/wordpress\.tv\/.+/i] -}, { - name: 'core-embed/amazon-kindle', - settings: { - title: 'Amazon Kindle', - icon: embedAmazonIcon, - keywords: [Object(external_this_wp_i18n_["__"])('ebook')], - responsive: false, - description: Object(external_this_wp_i18n_["__"])('Embed Amazon Kindle content.') - }, - patterns: [/^https?:\/\/([a-z0-9-]+\.)?(amazon|amzn)(\.[a-z]{2,4})+\/.+/i, /^https?:\/\/(www\.)?(a\.co|z\.cn)\/.+/i] -}]; +var upload = __webpack_require__("NTP4"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/overlay-text.js + + +/** + * WordPress dependencies + */ + +const overlayText = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12-9.8c.4 0 .8-.3.9-.7l1.1-3h3.6l.5 1.7h1.9L13 9h-2.2l-3.4 9.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12H20V6c0-1.1-.9-2-2-2zm-6 7l1.4 3.9h-2.7L12 11z" +})); +/* harmony default export */ var overlay_text = (overlayText); + +// EXTERNAL MODULE: external ["wp","notices"] +var external_wp_notices_ = __webpack_require__("onLe"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/constants.js -var ASPECT_RATIOS = [// Common video resolutions. +const ASPECT_RATIOS = [// Common video resolutions. { ratio: '2.33', className: 'wp-embed-aspect-21-9' @@ -3398,44 +2642,100 @@ ratio: '0.50', className: 'wp-embed-aspect-1-2' }]; -var DEFAULT_EMBED_BLOCK = 'core/embed'; -var WORDPRESS_EMBED_BLOCK = 'core-embed/wordpress'; +const WP_EMBED_TYPE = 'wp-embed'; // EXTERNAL MODULE: ./node_modules/classnames/dedupe.js -var dedupe = __webpack_require__(105); +var dedupe = __webpack_require__("A/WM"); var dedupe_default = /*#__PURE__*/__webpack_require__.n(dedupe); // EXTERNAL MODULE: ./node_modules/memize/index.js -var memize = __webpack_require__(60); +var memize = __webpack_require__("4eJC"); var memize_default = /*#__PURE__*/__webpack_require__.n(memize); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/util.js - - -function util_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function util_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { util_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { util_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * Internal dependencies - */ - - -/** - * External dependencies - */ - - - - -/** - * WordPress dependencies - */ - - - +/** + * Internal dependencies + */ + +/** + * External dependencies + */ + + + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + +const util_metadata = { + apiVersion: 2, + name: "core/embed", + title: "Embed", + category: "embed", + description: "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.", + textdomain: "default", + attributes: { + url: { + type: "string" + }, + caption: { + type: "string", + source: "html", + selector: "figcaption" + }, + type: { + type: "string" + }, + providerNameSlug: { + type: "string" + }, + allowResponsive: { + type: "boolean", + "default": true + }, + responsive: { + type: "boolean", + "default": false + }, + previewable: { + type: "boolean", + "default": true + } + }, + supports: { + align: true + }, + editorStyle: "wp-block-embed-editor", + style: "wp-block-embed" +}; +const { + name: DEFAULT_EMBED_BLOCK +} = util_metadata; +/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ + +/** + * Returns the embed block's information by matching the provided service provider + * + * @param {string} provider The embed block's provider + * @return {WPBlockVariation} The embed block's information + */ + +const getEmbedInfoByProvider = provider => { + var _getBlockVariations; + + return (_getBlockVariations = Object(external_wp_blocks_["getBlockVariations"])(DEFAULT_EMBED_BLOCK)) === null || _getBlockVariations === void 0 ? void 0 : _getBlockVariations.find(({ + name + }) => name === provider); +}; /** * Returns true if any of the regular expressions match the URL. * @@ -3444,44 +2744,33 @@ * @return {boolean} True if any of the regular expressions match the URL. */ -var matchesPatterns = function matchesPatterns(url) { - var patterns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - return patterns.some(function (pattern) { - return url.match(pattern); - }); -}; -/** - * Finds the block name that should be used for the URL, based on the - * structure of the URL. +const matchesPatterns = (url, patterns = []) => patterns.some(pattern => url.match(pattern)); +/** + * Finds the block variation that should be used for the URL, + * based on the provided URL and the variation's patterns. * * @param {string} url The URL to test. - * @return {string} The name of the block that should be used for this URL, e.g. core-embed/twitter - */ - -var util_findBlock = function findBlock(url) { - for (var _i = 0, _arr = [].concat(Object(toConsumableArray["a" /* default */])(common), Object(toConsumableArray["a" /* default */])(others)); _i < _arr.length; _i++) { - var block = _arr[_i]; - - if (matchesPatterns(url, block.patterns)) { - return block.name; - } - } - - return DEFAULT_EMBED_BLOCK; -}; -var util_isFromWordPress = function isFromWordPress(html) { - return Object(external_this_lodash_["includes"])(html, 'class="wp-embedded-content"'); -}; -var util_getPhotoHtml = function getPhotoHtml(photo) { + * @return {WPBlockVariation} The block variation that should be used for this URL + */ + +const findMoreSuitableBlock = url => { + var _getBlockVariations2; + + return (_getBlockVariations2 = Object(external_wp_blocks_["getBlockVariations"])(DEFAULT_EMBED_BLOCK)) === null || _getBlockVariations2 === void 0 ? void 0 : _getBlockVariations2.find(({ + patterns + }) => matchesPatterns(url, patterns)); +}; +const isFromWordPress = html => html && html.includes('class="wp-embedded-content"'); +const getPhotoHtml = photo => { // 100% width for the preview so it fits nicely into the document, some "thumbnails" are // actually the full size photo. If thumbnails not found, use full image. - var imageUrl = photo.thumbnail_url ? photo.thumbnail_url : photo.url; - var photoPreview = Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_element_["createElement"])("img", { + const imageUrl = photo.thumbnail_url || photo.url; + const photoPreview = Object(external_wp_element_["createElement"])("p", null, Object(external_wp_element_["createElement"])("img", { src: imageUrl, alt: photo.title, width: "100%" })); - return Object(external_this_wp_element_["renderToString"])(photoPreview); + return Object(external_wp_element_["renderToString"])(photoPreview); }; /** * Creates a more suitable embed block based on the passed in props @@ -3494,48 +2783,84 @@ * See `getAttributesFromPreview` in the generated embed edit component. * * @param {Object} props The block's props. - * @param {Object} attributesFromPreview Attributes generated from the block's most up to date preview. + * @param {Object} [attributesFromPreview] Attributes generated from the block's most up to date preview. * @return {Object|undefined} A more suitable embed block if one exists. */ -var util_createUpgradedEmbedBlock = function createUpgradedEmbedBlock(props, attributesFromPreview) { - var preview = props.preview, - name = props.name; - var url = props.attributes.url; - - if (!url) { - return; - } - - var matchingBlock = util_findBlock(url); - - if (!Object(external_this_wp_blocks_["getBlockType"])(matchingBlock)) { - return; - } // WordPress blocks can work on multiple sites, and so don't have patterns, +const createUpgradedEmbedBlock = (props, attributesFromPreview = {}) => { + var _getBlockVariations3; + + const { + preview, + attributes: { + url, + providerNameSlug, + type + } = {} + } = props; + if (!url || !Object(external_wp_blocks_["getBlockType"])(DEFAULT_EMBED_BLOCK)) return; + const matchedBlock = findMoreSuitableBlock(url); // WordPress blocks can work on multiple sites, and so don't have patterns, // so if we're in a WordPress block, assume the user has chosen it for a WordPress URL. - - if (WORDPRESS_EMBED_BLOCK !== name && DEFAULT_EMBED_BLOCK !== matchingBlock) { - // At this point, we have discovered a more suitable block for this url, so transform it. - if (name !== matchingBlock) { - return Object(external_this_wp_blocks_["createBlock"])(matchingBlock, { - url: url - }); - } - } - - if (preview) { - var html = preview.html; // We can't match the URL for WordPress embeds, we have to check the HTML instead. - - if (util_isFromWordPress(html)) { - // If this is not the WordPress embed block, transform it into one. - if (WORDPRESS_EMBED_BLOCK !== name) { - return Object(external_this_wp_blocks_["createBlock"])(WORDPRESS_EMBED_BLOCK, util_objectSpread({ - url: url - }, attributesFromPreview)); - } - } - } + const isCurrentBlockWP = providerNameSlug === 'wordpress' || type === WP_EMBED_TYPE; // if current block is not WordPress and a more suitable block found + // that is different from the current one, create the new matched block + + const shouldCreateNewBlock = !isCurrentBlockWP && matchedBlock && (matchedBlock.attributes.providerNameSlug !== providerNameSlug || !providerNameSlug); + + if (shouldCreateNewBlock) { + return Object(external_wp_blocks_["createBlock"])(DEFAULT_EMBED_BLOCK, { + url, + ...matchedBlock.attributes + }); + } + + const wpVariation = (_getBlockVariations3 = Object(external_wp_blocks_["getBlockVariations"])(DEFAULT_EMBED_BLOCK)) === null || _getBlockVariations3 === void 0 ? void 0 : _getBlockVariations3.find(({ + name + }) => name === 'wordpress'); // We can't match the URL for WordPress embeds, we have to check the HTML instead. + + if (!wpVariation || !preview || !isFromWordPress(preview.html) || isCurrentBlockWP) { + return; + } // This is not the WordPress embed block so transform it into one. + + + return Object(external_wp_blocks_["createBlock"])(DEFAULT_EMBED_BLOCK, { + url, + ...wpVariation.attributes, + // By now we have the preview, but when the new block first renders, it + // won't have had all the attributes set, and so won't get the correct + // type and it won't render correctly. So, we pass through the current attributes + // here so that the initial render works when we switch to the WordPress + // block. This only affects the WordPress block because it can't be + // rendered in the usual Sandbox (it has a sandbox of its own) and it + // relies on the preview to set the correct render type. + ...attributesFromPreview + }); +}; +/** + * Removes all previously set aspect ratio related classes and return the rest + * existing class names. + * + * @param {string} existingClassNames Any existing class names. + * @return {string} The class names without any aspect ratio related class. + */ + +const removeAspectRatioClasses = existingClassNames => { + if (!existingClassNames) { + // Avoids extraneous work and also, by returning the same value as + // received, ensures the post is not dirtied by a change of the block + // attribute from `undefined` to an emtpy string. + return existingClassNames; + } + + const aspectRatioClassNames = ASPECT_RATIOS.reduce((accumulator, { + className + }) => { + accumulator[className] = false; + return accumulator; + }, { + 'wp-has-aspect-ratio': false + }); + return dedupe_default()(existingClassNames, aspectRatioClassNames); }; /** * Returns class names with any relevant responsive aspect ratio names. @@ -3546,38 +2871,33 @@ * @return {string} Deduped class names. */ -function getClassNames(html) { - var existingClassNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var allowResponsive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - +function getClassNames(html, existingClassNames, allowResponsive = true) { if (!allowResponsive) { - // Remove all of the aspect ratio related class names. - var aspectRatioClassNames = { - 'wp-has-aspect-ratio': false - }; - - for (var ratioIndex = 0; ratioIndex < ASPECT_RATIOS.length; ratioIndex++) { - var aspectRatioToRemove = ASPECT_RATIOS[ratioIndex]; - aspectRatioClassNames[aspectRatioToRemove.className] = false; - } - - return dedupe_default()(existingClassNames, aspectRatioClassNames); - } - - var previewDocument = document.implementation.createHTMLDocument(''); + return removeAspectRatioClasses(existingClassNames); + } + + const previewDocument = document.implementation.createHTMLDocument(''); previewDocument.body.innerHTML = html; - var iframe = previewDocument.body.querySelector('iframe'); // If we have a fixed aspect iframe, and it's a responsive embed block. + const iframe = previewDocument.body.querySelector('iframe'); // If we have a fixed aspect iframe, and it's a responsive embed block. if (iframe && iframe.height && iframe.width) { - var aspectRatio = (iframe.width / iframe.height).toFixed(2); // Given the actual aspect ratio, find the widest ratio to support it. - - for (var _ratioIndex = 0; _ratioIndex < ASPECT_RATIOS.length; _ratioIndex++) { - var potentialRatio = ASPECT_RATIOS[_ratioIndex]; + const aspectRatio = (iframe.width / iframe.height).toFixed(2); // Given the actual aspect ratio, find the widest ratio to support it. + + for (let ratioIndex = 0; ratioIndex < ASPECT_RATIOS.length; ratioIndex++) { + const potentialRatio = ASPECT_RATIOS[ratioIndex]; if (aspectRatio >= potentialRatio.ratio) { - var _classnames; - - return dedupe_default()(existingClassNames, (_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, potentialRatio.className, allowResponsive), Object(defineProperty["a" /* default */])(_classnames, 'wp-has-aspect-ratio', allowResponsive), _classnames)); + // Evaluate the difference between actual aspect ratio and closest match. + // If the difference is too big, do not scale the embed according to aspect ratio. + const ratioDiff = aspectRatio - potentialRatio.ratio; + + if (ratioDiff > 0.1) { + // No close aspect ratio match found. + return removeAspectRatioClasses(existingClassNames); + } // Close aspect ratio match found. + + + return dedupe_default()(removeAspectRatioClasses(existingClassNames), potentialRatio.className, 'wp-has-aspect-ratio'); } } } @@ -3593,11 +2913,11 @@ */ function util_fallback(url, onReplace) { - var link = Object(external_this_wp_element_["createElement"])("a", { + const link = Object(external_wp_element_["createElement"])("a", { href: url }, url); - onReplace(Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: Object(external_this_wp_element_["renderToString"])(link) + onReplace(Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: Object(external_wp_element_["renderToString"])(link) })); } /*** @@ -3611,25 +2931,26 @@ * @return {Object} Attributes and values. */ -var getAttributesFromPreview = memize_default()(function (preview, title, currentClassNames, isResponsive) { - var allowResponsive = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true; - +const getAttributesFromPreview = memize_default()((preview, title, currentClassNames, isResponsive, allowResponsive = true) => { if (!preview) { return {}; } - var attributes = {}; // Some plugins only return HTML with no type info, so default this to 'rich'. - - var _preview$type = preview.type, - type = _preview$type === void 0 ? 'rich' : _preview$type; // If we got a provider name from the API, use it for the slug, otherwise we use the title, + const attributes = {}; // Some plugins only return HTML with no type info, so default this to 'rich'. + + let { + type = 'rich' + } = preview; // If we got a provider name from the API, use it for the slug, otherwise we use the title, // because not all embed code gives us a provider name. - var html = preview.html, - providerName = preview.provider_name; - var providerNameSlug = Object(external_this_lodash_["kebabCase"])(Object(external_this_lodash_["toLower"])('' !== providerName ? providerName : title)); - - if (util_isFromWordPress(html)) { - type = 'wp-embed'; + const { + html, + provider_name: providerName + } = preview; + const providerNameSlug = Object(external_lodash_["kebabCase"])((providerName || title).toLowerCase()); + + if (isFromWordPress(html)) { + type = WP_EMBED_TYPE; } if (html || 'photo' === type) { @@ -3642,27 +2963,24 @@ }); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/use-client-width.js - - /** * WordPress dependencies */ function useClientWidth(ref, dependencies) { - var _useState = Object(external_this_wp_element_["useState"])(), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - clientWidth = _useState2[0], - setClientWidth = _useState2[1]; + const [clientWidth, setClientWidth] = Object(external_wp_element_["useState"])(); function calculateClientWidth() { setClientWidth(ref.current.clientWidth); } - Object(external_this_wp_element_["useEffect"])(calculateClientWidth, dependencies); - Object(external_this_wp_element_["useEffect"])(function () { - var defaultView = ref.current.ownerDocument.defaultView; + Object(external_wp_element_["useEffect"])(calculateClientWidth, dependencies); + Object(external_wp_element_["useEffect"])(() => { + const { + defaultView + } = ref.current.ownerDocument; defaultView.addEventListener('resize', calculateClientWidth); - return function () { + return () => { defaultView.removeEventListener('resize', calculateClientWidth); }; }, []); @@ -3689,7 +3007,7 @@ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; @@ -3775,8 +3093,16 @@ } } -function __exportStar(m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { @@ -3857,11 +3183,17 @@ return cooked; }; +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); return result; } @@ -3884,14 +3216,19 @@ return value; } -// EXTERNAL MODULE: external {"this":"React"} -var external_this_React_ = __webpack_require__(13); -var external_this_React_default = /*#__PURE__*/__webpack_require__.n(external_this_React_); +// EXTERNAL MODULE: external "React" +var external_React_ = __webpack_require__("cDcd"); +var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_); + +// EXTERNAL MODULE: ./node_modules/normalize-wheel/index.js +var normalize_wheel = __webpack_require__("wJiJ"); +var normalize_wheel_default = /*#__PURE__*/__webpack_require__.n(normalize_wheel); // CONCATENATED MODULE: ./node_modules/react-easy-crop/index.module.js + /** * Compute the dimension of the crop area based on media size, * aspect ratio and optionally rotation @@ -4117,7 +3454,7 @@ }).join(' ').trim(); } -var css = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; +var css_248z = ".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n"; var MIN_ZOOM = 1; var MAX_ZOOM = 3; @@ -4209,7 +3546,7 @@ }; _this.computeSizes = function () { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f; var mediaRef = _this.imageRef || _this.videoRef; @@ -4223,6 +3560,10 @@ }; var cropSize = _this.props.cropSize ? _this.props.cropSize : getCropSize(mediaRef.offsetWidth, mediaRef.offsetHeight, _this.containerRect.width, _this.containerRect.height, _this.props.aspect, _this.props.rotation); + if (((_e = _this.state.cropSize) === null || _e === void 0 ? void 0 : _e.height) !== cropSize.height || ((_f = _this.state.cropSize) === null || _f === void 0 ? void 0 : _f.width) !== cropSize.width) { + _this.props.onCropSizeChange && _this.props.onCropSizeChange(cropSize); + } + _this.setState({ cropSize: cropSize }, _this.recomputeCropPosition); @@ -4268,11 +3609,10 @@ }; _this.onDragStart = function (_a) { + var _b, _c; + var x = _a.x, y = _a.y; - - var _b, _c; - _this.dragStartPosition = { x: x, y: y @@ -4313,7 +3653,8 @@ _this.onWheel = function (e) { e.preventDefault(); var point = Cropper.getMousePoint(e); - var newZoom = _this.props.zoom - e.deltaY * _this.props.zoomSpeed / 200; + var pixelY = normalize_wheel_default()(e).pixelY; + var newZoom = _this.props.zoom - pixelY * _this.props.zoomSpeed / 200; _this.setNewZoom(newZoom, point); @@ -4387,16 +3728,42 @@ _this.props.onZoomChange(newZoom); }; - _this.emitCropData = function () { - if (!_this.state.cropSize) return; // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ricardo-ch/react-easy-crop/issues/6) + _this.getCropData = function () { + if (!_this.state.cropSize) { + return null; + } // this is to ensure the crop is correctly restricted after a zoom back (https://github.com/ricardo-ch/react-easy-crop/issues/6) + var restrictedPosition = _this.props.restrictPosition ? index_module_restrictPosition(_this.props.crop, _this.mediaSize, _this.state.cropSize, _this.props.zoom, _this.props.rotation) : _this.props.crop; - - var _a = computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition), - croppedAreaPercentages = _a.croppedAreaPercentages, - croppedAreaPixels = _a.croppedAreaPixels; - - _this.props.onCropComplete && _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); + return computeCroppedArea(restrictedPosition, _this.mediaSize, _this.state.cropSize, _this.getAspect(), _this.props.zoom, _this.props.rotation, _this.props.restrictPosition); + }; + + _this.emitCropData = function () { + var cropData = _this.getCropData(); + + if (!cropData) return; + var croppedAreaPercentages = cropData.croppedAreaPercentages, + croppedAreaPixels = cropData.croppedAreaPixels; + + if (_this.props.onCropComplete) { + _this.props.onCropComplete(croppedAreaPercentages, croppedAreaPixels); + } + + if (_this.props.onCropAreaChange) { + _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); + } + }; + + _this.emitCropAreaChange = function () { + var cropData = _this.getCropData(); + + if (!cropData) return; + var croppedAreaPercentages = cropData.croppedAreaPercentages, + croppedAreaPixels = cropData.croppedAreaPixels; + + if (_this.props.onCropAreaChange) { + _this.props.onCropAreaChange(croppedAreaPercentages, croppedAreaPixels); + } }; _this.recomputeCropPosition = function () { @@ -4425,7 +3792,7 @@ if (!this.props.disableAutomaticStylesInjection) { this.styleRef = document.createElement('style'); this.styleRef.setAttribute('type', 'text/css'); - this.styleRef.innerHTML = css; + this.styleRef.innerHTML = css_248z; document.head.appendChild(this.styleRef); } // when rendered via SSR, the image can already be loaded and its onLoad callback will never be called @@ -4436,6 +3803,8 @@ }; Cropper.prototype.componentWillUnmount = function () { + var _a; + window.removeEventListener('resize', this.computeSizes); if (this.containerRef) { @@ -4444,7 +3813,7 @@ } if (this.styleRef) { - this.styleRef.remove(); + (_a = this.styleRef.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.styleRef); } this.cleanEvents(); @@ -4452,7 +3821,7 @@ }; Cropper.prototype.componentDidUpdate = function (prevProps) { - var _a, _b, _c, _d; + var _a, _b, _c, _d, _e, _f, _g, _h, _j; if (prevProps.rotation !== this.props.rotation) { this.computeSizes(); @@ -4463,6 +3832,8 @@ this.recomputeCropPosition(); } else if (((_a = prevProps.cropSize) === null || _a === void 0 ? void 0 : _a.height) !== ((_b = this.props.cropSize) === null || _b === void 0 ? void 0 : _b.height) || ((_c = prevProps.cropSize) === null || _c === void 0 ? void 0 : _c.width) !== ((_d = this.props.cropSize) === null || _d === void 0 ? void 0 : _d.width)) { this.computeSizes(); + } else if (((_e = prevProps.crop) === null || _e === void 0 ? void 0 : _e.x) !== ((_f = this.props.crop) === null || _f === void 0 ? void 0 : _f.x) || ((_g = prevProps.crop) === null || _g === void 0 ? void 0 : _g.y) !== ((_h = this.props.crop) === null || _h === void 0 ? void 0 : _h.y)) { + this.emitCropAreaChange(); } if (prevProps.zoomWithScroll !== this.props.zoomWithScroll && this.containerRef) { @@ -4470,6 +3841,10 @@ passive: false }) : this.clearScrollEvent(); } + + if (prevProps.video !== this.props.video) { + (_j = this.videoRef) === null || _j === void 0 ? void 0 : _j.load(); + } }; Cropper.prototype.getAspect = function () { @@ -4536,8 +3911,9 @@ _d = _a.classes, containerClassName = _d.containerClassName, cropAreaClassName = _d.cropAreaClassName, - mediaClassName = _d.mediaClassName; - return external_this_React_default.a.createElement("div", { + mediaClassName = _d.mediaClassName, + objectFit = _a.objectFit; + return /*#__PURE__*/external_React_default.a.createElement("div", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, ref: function ref(el) { @@ -4546,9 +3922,9 @@ "data-testid": "container", style: containerStyle, className: index_module_classNames('reactEasyCrop_Container', containerClassName) - }, image ? external_this_React_default.a.createElement("img", __assign({ + }, image ? /*#__PURE__*/external_React_default.a.createElement("img", __assign({ alt: "", - className: index_module_classNames('reactEasyCrop_Image', mediaClassName) + className: index_module_classNames('reactEasyCrop_Image', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { src: image, ref: function ref(el) { @@ -4558,13 +3934,12 @@ transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" }), onLoad: this.onMediaLoad - })) : video && external_this_React_default.a.createElement("video", __assign({ + })) : video && /*#__PURE__*/external_React_default.a.createElement("video", __assign({ autoPlay: true, loop: true, muted: true, - className: index_module_classNames('reactEasyCrop_Video', mediaClassName) + className: index_module_classNames('reactEasyCrop_Video', objectFit === 'contain' && 'reactEasyCrop_Contain', objectFit === 'horizontal-cover' && 'reactEasyCrop_Cover_Horizontal', objectFit === 'vertical-cover' && 'reactEasyCrop_Cover_Vertical', mediaClassName) }, mediaProps, { - src: video, ref: function ref(el) { return _this.videoRef = el; }, @@ -4573,7 +3948,13 @@ transform: transform || "translate(" + x + "px, " + y + "px) rotate(" + rotation + "deg) scale(" + zoom + ")" }), controls: false - })), this.state.cropSize && external_this_React_default.a.createElement("div", { + }), (Array.isArray(video) ? video : [{ + src: video + }]).map(function (item) { + return /*#__PURE__*/external_React_default.a.createElement("source", __assign({ + key: item.src + }, item)); + })), this.state.cropSize && /*#__PURE__*/external_React_default.a.createElement("div", { style: __assign(__assign({}, cropAreaStyle), { width: this.state.cropSize.width, height: this.state.cropSize.height @@ -4590,6 +3971,7 @@ maxZoom: MAX_ZOOM, minZoom: MIN_ZOOM, cropShape: 'rect', + objectFit: 'contain', showGrid: true, style: {}, classes: {}, @@ -4614,240 +3996,53 @@ }; return Cropper; -}(external_this_React_default.a.Component); +}(external_React_default.a.Component); /* harmony default export */ var index_module = (index_module_Cropper); -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js -var check = __webpack_require__(155); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js - - -/** - * WordPress dependencies - */ - -var aspect_ratio_aspectRatio = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" -})); -/* harmony default export */ var aspect_ratio = (aspect_ratio_aspectRatio); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js -var search = __webpack_require__(291); - -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js - - -/** - * WordPress dependencies - */ - -var rotateRight = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" -})); -/* harmony default export */ var rotate_right = (rotateRight); - -// EXTERNAL MODULE: external {"this":["wp","apiFetch"]} -var external_this_wp_apiFetch_ = __webpack_require__(45); -var external_this_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_apiFetch_); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editor.js - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - -var image_editor_MIN_ZOOM = 100; -var image_editor_MAX_ZOOM = 300; -var POPOVER_PROPS = { +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/constants.js +const constants_MIN_ZOOM = 100; +const constants_MAX_ZOOM = 300; +const constants_POPOVER_PROPS = { position: 'bottom right', isAlternate: true }; -function AspectGroup(_ref) { - var aspectRatios = _ref.aspectRatios, - isDisabled = _ref.isDisabled, - label = _ref.label, - _onClick = _ref.onClick, - value = _ref.value; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuGroup"], { - label: label - }, aspectRatios.map(function (_ref2) { - var title = _ref2.title, - aspect = _ref2.aspect; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], { - key: aspect, - isDisabled: isDisabled, - onClick: function onClick() { - _onClick(aspect); - }, - role: "menuitemradio", - isSelected: aspect === value, - icon: aspect === value ? check["a" /* default */] : undefined - }, title); - })); -} - -function AspectMenu(_ref3) { - var isDisabled = _ref3.isDisabled, - _onClick2 = _ref3.onClick, - value = _ref3.value, - defaultValue = _ref3.defaultValue; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["DropdownMenu"], { - icon: aspect_ratio, - label: Object(external_this_wp_i18n_["__"])('Aspect Ratio'), - popoverProps: POPOVER_PROPS, - className: "wp-block-image__aspect-ratio" - }, function (_ref4) { - var onClose = _ref4.onClose; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(AspectGroup, { - isDisabled: isDisabled, - onClick: function onClick(aspect) { - _onClick2(aspect); - - onClose(); - }, - value: value, - aspectRatios: [{ - title: Object(external_this_wp_i18n_["__"])('Original'), - aspect: defaultValue - }, { - title: Object(external_this_wp_i18n_["__"])('Square'), - aspect: 1 - }] - }), Object(external_this_wp_element_["createElement"])(AspectGroup, { - label: Object(external_this_wp_i18n_["__"])('Landscape'), - isDisabled: isDisabled, - onClick: function onClick(aspect) { - _onClick2(aspect); - - onClose(); - }, - value: value, - aspectRatios: [{ - title: Object(external_this_wp_i18n_["__"])('16:10'), - aspect: 16 / 10 - }, { - title: Object(external_this_wp_i18n_["__"])('16:9'), - aspect: 16 / 9 - }, { - title: Object(external_this_wp_i18n_["__"])('4:3'), - aspect: 4 / 3 - }, { - title: Object(external_this_wp_i18n_["__"])('3:2'), - aspect: 3 / 2 - }] - }), Object(external_this_wp_element_["createElement"])(AspectGroup, { - label: Object(external_this_wp_i18n_["__"])('Portrait'), - isDisabled: isDisabled, - onClick: function onClick(aspect) { - _onClick2(aspect); - - onClose(); - }, - value: value, - aspectRatios: [{ - title: Object(external_this_wp_i18n_["__"])('10:16'), - aspect: 10 / 16 - }, { - title: Object(external_this_wp_i18n_["__"])('9:16'), - aspect: 9 / 16 - }, { - title: Object(external_this_wp_i18n_["__"])('3:4'), - aspect: 3 / 4 - }, { - title: Object(external_this_wp_i18n_["__"])('2:3'), - aspect: 2 / 3 - }] - })); - }); -} - -function ImageEditor(_ref5) { - var id = _ref5.id, - url = _ref5.url, - setAttributes = _ref5.setAttributes, - naturalWidth = _ref5.naturalWidth, - naturalHeight = _ref5.naturalHeight, - width = _ref5.width, - height = _ref5.height, - clientWidth = _ref5.clientWidth, - setIsEditingImage = _ref5.setIsEditingImage; - - var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/notices'), - createErrorNotice = _useDispatch.createErrorNotice; - - var _useState = Object(external_this_wp_element_["useState"])(false), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - inProgress = _useState2[0], - setIsProgress = _useState2[1]; - - var _useState3 = Object(external_this_wp_element_["useState"])(null), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - crop = _useState4[0], - setCrop = _useState4[1]; - - var _useState5 = Object(external_this_wp_element_["useState"])({ - x: 0, - y: 0 - }), - _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), - position = _useState6[0], - setPosition = _useState6[1]; - - var _useState7 = Object(external_this_wp_element_["useState"])(100), - _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), - zoom = _useState8[0], - setZoom = _useState8[1]; - - var _useState9 = Object(external_this_wp_element_["useState"])(naturalWidth / naturalHeight), - _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), - aspect = _useState10[0], - setAspect = _useState10[1]; - - var _useState11 = Object(external_this_wp_element_["useState"])(0), - _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), - rotation = _useState12[0], - setRotation = _useState12[1]; - - var _useState13 = Object(external_this_wp_element_["useState"])(), - _useState14 = Object(slicedToArray["a" /* default */])(_useState13, 2), - editedUrl = _useState14[0], - setEditedUrl = _useState14[1]; - - var editedWidth = width; - var editedHeight = height || clientWidth * naturalHeight / naturalWidth; - var naturalAspectRatio = naturalWidth / naturalHeight; - - if (rotation % 180 === 90) { - editedHeight = clientWidth * naturalWidth / naturalHeight; - naturalAspectRatio = naturalHeight / naturalWidth; - } - - function apply() { - setIsProgress(true); - var attrs = {}; // The crop script may return some very small, sub-pixel values when the image was not cropped. +// EXTERNAL MODULE: external ["wp","apiFetch"] +var external_wp_apiFetch_ = __webpack_require__("ywyh"); +var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/use-save-image.js +/** + * WordPress dependencies + */ + + + + + +function useSaveImage({ + crop, + rotation, + height, + width, + aspect, + url, + id, + onSaveImage, + onFinishEditing +}) { + const { + createErrorNotice + } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); + const [isInProgress, setIsInProgress] = Object(external_wp_element_["useState"])(false); + const cancel = Object(external_wp_element_["useCallback"])(() => { + setIsInProgress(false); + onFinishEditing(); + }, [setIsInProgress, onFinishEditing]); + const apply = Object(external_wp_element_["useCallback"])(() => { + setIsInProgress(true); + let attrs = {}; // The crop script may return some very small, sub-pixel values when the image was not cropped. // Crop only when the new size has changed by more than 0.1%. if (crop.width < 99.9 || crop.height < 99.9) { @@ -4859,31 +4054,77 @@ } attrs.src = url; - external_this_wp_apiFetch_default()({ - path: "/wp/v2/media/".concat(id, "/edit"), + external_wp_apiFetch_default()({ + path: `/wp/v2/media/${id}/edit`, method: 'POST', data: attrs - }).then(function (response) { - setAttributes({ + }).then(response => { + onSaveImage({ id: response.id, url: response.source_url, height: height && width ? width / aspect : undefined }); - }).catch(function (error) { - createErrorNotice(Object(external_this_wp_i18n_["sprintf"])( + }).catch(error => { + createErrorNotice(Object(external_wp_i18n_["sprintf"])( /* translators: 1. Error message */ - Object(external_this_wp_i18n_["__"])('Could not edit image. %s'), error.message), { + Object(external_wp_i18n_["__"])('Could not edit image. %s'), error.message), { id: 'image-editing-error', type: 'snackbar' }); - }).finally(function () { - setIsProgress(false); - setIsEditingImage(false); - }); - } - - function rotate() { - var angle = (rotation + 90) % 360; + }).finally(() => { + setIsInProgress(false); + onFinishEditing(); + }); + }, [setIsInProgress, crop, rotation, height, width, aspect, url, onSaveImage, createErrorNotice, setIsInProgress, onFinishEditing]); + return Object(external_wp_element_["useMemo"])(() => ({ + isInProgress, + apply, + cancel + }), [isInProgress, apply, cancel]); +} + +// EXTERNAL MODULE: external ["wp","hooks"] +var external_wp_hooks_ = __webpack_require__("g56x"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/use-transform-image.js +/** + * WordPress dependencies + */ + + + +function useTransformState({ + url, + naturalWidth, + naturalHeight +}) { + const [editedUrl, setEditedUrl] = Object(external_wp_element_["useState"])(); + const [crop, setCrop] = Object(external_wp_element_["useState"])(); + const [position, setPosition] = Object(external_wp_element_["useState"])({ + x: 0, + y: 0 + }); + const [zoom, setZoom] = Object(external_wp_element_["useState"])(); + const [rotation, setRotation] = Object(external_wp_element_["useState"])(); + const [aspect, setAspect] = Object(external_wp_element_["useState"])(); + const [defaultAspect, setDefaultAspect] = Object(external_wp_element_["useState"])(); + const initializeTransformValues = Object(external_wp_element_["useCallback"])(() => { + setPosition({ + x: 0, + y: 0 + }); + setZoom(100); + setRotation(0); + setAspect(naturalWidth / naturalHeight); + setDefaultAspect(naturalWidth / naturalHeight); + }, [naturalWidth, naturalHeight, setPosition, setZoom, setRotation, setAspect, setDefaultAspect]); + const rotateClockwise = Object(external_wp_element_["useCallback"])(() => { + const angle = (rotation + 90) % 360; + let naturalAspectRatio = naturalWidth / naturalHeight; + + if (rotation % 180 === 90) { + naturalAspectRatio = naturalHeight / naturalWidth; + } if (angle === 0) { setEditedUrl(); @@ -4897,9 +4138,9 @@ } function editImage(event) { - var canvas = document.createElement('canvas'); - var translateX = 0; - var translateY = 0; + const canvas = document.createElement('canvas'); + let translateX = 0; + let translateY = 0; if (angle % 180) { canvas.width = event.target.height; @@ -4917,11 +4158,11 @@ translateY = canvas.height; } - var context = canvas.getContext('2d'); + const context = canvas.getContext('2d'); context.translate(translateX, translateY); context.rotate(angle * Math.PI / 180); context.drawImage(event.target, 0, 0); - canvas.toBlob(function (blob) { + canvas.toBlob(blob => { setEditedUrl(URL.createObjectURL(blob)); setRotation(angle); setAspect(1 / aspect); @@ -4932,100 +4173,471 @@ }); } - var el = new window.Image(); + const el = new window.Image(); el.src = url; el.onload = editImage; - } - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("div", { + const imgCrossOrigin = Object(external_wp_hooks_["applyFilters"])('media.crossOrigin', undefined, url); + + if (typeof imgCrossOrigin === 'string') { + el.crossOrigin = imgCrossOrigin; + } + }, [rotation, naturalWidth, naturalHeight, setEditedUrl, setRotation, setAspect, setPosition]); + return Object(external_wp_element_["useMemo"])(() => ({ + editedUrl, + setEditedUrl, + crop, + setCrop, + position, + setPosition, + zoom, + setZoom, + rotation, + setRotation, + rotateClockwise, + aspect, + setAspect, + defaultAspect, + initializeTransformValues + }), [editedUrl, setEditedUrl, crop, setCrop, position, setPosition, zoom, setZoom, rotation, setRotation, rotateClockwise, aspect, setAspect, defaultAspect, initializeTransformValues]); +} + +function useTransformImage(imageProperties, isEditing) { + const transformState = useTransformState(imageProperties); + const { + initializeTransformValues + } = transformState; + Object(external_wp_element_["useEffect"])(() => { + if (isEditing) { + initializeTransformValues(); + } + }, [isEditing, initializeTransformValues]); + return transformState; +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/context.js + + +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + + +const ImageEditingContext = Object(external_wp_element_["createContext"])({}); +const useImageEditingContext = () => Object(external_wp_element_["useContext"])(ImageEditingContext); +function ImageEditingProvider({ + id, + url, + naturalWidth, + naturalHeight, + isEditing, + onFinishEditing, + onSaveImage, + children +}) { + const transformImage = useTransformImage({ + url, + naturalWidth, + naturalHeight + }, isEditing); + const saveImage = useSaveImage({ + id, + url, + onSaveImage, + onFinishEditing, + ...transformImage + }); + const providerValue = Object(external_wp_element_["useMemo"])(() => ({ ...transformImage, + ...saveImage + }), [transformImage, saveImage]); + return Object(external_wp_element_["createElement"])(ImageEditingContext.Provider, { + value: providerValue + }, children); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/cropper.js + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +function ImageCropper({ + url, + width, + height, + clientWidth, + naturalHeight, + naturalWidth +}) { + const { + isInProgress, + editedUrl, + position, + zoom, + aspect, + setPosition, + setCrop, + setZoom, + rotation + } = useImageEditingContext(); + let editedHeight = height || clientWidth * naturalHeight / naturalWidth; + + if (rotation % 180 === 90) { + editedHeight = clientWidth * naturalWidth / naturalHeight; + } + + return Object(external_wp_element_["createElement"])("div", { className: classnames_default()('wp-block-image__crop-area', { - 'is-applying': inProgress + 'is-applying': isInProgress }), style: { - width: editedWidth, + width: width || clientWidth, height: editedHeight } - }, Object(external_this_wp_element_["createElement"])(index_module, { + }, Object(external_wp_element_["createElement"])(index_module, { image: editedUrl || url, - disabled: inProgress, - minZoom: image_editor_MIN_ZOOM / 100, - maxZoom: image_editor_MAX_ZOOM / 100, + disabled: isInProgress, + minZoom: constants_MIN_ZOOM / 100, + maxZoom: constants_MAX_ZOOM / 100, crop: position, zoom: zoom / 100, aspect: aspect, onCropChange: setPosition, - onCropComplete: function onCropComplete(newCropPercent) { + onCropComplete: newCropPercent => { setCrop(newCropPercent); }, - onZoomChange: function onZoomChange(newZoom) { + onZoomChange: newZoom => { setZoom(newZoom * 100); } - }), inProgress && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { + }), isInProgress && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)); +} + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js +var library_search = __webpack_require__("cGtP"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/zoom-dropdown.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function ZoomDropdown() { + const { + isInProgress, + zoom, + setZoom + } = useImageEditingContext(); + return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { contentClassName: "wp-block-image__zoom", - popoverProps: POPOVER_PROPS, - renderToggle: function renderToggle(_ref6) { - var isOpen = _ref6.isOpen, - onToggle = _ref6.onToggle; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - icon: search["a" /* default */], - label: Object(external_this_wp_i18n_["__"])('Zoom'), - onClick: onToggle, - "aria-expanded": isOpen, - disabled: inProgress - }); - }, - renderContent: function renderContent() { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - min: image_editor_MIN_ZOOM, - max: image_editor_MAX_ZOOM, - value: Math.round(zoom), - onChange: setZoom - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["__experimentalToolbarItem"], null, function (toggleProps) { - return Object(external_this_wp_element_["createElement"])(AspectMenu, { - toggleProps: toggleProps, - isDisabled: inProgress, - onClick: setAspect, - value: aspect, - defaultValue: naturalWidth / naturalHeight - }); - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + popoverProps: constants_POPOVER_PROPS, + renderToggle: ({ + isOpen, + onToggle + }) => Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: library_search["a" /* default */], + label: Object(external_wp_i18n_["__"])('Zoom'), + onClick: onToggle, + "aria-expanded": isOpen, + disabled: isInProgress + }), + renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Zoom'), + min: constants_MIN_ZOOM, + max: constants_MAX_ZOOM, + value: Math.round(zoom), + onChange: setZoom + }) + }); +} + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js +var check = __webpack_require__("RMJe"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/aspect-ratio.js + + +/** + * WordPress dependencies + */ + +const aspect_ratio_aspectRatio = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M18.5 5.5h-13c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2v-9c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5h-13c-.3 0-.5-.2-.5-.5v-9c0-.3.2-.5.5-.5h13c.3 0 .5.2.5.5v9zM6.5 12H8v-2h2V8.5H6.5V12zm9.5 2h-2v1.5h3.5V12H16v2z" +})); +/* harmony default export */ var aspect_ratio = (aspect_ratio_aspectRatio); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/aspect-ratio-dropdown.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + + + +function AspectGroup({ + aspectRatios, + isDisabled, + label, + onClick, + value +}) { + return Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { + label: label + }, aspectRatios.map(({ + title, + aspect + }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { + key: aspect, + disabled: isDisabled, + onClick: () => { + onClick(aspect); + }, + role: "menuitemradio", + isSelected: aspect === value, + icon: aspect === value ? check["a" /* default */] : undefined + }, title))); +} + +function AspectRatioDropdown({ + toggleProps +}) { + const { + isInProgress, + aspect, + setAspect, + defaultAspect + } = useImageEditingContext(); + return Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { + icon: aspect_ratio, + label: Object(external_wp_i18n_["__"])('Aspect Ratio'), + popoverProps: constants_POPOVER_PROPS, + toggleProps: toggleProps, + className: "wp-block-image__aspect-ratio" + }, ({ + onClose + }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(AspectGroup, { + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: Object(external_wp_i18n_["__"])('Original'), + aspect: defaultAspect + }, { + title: Object(external_wp_i18n_["__"])('Square'), + aspect: 1 + }] + }), Object(external_wp_element_["createElement"])(AspectGroup, { + label: Object(external_wp_i18n_["__"])('Landscape'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: Object(external_wp_i18n_["__"])('16:10'), + aspect: 16 / 10 + }, { + title: Object(external_wp_i18n_["__"])('16:9'), + aspect: 16 / 9 + }, { + title: Object(external_wp_i18n_["__"])('4:3'), + aspect: 4 / 3 + }, { + title: Object(external_wp_i18n_["__"])('3:2'), + aspect: 3 / 2 + }] + }), Object(external_wp_element_["createElement"])(AspectGroup, { + label: Object(external_wp_i18n_["__"])('Portrait'), + isDisabled: isInProgress, + onClick: newAspect => { + setAspect(newAspect); + onClose(); + }, + value: aspect, + aspectRatios: [{ + title: Object(external_wp_i18n_["__"])('10:16'), + aspect: 10 / 16 + }, { + title: Object(external_wp_i18n_["__"])('9:16'), + aspect: 9 / 16 + }, { + title: Object(external_wp_i18n_["__"])('3:4'), + aspect: 3 / 4 + }, { + title: Object(external_wp_i18n_["__"])('2:3'), + aspect: 2 / 3 + }] + }))); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rotate-right.js + + +/** + * WordPress dependencies + */ + +const rotateRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z" +})); +/* harmony default export */ var rotate_right = (rotateRight); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/rotation-button.js + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +function RotationButton() { + const { + isInProgress, + rotateClockwise + } = useImageEditingContext(); + return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { icon: rotate_right, - label: Object(external_this_wp_i18n_["__"])('Rotate'), - onClick: rotate, - disabled: inProgress - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + label: Object(external_wp_i18n_["__"])('Rotate'), + onClick: rotateClockwise, + disabled: isInProgress + }); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/form-controls.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function FormControls() { + const { + isInProgress, + apply, + cancel + } = useImageEditingContext(); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { onClick: apply, - disabled: inProgress - }, Object(external_this_wp_i18n_["__"])('Apply')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - onClick: function onClick() { - return setIsEditingImage(false); - } - }, Object(external_this_wp_i18n_["__"])('Cancel'))))); -} + disabled: isInProgress + }, Object(external_wp_i18n_["__"])('Apply')), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + onClick: cancel + }, Object(external_wp_i18n_["__"])('Cancel'))); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image-editing/index.js + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + + + + +function ImageEditor({ + url, + width, + height, + clientWidth, + naturalHeight, + naturalWidth +}) { + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(ImageCropper, { + url: url, + width: width, + height: height, + clientWidth: clientWidth, + naturalHeight: naturalHeight, + naturalWidth: naturalWidth + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(ZoomDropdown, null), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], null, toggleProps => Object(external_wp_element_["createElement"])(AspectRatioDropdown, { + toggleProps: toggleProps + })), Object(external_wp_element_["createElement"])(RotationButton, null)), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(FormControls, null)))); +} + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/constants.js -var MIN_SIZE = 20; -var LINK_DESTINATION_NONE = 'none'; -var LINK_DESTINATION_MEDIA = 'media'; -var LINK_DESTINATION_ATTACHMENT = 'attachment'; -var LINK_DESTINATION_CUSTOM = 'custom'; -var NEW_TAB_REL = ['noreferrer', 'noopener']; -var ALLOWED_MEDIA_TYPES = ['image']; -var DEFAULT_SIZE_SLUG = 'large'; +const MIN_SIZE = 20; +const LINK_DESTINATION_NONE = 'none'; +const LINK_DESTINATION_MEDIA = 'media'; +const LINK_DESTINATION_ATTACHMENT = 'attachment'; +const LINK_DESTINATION_CUSTOM = 'custom'; +const NEW_TAB_REL = ['noreferrer', 'noopener']; +const ALLOWED_MEDIA_TYPES = ['image']; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/image.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + @@ -5052,136 +4664,136 @@ function getFilename(url) { - var path = Object(external_this_wp_url_["getPath"])(url); + const path = Object(external_wp_url_["getPath"])(url); if (path) { - return Object(external_this_lodash_["last"])(path.split('/')); - } -} - -function Image(_ref) { - var _ref$attributes = _ref.attributes, - _ref$attributes$url = _ref$attributes.url, - url = _ref$attributes$url === void 0 ? '' : _ref$attributes$url, - alt = _ref$attributes.alt, - caption = _ref$attributes.caption, - align = _ref$attributes.align, - id = _ref$attributes.id, - href = _ref$attributes.href, - rel = _ref$attributes.rel, - linkClass = _ref$attributes.linkClass, - linkDestination = _ref$attributes.linkDestination, - title = _ref$attributes.title, - width = _ref$attributes.width, - height = _ref$attributes.height, - linkTarget = _ref$attributes.linkTarget, - sizeSlug = _ref$attributes.sizeSlug, - setAttributes = _ref.setAttributes, - isSelected = _ref.isSelected, - insertBlocksAfter = _ref.insertBlocksAfter, - onReplace = _ref.onReplace, - onSelectImage = _ref.onSelectImage, - onSelectURL = _ref.onSelectURL, - onUploadError = _ref.onUploadError, - containerRef = _ref.containerRef; - var image = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core'), - getMedia = _select.getMedia; - - return id && isSelected ? getMedia(id) : null; + return Object(external_lodash_["last"])(path.split('/')); + } +} + +function Image({ + temporaryURL, + attributes: { + url = '', + alt, + caption, + align, + id, + href, + rel, + linkClass, + linkDestination, + title, + width, + height, + linkTarget, + sizeSlug + }, + setAttributes, + isSelected, + insertBlocksAfter, + onReplace, + onSelectImage, + onSelectURL, + onUploadError, + containerRef, + clientId +}) { + const captionRef = Object(external_wp_element_["useRef"])(); + const prevUrl = Object(external_wp_compose_["usePrevious"])(url); + const { + getBlock + } = Object(external_wp_data_["useSelect"])(external_wp_blockEditor_["store"]); + const { + image, + multiImageSelection + } = Object(external_wp_data_["useSelect"])(select => { + const { + getMedia + } = select(external_wp_coreData_["store"]); + const { + getMultiSelectedBlockClientIds, + getBlockName + } = select(external_wp_blockEditor_["store"]); + const multiSelectedClientIds = getMultiSelectedBlockClientIds(); + return { + image: id && isSelected ? getMedia(id) : null, + multiImageSelection: multiSelectedClientIds.length && multiSelectedClientIds.every(_clientId => getBlockName(_clientId) === 'core/image') + }; }, [id, isSelected]); - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select2 = select('core/block-editor'), - getSettings = _select2.getSettings; - - return Object(external_this_lodash_["pick"])(getSettings(), ['imageEditing', 'imageSizes', 'isRTL', 'maxWidth', 'mediaUpload']); - }), - imageEditing = _useSelect.imageEditing, - imageSizes = _useSelect.imageSizes, - isRTL = _useSelect.isRTL, - maxWidth = _useSelect.maxWidth, - mediaUpload = _useSelect.mediaUpload; - - var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), - toggleSelection = _useDispatch.toggleSelection; - - var _useDispatch2 = Object(external_this_wp_data_["useDispatch"])('core/notices'), - createErrorNotice = _useDispatch2.createErrorNotice, - createSuccessNotice = _useDispatch2.createSuccessNotice; - - var isLargeViewport = Object(external_this_wp_compose_["useViewportMatch"])('medium'); - - var _useState = Object(external_this_wp_element_["useState"])(false), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - captionFocused = _useState2[0], - setCaptionFocused = _useState2[1]; - - var isWideAligned = Object(external_this_lodash_["includes"])(['wide', 'full'], align); - - var _useState3 = Object(external_this_wp_element_["useState"])({}), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - _useState4$ = _useState4[0], - naturalWidth = _useState4$.naturalWidth, - naturalHeight = _useState4$.naturalHeight, - setNaturalSize = _useState4[1]; - - var _useState5 = Object(external_this_wp_element_["useState"])(false), - _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), - isEditingImage = _useState6[0], - setIsEditingImage = _useState6[1]; - - var _useState7 = Object(external_this_wp_element_["useState"])(), - _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), - externalBlob = _useState8[0], - setExternalBlob = _useState8[1]; - - var clientWidth = useClientWidth(containerRef, [align]); - var isResizable = !isWideAligned && isLargeViewport; - var imageSizeOptions = Object(external_this_lodash_["map"])(Object(external_this_lodash_["filter"])(imageSizes, function (_ref2) { - var slug = _ref2.slug; - return Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', slug, 'source_url']); - }), function (_ref3) { - var name = _ref3.name, - slug = _ref3.slug; - return { - value: slug, - label: name - }; - }); - Object(external_this_wp_element_["useEffect"])(function () { - if (!isSelected) { - setCaptionFocused(false); - } - }, [isSelected]); // If an image is externally hosted, try to fetch the image data. This may + const { + imageEditing, + imageSizes, + maxWidth, + mediaUpload + } = Object(external_wp_data_["useSelect"])(select => { + const { + getSettings + } = select(external_wp_blockEditor_["store"]); + return Object(external_lodash_["pick"])(getSettings(), ['imageEditing', 'imageSizes', 'maxWidth', 'mediaUpload']); + }); + const { + replaceBlocks, + toggleSelection + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + const { + createErrorNotice, + createSuccessNotice + } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); + const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); + const isWideAligned = Object(external_lodash_["includes"])(['wide', 'full'], align); + const [{ + naturalWidth, + naturalHeight + }, setNaturalSize] = Object(external_wp_element_["useState"])({}); + const [isEditingImage, setIsEditingImage] = Object(external_wp_element_["useState"])(false); + const [externalBlob, setExternalBlob] = Object(external_wp_element_["useState"])(); + const clientWidth = useClientWidth(containerRef, [align]); + const isResizable = !isWideAligned && isLargeViewport; + const imageSizeOptions = Object(external_lodash_["map"])(Object(external_lodash_["filter"])(imageSizes, ({ + slug + }) => Object(external_lodash_["get"])(image, ['media_details', 'sizes', slug, 'source_url'])), ({ + name, + slug + }) => ({ + value: slug, + label: name + })); // Check if the cover block is registered. + + const coverBlockExists = !!Object(external_wp_blocks_["getBlockType"])('core/cover'); // If an image is externally hosted, try to fetch the image data. This may // fail if the image host doesn't allow CORS with the domain. If it works, // we can enable a button in the toolbar to upload the image. - Object(external_this_wp_element_["useEffect"])(function () { - if (!edit_isExternalImage(id, url) || !isSelected || externalBlob) { + Object(external_wp_element_["useEffect"])(() => { + if (!isExternalImage(id, url) || !isSelected || externalBlob) { return; } - window.fetch(url).then(function (response) { - return response.blob(); - }).then(function (blob) { - return setExternalBlob(blob); - }); - }, [id, url, isSelected, externalBlob]); + window.fetch(url).then(response => response.blob()).then(blob => setExternalBlob(blob)); + }, [id, url, isSelected, externalBlob]); // Focus the caption after inserting an image from the placeholder. This is + // done to preserve the behaviour of focussing the first tabbable element + // when a block is mounted. Previously, the image block would remount when + // the placeholder is removed. Maybe this behaviour could be removed. + + Object(external_wp_element_["useEffect"])(() => { + if (url && !prevUrl && isSelected) { + captionRef.current.focus(); + } + }, [url, prevUrl]); function onResizeStart() { toggleSelection(false); } - function _onResizeStop() { + function onResizeStop() { toggleSelection(true); } function onImageError() { // Check if there's an embed block that handles this URL. - var embedBlock = util_createUpgradedEmbedBlock({ + const embedBlock = createUpgradedEmbedBlock({ attributes: { - url: url + url } }); @@ -5202,18 +4814,6 @@ }); } - function onFocusCaption() { - if (!captionFocused) { - setCaptionFocused(true); - } - } - - function onImageClick() { - if (captionFocused) { - setCaptionFocused(false); - } - } - function updateAlt(newAlt) { setAttributes({ alt: newAlt @@ -5221,7 +4821,7 @@ } function updateImage(newSizeSlug) { - var newUrl = Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', newSizeSlug, 'source_url']); + const newUrl = Object(external_lodash_["get"])(image, ['media_details', 'sizes', newSizeSlug, 'source_url']); if (!newUrl) { return null; @@ -5238,56 +4838,82 @@ function uploadExternal() { mediaUpload({ filesList: [externalBlob], - onFileChange: function onFileChange(_ref4) { - var _ref5 = Object(slicedToArray["a" /* default */])(_ref4, 1), - img = _ref5[0]; - + + onFileChange([img]) { onSelectImage(img); - if (Object(external_this_wp_blob_["isBlobURL"])(img.url)) { + if (Object(external_wp_blob_["isBlobURL"])(img.url)) { return; } setExternalBlob(); - createSuccessNotice(Object(external_this_wp_i18n_["__"])('Image uploaded.'), { + createSuccessNotice(Object(external_wp_i18n_["__"])('Image uploaded.'), { type: 'snackbar' }); }, + allowedTypes: ALLOWED_MEDIA_TYPES, - onError: function onError(message) { + + onError(message) { createErrorNotice(message, { type: 'snackbar' }); } - }); - } - - Object(external_this_wp_element_["useEffect"])(function () { + + }); + } + + function updateAlignment(nextAlign) { + const extraUpdatedAttributes = ['wide', 'full'].includes(nextAlign) ? { + width: undefined, + height: undefined + } : {}; + setAttributes({ ...extraUpdatedAttributes, + align: nextAlign + }); + } + + Object(external_wp_element_["useEffect"])(() => { if (!isSelected) { setIsEditingImage(false); } }, [isSelected]); - var canEditImage = id && naturalWidth && naturalHeight && imageEditing; - var controls = Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, !isEditingImage && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalImageURLInputUI"], { + const canEditImage = id && naturalWidth && naturalHeight && imageEditing; + const allowCrop = !multiImageSelection && canEditImage && !isEditingImage; + + function switchToCover() { + replaceBlocks(clientId, Object(external_wp_blocks_["switchToBlockType"])(getBlock(clientId), 'core/cover')); + } + + const controls = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockAlignmentControl"], { + value: align, + onChange: updateAlignment + }), !multiImageSelection && !isEditingImage && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalImageURLInputUI"], { url: href || '', onChangeUrl: onSetHref, linkDestination: linkDestination, - mediaUrl: image && image.source_url, + mediaUrl: image && image.source_url || url, mediaLink: image && image.link, linkTarget: linkTarget, linkClass: linkClass, rel: rel - })), canEditImage && !isEditingImage && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - onClick: function onClick() { - return setIsEditingImage(true); - }, + }), allowCrop && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + onClick: () => setIsEditingImage(true), icon: library_crop, - label: Object(external_this_wp_i18n_["__"])('Crop') - })), externalBlob && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + label: Object(external_wp_i18n_["__"])('Crop') + }), externalBlob && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { onClick: uploadExternal, icon: upload["a" /* default */], - label: Object(external_this_wp_i18n_["__"])('Upload external image') - })), !isEditingImage && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaReplaceFlow"], { + label: Object(external_wp_i18n_["__"])('Upload external image') + }), !multiImageSelection && coverBlockExists && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: overlay_text, + label: Object(external_wp_i18n_["__"])('Add text over image'), + onClick: switchToCover + })), !multiImageSelection && !isEditingImage && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], { mediaId: id, mediaURL: url, allowedTypes: ALLOWED_MEDIA_TYPES, @@ -5295,20 +4921,18 @@ onSelect: onSelectImage, onSelectURL: onSelectURL, onError: onUploadError - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Image settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextareaControl"], { - label: Object(external_this_wp_i18n_["__"])('Alt text (alternative text)'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Image settings') + }, !multiImageSelection && Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], { + label: Object(external_wp_i18n_["__"])('Alt text (alternative text)'), value: alt, onChange: updateAlt, - help: Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { + help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { href: "https://www.w3.org/WAI/tutorials/images/decision-tree" - }, Object(external_this_wp_i18n_["__"])('Describe the purpose of the image')), Object(external_this_wp_i18n_["__"])('Leave empty if the image is purely decorative.')) - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalImageSizeControl"], { + }, Object(external_wp_i18n_["__"])('Describe the purpose of the image')), Object(external_wp_i18n_["__"])('Leave empty if the image is purely decorative.')) + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalImageSizeControl"], { onChangeImage: updateImage, - onChange: function onChange(value) { - return setAttributes(value); - }, + onChange: value => setAttributes(value), slug: sizeSlug, width: width, height: height, @@ -5316,81 +4940,73 @@ isResizable: isResizable, imageWidth: naturalWidth, imageHeight: naturalHeight - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorAdvancedControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { - label: Object(external_this_wp_i18n_["__"])('Title attribute'), + }))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorAdvancedControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + label: Object(external_wp_i18n_["__"])('Title attribute'), value: title || '', onChange: onSetTitle, - help: Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_i18n_["__"])('Describe the role of this image on the page.'), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { + help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('Describe the role of this image on the page.'), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { href: "https://www.w3.org/TR/html52/dom.html#the-title-attribute" - }, Object(external_this_wp_i18n_["__"])('(Note: many devices and browsers do not display this text.)'))) + }, Object(external_wp_i18n_["__"])('(Note: many devices and browsers do not display this text.)'))) }))); - var filename = getFilename(url); - var defaultedAlt; + const filename = getFilename(url); + let defaultedAlt; if (alt) { defaultedAlt = alt; } else if (filename) { - defaultedAlt = Object(external_this_wp_i18n_["sprintf"])( + defaultedAlt = Object(external_wp_i18n_["sprintf"])( /* translators: %s: file name */ - Object(external_this_wp_i18n_["__"])('This image has an empty alt attribute; its file name is %s'), filename); + Object(external_wp_i18n_["__"])('This image has an empty alt attribute; its file name is %s'), filename); } else { - defaultedAlt = Object(external_this_wp_i18n_["__"])('This image has an empty alt attribute'); - } - - var img = // Disable reason: Image itself is not meant to be interactive, but + defaultedAlt = Object(external_wp_i18n_["__"])('This image has an empty alt attribute'); + } + + let img = // Disable reason: Image itself is not meant to be interactive, but // should direct focus to block. /* eslint-disable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ - Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("img", { - src: url, + Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("img", { + src: temporaryURL || url, alt: defaultedAlt, - onClick: onImageClick, - onError: function onError() { - return onImageError(); - }, - onLoad: function onLoad(event) { - setNaturalSize(Object(external_this_lodash_["pick"])(event.target, ['naturalWidth', 'naturalHeight'])); - } - }), Object(external_this_wp_blob_["isBlobURL"])(url) && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)) + onError: () => onImageError(), + onLoad: event => { + setNaturalSize(Object(external_lodash_["pick"])(event.target, ['naturalWidth', 'naturalHeight'])); + } + }), temporaryURL && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)) /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ ; - var imageWidthWithinContainer; - var imageHeightWithinContainer; + let imageWidthWithinContainer; + let imageHeightWithinContainer; if (clientWidth && naturalWidth && naturalHeight) { - var exceedMaxWidth = naturalWidth > clientWidth; - var ratio = naturalHeight / naturalWidth; + const exceedMaxWidth = naturalWidth > clientWidth; + const ratio = naturalHeight / naturalWidth; imageWidthWithinContainer = exceedMaxWidth ? clientWidth : naturalWidth; imageHeightWithinContainer = exceedMaxWidth ? clientWidth * ratio : naturalHeight; } if (canEditImage && isEditingImage) { - img = Object(external_this_wp_element_["createElement"])(ImageEditor, { - id: id, + img = Object(external_wp_element_["createElement"])(ImageEditor, { url: url, - setAttributes: setAttributes, - naturalWidth: naturalWidth, - naturalHeight: naturalHeight, width: width, height: height, clientWidth: clientWidth, - setIsEditingImage: setIsEditingImage + naturalHeight: naturalHeight, + naturalWidth: naturalWidth }); } else if (!isResizable || !imageWidthWithinContainer) { - img = Object(external_this_wp_element_["createElement"])("div", { + img = Object(external_wp_element_["createElement"])("div", { style: { - width: width, - height: height + width, + height } }, img); } else { - var currentWidth = width || imageWidthWithinContainer; - var currentHeight = height || imageHeightWithinContainer; - - var _ratio = naturalWidth / naturalHeight; - - var minWidth = naturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * _ratio; - var minHeight = naturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / _ratio; // With the current implementation of ResizableBox, an image needs an + const currentWidth = width || imageWidthWithinContainer; + const currentHeight = height || imageHeightWithinContainer; + const ratio = naturalWidth / naturalHeight; + const minWidth = naturalWidth < naturalHeight ? MIN_SIZE : MIN_SIZE * ratio; + const minHeight = naturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio; // With the current implementation of ResizableBox, an image needs an // explicit pixel value for the max-width. In absence of being able to // set the content-width, this max-width is currently dictated by the // vanilla editor style. The following variable adds a buffer to this @@ -5400,9 +5016,9 @@ // @todo It would be good to revisit this once a content-width variable // becomes available. - var maxWidthBuffer = maxWidth * 2.5; - var showRightHandle = false; - var showLeftHandle = false; + const maxWidthBuffer = maxWidth * 2.5; + let showRightHandle = false; + let showLeftHandle = false; /* eslint-disable no-lonely-if */ // See https://github.com/WordPress/gutenberg/issues/7584. @@ -5410,7 +5026,7 @@ // When the image is centered, show both handles. showRightHandle = true; showLeftHandle = true; - } else if (isRTL) { + } else if (Object(external_wp_i18n_["isRTL"])()) { // In RTL mode the image is on the right by default. // Show the right handle and hide the left handle only when it is // aligned left. Otherwise always show the left handle. @@ -5431,16 +5047,16 @@ /* eslint-enable no-lonely-if */ - img = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResizableBox"], { + img = Object(external_wp_element_["createElement"])(external_wp_components_["ResizableBox"], { size: { - width: width, - height: height + width: width !== null && width !== void 0 ? width : 'auto', + height: height !== null && height !== void 0 ? height : 'auto' }, showHandle: isSelected, minWidth: minWidth, maxWidth: maxWidthBuffer, minHeight: minHeight, - maxHeight: maxWidthBuffer / _ratio, + maxHeight: maxWidthBuffer / ratio, lockAspectRatio: true, enable: { top: false, @@ -5449,9 +5065,8 @@ left: showLeftHandle }, onResizeStart: onResizeStart, - onResizeStop: function onResizeStop(event, direction, elt, delta) { - _onResizeStop(); - + onResizeStop: (event, direction, elt, delta) => { + onResizeStop(); setAttributes({ width: parseInt(currentWidth + delta.width, 10), height: parseInt(currentHeight + delta.height, 10) @@ -5460,48 +5075,49 @@ }, img); } - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, controls, img, (!external_this_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + return Object(external_wp_element_["createElement"])(ImageEditingProvider, { + id: id, + url: url, + naturalWidth: naturalWidth, + naturalHeight: naturalHeight, + clientWidth: clientWidth, + onSaveImage: imageAttributes => setAttributes(imageAttributes), + isEditing: isEditingImage, + onFinishEditing: () => setIsEditingImage(false) + }, !temporaryURL && controls, img, (!external_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + ref: captionRef, tagName: "figcaption", - placeholder: Object(external_this_wp_i18n_["__"])('Write caption…'), + "aria-label": Object(external_wp_i18n_["__"])('Image caption text'), + placeholder: Object(external_wp_i18n_["__"])('Add caption'), value: caption, - unstableOnFocus: onFocusCaption, - onChange: function onChange(value) { - return setAttributes({ - caption: value - }); - }, - isSelected: captionFocused, + onChange: value => setAttributes({ + caption: value + }), inlineToolbar: true, - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/edit.js - - -function image_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function image_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { image_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { image_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + +/* global wp */ /** * Internal dependencies @@ -5513,9 +5129,9 @@ */ -var edit_pickRelevantMediaFiles = function pickRelevantMediaFiles(image) { - var imageProps = Object(external_this_lodash_["pick"])(image, ['alt', 'id', 'link', 'caption']); - imageProps.url = Object(external_this_lodash_["get"])(image, ['sizes', 'large', 'url']) || Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', 'large', 'source_url']) || image.url; +const pickRelevantMediaFiles = (image, size) => { + const imageProps = Object(external_lodash_["pick"])(image, ['alt', 'id', 'link', 'caption']); + imageProps.url = Object(external_lodash_["get"])(image, ['sizes', size, 'url']) || Object(external_lodash_["get"])(image, ['media_details', 'sizes', size, 'source_url']) || image.url; return imageProps; }; /** @@ -5528,9 +5144,7 @@ * @return {boolean} Is the URL a Blob URL */ -var edit_isTemporaryImage = function isTemporaryImage(id, url) { - return !id && Object(external_this_wp_blob_["isBlobURL"])(url); -}; +const isTemporaryImage = (id, url) => !id && Object(external_wp_blob_["isBlobURL"])(url); /** * Is the url for the image hosted externally. An externally hosted image has no * id and is not a blob url. @@ -5542,35 +5156,61 @@ */ -var edit_isExternalImage = function isExternalImage(id, url) { - return url && !id && !Object(external_this_wp_blob_["isBlobURL"])(url); -}; -function ImageEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes, - isSelected = _ref.isSelected, - className = _ref.className, - noticeUI = _ref.noticeUI, - insertBlocksAfter = _ref.insertBlocksAfter, - noticeOperations = _ref.noticeOperations, - onReplace = _ref.onReplace; - var _attributes$url = attributes.url, - url = _attributes$url === void 0 ? '' : _attributes$url, - alt = attributes.alt, - caption = attributes.caption, - align = attributes.align, - id = attributes.id, - linkDestination = attributes.linkDestination, - width = attributes.width, - height = attributes.height, - sizeSlug = attributes.sizeSlug; - var ref = Object(external_this_wp_element_["useRef"])(); - var mediaUpload = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core/block-editor'), - getSettings = _select.getSettings; - - return getSettings().mediaUpload; - }); +const isExternalImage = (id, url) => url && !id && !Object(external_wp_blob_["isBlobURL"])(url); +/** + * Checks if WP generated default image size. Size generation is skipped + * when the image is smaller than the said size. + * + * @param {Object} image + * @param {string} defaultSize + * + * @return {boolean} Whether or not it has default image size. + */ + +function hasDefaultSize(image, defaultSize) { + return Object(external_lodash_["has"])(image, ['sizes', defaultSize, 'url']) || Object(external_lodash_["has"])(image, ['media_details', 'sizes', defaultSize, 'source_url']); +} + +function ImageEdit({ + attributes, + setAttributes, + isSelected, + className, + noticeUI, + insertBlocksAfter, + noticeOperations, + onReplace, + clientId +}) { + const { + url = '', + alt, + caption, + align, + id, + width, + height, + sizeSlug + } = attributes; + const [temporaryURL, setTemporaryURL] = Object(external_wp_element_["useState"])(); + const altRef = Object(external_wp_element_["useRef"])(); + Object(external_wp_element_["useEffect"])(() => { + altRef.current = alt; + }, [alt]); + const captionRef = Object(external_wp_element_["useRef"])(); + Object(external_wp_element_["useEffect"])(() => { + captionRef.current = caption; + }, [caption]); + const ref = Object(external_wp_element_["useRef"])(); + const { + imageDefaultSize, + mediaUpload + } = Object(external_wp_data_["useSelect"])(select => { + const { + getSettings + } = select(external_wp_blockEditor_["store"]); + return Object(external_lodash_["pick"])(getSettings(), ['imageDefaultSize', 'mediaUpload']); + }, []); function onUploadError(message) { noticeOperations.removeAllNotices(); @@ -5578,6 +5218,8 @@ } function onSelectImage(media) { + var _wp, _wp$media, _wp$media$view, _wp$media$view$settin, _wp$media$view$settin2; + if (!media || !media.url) { setAttributes({ url: undefined, @@ -5589,50 +5231,83 @@ return; } - var mediaAttributes = edit_pickRelevantMediaFiles(media); // If the current image is temporary but an alt text was meanwhile - // written by the user, make sure the text is not overwritten. - - if (edit_isTemporaryImage(id, url)) { - if (alt) { - mediaAttributes = Object(external_this_lodash_["omit"])(mediaAttributes, ['alt']); - } - } // If a caption text was meanwhile written by the user, + if (Object(external_wp_blob_["isBlobURL"])(media.url)) { + setTemporaryURL(media.url); + return; + } + + setTemporaryURL(); + let mediaAttributes = pickRelevantMediaFiles(media, imageDefaultSize); // If a caption text was meanwhile written by the user, // make sure the text is not overwritten by empty captions. - - if (caption && !Object(external_this_lodash_["get"])(mediaAttributes, ['caption'])) { - mediaAttributes = Object(external_this_lodash_["omit"])(mediaAttributes, ['caption']); - } - - var additionalAttributes; // Reset the dimension attributes if changing to a different image. + if (captionRef.current && !Object(external_lodash_["get"])(mediaAttributes, ['caption'])) { + mediaAttributes = Object(external_lodash_["omit"])(mediaAttributes, ['caption']); + } + + let additionalAttributes; // Reset the dimension attributes if changing to a different image. if (!media.id || media.id !== id) { additionalAttributes = { width: undefined, height: undefined, - sizeSlug: DEFAULT_SIZE_SLUG + // Fallback to size "full" if there's no default image size. + // It means the image is smaller, and the block will use a full-size URL. + sizeSlug: hasDefaultSize(media, imageDefaultSize) ? imageDefaultSize : 'full' }; } else { // Keep the same url when selecting the same file, so "Image Size" // option is not changed. additionalAttributes = { - url: url - }; + url + }; + } // Check if default link setting should be used. + + + let linkDestination = attributes.linkDestination; + + if (!linkDestination) { + // Use the WordPress option to determine the proper default. + // The constants used in Gutenberg do not match WP options so a little more complicated than ideal. + // TODO: fix this in a follow up PR, requires updating media-text and ui component. + switch (((_wp = wp) === null || _wp === void 0 ? void 0 : (_wp$media = _wp.media) === null || _wp$media === void 0 ? void 0 : (_wp$media$view = _wp$media.view) === null || _wp$media$view === void 0 ? void 0 : (_wp$media$view$settin = _wp$media$view.settings) === null || _wp$media$view$settin === void 0 ? void 0 : (_wp$media$view$settin2 = _wp$media$view$settin.defaultProps) === null || _wp$media$view$settin2 === void 0 ? void 0 : _wp$media$view$settin2.link) || LINK_DESTINATION_NONE) { + case 'file': + case LINK_DESTINATION_MEDIA: + linkDestination = LINK_DESTINATION_MEDIA; + break; + + case 'post': + case LINK_DESTINATION_ATTACHMENT: + linkDestination = LINK_DESTINATION_ATTACHMENT; + break; + + case LINK_DESTINATION_CUSTOM: + linkDestination = LINK_DESTINATION_CUSTOM; + break; + + case LINK_DESTINATION_NONE: + linkDestination = LINK_DESTINATION_NONE; + break; + } } // Check if the image is linked to it's media. - if (linkDestination === LINK_DESTINATION_MEDIA) { - // Update the media link. - mediaAttributes.href = media.url; - } // Check if the image is linked to the attachment page. - - - if (linkDestination === LINK_DESTINATION_ATTACHMENT) { - // Update the media link. - mediaAttributes.href = media.link; - } - - setAttributes(image_edit_objectSpread({}, mediaAttributes, {}, additionalAttributes)); + let href; + + switch (linkDestination) { + case LINK_DESTINATION_MEDIA: + href = media.url; + break; + + case LINK_DESTINATION_ATTACHMENT: + href = media.link; + break; + } + + mediaAttributes.href = href; + setAttributes({ ...mediaAttributes, + ...additionalAttributes, + linkDestination + }); } function onSelectURL(newURL) { @@ -5640,71 +5315,97 @@ setAttributes({ url: newURL, id: undefined, - sizeSlug: DEFAULT_SIZE_SLUG + width: undefined, + height: undefined, + sizeSlug: imageDefaultSize }); } } function updateAlignment(nextAlign) { - var extraUpdatedAttributes = ['wide', 'full'].includes(nextAlign) ? { + const extraUpdatedAttributes = ['wide', 'full'].includes(nextAlign) ? { width: undefined, height: undefined } : {}; - setAttributes(image_edit_objectSpread({}, extraUpdatedAttributes, { + setAttributes({ ...extraUpdatedAttributes, align: nextAlign - })); - } - - var isTemp = edit_isTemporaryImage(id, url); // Upload a temporary image on mount. - - Object(external_this_wp_element_["useEffect"])(function () { + }); + } + + const isTemp = isTemporaryImage(id, url); // Upload a temporary image on mount. + + Object(external_wp_element_["useEffect"])(() => { if (!isTemp) { return; } - var file = Object(external_this_wp_blob_["getBlobByURL"])(url); + const file = Object(external_wp_blob_["getBlobByURL"])(url); if (file) { mediaUpload({ filesList: [file], - onFileChange: function onFileChange(_ref2) { - var _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 1), - img = _ref3[0]; - + onFileChange: ([img]) => { onSelectImage(img); }, allowedTypes: ALLOWED_MEDIA_TYPES, - onError: function onError(message) { + onError: message => { noticeOperations.createErrorNotice(message); + setAttributes({ + src: undefined, + id: undefined, + url: undefined + }); } }); } }, []); // If an image is temporary, revoke the Blob url when it is uploaded (and is // no longer temporary). - Object(external_this_wp_element_["useEffect"])(function () { - if (!isTemp) { + Object(external_wp_element_["useEffect"])(() => { + if (!temporaryURL) { return; } - return function () { - Object(external_this_wp_blob_["revokeBlobURL"])(url); - }; - }, [isTemp]); - var isExternal = edit_isExternalImage(id, url); - var controls = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockAlignmentToolbar"], { + return () => { + Object(external_wp_blob_["revokeBlobURL"])(temporaryURL); + }; + }, [temporaryURL]); + const isExternal = isExternalImage(id, url); + const src = isExternal ? url : undefined; + const mediaPreview = !!url && Object(external_wp_element_["createElement"])("img", { + alt: Object(external_wp_i18n_["__"])('Edit image'), + title: Object(external_wp_i18n_["__"])('Edit image'), + className: 'edit-image-preview', + src: url + }); + const classes = classnames_default()(className, { + 'is-transient': temporaryURL, + 'is-resized': !!width || !!height, + [`size-${sizeSlug}`]: sizeSlug + }); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + ref, + className: classes + }); + return Object(external_wp_element_["createElement"])("figure", blockProps, (temporaryURL || url) && Object(external_wp_element_["createElement"])(Image, { + temporaryURL: temporaryURL, + attributes: attributes, + setAttributes: setAttributes, + isSelected: isSelected, + insertBlocksAfter: insertBlocksAfter, + onReplace: onReplace, + onSelectImage: onSelectImage, + onSelectURL: onSelectURL, + onUploadError: onUploadError, + containerRef: ref, + clientId: clientId + }), !url && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockAlignmentControl"], { value: align, onChange: updateAlignment - })); - var src = isExternal ? url : undefined; - var mediaPreview = !!url && Object(external_this_wp_element_["createElement"])("img", { - alt: Object(external_this_wp_i18n_["__"])('Edit image'), - title: Object(external_this_wp_i18n_["__"])('Edit image'), - className: 'edit-image-preview', - src: url - }); - var mediaPlaceholder = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { icon: library_image }), onSelect: onSelectImage, @@ -5714,120 +5415,95 @@ accept: "image/*", allowedTypes: ALLOWED_MEDIA_TYPES, value: { - id: id, - src: src + id, + src }, mediaPreview: mediaPreview, - disableMediaButtons: url - }); - var classes = classnames_default()(className, Object(defineProperty["a" /* default */])({ - 'is-transient': Object(external_this_wp_blob_["isBlobURL"])(url), - 'is-resized': !!width || !!height, - 'is-focused': isSelected - }, "size-".concat(sizeSlug), sizeSlug)); // Focussing the image caption after inserting an image relies on the - // component remounting. This needs to be fixed. - - var key = !!url; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, controls, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].figure, { - ref: ref, - className: classes, - key: key - }, url && Object(external_this_wp_element_["createElement"])(Image, { - attributes: attributes, - setAttributes: setAttributes, - isSelected: isSelected, - insertBlocksAfter: insertBlocksAfter, - onReplace: onReplace, - onSelectImage: onSelectImage, - onSelectURL: onSelectURL, - onUploadError: onUploadError, - containerRef: ref - }), mediaPlaceholder)); -} -/* harmony default export */ var image_edit = (Object(external_this_wp_components_["withNotices"])(ImageEdit)); + disableMediaButtons: temporaryURL || url + })); +} +/* harmony default export */ var image_edit = (Object(external_wp_components_["withNotices"])(ImageEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/save.js - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -function image_save_save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var url = attributes.url, - alt = attributes.alt, - caption = attributes.caption, - align = attributes.align, - href = attributes.href, - rel = attributes.rel, - linkClass = attributes.linkClass, - width = attributes.width, - height = attributes.height, - id = attributes.id, - linkTarget = attributes.linkTarget, - sizeSlug = attributes.sizeSlug, - title = attributes.title; - var newRel = Object(external_this_lodash_["isEmpty"])(rel) ? undefined : rel; - var classes = classnames_default()((_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, "align".concat(align), align), Object(defineProperty["a" /* default */])(_classnames, "size-".concat(sizeSlug), sizeSlug), Object(defineProperty["a" /* default */])(_classnames, 'is-resized', width || height), _classnames)); - var image = Object(external_this_wp_element_["createElement"])("img", { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +function save_save({ + attributes +}) { + const { + url, + alt, + caption, + align, + href, + rel, + linkClass, + width, + height, + id, + linkTarget, + sizeSlug, + title + } = attributes; + const newRel = Object(external_lodash_["isEmpty"])(rel) ? undefined : rel; + const classes = classnames_default()({ + [`align${align}`]: align, + [`size-${sizeSlug}`]: sizeSlug, + 'is-resized': width || height + }); + const image = Object(external_wp_element_["createElement"])("img", { src: url, alt: alt, - className: id ? "wp-image-".concat(id) : null, + className: id ? `wp-image-${id}` : null, width: width, height: height, title: title }); - var figure = Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, href ? Object(external_this_wp_element_["createElement"])("a", { + const figure = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, href ? Object(external_wp_element_["createElement"])("a", { className: linkClass, href: href, target: linkTarget, rel: newRel - }, image) : image, !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, image) : image, !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); if ('left' === align || 'right' === align || 'center' === align) { - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save(), Object(external_wp_element_["createElement"])("figure", { className: classes }, figure)); } - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", external_wp_blockEditor_["useBlockProps"].save({ className: classes - }, figure); + }), figure); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/transforms.js - - -function transforms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function transforms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { transforms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { transforms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -function stripFirstImage(attributes, _ref) { - var shortcode = _ref.shortcode; - - var _document$implementat = document.implementation.createHTMLDocument(''), - body = _document$implementat.body; - +/** + * WordPress dependencies + */ + + +function stripFirstImage(attributes, { + shortcode +}) { + const { + body + } = document.implementation.createHTMLDocument(''); body.innerHTML = shortcode.content; - var nodeToRemove = body.querySelector('img'); // if an image has parents, find the topmost node to remove + let nodeToRemove = body.querySelector('img'); // if an image has parents, find the topmost node to remove while (nodeToRemove && nodeToRemove.parentNode && nodeToRemove.parentNode !== body) { nodeToRemove = nodeToRemove.parentNode; @@ -5841,88 +5517,90 @@ } function getFirstAnchorAttributeFormHTML(html, attributeName) { - var _document$implementat2 = document.implementation.createHTMLDocument(''), - body = _document$implementat2.body; - + const { + body + } = document.implementation.createHTMLDocument(''); body.innerHTML = html; - var firstElementChild = body.firstElementChild; + const { + firstElementChild + } = body; if (firstElementChild && firstElementChild.nodeName === 'A') { return firstElementChild.getAttribute(attributeName) || undefined; } } -var imageSchema = { +const imageSchema = { img: { attributes: ['src', 'alt', 'title'], classes: ['alignleft', 'aligncenter', 'alignright', 'alignnone', /^wp-image-\d+$/] } }; -var schema = function schema(_ref2) { - var phrasingContentSchema = _ref2.phrasingContentSchema; - return { - figure: { - require: ['img'], - children: transforms_objectSpread({}, imageSchema, { - a: { - attributes: ['href', 'rel', 'target'], - children: imageSchema - }, - figcaption: { - children: phrasingContentSchema - } - }) - } - }; -}; - -var image_transforms_transforms = { +const schema = ({ + phrasingContentSchema +}) => ({ + figure: { + require: ['img'], + children: { ...imageSchema, + a: { + attributes: ['href', 'rel', 'target'], + children: imageSchema + }, + figcaption: { + children: phrasingContentSchema + } + } + } +}); + +const transforms_transforms = { from: [{ type: 'raw', - isMatch: function isMatch(node) { - return node.nodeName === 'FIGURE' && !!node.querySelector('img'); - }, - schema: schema, - transform: function transform(node) { + isMatch: node => node.nodeName === 'FIGURE' && !!node.querySelector('img'), + schema, + transform: node => { // Search both figure and image classes. Alignment could be // set on either. ID is set on the image. - var className = node.className + ' ' + node.querySelector('img').className; - var alignMatches = /(?:^|\s)align(left|center|right)(?:$|\s)/.exec(className); - var anchor = node.id === '' ? undefined : node.id; - var align = alignMatches ? alignMatches[1] : undefined; - var idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(className); - var id = idMatches ? Number(idMatches[1]) : undefined; - var anchorElement = node.querySelector('a'); - var linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined; - var href = anchorElement && anchorElement.href ? anchorElement.href : undefined; - var rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined; - var linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined; - var attributes = Object(external_this_wp_blocks_["getBlockAttributes"])('core/image', node.outerHTML, { - align: align, - id: id, - linkDestination: linkDestination, - href: href, - rel: rel, - linkClass: linkClass, - anchor: anchor - }); - return Object(external_this_wp_blocks_["createBlock"])('core/image', attributes); + const className = node.className + ' ' + node.querySelector('img').className; + const alignMatches = /(?:^|\s)align(left|center|right)(?:$|\s)/.exec(className); + const anchor = node.id === '' ? undefined : node.id; + const align = alignMatches ? alignMatches[1] : undefined; + const idMatches = /(?:^|\s)wp-image-(\d+)(?:$|\s)/.exec(className); + const id = idMatches ? Number(idMatches[1]) : undefined; + const anchorElement = node.querySelector('a'); + const linkDestination = anchorElement && anchorElement.href ? 'custom' : undefined; + const href = anchorElement && anchorElement.href ? anchorElement.href : undefined; + const rel = anchorElement && anchorElement.rel ? anchorElement.rel : undefined; + const linkClass = anchorElement && anchorElement.className ? anchorElement.className : undefined; + const attributes = Object(external_wp_blocks_["getBlockAttributes"])('core/image', node.outerHTML, { + align, + id, + linkDestination, + href, + rel, + linkClass, + anchor + }); + return Object(external_wp_blocks_["createBlock"])('core/image', attributes); } }, { type: 'files', - isMatch: function isMatch(files) { + + isMatch(files) { return files.length === 1 && files[0].type.indexOf('image/') === 0; }, - transform: function transform(files) { - var file = files[0]; // We don't need to upload the media directly here + + transform(files) { + const file = files[0]; // We don't need to upload the media directly here // It's already done as part of the `componentDidMount` // int the image block - return Object(external_this_wp_blocks_["createBlock"])('core/image', { - url: Object(external_this_wp_blob_["createBlobURL"])(file) - }); - } + return Object(external_wp_blocks_["createBlock"])('core/image', { + url: Object(external_wp_blob_["createBlobURL"])(file) + }); + } + }, { type: 'shortcode', tag: 'caption', @@ -5943,28 +5621,33 @@ shortcode: stripFirstImage }, href: { - shortcode: function shortcode(attributes, _ref3) { - var _shortcode = _ref3.shortcode; - return getFirstAnchorAttributeFormHTML(_shortcode.content, 'href'); + shortcode: (attributes, { + shortcode + }) => { + return getFirstAnchorAttributeFormHTML(shortcode.content, 'href'); } }, rel: { - shortcode: function shortcode(attributes, _ref4) { - var _shortcode2 = _ref4.shortcode; - return getFirstAnchorAttributeFormHTML(_shortcode2.content, 'rel'); + shortcode: (attributes, { + shortcode + }) => { + return getFirstAnchorAttributeFormHTML(shortcode.content, 'rel'); } }, linkClass: { - shortcode: function shortcode(attributes, _ref5) { - var _shortcode3 = _ref5.shortcode; - return getFirstAnchorAttributeFormHTML(_shortcode3.content, 'class'); + shortcode: (attributes, { + shortcode + }) => { + return getFirstAnchorAttributeFormHTML(shortcode.content, 'class'); } }, id: { type: 'number', - shortcode: function shortcode(_ref6) { - var id = _ref6.named.id; - + shortcode: ({ + named: { + id + } + }) => { if (!id) { return; } @@ -5974,16 +5657,18 @@ }, align: { type: 'string', - shortcode: function shortcode(_ref7) { - var _ref7$named$align = _ref7.named.align, - align = _ref7$named$align === void 0 ? 'alignnone' : _ref7$named$align; + shortcode: ({ + named: { + align = 'alignnone' + } + }) => { return align.replace('align', ''); } } } }] }; -/* harmony default export */ var image_transforms = (image_transforms_transforms); +/* harmony default export */ var image_transforms = (transforms_transforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/index.js /** @@ -5997,9 +5682,14 @@ -var image_metadata = { +const image_metadata = { + apiVersion: 2, name: "core/image", + title: "Image", category: "media", + description: "Insert an image to make a visual statement.", + keywords: ["img", "photo", "picture"], + textdomain: "default", attributes: { align: { type: "string" @@ -6059,8 +5749,7 @@ type: "string" }, linkDestination: { - type: "string", - "default": "none" + type: "string" }, linkTarget: { type: "string", @@ -6071,45 +5760,55 @@ }, supports: { anchor: true, - lightBlockWrapper: true - } -}; - - -var image_name = image_metadata.name; - -var image_settings = { - title: Object(external_this_wp_i18n_["__"])('Image'), - description: Object(external_this_wp_i18n_["__"])('Insert an image to make a visual statement.'), + color: { + __experimentalDuotone: "img", + text: false, + background: false + }, + __experimentalBorder: { + radius: true + } + }, + styles: [{ + name: "default", + label: "Default", + isDefault: true + }, { + name: "rounded", + label: "Rounded" + }], + editorStyle: "wp-block-image-editor", + style: "wp-block-image" +}; + + +const { + name: image_name +} = image_metadata; + +const image_settings = { icon: library_image, - keywords: ['img', // "img" is not translated as it is intended to reflect the HTML tag. - Object(external_this_wp_i18n_["__"])('photo')], example: { attributes: { sizeSlug: 'large', url: 'https://s.w.org/images/core/5.3/MtBlanc1.jpg', // translators: Caption accompanying an image of the Mont Blanc, which serves as an example for the Image block. - caption: Object(external_this_wp_i18n_["__"])('Mont Blanc appears—still, snowy, and serene.') - } - }, - styles: [{ - name: 'default', - label: Object(external_this_wp_i18n_["_x"])('Default', 'block style'), - isDefault: true - }, { - name: 'rounded', - label: Object(external_this_wp_i18n_["_x"])('Rounded', 'block style') - }], - __experimentalLabel: function __experimentalLabel(attributes, _ref) { - var context = _ref.context; - + caption: Object(external_wp_i18n_["__"])('Mont Blanc appears—still, snowy, and serene.') + } + }, + + __experimentalLabel(attributes, { + context + }) { if (context === 'accessibility') { - var caption = attributes.caption, - alt = attributes.alt, - url = attributes.url; + const { + caption, + alt, + url + } = attributes; if (!url) { - return Object(external_this_wp_i18n_["__"])('Empty'); + return Object(external_wp_i18n_["__"])('Empty'); } if (!alt) { @@ -6121,14 +5820,16 @@ return alt + (caption ? '. ' + caption : ''); } }, - getEditWrapperProps: function getEditWrapperProps(attributes) { + + getEditWrapperProps(attributes) { return { 'data-align': attributes.align }; }, + transforms: image_transforms, edit: image_edit, - save: image_save_save, + save: save_save, deprecated: image_deprecated }; @@ -6139,10 +5840,10 @@ * WordPress dependencies */ -var heading = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const heading = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M6.2 5.2v13.4l5.8-4.8 5.8 4.8V5.2z" })); /* harmony default export */ var library_heading = (heading); @@ -6150,26 +5851,21 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/deprecated.js - -function deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -var blockSupports = { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +const blockSupports = { className: false, anchor: true }; -var heading_deprecated_blockAttributes = { +const heading_deprecated_blockAttributes = { align: { type: 'string' }, @@ -6188,45 +5884,108 @@ } }; -var deprecated_migrateCustomColors = function migrateCustomColors(attributes) { +const migrateCustomColors = attributes => { if (!attributes.customTextColor) { return attributes; } - var style = { + const style = { color: { text: attributes.customTextColor } }; - return deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customTextColor']), { - style: style - }); -}; - -var heading_deprecated_deprecated = [{ + return { ...Object(external_lodash_["omit"])(attributes, ['customTextColor']), + style + }; +}; + +const TEXT_ALIGN_OPTIONS = ['left', 'right', 'center']; + +const migrateTextAlign = attributes => { + const { + align, + ...rest + } = attributes; + return TEXT_ALIGN_OPTIONS.includes(align) ? { ...rest, + textAlign: align + } : attributes; +}; + +const heading_deprecated_deprecated = [{ + supports: { + align: ['wide', 'full'], + anchor: true, + className: false, + color: { + link: true + }, + fontSize: true, + lineHeight: true, + __experimentalSelector: { + 'core/heading/h1': 'h1', + 'core/heading/h2': 'h2', + 'core/heading/h3': 'h3', + 'core/heading/h4': 'h4', + 'core/heading/h5': 'h5', + 'core/heading/h6': 'h6' + }, + __unstablePasteTextInline: true + }, + attributes: heading_deprecated_blockAttributes, + isEligible: ({ + align + }) => TEXT_ALIGN_OPTIONS.includes(align), + migrate: migrateTextAlign, + + save({ + attributes + }) { + const { + align, + content, + level + } = attributes; + const TagName = 'h' + level; + const className = classnames_default()({ + [`has-text-align-${align}`]: align + }); + return Object(external_wp_element_["createElement"])(TagName, external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + value: content + })); + } + +}, { supports: blockSupports, - attributes: deprecated_objectSpread({}, heading_deprecated_blockAttributes, { + attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } - }), - migrate: deprecated_migrateCustomColors, - save: function save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var align = attributes.align, - content = attributes.content, - customTextColor = attributes.customTextColor, - level = attributes.level, - textColor = attributes.textColor; - var tagName = 'h' + level; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()((_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames, 'has-text-color', textColor || customTextColor), Object(defineProperty["a" /* default */])(_classnames, "has-text-align-".concat(align), align), _classnames)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, + migrate: attributes => migrateCustomColors(migrateTextAlign(attributes)), + + save({ + attributes + }) { + const { + align, + content, + customTextColor, + level, + textColor + } = attributes; + const tagName = 'h' + level; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()({ + [textClass]: textClass, + 'has-text-color': textColor || customTextColor, + [`has-text-align-${align}`]: align + }); + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { className: className ? className : undefined, tagName: tagName, style: { @@ -6235,29 +5994,35 @@ value: content }); } -}, { - attributes: deprecated_objectSpread({}, heading_deprecated_blockAttributes, { + +}, { + attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } - }), - migrate: deprecated_migrateCustomColors, - save: function save(_ref2) { - var _classnames2; - - var attributes = _ref2.attributes; - var align = attributes.align, - content = attributes.content, - customTextColor = attributes.customTextColor, - level = attributes.level, - textColor = attributes.textColor; - var tagName = 'h' + level; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()((_classnames2 = {}, Object(defineProperty["a" /* default */])(_classnames2, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames2, "has-text-align-".concat(align), align), _classnames2)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, + migrate: attributes => migrateCustomColors(migrateTextAlign(attributes)), + + save({ + attributes + }) { + const { + align, + content, + customTextColor, + level, + textColor + } = attributes; + const tagName = 'h' + level; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()({ + [textClass]: textClass, + [`has-text-align-${align}`]: align + }); + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { className: className ? className : undefined, tagName: tagName, style: { @@ -6266,29 +6031,36 @@ value: content }); }, + supports: blockSupports }, { supports: blockSupports, - attributes: deprecated_objectSpread({}, heading_deprecated_blockAttributes, { + attributes: { ...heading_deprecated_blockAttributes, customTextColor: { type: 'string' }, textColor: { type: 'string' } - }), - migrate: deprecated_migrateCustomColors, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var align = attributes.align, - level = attributes.level, - content = attributes.content, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor; - var tagName = 'h' + level; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()(Object(defineProperty["a" /* default */])({}, textClass, textClass)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, + migrate: attributes => migrateCustomColors(migrateTextAlign(attributes)), + + save({ + attributes + }) { + const { + align, + level, + content, + textColor, + customTextColor + } = attributes; + const tagName = 'h' + level; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()({ + [textClass]: textClass + }); + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { className: className ? className : undefined, tagName: tagName, style: { @@ -6298,11 +6070,12 @@ value: content }); } + }]; /* harmony default export */ var heading_deprecated = (heading_deprecated_deprecated); -// EXTERNAL MODULE: external {"this":["wp","keycodes"]} -var external_this_wp_keycodes_ = __webpack_require__(21); +// EXTERNAL MODULE: external ["wp","keycodes"] +var external_wp_keycodes_ = __webpack_require__("RxS6"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/heading-level-icon.js @@ -6330,11 +6103,11 @@ * @return {?WPComponent} The icon. */ -function HeadingLevelIcon(_ref) { - var level = _ref.level, - _ref$isPressed = _ref.isPressed, - isPressed = _ref$isPressed === void 0 ? false : _ref$isPressed; - var levelToPath = { +function HeadingLevelIcon({ + level, + isPressed = false +}) { + const levelToPath = { 1: 'M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z', 2: 'M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z', 3: 'M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z', @@ -6347,13 +6120,13 @@ return null; } - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { + return Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "24", height: "24", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", isPressed: isPressed - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: levelToPath[level] })); } @@ -6372,8 +6145,8 @@ */ -var HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; -var heading_level_dropdown_POPOVER_PROPS = { +const HEADING_LEVELS = [1, 2, 3, 4, 5, 6]; +const heading_level_dropdown_POPOVER_PROPS = { className: 'block-library-heading-level-dropdown', isAlternate: true }; @@ -6397,58 +6170,59 @@ * @return {WPComponent} The toolbar. */ -function HeadingLevelDropdown(_ref) { - var selectedLevel = _ref.selectedLevel, - onChange = _ref.onChange; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Dropdown"], { +function HeadingLevelDropdown({ + selectedLevel, + onChange +}) { + return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], { popoverProps: heading_level_dropdown_POPOVER_PROPS, - renderToggle: function renderToggle(_ref2) { - var onToggle = _ref2.onToggle, - isOpen = _ref2.isOpen; - - var openOnArrowDown = function openOnArrowDown(event) { - if (!isOpen && event.keyCode === external_this_wp_keycodes_["DOWN"]) { + renderToggle: ({ + onToggle, + isOpen + }) => { + const openOnArrowDown = event => { + if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) { event.preventDefault(); event.stopPropagation(); onToggle(); } }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { "aria-expanded": isOpen, "aria-haspopup": "true", - icon: Object(external_this_wp_element_["createElement"])(HeadingLevelIcon, { + icon: Object(external_wp_element_["createElement"])(HeadingLevelIcon, { level: selectedLevel }), - label: Object(external_this_wp_i18n_["__"])('Change heading level'), + label: Object(external_wp_i18n_["__"])('Change heading level'), onClick: onToggle, onKeyDown: openOnArrowDown, showTooltip: true }); }, - renderContent: function renderContent() { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Toolbar"], { - className: "block-library-heading-level-toolbar", - __experimentalAccessibilityLabel: Object(external_this_wp_i18n_["__"])('Change heading level') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { - isCollapsed: false, - controls: HEADING_LEVELS.map(function (targetLevel) { - var isActive = targetLevel === selectedLevel; - return { - icon: Object(external_this_wp_element_["createElement"])(HeadingLevelIcon, { - level: targetLevel, - isPressed: isActive - }), - title: Object(external_this_wp_i18n_["sprintf"])( // translators: %s: heading level e.g: "1", "2", "3" - Object(external_this_wp_i18n_["__"])('Heading %d'), targetLevel), - isActive: isActive, - onClick: function onClick() { - onChange(targetLevel); - } - }; - }) - })); - } + renderContent: () => Object(external_wp_element_["createElement"])(external_wp_components_["Toolbar"], { + className: "block-library-heading-level-toolbar", + label: Object(external_wp_i18n_["__"])('Change heading level') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { + isCollapsed: false, + controls: HEADING_LEVELS.map(targetLevel => { + const isActive = targetLevel === selectedLevel; + return { + icon: Object(external_wp_element_["createElement"])(HeadingLevelIcon, { + level: targetLevel, + isPressed: isActive + }), + title: Object(external_wp_i18n_["sprintf"])( // translators: %s: heading level e.g: "1", "2", "3" + Object(external_wp_i18n_["__"])('Heading %d'), targetLevel), + isActive, + + onClick() { + onChange(targetLevel); + } + + }; + }) + })) }); } @@ -6456,81 +6230,89 @@ -function heading_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function heading_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { heading_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { heading_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -function HeadingEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes, - mergeBlocks = _ref.mergeBlocks, - onReplace = _ref.onReplace, - mergedStyle = _ref.mergedStyle; - var align = attributes.align, - content = attributes.content, - level = attributes.level, - placeholder = attributes.placeholder; - var tagName = 'h' + level; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(HeadingLevelDropdown, { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + + +function HeadingEdit({ + attributes, + setAttributes, + mergeBlocks, + onReplace, + mergedStyle, + clientId +}) { + const { + textAlign, + content, + level, + placeholder + } = attributes; + const tagName = 'h' + level; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()({ + [`has-text-align-${textAlign}`]: textAlign + }), + style: mergedStyle + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(HeadingLevelDropdown, { selectedLevel: level, - onChange: function onChange(newLevel) { - return setAttributes({ - level: newLevel - }); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["AlignmentToolbar"], { - value: align, - onChange: function onChange(nextAlign) { - setAttributes({ - align: nextAlign - }); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + onChange: newLevel => setAttributes({ + level: newLevel + }) + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentControl"], { + value: textAlign, + onChange: nextAlign => { + setAttributes({ + textAlign: nextAlign + }); + } + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], Object(esm_extends["a" /* default */])({ identifier: "content", - tagName: external_this_wp_blockEditor_["__experimentalBlock"][tagName], + tagName: tagName, value: content, - onChange: function onChange(value) { - return setAttributes({ - content: value - }); - }, + onChange: value => setAttributes({ + content: value + }), onMerge: mergeBlocks, - onSplit: function onSplit(value) { - if (!value) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph'); - } - - return Object(external_this_wp_blocks_["createBlock"])('core/heading', heading_edit_objectSpread({}, attributes, { - content: value - })); + onSplit: (value, isOriginal) => { + let block; + + if (isOriginal || value) { + block = Object(external_wp_blocks_["createBlock"])('core/heading', { ...attributes, + content: value + }); + } else { + block = Object(external_wp_blocks_["createBlock"])('core/paragraph'); + } + + if (isOriginal) { + block.clientId = clientId; + } + + return block; }, onReplace: onReplace, - onRemove: function onRemove() { - return onReplace([]); - }, - className: classnames_default()(Object(defineProperty["a" /* default */])({}, "has-text-align-".concat(align), align)), - placeholder: placeholder || Object(external_this_wp_i18n_["__"])('Write heading…'), - textAlign: align, - style: mergedStyle - })); + onRemove: () => onReplace([]), + "aria-label": Object(external_wp_i18n_["__"])('Heading text'), + placeholder: placeholder || Object(external_wp_i18n_["__"])('Heading'), + textAlign: textAlign + }, blockProps))); } /* harmony default export */ var heading_edit = (HeadingEdit); @@ -6538,28 +6320,32 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -function heading_save_save(_ref) { - var attributes = _ref.attributes; - var align = attributes.align, - content = attributes.content, - level = attributes.level; - var tagName = 'h' + level; - var className = classnames_default()(Object(defineProperty["a" /* default */])({}, "has-text-align-".concat(align), align)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - className: className ? className : undefined, - tagName: tagName, +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function heading_save_save({ + attributes +}) { + const { + textAlign, + content, + level + } = attributes; + const TagName = 'h' + level; + const className = classnames_default()({ + [`has-text-align-${textAlign}`]: textAlign + }); + return Object(external_wp_element_["createElement"])(TagName, external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: content - }); + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/shared.js @@ -6575,29 +6361,35 @@ } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/heading/transforms.js - - -/** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -var transforms_name$category$attrib = { +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const { + name: heading_transforms_name +} = { + apiVersion: 2, name: "core/heading", + title: "Heading", category: "text", - attributes: { - align: { + description: "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.", + keywords: ["title", "subtitle"], + textdomain: "default", + attributes: { + textAlign: { type: "string" }, content: { type: "string", source: "html", selector: "h1,h2,h3,h4,h5,h6", - "default": "" + "default": "", + __experimentalRole: "content" }, level: { type: "number", @@ -6608,45 +6400,43 @@ } }, supports: { + align: ["wide", "full"], anchor: true, className: false, - lightBlockWrapper: true, - __experimentalColor: { - linkColor: true - }, - __experimentalFontSize: true, - __experimentalLineHeight: true, - __experimentalSelector: { - "core/heading/h1": "h1", - "core/heading/h2": "h2", - "core/heading/h3": "h3", - "core/heading/h4": "h4", - "core/heading/h5": "h5", - "core/heading/h6": "h6" - }, + color: { + link: true + }, + typography: { + fontSize: true, + lineHeight: true, + __experimentalFontWeight: true + }, + __experimentalSelector: "h1,h2,h3,h4,h5,h6", __unstablePasteTextInline: true - } -}, - heading_transforms_name = transforms_name$category$attrib.name; -var heading_transforms_transforms = { + }, + editorStyle: "wp-block-heading-editor", + style: "wp-block-heading" +}; +const heading_transforms_transforms = { from: [{ type: 'block', + isMultiBlock: true, blocks: ['core/paragraph'], - transform: function transform(_ref) { - var content = _ref.content, - anchor = _ref.anchor; - return Object(external_this_wp_blocks_["createBlock"])(heading_transforms_name, { - content: content, - anchor: anchor - }); - } + transform: attributes => attributes.map(({ + content, + anchor + }) => Object(external_wp_blocks_["createBlock"])(heading_transforms_name, { + content, + anchor + })) }, { type: 'raw', selector: 'h1,h2,h3,h4,h5,h6', - schema: function schema(_ref2) { - var phrasingContentSchema = _ref2.phrasingContentSchema, - isPaste = _ref2.isPaste; - var schema = { + schema: ({ + phrasingContentSchema, + isPaste + }) => { + const schema = { children: phrasingContentSchema, attributes: isPaste ? [] : ['style', 'id'] }; @@ -6659,43 +6449,55 @@ h6: schema }; }, - transform: function transform(node) { - var attributes = Object(external_this_wp_blocks_["getBlockAttributes"])(heading_transforms_name, node.outerHTML); - - var _ref3 = node.style || {}, - textAlign = _ref3.textAlign; - + + transform(node) { + const attributes = Object(external_wp_blocks_["getBlockAttributes"])(heading_transforms_name, node.outerHTML); + const { + textAlign + } = node.style || {}; attributes.level = getLevelFromHeadingNodeName(node.nodeName); if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') { attributes.align = textAlign; } - return Object(external_this_wp_blocks_["createBlock"])(heading_transforms_name, attributes); - } - }].concat(Object(toConsumableArray["a" /* default */])([2, 3, 4, 5, 6].map(function (level) { - return { - type: 'prefix', - prefix: Array(level + 1).join('#'), - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])(heading_transforms_name, { - level: level, - content: content - }); - } - }; - }))), + return Object(external_wp_blocks_["createBlock"])(heading_transforms_name, attributes); + } + + }, ...[1, 2, 3, 4, 5, 6].map(level => ({ + type: 'prefix', + prefix: Array(level + 1).join('#'), + + transform(content) { + return Object(external_wp_blocks_["createBlock"])(heading_transforms_name, { + level, + content + }); + } + + })), ...[1, 2, 3, 4, 5, 6].map(level => ({ + type: 'enter', + regExp: new RegExp(`^/(h|H)${level}$`), + + transform(content) { + return Object(external_wp_blocks_["createBlock"])(heading_transforms_name, { + level, + content + }); + } + + }))], to: [{ type: 'block', + isMultiBlock: true, blocks: ['core/paragraph'], - transform: function transform(_ref4) { - var content = _ref4.content, - anchor = _ref4.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: content, - anchor: anchor - }); - } + transform: attributes => attributes.map(({ + content, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content, + anchor + })) }] }; /* harmony default export */ var heading_transforms = (heading_transforms_transforms); @@ -6717,18 +6519,24 @@ -var heading_metadata = { +const heading_metadata = { + apiVersion: 2, name: "core/heading", + title: "Heading", category: "text", - attributes: { - align: { + description: "Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.", + keywords: ["title", "subtitle"], + textdomain: "default", + attributes: { + textAlign: { type: "string" }, content: { type: "string", source: "html", selector: "h1,h2,h3,h4,h5,h6", - "default": "" + "default": "", + __experimentalRole: "content" }, level: { type: "number", @@ -6739,60 +6547,63 @@ } }, supports: { + align: ["wide", "full"], anchor: true, className: false, - lightBlockWrapper: true, - __experimentalColor: { - linkColor: true - }, - __experimentalFontSize: true, - __experimentalLineHeight: true, - __experimentalSelector: { - "core/heading/h1": "h1", - "core/heading/h2": "h2", - "core/heading/h3": "h3", - "core/heading/h4": "h4", - "core/heading/h5": "h5", - "core/heading/h6": "h6" - }, + color: { + link: true + }, + typography: { + fontSize: true, + lineHeight: true, + __experimentalFontWeight: true + }, + __experimentalSelector: "h1,h2,h3,h4,h5,h6", __unstablePasteTextInline: true - } -}; - - -var heading_name = heading_metadata.name; - -var heading_settings = { - title: Object(external_this_wp_i18n_["__"])('Heading'), - description: Object(external_this_wp_i18n_["__"])('Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content.'), + }, + editorStyle: "wp-block-heading-editor", + style: "wp-block-heading" +}; + + +const { + name: heading_name +} = heading_metadata; + +const heading_settings = { icon: library_heading, - keywords: [Object(external_this_wp_i18n_["__"])('title'), Object(external_this_wp_i18n_["__"])('subtitle')], example: { attributes: { - content: Object(external_this_wp_i18n_["__"])('Code is Poetry'), + content: Object(external_wp_i18n_["__"])('Code is Poetry'), level: 2 } }, - __experimentalLabel: function __experimentalLabel(attributes, _ref) { - var context = _ref.context; - + + __experimentalLabel(attributes, { + context + }) { if (context === 'accessibility') { - var content = attributes.content, - level = attributes.level; - return Object(external_this_lodash_["isEmpty"])(content) ? Object(external_this_wp_i18n_["sprintf"])( + const { + content, + level + } = attributes; + return Object(external_lodash_["isEmpty"])(content) ? Object(external_wp_i18n_["sprintf"])( /* translators: accessibility text. %s: heading level. */ - Object(external_this_wp_i18n_["__"])('Level %s. Empty.'), level) : Object(external_this_wp_i18n_["sprintf"])( + Object(external_wp_i18n_["__"])('Level %s. Empty.'), level) : Object(external_wp_i18n_["sprintf"])( /* translators: accessibility text. 1: heading level. 2: heading content. */ - Object(external_this_wp_i18n_["__"])('Level %1$s. %2$s'), level, content); - } - }, + Object(external_wp_i18n_["__"])('Level %1$s. %2$s'), level, content); + } + }, + transforms: heading_transforms, deprecated: heading_deprecated, - merge: function merge(attributes, attributesToMerge) { + + merge(attributes, attributesToMerge) { return { content: (attributes.content || '') + (attributesToMerge.content || '') }; }, + edit: heading_edit, save: heading_save_save }; @@ -6804,10 +6615,10 @@ * WordPress dependencies */ -var quote = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const quote = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M13 6v6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H13zm-9 6h5.2v4c0 .8-.2 1.4-.5 1.7-.6.6-1.6.6-2.5.5h-.3v1.5h.5c1 0 2.3-.1 3.3-1 .6-.6 1-1.6 1-2.8V6H4v6z" })); /* harmony default export */ var library_quote = (quote); @@ -6815,21 +6626,16 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/deprecated.js - -function quote_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function quote_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { quote_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { quote_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -var quote_deprecated_blockAttributes = { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +const quote_deprecated_blockAttributes = { value: { type: 'string', source: 'html', @@ -6847,62 +6653,73 @@ type: 'string' } }; -var quote_deprecated_deprecated = [{ +const quote_deprecated_deprecated = [{ attributes: quote_deprecated_blockAttributes, - save: function save(_ref) { - var attributes = _ref.attributes; - var align = attributes.align, - value = attributes.value, - citation = attributes.citation; - return Object(external_this_wp_element_["createElement"])("blockquote", { + + save({ + attributes + }) { + const { + align, + value, + citation + } = attributes; + return Object(external_wp_element_["createElement"])("blockquote", { style: { textAlign: align ? align : null } - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { multiline: true, value: value - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation })); } -}, { - attributes: quote_deprecated_objectSpread({}, quote_deprecated_blockAttributes, { + +}, { + attributes: { ...quote_deprecated_blockAttributes, style: { type: 'number', default: 1 } - }), - migrate: function migrate(attributes) { + }, + + migrate(attributes) { if (attributes.style === 2) { - return quote_deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['style']), { + return { ...Object(external_lodash_["omit"])(attributes, ['style']), className: attributes.className ? attributes.className + ' is-style-large' : 'is-style-large' - }); + }; } return attributes; }, - save: function save(_ref2) { - var attributes = _ref2.attributes; - var align = attributes.align, - value = attributes.value, - citation = attributes.citation, - style = attributes.style; - return Object(external_this_wp_element_["createElement"])("blockquote", { + + save({ + attributes + }) { + const { + align, + value, + citation, + style + } = attributes; + return Object(external_wp_element_["createElement"])("blockquote", { className: style === 2 ? 'is-large' : '', style: { textAlign: align ? align : null } - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { multiline: true, value: value - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation })); } -}, { - attributes: quote_deprecated_objectSpread({}, quote_deprecated_blockAttributes, { + +}, { + attributes: { ...quote_deprecated_blockAttributes, citation: { type: 'string', source: 'html', @@ -6913,181 +6730,181 @@ type: 'number', default: 1 } - }), - save: function save(_ref3) { - var attributes = _ref3.attributes; - var align = attributes.align, - value = attributes.value, - citation = attributes.citation, - style = attributes.style; - return Object(external_this_wp_element_["createElement"])("blockquote", { - className: "blocks-quote-style-".concat(style), + }, + + save({ + attributes + }) { + const { + align, + value, + citation, + style + } = attributes; + return Object(external_wp_element_["createElement"])("blockquote", { + className: `blocks-quote-style-${style}`, style: { textAlign: align ? align : null } - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { multiline: true, value: value - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "footer", value: citation })); } + }]; /* harmony default export */ var quote_deprecated = (quote_deprecated_deprecated); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/edit.js - -function quote_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function quote_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { quote_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { quote_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -function QuoteEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes, - isSelected = _ref.isSelected, - mergeBlocks = _ref.mergeBlocks, - onReplace = _ref.onReplace, - className = _ref.className, - insertBlocksAfter = _ref.insertBlocksAfter; - var align = attributes.align, - value = attributes.value, - citation = attributes.citation; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["AlignmentToolbar"], { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +const isWebPlatform = external_wp_element_["Platform"].OS === 'web'; +function QuoteEdit({ + attributes, + setAttributes, + isSelected, + mergeBlocks, + onReplace, + className, + insertBlocksAfter, + mergedStyle +}) { + const { + align, + value, + citation + } = attributes; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()(className, { + [`has-text-align-${align}`]: align + }), + style: mergedStyle + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["AlignmentControl"], { value: align, - onChange: function onChange(nextAlign) { + onChange: nextAlign => { setAttributes({ align: nextAlign }); } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["BlockQuotation"], { - className: classnames_default()(className, Object(defineProperty["a" /* default */])({}, "has-text-align-".concat(align), align)) - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + })), Object(external_wp_element_["createElement"])(external_wp_components_["BlockQuotation"], blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { identifier: "value", multiline: true, value: value, - onChange: function onChange(nextValue) { - return setAttributes({ - value: nextValue - }); - }, + onChange: nextValue => setAttributes({ + value: nextValue + }), onMerge: mergeBlocks, - onRemove: function onRemove(forward) { - var hasEmptyCitation = !citation || citation.length === 0; + onRemove: forward => { + const hasEmptyCitation = !citation || citation.length === 0; if (!forward && hasEmptyCitation) { onReplace([]); } }, + "aria-label": Object(external_wp_i18n_["__"])('Quote text'), placeholder: // translators: placeholder text used for the quote - Object(external_this_wp_i18n_["__"])('Write quote…'), + Object(external_wp_i18n_["__"])('Add quote'), onReplace: onReplace, - onSplit: function onSplit(piece) { - return Object(external_this_wp_blocks_["createBlock"])('core/quote', quote_edit_objectSpread({}, attributes, { - value: piece - })); - }, - __unstableOnSplitMiddle: function __unstableOnSplitMiddle() { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph'); - }, + onSplit: piece => Object(external_wp_blocks_["createBlock"])('core/quote', { ...attributes, + value: piece + }), + __unstableOnSplitMiddle: () => Object(external_wp_blocks_["createBlock"])('core/paragraph'), textAlign: align - }), (!external_this_wp_blockEditor_["RichText"].isEmpty(citation) || isSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + }), (!external_wp_blockEditor_["RichText"].isEmpty(citation) || isSelected) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { identifier: "citation", + tagName: isWebPlatform ? 'cite' : undefined, + style: { + display: 'block' + }, value: citation, - onChange: function onChange(nextCitation) { - return setAttributes({ - citation: nextCitation - }); - }, + onChange: nextCitation => setAttributes({ + citation: nextCitation + }), __unstableMobileNoFocusOnMount: true, + "aria-label": Object(external_wp_i18n_["__"])('Quote citation text'), placeholder: // translators: placeholder text used for the citation - Object(external_this_wp_i18n_["__"])('Write citation…'), + Object(external_wp_i18n_["__"])('Add citation'), className: "wp-block-quote__citation", textAlign: align, - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) }))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -function quote_save_save(_ref) { - var attributes = _ref.attributes; - var align = attributes.align, - value = attributes.value, - citation = attributes.citation; - var className = classnames_default()(Object(defineProperty["a" /* default */])({}, "has-text-align-".concat(align), align)); - return Object(external_this_wp_element_["createElement"])("blockquote", { - className: className - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function quote_save_save({ + attributes +}) { + const { + align, + value, + citation + } = attributes; + const className = classnames_default()({ + [`has-text-align-${align}`]: align + }); + return Object(external_wp_element_["createElement"])("blockquote", external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { multiline: true, value: value - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation })); } -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js -var objectWithoutProperties = __webpack_require__(15); - -// EXTERNAL MODULE: external {"this":["wp","richText"]} -var external_this_wp_richText_ = __webpack_require__(25); +// EXTERNAL MODULE: external ["wp","richText"] +var external_wp_richText_ = __webpack_require__("qRz9"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/transforms.js - - - - -function quote_transforms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function quote_transforms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { quote_transforms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { quote_transforms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -var quote_transforms_transforms = { +/** + * WordPress dependencies + */ + + +const quote_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/paragraph'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/quote', { - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["join"])(attributes.map(function (_ref) { - var content = _ref.content; - return Object(external_this_wp_richText_["create"])({ - html: content - }); - }), "\u2028"), + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/quote', { + value: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["join"])(attributes.map(({ + content + }) => Object(external_wp_richText_["create"])({ + html: content + })), '\u2028'), multilineTag: 'p' }), anchor: attributes.anchor @@ -7096,41 +6913,41 @@ }, { type: 'block', blocks: ['core/heading'], - transform: function transform(_ref2) { - var content = _ref2.content, - anchor = _ref2.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/quote', { - value: "

".concat(content, "

"), - anchor: anchor + transform: ({ + content, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/quote', { + value: `

${content}

`, + anchor }); } }, { type: 'block', blocks: ['core/pullquote'], - transform: function transform(_ref3) { - var value = _ref3.value, - citation = _ref3.citation, - anchor = _ref3.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/quote', { - value: value, - citation: citation, - anchor: anchor - }); - } + transform: ({ + value, + citation, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/quote', { + value, + citation, + anchor + }) }, { type: 'prefix', prefix: '>', - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])('core/quote', { - value: "

".concat(content, "

") + transform: content => { + return Object(external_wp_blocks_["createBlock"])('core/quote', { + value: `

${content}

` }); } }, { type: 'raw', - isMatch: function isMatch(node) { - var isParagraphOrSingleCite = function () { - var hasCitation = false; - return function (child) { + isMatch: node => { + const isParagraphOrSingleCite = (() => { + let hasCitation = false; + return child => { // Child is a paragraph. if (child.nodeName === 'P') { return true; @@ -7142,57 +6959,55 @@ return true; } }; - }(); + })(); return node.nodeName === 'BLOCKQUOTE' && // The quote block can only handle multiline paragraph // content with an optional cite child. Array.from(node.childNodes).every(isParagraphOrSingleCite); }, - schema: function schema(_ref4) { - var phrasingContentSchema = _ref4.phrasingContentSchema; - return { - blockquote: { - children: { - p: { - children: phrasingContentSchema - }, - cite: { - children: phrasingContentSchema - } + schema: ({ + phrasingContentSchema + }) => ({ + blockquote: { + children: { + p: { + children: phrasingContentSchema + }, + cite: { + children: phrasingContentSchema } } - }; - } + } + }) }], to: [{ type: 'block', blocks: ['core/paragraph'], - transform: function transform(_ref5) { - var value = _ref5.value, - citation = _ref5.citation; - var paragraphs = []; + transform: ({ + value, + citation + }) => { + const paragraphs = []; if (value && value !== '

') { - paragraphs.push.apply(paragraphs, Object(toConsumableArray["a" /* default */])(Object(external_this_wp_richText_["split"])(Object(external_this_wp_richText_["create"])({ + paragraphs.push(...Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ html: value, multilineTag: 'p' - }), "\u2028").map(function (piece) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: Object(external_this_wp_richText_["toHTMLString"])({ - value: piece - }) - }); + }), '\u2028').map(piece => Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: Object(external_wp_richText_["toHTMLString"])({ + value: piece + }) }))); } if (citation && citation !== '

') { - paragraphs.push(Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + paragraphs.push(Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: citation })); } if (paragraphs.length === 0) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + return Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: '' }); } @@ -7202,26 +7017,26 @@ }, { type: 'block', blocks: ['core/heading'], - transform: function transform(_ref6) { - var value = _ref6.value, - citation = _ref6.citation, - attrs = Object(objectWithoutProperties["a" /* default */])(_ref6, ["value", "citation"]); - + transform: ({ + value, + citation, + ...attrs + }) => { // If there is no quote content, use the citation as the // content of the resulting heading. A nonexistent citation // will result in an empty heading. if (value === '

') { - return Object(external_this_wp_blocks_["createBlock"])('core/heading', { + return Object(external_wp_blocks_["createBlock"])('core/heading', { content: citation }); } - var pieces = Object(external_this_wp_richText_["split"])(Object(external_this_wp_richText_["create"])({ + const pieces = Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ html: value, multilineTag: 'p' - }), "\u2028"); - var headingBlock = Object(external_this_wp_blocks_["createBlock"])('core/heading', { - content: Object(external_this_wp_richText_["toHTMLString"])({ + }), '\u2028'); + const headingBlock = Object(external_wp_blocks_["createBlock"])('core/heading', { + content: Object(external_wp_richText_["toHTMLString"])({ value: pieces[0] }) }); @@ -7230,27 +7045,28 @@ return headingBlock; } - var quotePieces = pieces.slice(1); - var quoteBlock = Object(external_this_wp_blocks_["createBlock"])('core/quote', quote_transforms_objectSpread({}, attrs, { - citation: citation, - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: quotePieces.length ? Object(external_this_wp_richText_["join"])(pieces.slice(1), "\u2028") : Object(external_this_wp_richText_["create"])(), + const quotePieces = pieces.slice(1); + const quoteBlock = Object(external_wp_blocks_["createBlock"])('core/quote', { ...attrs, + citation, + value: Object(external_wp_richText_["toHTMLString"])({ + value: quotePieces.length ? Object(external_wp_richText_["join"])(pieces.slice(1), '\u2028') : Object(external_wp_richText_["create"])(), multilineTag: 'p' }) - })); + }); return [headingBlock, quoteBlock]; } }, { type: 'block', blocks: ['core/pullquote'], - transform: function transform(_ref7) { - var value = _ref7.value, - citation = _ref7.citation, - anchor = _ref7.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/pullquote', { - value: value, - citation: citation, - anchor: anchor + transform: ({ + value, + citation, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/pullquote', { + value, + citation, + anchor }); } }] @@ -7258,39 +7074,40 @@ /* harmony default export */ var quote_transforms = (quote_transforms_transforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/quote/index.js - - -function quote_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function quote_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { quote_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { quote_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -var quote_metadata = { +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +const quote_metadata = { + apiVersion: 2, name: "core/quote", + title: "Quote", category: "text", + description: "Give quoted text visual emphasis. \"In quoting others, we cite ourselves.\" \u2014 Julio Cort\xE1zar", + keywords: ["blockquote", "cite"], + textdomain: "default", attributes: { value: { type: "string", source: "html", selector: "blockquote", multiline: "p", - "default": "" + "default": "", + __experimentalRole: "content" }, citation: { type: "string", source: "html", selector: "cite", - "default": "" + "default": "", + __experimentalRole: "content" }, align: { type: "string" @@ -7298,39 +7115,41 @@ }, supports: { anchor: true - } -}; - - -var quote_name = quote_metadata.name; - -var quote_settings = { - title: Object(external_this_wp_i18n_["__"])('Quote'), - description: Object(external_this_wp_i18n_["__"])('Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Julio Cortázar'), + }, + styles: [{ + name: "default", + label: "Default", + isDefault: true + }, { + name: "large", + label: "Large" + }], + editorStyle: "wp-block-quote-editor", + style: "wp-block-quote" +}; + + +const { + name: quote_name +} = quote_metadata; + +const quote_settings = { icon: library_quote, - keywords: [Object(external_this_wp_i18n_["__"])('blockquote'), Object(external_this_wp_i18n_["__"])('cite')], example: { attributes: { - value: '

' + Object(external_this_wp_i18n_["__"])('In quoting others, we cite ourselves.') + '

', + value: '

' + Object(external_wp_i18n_["__"])('In quoting others, we cite ourselves.') + '

', citation: 'Julio Cortázar', className: 'is-style-large' } }, - styles: [{ - name: 'default', - label: Object(external_this_wp_i18n_["_x"])('Default', 'block style'), - isDefault: true - }, { - name: 'large', - label: Object(external_this_wp_i18n_["_x"])('Large', 'block style') - }], transforms: quote_transforms, edit: QuoteEdit, save: quote_save_save, - merge: function merge(attributes, _ref) { - var value = _ref.value, - citation = _ref.citation; - + + merge(attributes, { + value, + citation + }) { // Quote citations cannot be merged. Pick the second one unless it's // empty. if (!citation) { @@ -7338,16 +7157,17 @@ } if (!value || value === '

') { - return quote_objectSpread({}, attributes, { - citation: citation - }); - } - - return quote_objectSpread({}, attributes, { + return { ...attributes, + citation + }; + } + + return { ...attributes, value: attributes.value + value, - citation: citation - }); - }, + citation + }; + }, + deprecated: quote_deprecated }; @@ -7358,10 +7178,10 @@ * WordPress dependencies */ -var gallery = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const gallery = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8h-1.5zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zM4.5 4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1V12l-2.3-1.7c-.3-.2-.6-.2-.9 0l-2.9 2.1L8 11.3c-.2-.1-.5-.1-.7 0l-2.9 1.5V4.6zm0 11.8v-1.8l3.2-1.7 2.4 1.2c.2.1.5.1.8-.1l2.8-2 2.8 2v2.5c0 .1-.1.1-.1.1H4.6c0-.1-.1-.2-.1-.2z" })); /* harmony default export */ var library_gallery = (gallery); @@ -7374,11 +7194,10 @@ function defaultColumnsNumber(attributes) { return Math.min(3, attributes.images.length); } -var shared_pickRelevantMediaFiles = function pickRelevantMediaFiles(image) { - var sizeSlug = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'large'; - var imageProps = Object(external_this_lodash_["pick"])(image, ['alt', 'id', 'link', 'caption']); - imageProps.url = Object(external_this_lodash_["get"])(image, ['sizes', sizeSlug, 'url']) || Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', sizeSlug, 'source_url']) || image.url; - var fullUrl = Object(external_this_lodash_["get"])(image, ['sizes', 'full', 'url']) || Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', 'full', 'source_url']); +const shared_pickRelevantMediaFiles = (image, sizeSlug = 'large') => { + const imageProps = Object(external_lodash_["pick"])(image, ['alt', 'id', 'link', 'caption']); + imageProps.url = Object(external_lodash_["get"])(image, ['sizes', sizeSlug, 'url']) || Object(external_lodash_["get"])(image, ['media_details', 'sizes', sizeSlug, 'source_url']) || image.url; + const fullUrl = Object(external_lodash_["get"])(image, ['sizes', 'full', 'url']) || Object(external_lodash_["get"])(image, ['media_details', 'sizes', 'full', 'source_url']); if (fullUrl) { imageProps.fullUrl = fullUrl; @@ -7390,27 +7209,176 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/deprecated.js - -function gallery_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function gallery_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { gallery_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { gallery_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -var gallery_deprecated_deprecated = [{ +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +const gallery_deprecated_deprecated = [{ + attributes: { + images: { + type: 'array', + default: [], + source: 'query', + selector: '.blocks-gallery-item', + query: { + url: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'src' + }, + fullUrl: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-full-url' + }, + link: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-link' + }, + alt: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'alt', + default: '' + }, + id: { + type: 'string', + source: 'attribute', + selector: 'img', + attribute: 'data-id' + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-item__caption' + } + } + }, + ids: { + type: 'array', + items: { + type: 'number' + }, + default: [] + }, + columns: { + type: 'number', + minimum: 1, + maximum: 8 + }, + caption: { + type: 'string', + source: 'html', + selector: '.blocks-gallery-caption' + }, + imageCrop: { + type: 'boolean', + default: true + }, + linkTo: { + type: 'string', + default: 'none' + }, + sizeSlug: { + type: 'string', + default: 'large' + } + }, + supports: { + align: true + }, + + isEligible({ + linkTo + }) { + return !linkTo || linkTo === 'attachment' || linkTo === 'media'; + }, + + migrate(attributes) { + let linkTo = attributes.linkTo; + + if (!attributes.linkTo) { + linkTo = 'none'; + } else if (attributes.linkTo === 'attachment') { + linkTo = 'post'; + } else if (attributes.linkTo === 'media') { + linkTo = 'file'; + } + + return { ...attributes, + linkTo + }; + }, + + save({ + attributes + }) { + const { + images, + columns = defaultColumnsNumber(attributes), + imageCrop, + caption, + linkTo + } = attributes; + return Object(external_wp_element_["createElement"])("figure", { + className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}` + }, Object(external_wp_element_["createElement"])("ul", { + className: "blocks-gallery-grid" + }, images.map(image => { + let href; + + switch (linkTo) { + case 'media': + href = image.fullUrl || image.url; + break; + + case 'attachment': + href = image.link; + break; + } + + const img = Object(external_wp_element_["createElement"])("img", { + src: image.url, + alt: image.alt, + "data-id": image.id, + "data-full-url": image.fullUrl, + "data-link": image.link, + className: image.id ? `wp-image-${image.id}` : null + }); + return Object(external_wp_element_["createElement"])("li", { + key: image.id || image.url, + className: "blocks-gallery-item" + }, Object(external_wp_element_["createElement"])("figure", null, href ? Object(external_wp_element_["createElement"])("a", { + href: href + }, img) : img, !external_wp_blockEditor_["RichText"].isEmpty(image.caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "figcaption", + className: "blocks-gallery-item__caption", + value: image.caption + }))); + })), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "figcaption", + className: "blocks-gallery-caption", + value: caption + })); + } + +}, { attributes: { images: { type: 'array', @@ -7475,34 +7443,38 @@ supports: { align: true }, - isEligible: function isEligible(_ref) { - var ids = _ref.ids; - return ids && ids.some(function (id) { - return typeof id === 'string'; - }); - }, - migrate: function migrate(attributes) { - return gallery_deprecated_objectSpread({}, attributes, { - ids: Object(external_this_lodash_["map"])(attributes.ids, function (id) { - var parsedId = parseInt(id, 10); + + isEligible({ + ids + }) { + return ids && ids.some(id => typeof id === 'string'); + }, + + migrate(attributes) { + return { ...attributes, + ids: Object(external_lodash_["map"])(attributes.ids, id => { + const parsedId = parseInt(id, 10); return Number.isInteger(parsedId) ? parsedId : null; }) - }); - }, - save: function save(_ref2) { - var attributes = _ref2.attributes; - var images = attributes.images, - _attributes$columns = attributes.columns, - columns = _attributes$columns === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns, - imageCrop = attributes.imageCrop, - caption = attributes.caption, - linkTo = attributes.linkTo; - return Object(external_this_wp_element_["createElement"])("figure", { - className: "columns-".concat(columns, " ").concat(imageCrop ? 'is-cropped' : '') - }, Object(external_this_wp_element_["createElement"])("ul", { + }; + }, + + save({ + attributes + }) { + const { + images, + columns = defaultColumnsNumber(attributes), + imageCrop, + caption, + linkTo + } = attributes; + return Object(external_wp_element_["createElement"])("figure", { + className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}` + }, Object(external_wp_element_["createElement"])("ul", { className: "blocks-gallery-grid" - }, images.map(function (image) { - var href; + }, images.map(image => { + let href; switch (linkTo) { case 'media': @@ -7514,30 +7486,31 @@ break; } - var img = Object(external_this_wp_element_["createElement"])("img", { + const img = Object(external_wp_element_["createElement"])("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, - className: image.id ? "wp-image-".concat(image.id) : null - }); - return Object(external_this_wp_element_["createElement"])("li", { + className: image.id ? `wp-image-${image.id}` : null + }); + return Object(external_wp_element_["createElement"])("li", { key: image.id || image.url, className: "blocks-gallery-item" - }, Object(external_this_wp_element_["createElement"])("figure", null, href ? Object(external_this_wp_element_["createElement"])("a", { + }, Object(external_wp_element_["createElement"])("figure", null, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, img) : img, !external_this_wp_blockEditor_["RichText"].isEmpty(image.caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, img) : img, !external_wp_blockEditor_["RichText"].isEmpty(image.caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", className: "blocks-gallery-item__caption", value: image.caption }))); - })), !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + })), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", className: "blocks-gallery-caption", value: caption })); } + }, { attributes: { images: { @@ -7598,17 +7571,20 @@ supports: { align: true }, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var images = attributes.images, - _attributes$columns2 = attributes.columns, - columns = _attributes$columns2 === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns2, - imageCrop = attributes.imageCrop, - linkTo = attributes.linkTo; - return Object(external_this_wp_element_["createElement"])("ul", { - className: "columns-".concat(columns, " ").concat(imageCrop ? 'is-cropped' : '') - }, images.map(function (image) { - var href; + + save({ + attributes + }) { + const { + images, + columns = defaultColumnsNumber(attributes), + imageCrop, + linkTo + } = attributes; + return Object(external_wp_element_["createElement"])("ul", { + className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}` + }, images.map(image => { + let href; switch (linkTo) { case 'media': @@ -7620,25 +7596,26 @@ break; } - var img = Object(external_this_wp_element_["createElement"])("img", { + const img = Object(external_wp_element_["createElement"])("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, - className: image.id ? "wp-image-".concat(image.id) : null - }); - return Object(external_this_wp_element_["createElement"])("li", { + className: image.id ? `wp-image-${image.id}` : null + }); + return Object(external_wp_element_["createElement"])("li", { key: image.id || image.url, className: "blocks-gallery-item" - }, Object(external_this_wp_element_["createElement"])("figure", null, href ? Object(external_this_wp_element_["createElement"])("a", { + }, Object(external_wp_element_["createElement"])("figure", null, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, img) : img, image.caption && image.caption.length > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, img) : img, image.caption && image.caption.length > 0 && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: image.caption }))); })); } + }, { attributes: { images: { @@ -7687,10 +7664,12 @@ default: 'none' } }, - isEligible: function isEligible(_ref4) { - var images = _ref4.images, - ids = _ref4.ids; - return images && images.length > 0 && (!ids && images || ids && images && ids.length !== images.length || Object(external_this_lodash_["some"])(images, function (id, index) { + + isEligible({ + images, + ids + }) { + return images && images.length > 0 && (!ids && images || ids && images && ids.length !== images.length || Object(external_lodash_["some"])(images, (id, index) => { if (!id && ids[index] !== null) { return true; } @@ -7698,33 +7677,38 @@ return parseInt(id, 10) !== ids[index]; })); }, - migrate: function migrate(attributes) { - return gallery_deprecated_objectSpread({}, attributes, { - ids: Object(external_this_lodash_["map"])(attributes.images, function (_ref5) { - var id = _ref5.id; - + + migrate(attributes) { + return { ...attributes, + ids: Object(external_lodash_["map"])(attributes.images, ({ + id + }) => { if (!id) { return null; } return parseInt(id, 10); }) - }); - }, + }; + }, + supports: { align: true }, - save: function save(_ref6) { - var attributes = _ref6.attributes; - var images = attributes.images, - _attributes$columns3 = attributes.columns, - columns = _attributes$columns3 === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns3, - imageCrop = attributes.imageCrop, - linkTo = attributes.linkTo; - return Object(external_this_wp_element_["createElement"])("ul", { - className: "columns-".concat(columns, " ").concat(imageCrop ? 'is-cropped' : '') - }, images.map(function (image) { - var href; + + save({ + attributes + }) { + const { + images, + columns = defaultColumnsNumber(attributes), + imageCrop, + linkTo + } = attributes; + return Object(external_wp_element_["createElement"])("ul", { + className: `columns-${columns} ${imageCrop ? 'is-cropped' : ''}` + }, images.map(image => { + let href; switch (linkTo) { case 'media': @@ -7736,24 +7720,25 @@ break; } - var img = Object(external_this_wp_element_["createElement"])("img", { + const img = Object(external_wp_element_["createElement"])("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-link": image.link, - className: image.id ? "wp-image-".concat(image.id) : null - }); - return Object(external_this_wp_element_["createElement"])("li", { + className: image.id ? `wp-image-${image.id}` : null + }); + return Object(external_wp_element_["createElement"])("li", { key: image.id || image.url, className: "blocks-gallery-item" - }, Object(external_this_wp_element_["createElement"])("figure", null, href ? Object(external_this_wp_element_["createElement"])("a", { + }, Object(external_wp_element_["createElement"])("figure", null, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, img) : img, image.caption && image.caption.length > 0 && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, img) : img, image.caption && image.caption.length > 0 && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: image.caption }))); })); } + }, { attributes: { images: { @@ -7796,22 +7781,25 @@ supports: { align: true }, - save: function save(_ref7) { - var attributes = _ref7.attributes; - var images = attributes.images, - _attributes$columns4 = attributes.columns, - columns = _attributes$columns4 === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns4, - align = attributes.align, - imageCrop = attributes.imageCrop, - linkTo = attributes.linkTo; - var className = classnames_default()("columns-".concat(columns), { + + save({ + attributes + }) { + const { + images, + columns = defaultColumnsNumber(attributes), + align, + imageCrop, + linkTo + } = attributes; + const className = classnames_default()(`columns-${columns}`, { alignnone: align === 'none', 'is-cropped': imageCrop }); - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", { className: className - }, images.map(function (image) { - var href; + }, images.map(image => { + let href; switch (linkTo) { case 'media': @@ -7823,42 +7811,25 @@ break; } - var img = Object(external_this_wp_element_["createElement"])("img", { + const img = Object(external_wp_element_["createElement"])("img", { src: image.url, alt: image.alt, "data-id": image.id }); - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", { key: image.id || image.url, className: "blocks-gallery-image" - }, href ? Object(external_this_wp_element_["createElement"])("a", { + }, href ? Object(external_wp_element_["createElement"])("a", { href: href }, img) : img); })); } + }]; /* harmony default export */ var gallery_deprecated = (gallery_deprecated_deprecated); -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js -var classCallCheck = __webpack_require__(20); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js -var createClass = __webpack_require__(19); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js -var assertThisInitialized = __webpack_require__(12); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js -var possibleConstructorReturn = __webpack_require__(23); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js -var getPrototypeOf = __webpack_require__(16); - -// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules -var inherits = __webpack_require__(22); - -// EXTERNAL MODULE: external {"this":["wp","viewport"]} -var external_this_wp_viewport_ = __webpack_require__(81); +// EXTERNAL MODULE: external ["wp","viewport"] +var external_wp_viewport_ = __webpack_require__("KEfo"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/shared-icon.js @@ -7868,277 +7839,230 @@ */ -var sharedIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { +const sharedIcon = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { icon: library_gallery }); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js -var chevron_left = __webpack_require__(293); +var chevron_left = __webpack_require__("2gm7"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js -var chevron_right = __webpack_require__(292); - -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js -var library_edit = __webpack_require__(300); +var chevron_right = __webpack_require__("1iEr"); + +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js + 1 modules +var library_edit = __webpack_require__("B9Az"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js -var close_small = __webpack_require__(177); +var close_small = __webpack_require__("bWcr"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/constants.js +const constants_LINK_DESTINATION_NONE = 'none'; +const constants_LINK_DESTINATION_MEDIA = 'file'; +const constants_LINK_DESTINATION_ATTACHMENT = 'post'; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/gallery-image.js - - - - - - -function _createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - - - - - -/** - * Internal dependencies - */ - - - -var gallery_image_isTemporaryImage = function isTemporaryImage(id, url) { - return !id && Object(external_this_wp_blob_["isBlobURL"])(url); -}; - -var gallery_image_GalleryImage = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(GalleryImage, _Component); - - var _super = _createSuper(GalleryImage); - - function GalleryImage() { - var _this; - - Object(classCallCheck["a" /* default */])(this, GalleryImage); - - _this = _super.apply(this, arguments); - _this.onSelectImage = _this.onSelectImage.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onSelectCaption = _this.onSelectCaption.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onRemoveImage = _this.onRemoveImage.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.bindContainer = _this.bindContainer.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onEdit = _this.onEdit.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onSelectImageFromLibrary = _this.onSelectImageFromLibrary.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onSelectCustomURL = _this.onSelectCustomURL.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { - captionSelected: false, +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + + + + +/** + * Internal dependencies + */ + + + + +const gallery_image_isTemporaryImage = (id, url) => !id && Object(external_wp_blob_["isBlobURL"])(url); + +class gallery_image_GalleryImage extends external_wp_element_["Component"] { + constructor() { + super(...arguments); + this.onSelectImage = this.onSelectImage.bind(this); + this.onRemoveImage = this.onRemoveImage.bind(this); + this.bindContainer = this.bindContainer.bind(this); + this.onEdit = this.onEdit.bind(this); + this.onSelectImageFromLibrary = this.onSelectImageFromLibrary.bind(this); + this.onSelectCustomURL = this.onSelectCustomURL.bind(this); + this.state = { isEditing: false }; - return _this; - } - - Object(createClass["a" /* default */])(GalleryImage, [{ - key: "bindContainer", - value: function bindContainer(ref) { - this.container = ref; - } - }, { - key: "onSelectCaption", - value: function onSelectCaption() { - if (!this.state.captionSelected) { - this.setState({ - captionSelected: true - }); - } - - if (!this.props.isSelected) { - this.props.onSelect(); - } - } - }, { - key: "onSelectImage", - value: function onSelectImage() { - if (!this.props.isSelected) { - this.props.onSelect(); - } - - if (this.state.captionSelected) { - this.setState({ - captionSelected: false - }); - } - } - }, { - key: "onRemoveImage", - value: function onRemoveImage(event) { - if (this.container === document.activeElement && this.props.isSelected && [external_this_wp_keycodes_["BACKSPACE"], external_this_wp_keycodes_["DELETE"]].indexOf(event.keyCode) !== -1) { - event.stopPropagation(); - event.preventDefault(); - this.props.onRemove(); - } - } - }, { - key: "onEdit", - value: function onEdit() { - this.setState({ - isEditing: true - }); - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - var _this$props = this.props, - isSelected = _this$props.isSelected, - image = _this$props.image, - url = _this$props.url, - __unstableMarkNextChangeAsNotPersistent = _this$props.__unstableMarkNextChangeAsNotPersistent; - - if (image && !url) { - __unstableMarkNextChangeAsNotPersistent(); - - this.props.setAttributes({ - url: image.source_url, - alt: image.alt_text - }); - } // unselect the caption so when the user selects other image and comeback - // the caption is not immediately selected - - - if (this.state.captionSelected && !isSelected && prevProps.isSelected) { - this.setState({ - captionSelected: false - }); - } - } - }, { - key: "deselectOnBlur", - value: function deselectOnBlur() { - this.props.onDeselect(); - } - }, { - key: "onSelectImageFromLibrary", - value: function onSelectImageFromLibrary(media) { - var _this$props2 = this.props, - setAttributes = _this$props2.setAttributes, - id = _this$props2.id, - url = _this$props2.url, - alt = _this$props2.alt, - caption = _this$props2.caption, - sizeSlug = _this$props2.sizeSlug; - - if (!media || !media.url) { - return; - } - - var mediaAttributes = shared_pickRelevantMediaFiles(media, sizeSlug); // If the current image is temporary but an alt text was meanwhile - // written by the user, make sure the text is not overwritten. - - if (gallery_image_isTemporaryImage(id, url)) { - if (alt) { - mediaAttributes = Object(external_this_lodash_["omit"])(mediaAttributes, ['alt']); - } - } // If a caption text was meanwhile written by the user, - // make sure the text is not overwritten by empty captions. - - - if (caption && !Object(external_this_lodash_["get"])(mediaAttributes, ['caption'])) { - mediaAttributes = Object(external_this_lodash_["omit"])(mediaAttributes, ['caption']); - } - - setAttributes(mediaAttributes); + } + + bindContainer(ref) { + this.container = ref; + } + + onSelectImage() { + if (!this.props.isSelected) { + this.props.onSelect(); + } + } + + onRemoveImage(event) { + if (this.container === this.container.ownerDocument.activeElement && this.props.isSelected && [external_wp_keycodes_["BACKSPACE"], external_wp_keycodes_["DELETE"]].indexOf(event.keyCode) !== -1) { + event.stopPropagation(); + event.preventDefault(); + this.props.onRemove(); + } + } + + onEdit() { + this.setState({ + isEditing: true + }); + } + + componentDidUpdate() { + const { + image, + url, + __unstableMarkNextChangeAsNotPersistent + } = this.props; + + if (image && !url) { + __unstableMarkNextChangeAsNotPersistent(); + + this.props.setAttributes({ + url: image.source_url, + alt: image.alt_text + }); + } + } + + deselectOnBlur() { + this.props.onDeselect(); + } + + onSelectImageFromLibrary(media) { + const { + setAttributes, + id, + url, + alt, + caption, + sizeSlug + } = this.props; + + if (!media || !media.url) { + return; + } + + let mediaAttributes = shared_pickRelevantMediaFiles(media, sizeSlug); // If the current image is temporary but an alt text was meanwhile + // written by the user, make sure the text is not overwritten. + + if (gallery_image_isTemporaryImage(id, url)) { + if (alt) { + mediaAttributes = Object(external_lodash_["omit"])(mediaAttributes, ['alt']); + } + } // If a caption text was meanwhile written by the user, + // make sure the text is not overwritten by empty captions. + + + if (caption && !Object(external_lodash_["get"])(mediaAttributes, ['caption'])) { + mediaAttributes = Object(external_lodash_["omit"])(mediaAttributes, ['caption']); + } + + setAttributes(mediaAttributes); + this.setState({ + isEditing: false + }); + } + + onSelectCustomURL(newURL) { + const { + setAttributes, + url + } = this.props; + + if (newURL !== url) { + setAttributes({ + url: newURL, + id: undefined + }); this.setState({ isEditing: false }); } - }, { - key: "onSelectCustomURL", - value: function onSelectCustomURL(newURL) { - var _this$props3 = this.props, - setAttributes = _this$props3.setAttributes, - url = _this$props3.url; - - if (newURL !== url) { - setAttributes({ - url: newURL, - id: undefined - }); - this.setState({ - isEditing: false - }); - } - } - }, { - key: "render", - value: function render() { - var _this$props4 = this.props, - url = _this$props4.url, - alt = _this$props4.alt, - id = _this$props4.id, - linkTo = _this$props4.linkTo, - link = _this$props4.link, - isFirstItem = _this$props4.isFirstItem, - isLastItem = _this$props4.isLastItem, - isSelected = _this$props4.isSelected, - caption = _this$props4.caption, - onRemove = _this$props4.onRemove, - onMoveForward = _this$props4.onMoveForward, - onMoveBackward = _this$props4.onMoveBackward, - setAttributes = _this$props4.setAttributes, - ariaLabel = _this$props4['aria-label']; - var isEditing = this.state.isEditing; - var href; - - switch (linkTo) { - case 'media': - href = url; - break; - - case 'attachment': - href = link; - break; - } - - var img = // Disable reason: Image itself is not meant to be interactive, but should - // direct image selection and unfocus caption fields. - - /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ - Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])("img", { - src: url, - alt: alt, - "data-id": id, + } + + render() { + const { + url, + alt, + id, + linkTo, + link, + isFirstItem, + isLastItem, + isSelected, + caption, + onRemove, + onMoveForward, + onMoveBackward, + setAttributes, + 'aria-label': ariaLabel + } = this.props; + const { + isEditing + } = this.state; + let href; + + switch (linkTo) { + case constants_LINK_DESTINATION_MEDIA: + href = url; + break; + + case constants_LINK_DESTINATION_ATTACHMENT: + href = link; + break; + } + + const img = // Disable reason: Image itself is not meant to be interactive, but should + // direct image selection and unfocus caption fields. + + /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ + Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("img", { + src: url, + alt: alt, + "data-id": id, + onKeyDown: this.onRemoveImage, + tabIndex: "0", + "aria-label": ariaLabel, + ref: this.bindContainer + }), Object(external_wp_blob_["isBlobURL"])(url) && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)) + /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */ + ; + const className = classnames_default()({ + 'is-selected': isSelected, + 'is-transient': Object(external_wp_blob_["isBlobURL"])(url) + }); + return (// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions + Object(external_wp_element_["createElement"])("figure", { + className: className, onClick: this.onSelectImage, - onFocus: this.onSelectImage, - onKeyDown: this.onRemoveImage, - tabIndex: "0", - "aria-label": ariaLabel, - ref: this.bindContainer - }), Object(external_this_wp_blob_["isBlobURL"])(url) && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)) - /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */ - ; - var className = classnames_default()({ - 'is-selected': isSelected, - 'is-transient': Object(external_this_wp_blob_["isBlobURL"])(url) - }); - return Object(external_this_wp_element_["createElement"])("figure", { - className: className - }, !isEditing && (href ? Object(external_this_wp_element_["createElement"])("a", { + onFocus: this.onSelectImage + }, !isEditing && (href ? Object(external_wp_element_["createElement"])("a", { href: href - }, img) : img), isEditing && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { + }, img) : img), isEditing && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { labels: { - title: Object(external_this_wp_i18n_["__"])('Edit gallery image') + title: Object(external_wp_i18n_["__"])('Edit gallery image') }, icon: library_image, onSelect: this.onSelectImageFromLibrary, @@ -8146,68 +8070,66 @@ accept: "image/*", allowedTypes: ['image'], value: { - id: id, + id, src: url } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ButtonGroup"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { className: "block-library-gallery-item__inline-menu is-left" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: chevron_left["a" /* default */], onClick: isFirstItem ? undefined : onMoveBackward, - label: Object(external_this_wp_i18n_["__"])('Move image backward'), + label: Object(external_wp_i18n_["__"])('Move image backward'), "aria-disabled": isFirstItem, disabled: !isSelected - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: chevron_right["a" /* default */], onClick: isLastItem ? undefined : onMoveForward, - label: Object(external_this_wp_i18n_["__"])('Move image forward'), + label: Object(external_wp_i18n_["__"])('Move image forward'), "aria-disabled": isLastItem, disabled: !isSelected - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ButtonGroup"], { + })), Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { className: "block-library-gallery-item__inline-menu is-right" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: library_edit["a" /* default */], onClick: this.onEdit, - label: Object(external_this_wp_i18n_["__"])('Replace image'), + label: Object(external_wp_i18n_["__"])('Replace image'), disabled: !isSelected - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { icon: close_small["a" /* default */], onClick: onRemove, - label: Object(external_this_wp_i18n_["__"])('Remove image'), + label: Object(external_wp_i18n_["__"])('Remove image'), disabled: !isSelected - })), !isEditing && (isSelected || caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + })), !isEditing && (isSelected || caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { tagName: "figcaption", - placeholder: isSelected ? Object(external_this_wp_i18n_["__"])('Write caption…') : null, + "aria-label": Object(external_wp_i18n_["__"])('Image caption text'), + placeholder: isSelected ? Object(external_wp_i18n_["__"])('Add caption') : null, value: caption, - isSelected: this.state.captionSelected, - onChange: function onChange(newCaption) { - return setAttributes({ - caption: newCaption - }); - }, - unstableOnFocus: this.onSelectCaption, + onChange: newCaption => setAttributes({ + caption: newCaption + }), inlineToolbar: true - })); - } - }]); - - return GalleryImage; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var gallery_image = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { - var _select = select('core'), - getMedia = _select.getMedia; - - var id = ownProps.id; + })) + ); + } + +} + +/* harmony default export */ var gallery_image = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, ownProps) => { + const { + getMedia + } = select(external_wp_coreData_["store"]); + const { + id + } = ownProps; return { image: id ? getMedia(parseInt(id, 10)) : null }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - var _dispatch = dispatch('core/block-editor'), - __unstableMarkNextChangeAsNotPersistent = _dispatch.__unstableMarkNextChangeAsNotPersistent; - +}), Object(external_wp_data_["withDispatch"])(dispatch => { + const { + __unstableMarkNextChangeAsNotPersistent + } = dispatch(external_wp_blockEditor_["store"]); return { - __unstableMarkNextChangeAsNotPersistent: __unstableMarkNextChangeAsNotPersistent + __unstableMarkNextChangeAsNotPersistent }; })])(gallery_image_GalleryImage)); @@ -8215,61 +8137,63 @@ - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -var gallery_Gallery = function Gallery(props) { - var _classnames; - - var attributes = props.attributes, - className = props.className, - isSelected = props.isSelected, - setAttributes = props.setAttributes, - selectedImage = props.selectedImage, - mediaPlaceholder = props.mediaPlaceholder, - onMoveBackward = props.onMoveBackward, - onMoveForward = props.onMoveForward, - onRemoveImage = props.onRemoveImage, - onSelectImage = props.onSelectImage, - onDeselectImage = props.onDeselectImage, - onSetImageAttributes = props.onSetImageAttributes, - onFocusGalleryCaption = props.onFocusGalleryCaption, - insertBlocksAfter = props.insertBlocksAfter; - var align = attributes.align, - _attributes$columns = attributes.columns, - columns = _attributes$columns === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns, - caption = attributes.caption, - imageCrop = attributes.imageCrop, - images = attributes.images; - return Object(external_this_wp_element_["createElement"])("figure", { - className: classnames_default()(className, (_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, "align".concat(align), align), Object(defineProperty["a" /* default */])(_classnames, "columns-".concat(columns), columns), Object(defineProperty["a" /* default */])(_classnames, 'is-cropped', imageCrop), _classnames)) - }, Object(external_this_wp_element_["createElement"])("ul", { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +const Gallery = props => { + const { + attributes, + isSelected, + setAttributes, + selectedImage, + mediaPlaceholder, + onMoveBackward, + onMoveForward, + onRemoveImage, + onSelectImage, + onDeselectImage, + onSetImageAttributes, + insertBlocksAfter, + blockProps + } = props; + const { + align, + columns = defaultColumnsNumber(attributes), + caption, + imageCrop, + images + } = attributes; + return Object(external_wp_element_["createElement"])("figure", Object(esm_extends["a" /* default */])({}, blockProps, { + className: classnames_default()(blockProps.className, { + [`align${align}`]: align, + [`columns-${columns}`]: columns, + 'is-cropped': imageCrop + }) + }), Object(external_wp_element_["createElement"])("ul", { className: "blocks-gallery-grid" - }, images.map(function (img, index) { - var ariaLabel = Object(external_this_wp_i18n_["sprintf"])( + }, images.map((img, index) => { + const ariaLabel = Object(external_wp_i18n_["sprintf"])( /* translators: 1: the order number of the image. 2: the total number of images. */ - Object(external_this_wp_i18n_["__"])('image %1$d of %2$d in gallery'), index + 1, images.length); - return Object(external_this_wp_element_["createElement"])("li", { + Object(external_wp_i18n_["__"])('image %1$d of %2$d in gallery'), index + 1, images.length); + return Object(external_wp_element_["createElement"])("li", { className: "blocks-gallery-item", - key: img.id || img.url - }, Object(external_this_wp_element_["createElement"])(gallery_image, { + key: img.id ? `${img.id}-${index}` : img.url + }, Object(external_wp_element_["createElement"])(gallery_image, { url: img.url, alt: img.alt, id: img.id, @@ -8281,567 +8205,448 @@ onRemove: onRemoveImage(index), onSelect: onSelectImage(index), onDeselect: onDeselectImage(index), - setAttributes: function setAttributes(attrs) { - return onSetImageAttributes(index, attrs); - }, + setAttributes: attrs => onSetImageAttributes(index, attrs), caption: img.caption, "aria-label": ariaLabel, sizeSlug: attributes.sizeSlug })); - })), mediaPlaceholder, Object(external_this_wp_element_["createElement"])(RichTextVisibilityHelper, { - isHidden: !isSelected && external_this_wp_blockEditor_["RichText"].isEmpty(caption), + })), mediaPlaceholder, Object(external_wp_element_["createElement"])(RichTextVisibilityHelper, { + isHidden: !isSelected && external_wp_blockEditor_["RichText"].isEmpty(caption), tagName: "figcaption", className: "blocks-gallery-caption", - placeholder: Object(external_this_wp_i18n_["__"])('Write gallery caption…'), + "aria-label": Object(external_wp_i18n_["__"])('Gallery caption text'), + placeholder: Object(external_wp_i18n_["__"])('Write gallery caption…'), value: caption, - unstableOnFocus: onFocusGalleryCaption, - onChange: function onChange(value) { - return setAttributes({ - caption: value - }); - }, + onChange: value => setAttributes({ + caption: value + }), inlineToolbar: true, - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } - })); -}; - -function RichTextVisibilityHelper(_ref) { - var isHidden = _ref.isHidden, - richTextProps = Object(objectWithoutProperties["a" /* default */])(_ref, ["isHidden"]); - - return isHidden ? Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], Object(esm_extends["a" /* default */])({ - as: external_this_wp_blockEditor_["RichText"] - }, richTextProps)) : Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], richTextProps); -} - -/* harmony default export */ var gallery_gallery = (gallery_Gallery); + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) + })); +}; + +function RichTextVisibilityHelper({ + isHidden, + ...richTextProps +}) { + return isHidden ? Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], Object(esm_extends["a" /* default */])({ + as: external_wp_blockEditor_["RichText"] + }, richTextProps)) : Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], richTextProps); +} + +/* harmony default export */ var gallery_gallery = (Gallery); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/edit.js - - - - - - - - -function gallery_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function gallery_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { gallery_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { gallery_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - - -var MAX_COLUMNS = 8; -var linkOptions = [{ - value: 'attachment', - label: Object(external_this_wp_i18n_["__"])('Attachment Page') -}, { - value: 'media', - label: Object(external_this_wp_i18n_["__"])('Media File') -}, { - value: 'none', - label: Object(external_this_wp_i18n_["__"])('None') +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + + + +/** + * Internal dependencies + */ + + + + + +const MAX_COLUMNS = 8; +const linkOptions = [{ + value: constants_LINK_DESTINATION_ATTACHMENT, + label: Object(external_wp_i18n_["__"])('Attachment Page') +}, { + value: constants_LINK_DESTINATION_MEDIA, + label: Object(external_wp_i18n_["__"])('Media File') +}, { + value: constants_LINK_DESTINATION_NONE, + label: Object(external_wp_i18n_["__"])('None') }]; -var edit_ALLOWED_MEDIA_TYPES = ['image']; -var PLACEHOLDER_TEXT = external_this_wp_element_["Platform"].select({ - web: Object(external_this_wp_i18n_["__"])('Drag images, upload new ones or select files from your library.'), - native: Object(external_this_wp_i18n_["__"])('ADD MEDIA') +const edit_ALLOWED_MEDIA_TYPES = ['image']; +const PLACEHOLDER_TEXT = external_wp_element_["Platform"].select({ + web: Object(external_wp_i18n_["__"])('Drag images, upload new ones or select files from your library.'), + native: Object(external_wp_i18n_["__"])('ADD MEDIA') }); -var MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_this_wp_element_["Platform"].select({ +const MOBILE_CONTROL_PROPS_RANGE_CONTROL = external_wp_element_["Platform"].select({ web: {}, native: { type: 'stepper' } }); -var edit_GalleryEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(GalleryEdit, _Component); - - var _super = edit_createSuper(GalleryEdit); - - function GalleryEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, GalleryEdit); - - _this = _super.apply(this, arguments); - _this.onSelectImage = _this.onSelectImage.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onSelectImages = _this.onSelectImages.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onDeselectImage = _this.onDeselectImage.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setLinkTo = _this.setLinkTo.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setColumnsNumber = _this.setColumnsNumber.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.toggleImageCrop = _this.toggleImageCrop.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onMove = _this.onMove.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onMoveForward = _this.onMoveForward.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onMoveBackward = _this.onMoveBackward.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onRemoveImage = _this.onRemoveImage.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onUploadError = _this.onUploadError.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setImageAttributes = _this.setImageAttributes.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setAttributes = _this.setAttributes.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onFocusGalleryCaption = _this.onFocusGalleryCaption.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.getImagesSizeOptions = _this.getImagesSizeOptions.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.updateImagesSize = _this.updateImagesSize.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { - selectedImage: null, - attachmentCaptions: null - }; - return _this; - } - - Object(createClass["a" /* default */])(GalleryEdit, [{ - key: "setAttributes", - value: function setAttributes(attributes) { - if (attributes.ids) { - throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes'); - } - - if (attributes.images) { - attributes = gallery_edit_objectSpread({}, attributes, { - // Unlike images[ n ].id which is a string, always ensure the - // ids array contains numbers as per its attribute type. - ids: Object(external_this_lodash_["map"])(attributes.images, function (_ref) { - var id = _ref.id; - return parseInt(id, 10); - }) - }); - } - - this.props.setAttributes(attributes); - } - }, { - key: "onSelectImage", - value: function onSelectImage(index) { - var _this2 = this; - - return function () { - if (_this2.state.selectedImage !== index) { - _this2.setState({ - selectedImage: index - }); - } - }; - } - }, { - key: "onDeselectImage", - value: function onDeselectImage(index) { - var _this3 = this; - - return function () { - if (_this3.state.selectedImage === index) { - _this3.setState({ - selectedImage: null - }); - } - }; - } - }, { - key: "onMove", - value: function onMove(oldIndex, newIndex) { - var images = Object(toConsumableArray["a" /* default */])(this.props.attributes.images); - - images.splice(newIndex, 1, this.props.attributes.images[oldIndex]); - images.splice(oldIndex, 1, this.props.attributes.images[newIndex]); - this.setState({ - selectedImage: newIndex - }); - this.setAttributes({ - images: images - }); - } - }, { - key: "onMoveForward", - value: function onMoveForward(oldIndex) { - var _this4 = this; - - return function () { - if (oldIndex === _this4.props.attributes.images.length - 1) { - return; - } - - _this4.onMove(oldIndex, oldIndex + 1); - }; - } - }, { - key: "onMoveBackward", - value: function onMoveBackward(oldIndex) { - var _this5 = this; - - return function () { - if (oldIndex === 0) { - return; - } - - _this5.onMove(oldIndex, oldIndex - 1); - }; - } - }, { - key: "onRemoveImage", - value: function onRemoveImage(index) { - var _this6 = this; - - return function () { - var images = Object(external_this_lodash_["filter"])(_this6.props.attributes.images, function (img, i) { - return index !== i; - }); - var columns = _this6.props.attributes.columns; - - _this6.setState({ - selectedImage: null - }); - - _this6.setAttributes({ - images: images, - columns: columns ? Math.min(images.length, columns) : columns - }); - }; - } - }, { - key: "selectCaption", - value: function selectCaption(newImage, images, attachmentCaptions) { - // The image id in both the images and attachmentCaptions arrays is a - // string, so ensure comparison works correctly by converting the - // newImage.id to a string. - var newImageId = Object(external_this_lodash_["toString"])(newImage.id); - var currentImage = Object(external_this_lodash_["find"])(images, { - id: newImageId - }); - var currentImageCaption = currentImage ? currentImage.caption : newImage.caption; - - if (!attachmentCaptions) { - return currentImageCaption; - } - - var attachment = Object(external_this_lodash_["find"])(attachmentCaptions, { - id: newImageId - }); // if the attachment caption is updated - - if (attachment && attachment.caption !== newImage.caption) { - return newImage.caption; - } - +function GalleryEdit(props) { + const { + attributes, + clientId, + isSelected, + noticeUI, + noticeOperations, + onFocus + } = props; + const { + columns = defaultColumnsNumber(attributes), + imageCrop, + images, + linkTo, + sizeSlug + } = attributes; + const [selectedImage, setSelectedImage] = Object(external_wp_element_["useState"])(); + const [attachmentCaptions, setAttachmentCaptions] = Object(external_wp_element_["useState"])(); + const { + __unstableMarkNextChangeAsNotPersistent + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + const { + imageSizes, + mediaUpload, + getMedia, + wasBlockJustInserted + } = Object(external_wp_data_["useSelect"])(select => { + const settings = select(external_wp_blockEditor_["store"]).getSettings(); + return { + imageSizes: settings.imageSizes, + mediaUpload: settings.mediaUpload, + getMedia: select(external_wp_coreData_["store"]).getMedia, + wasBlockJustInserted: select(external_wp_blockEditor_["store"]).wasBlockJustInserted(clientId, 'inserter_menu') + }; + }); + const resizedImages = Object(external_wp_element_["useMemo"])(() => { + if (isSelected) { + return Object(external_lodash_["reduce"])(attributes.ids, (currentResizedImages, id) => { + if (!id) { + return currentResizedImages; + } + + const image = getMedia(id); + const sizes = Object(external_lodash_["reduce"])(imageSizes, (currentSizes, size) => { + const defaultUrl = Object(external_lodash_["get"])(image, ['sizes', size.slug, 'url']); + const mediaDetailsUrl = Object(external_lodash_["get"])(image, ['media_details', 'sizes', size.slug, 'source_url']); + return { ...currentSizes, + [size.slug]: defaultUrl || mediaDetailsUrl + }; + }, {}); + return { ...currentResizedImages, + [parseInt(id, 10)]: sizes + }; + }, {}); + } + + return {}; + }, [isSelected, attributes.ids, imageSizes]); + + function onFocusGalleryCaption() { + setSelectedImage(); + } + + function setAttributes(newAttrs) { + if (newAttrs.ids) { + throw new Error('The "ids" attribute should not be changed directly. It is managed automatically when "images" attribute changes'); + } + + if (newAttrs.images) { + newAttrs = { ...newAttrs, + // Unlike images[ n ].id which is a string, always ensure the + // ids array contains numbers as per its attribute type. + ids: Object(external_lodash_["map"])(newAttrs.images, ({ + id + }) => parseInt(id, 10)) + }; + } + + props.setAttributes(newAttrs); + } + + function onSelectImage(index) { + return () => { + setSelectedImage(index); + }; + } + + function onDeselectImage() { + return () => { + setSelectedImage(); + }; + } + + function onMove(oldIndex, newIndex) { + const newImages = [...images]; + newImages.splice(newIndex, 1, images[oldIndex]); + newImages.splice(oldIndex, 1, images[newIndex]); + setSelectedImage(newIndex); + setAttributes({ + images: newImages + }); + } + + function onMoveForward(oldIndex) { + return () => { + if (oldIndex === images.length - 1) { + return; + } + + onMove(oldIndex, oldIndex + 1); + }; + } + + function onMoveBackward(oldIndex) { + return () => { + if (oldIndex === 0) { + return; + } + + onMove(oldIndex, oldIndex - 1); + }; + } + + function onRemoveImage(index) { + return () => { + const newImages = Object(external_lodash_["filter"])(images, (img, i) => index !== i); + setSelectedImage(); + setAttributes({ + images: newImages, + columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns + }); + }; + } + + function selectCaption(newImage) { + // The image id in both the images and attachmentCaptions arrays is a + // string, so ensure comparison works correctly by converting the + // newImage.id to a string. + const newImageId = Object(external_lodash_["toString"])(newImage.id); + const currentImage = Object(external_lodash_["find"])(images, { + id: newImageId + }); + const currentImageCaption = currentImage ? currentImage.caption : newImage.caption; + + if (!attachmentCaptions) { return currentImageCaption; } - }, { - key: "onSelectImages", - value: function onSelectImages(newImages) { - var _this7 = this; - - var _this$props$attribute = this.props.attributes, - columns = _this$props$attribute.columns, - images = _this$props$attribute.images, - sizeSlug = _this$props$attribute.sizeSlug; - var attachmentCaptions = this.state.attachmentCaptions; - this.setState({ - attachmentCaptions: newImages.map(function (newImage) { - return { - // Store the attachmentCaption id as a string for consistency - // with the type of the id in the images attribute. - id: Object(external_this_lodash_["toString"])(newImage.id), - caption: newImage.caption - }; + + const attachment = Object(external_lodash_["find"])(attachmentCaptions, { + id: newImageId + }); // if the attachment caption is updated + + if (attachment && attachment.caption !== newImage.caption) { + return newImage.caption; + } + + return currentImageCaption; + } + + function onSelectImages(newImages) { + setAttachmentCaptions(newImages.map(newImage => ({ + // Store the attachmentCaption id as a string for consistency + // with the type of the id in the images attribute. + id: Object(external_lodash_["toString"])(newImage.id), + caption: newImage.caption + }))); + setAttributes({ + images: newImages.map(newImage => ({ ...shared_pickRelevantMediaFiles(newImage, sizeSlug), + caption: selectCaption(newImage, images, attachmentCaptions), + // The id value is stored in a data attribute, so when the + // block is parsed it's converted to a string. Converting + // to a string here ensures it's type is consistent. + id: Object(external_lodash_["toString"])(newImage.id) + })), + columns: attributes.columns ? Math.min(newImages.length, attributes.columns) : attributes.columns + }); + } + + function onUploadError(message) { + noticeOperations.removeAllNotices(); + noticeOperations.createErrorNotice(message); + } + + function setLinkTo(value) { + setAttributes({ + linkTo: value + }); + } + + function setColumnsNumber(value) { + setAttributes({ + columns: value + }); + } + + function toggleImageCrop() { + setAttributes({ + imageCrop: !imageCrop + }); + } + + function getImageCropHelp(checked) { + return checked ? Object(external_wp_i18n_["__"])('Thumbnails are cropped to align.') : Object(external_wp_i18n_["__"])('Thumbnails are not cropped.'); + } + + function setImageAttributes(index, newAttributes) { + if (!images[index]) { + return; + } + + setAttributes({ + images: [...images.slice(0, index), { ...images[index], + ...newAttributes + }, ...images.slice(index + 1)] + }); + } + + function getImagesSizeOptions() { + return Object(external_lodash_["map"])(Object(external_lodash_["filter"])(imageSizes, ({ + slug + }) => Object(external_lodash_["some"])(resizedImages, sizes => sizes[slug])), ({ + name, + slug + }) => ({ + value: slug, + label: name + })); + } + + function updateImagesSize(newSizeSlug) { + const updatedImages = Object(external_lodash_["map"])(images, image => { + if (!image.id) { + return image; + } + + const url = Object(external_lodash_["get"])(resizedImages, [parseInt(image.id, 10), newSizeSlug]); + return { ...image, + ...(url && { + url }) - }); - this.setAttributes({ - images: newImages.map(function (newImage) { - return gallery_edit_objectSpread({}, shared_pickRelevantMediaFiles(newImage, sizeSlug), { - caption: _this7.selectCaption(newImage, images, attachmentCaptions), - // The id value is stored in a data attribute, so when the - // block is parsed it's converted to a string. Converting - // to a string here ensures it's type is consistent. - id: Object(external_this_lodash_["toString"])(newImage.id) - }); - }), - columns: columns ? Math.min(newImages.length, columns) : columns - }); - } - }, { - key: "onUploadError", - value: function onUploadError(message) { - var noticeOperations = this.props.noticeOperations; - noticeOperations.removeAllNotices(); - noticeOperations.createErrorNotice(message); - } - }, { - key: "setLinkTo", - value: function setLinkTo(value) { - this.setAttributes({ - linkTo: value - }); - } - }, { - key: "setColumnsNumber", - value: function setColumnsNumber(value) { - this.setAttributes({ - columns: value - }); - } - }, { - key: "toggleImageCrop", - value: function toggleImageCrop() { - this.setAttributes({ - imageCrop: !this.props.attributes.imageCrop - }); - } - }, { - key: "getImageCropHelp", - value: function getImageCropHelp(checked) { - return checked ? Object(external_this_wp_i18n_["__"])('Thumbnails are cropped to align.') : Object(external_this_wp_i18n_["__"])('Thumbnails are not cropped.'); - } - }, { - key: "onFocusGalleryCaption", - value: function onFocusGalleryCaption() { - this.setState({ - selectedImage: null - }); - } - }, { - key: "setImageAttributes", - value: function setImageAttributes(index, attributes) { - var images = this.props.attributes.images; - var setAttributes = this.setAttributes; - - if (!images[index]) { - return; - } - - setAttributes({ - images: [].concat(Object(toConsumableArray["a" /* default */])(images.slice(0, index)), [gallery_edit_objectSpread({}, images[index], {}, attributes)], Object(toConsumableArray["a" /* default */])(images.slice(index + 1))) - }); - } - }, { - key: "getImagesSizeOptions", - value: function getImagesSizeOptions() { - var _this$props = this.props, - imageSizes = _this$props.imageSizes, - resizedImages = _this$props.resizedImages; - return Object(external_this_lodash_["map"])(Object(external_this_lodash_["filter"])(imageSizes, function (_ref2) { - var slug = _ref2.slug; - return Object(external_this_lodash_["some"])(resizedImages, function (sizes) { - return sizes[slug]; - }); - }), function (_ref3) { - var name = _ref3.name, - slug = _ref3.slug; - return { - value: slug, - label: name - }; - }); - } - }, { - key: "updateImagesSize", - value: function updateImagesSize(sizeSlug) { - var _this$props2 = this.props, - images = _this$props2.attributes.images, - resizedImages = _this$props2.resizedImages; - var updatedImages = Object(external_this_lodash_["map"])(images, function (image) { - if (!image.id) { - return image; - } - - var url = Object(external_this_lodash_["get"])(resizedImages, [parseInt(image.id, 10), sizeSlug]); - return gallery_edit_objectSpread({}, image, {}, url && { - url: url - }); - }); - this.setAttributes({ - images: updatedImages, - sizeSlug: sizeSlug - }); - } - }, { - key: "componentDidMount", - value: function componentDidMount() { - var _this$props3 = this.props, - attributes = _this$props3.attributes, - mediaUpload = _this$props3.mediaUpload; - var images = attributes.images; - - if (external_this_wp_element_["Platform"].OS === 'web' && images && images.length > 0 && Object(external_this_lodash_["every"])(images, function (_ref4) { - var url = _ref4.url; - return Object(external_this_wp_blob_["isBlobURL"])(url); - })) { - var filesList = Object(external_this_lodash_["map"])(images, function (_ref5) { - var url = _ref5.url; - return Object(external_this_wp_blob_["getBlobByURL"])(url); - }); - Object(external_this_lodash_["forEach"])(images, function (_ref6) { - var url = _ref6.url; - return Object(external_this_wp_blob_["revokeBlobURL"])(url); - }); - mediaUpload({ - filesList: filesList, - onFileChange: this.onSelectImages, - allowedTypes: ['image'] - }); - } - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - // Deselect images when deselecting the block - if (!this.props.isSelected && prevProps.isSelected) { - this.setState({ - selectedImage: null, - captionSelected: false - }); - } - } - }, { - key: "render", - value: function render() { - var _this$props4 = this.props, - attributes = _this$props4.attributes, - className = _this$props4.className, - isSelected = _this$props4.isSelected, - noticeUI = _this$props4.noticeUI, - insertBlocksAfter = _this$props4.insertBlocksAfter; - var _attributes$columns = attributes.columns, - columns = _attributes$columns === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns, - imageCrop = attributes.imageCrop, - images = attributes.images, - linkTo = attributes.linkTo, - sizeSlug = attributes.sizeSlug; - var hasImages = !!images.length; - var mediaPlaceholder = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - addToGallery: hasImages, - isAppender: hasImages, - className: className, - disableMediaButtons: hasImages && !isSelected, - icon: !hasImages && sharedIcon, - labels: { - title: !hasImages && Object(external_this_wp_i18n_["__"])('Gallery'), - instructions: !hasImages && PLACEHOLDER_TEXT - }, - onSelect: this.onSelectImages, - accept: "image/*", - allowedTypes: edit_ALLOWED_MEDIA_TYPES, - multiple: true, - value: images, - onError: this.onUploadError, - notices: hasImages ? undefined : noticeUI, - onFocus: this.props.onFocus - }); - - if (!hasImages) { - return mediaPlaceholder; - } - - var imageSizeOptions = this.getImagesSizeOptions(); - var shouldShowSizeOptions = hasImages && !Object(external_this_lodash_["isEmpty"])(imageSizeOptions); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Gallery settings') - }, images.length > 1 && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], Object(esm_extends["a" /* default */])({ - label: Object(external_this_wp_i18n_["__"])('Columns'), - value: columns, - onChange: this.setColumnsNumber, - min: 1, - max: Math.min(MAX_COLUMNS, images.length) - }, MOBILE_CONTROL_PROPS_RANGE_CONTROL, { - required: true - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Crop images'), - checked: !!imageCrop, - onChange: this.toggleImageCrop, - help: this.getImageCropHelp - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { - label: Object(external_this_wp_i18n_["__"])('Link to'), - value: linkTo, - onChange: this.setLinkTo, - options: linkOptions - }), shouldShowSizeOptions && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { - label: Object(external_this_wp_i18n_["__"])('Image size'), - value: sizeSlug, - options: imageSizeOptions, - onChange: this.updateImagesSize - }))), noticeUI, Object(external_this_wp_element_["createElement"])(gallery_gallery, Object(esm_extends["a" /* default */])({}, this.props, { - selectedImage: this.state.selectedImage, - mediaPlaceholder: mediaPlaceholder, - onMoveBackward: this.onMoveBackward, - onMoveForward: this.onMoveForward, - onRemoveImage: this.onRemoveImage, - onSelectImage: this.onSelectImage, - onDeselectImage: this.onDeselectImage, - onSetImageAttributes: this.setImageAttributes, - onFocusGalleryCaption: this.onFocusGalleryCaption, - insertBlocksAfter: insertBlocksAfter - }))); - } - }]); - - return GalleryEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var gallery_edit = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref7) { - var ids = _ref7.attributes.ids, - isSelected = _ref7.isSelected; - - var _select = select('core'), - getMedia = _select.getMedia; - - var _select2 = select('core/block-editor'), - getSettings = _select2.getSettings; - - var _getSettings = getSettings(), - imageSizes = _getSettings.imageSizes, - mediaUpload = _getSettings.mediaUpload; - - var resizedImages = {}; - - if (isSelected) { - resizedImages = Object(external_this_lodash_["reduce"])(ids, function (currentResizedImages, id) { - if (!id) { - return currentResizedImages; - } - - var image = getMedia(id); - var sizes = Object(external_this_lodash_["reduce"])(imageSizes, function (currentSizes, size) { - var defaultUrl = Object(external_this_lodash_["get"])(image, ['sizes', size.slug, 'url']); - var mediaDetailsUrl = Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', size.slug, 'source_url']); - return gallery_edit_objectSpread({}, currentSizes, Object(defineProperty["a" /* default */])({}, size.slug, defaultUrl || mediaDetailsUrl)); - }, {}); - return gallery_edit_objectSpread({}, currentResizedImages, Object(defineProperty["a" /* default */])({}, parseInt(id, 10), sizes)); - }, {}); - } - - return { - imageSizes: imageSizes, - mediaUpload: mediaUpload, - resizedImages: resizedImages - }; -}), external_this_wp_components_["withNotices"], Object(external_this_wp_viewport_["withViewportMatch"])({ + }; + }); + setAttributes({ + images: updatedImages, + sizeSlug: newSizeSlug + }); + } + + Object(external_wp_element_["useEffect"])(() => { + if (external_wp_element_["Platform"].OS === 'web' && images && images.length > 0 && Object(external_lodash_["every"])(images, ({ + url + }) => Object(external_wp_blob_["isBlobURL"])(url))) { + const filesList = Object(external_lodash_["map"])(images, ({ + url + }) => Object(external_wp_blob_["getBlobByURL"])(url)); + Object(external_lodash_["forEach"])(images, ({ + url + }) => Object(external_wp_blob_["revokeBlobURL"])(url)); + mediaUpload({ + filesList, + onFileChange: onSelectImages, + allowedTypes: ['image'] + }); + } + }, []); + Object(external_wp_element_["useEffect"])(() => { + // Deselect images when deselecting the block + if (!isSelected) { + setSelectedImage(); + } + }, [isSelected]); + Object(external_wp_element_["useEffect"])(() => { + // linkTo attribute must be saved so blocks don't break when changing + // image_default_link_type in options.php + if (!linkTo) { + var _window, _window$wp, _window$wp$media, _window$wp$media$view, _window$wp$media$view2, _window$wp$media$view3; + + __unstableMarkNextChangeAsNotPersistent(); + + setAttributes({ + linkTo: ((_window = window) === null || _window === void 0 ? void 0 : (_window$wp = _window.wp) === null || _window$wp === void 0 ? void 0 : (_window$wp$media = _window$wp.media) === null || _window$wp$media === void 0 ? void 0 : (_window$wp$media$view = _window$wp$media.view) === null || _window$wp$media$view === void 0 ? void 0 : (_window$wp$media$view2 = _window$wp$media$view.settings) === null || _window$wp$media$view2 === void 0 ? void 0 : (_window$wp$media$view3 = _window$wp$media$view2.defaultProps) === null || _window$wp$media$view3 === void 0 ? void 0 : _window$wp$media$view3.link) || constants_LINK_DESTINATION_NONE + }); + } + }, [linkTo]); + const hasImages = !!images.length; + const hasImageIds = hasImages && images.some(image => !!image.id); + const mediaPlaceholder = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + addToGallery: hasImageIds, + isAppender: hasImages, + disableMediaButtons: hasImages && !isSelected, + icon: !hasImages && sharedIcon, + labels: { + title: !hasImages && Object(external_wp_i18n_["__"])('Gallery'), + instructions: !hasImages && PLACEHOLDER_TEXT + }, + onSelect: onSelectImages, + accept: "image/*", + allowedTypes: edit_ALLOWED_MEDIA_TYPES, + multiple: true, + value: hasImageIds ? images : {}, + onError: onUploadError, + notices: hasImages ? undefined : noticeUI, + onFocus: onFocus, + autoOpenMediaUpload: !hasImages && isSelected && wasBlockJustInserted + }); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + + if (!hasImages) { + return Object(external_wp_element_["createElement"])(external_wp_primitives_["View"], blockProps, mediaPlaceholder); + } + + const imageSizeOptions = getImagesSizeOptions(); + const shouldShowSizeOptions = hasImages && !Object(external_lodash_["isEmpty"])(imageSizeOptions); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Gallery settings') + }, images.length > 1 && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], Object(esm_extends["a" /* default */])({ + label: Object(external_wp_i18n_["__"])('Columns'), + value: columns, + onChange: setColumnsNumber, + min: 1, + max: Math.min(MAX_COLUMNS, images.length) + }, MOBILE_CONTROL_PROPS_RANGE_CONTROL, { + required: true + })), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Crop images'), + checked: !!imageCrop, + onChange: toggleImageCrop, + help: getImageCropHelp + }), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { + label: Object(external_wp_i18n_["__"])('Link to'), + value: linkTo, + onChange: setLinkTo, + options: linkOptions, + hideCancelButton: true + }), shouldShowSizeOptions && Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { + label: Object(external_wp_i18n_["__"])('Image size'), + value: sizeSlug, + options: imageSizeOptions, + onChange: updateImagesSize, + hideCancelButton: true + }))), noticeUI, Object(external_wp_element_["createElement"])(gallery_gallery, Object(esm_extends["a" /* default */])({}, props, { + selectedImage: selectedImage, + mediaPlaceholder: mediaPlaceholder, + onMoveBackward: onMoveBackward, + onMoveForward: onMoveForward, + onRemoveImage: onRemoveImage, + onSelectImage: onSelectImage, + onDeselectImage: onDeselectImage, + onSetImageAttributes: setImageAttributes, + blockProps: blockProps // This prop is used by gallery.native.js. + , + onFocusGalleryCaption: onFocusGalleryCaption + }))); +} + +/* harmony default export */ var gallery_edit = (Object(external_wp_compose_["compose"])([external_wp_components_["withNotices"], Object(external_wp_viewport_["withViewportMatch"])({ isNarrow: '< small' -})])(edit_GalleryEdit)); +})])(GalleryEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/gallery/save.js @@ -8855,50 +8660,54 @@ */ -function gallery_save_save(_ref) { - var attributes = _ref.attributes; - var images = attributes.images, - _attributes$columns = attributes.columns, - columns = _attributes$columns === void 0 ? defaultColumnsNumber(attributes) : _attributes$columns, - imageCrop = attributes.imageCrop, - caption = attributes.caption, - linkTo = attributes.linkTo; - return Object(external_this_wp_element_["createElement"])("figure", { - className: "columns-".concat(columns, " ").concat(imageCrop ? 'is-cropped' : '') - }, Object(external_this_wp_element_["createElement"])("ul", { + +function gallery_save_save({ + attributes +}) { + const { + images, + columns = defaultColumnsNumber(attributes), + imageCrop, + caption, + linkTo + } = attributes; + const className = `columns-${columns} ${imageCrop ? 'is-cropped' : ''}`; + return Object(external_wp_element_["createElement"])("figure", external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])("ul", { className: "blocks-gallery-grid" - }, images.map(function (image) { - var href; + }, images.map(image => { + let href; switch (linkTo) { - case 'media': + case constants_LINK_DESTINATION_MEDIA: href = image.fullUrl || image.url; break; - case 'attachment': + case constants_LINK_DESTINATION_ATTACHMENT: href = image.link; break; } - var img = Object(external_this_wp_element_["createElement"])("img", { + const img = Object(external_wp_element_["createElement"])("img", { src: image.url, alt: image.alt, "data-id": image.id, "data-full-url": image.fullUrl, "data-link": image.link, - className: image.id ? "wp-image-".concat(image.id) : null - }); - return Object(external_this_wp_element_["createElement"])("li", { + className: image.id ? `wp-image-${image.id}` : null + }); + return Object(external_wp_element_["createElement"])("li", { key: image.id || image.url, className: "blocks-gallery-item" - }, Object(external_this_wp_element_["createElement"])("figure", null, href ? Object(external_this_wp_element_["createElement"])("a", { + }, Object(external_wp_element_["createElement"])("figure", null, href ? Object(external_wp_element_["createElement"])("a", { href: href - }, img) : img, !external_this_wp_blockEditor_["RichText"].isEmpty(image.caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, img) : img, !external_wp_blockEditor_["RichText"].isEmpty(image.caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", className: "blocks-gallery-item__caption", value: image.caption }))); - })), !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + })), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", className: "blocks-gallery-caption", value: caption @@ -8922,52 +8731,49 @@ -var parseShortcodeIds = function parseShortcodeIds(ids) { + +const parseShortcodeIds = ids => { if (!ids) { return []; } - return ids.split(',').map(function (id) { - return parseInt(id, 10); - }); -}; - -var gallery_transforms_transforms = { + return ids.split(',').map(id => parseInt(id, 10)); +}; + +const gallery_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/image'], - transform: function transform(attributes) { + transform: attributes => { // Init the align and size from the first item which may be either the placeholder or an image. - var _attributes$ = attributes[0], - align = _attributes$.align, - sizeSlug = _attributes$.sizeSlug; // Loop through all the images and check if they have the same align and size. - - align = Object(external_this_lodash_["every"])(attributes, ['align', align]) ? align : undefined; - sizeSlug = Object(external_this_lodash_["every"])(attributes, ['sizeSlug', sizeSlug]) ? sizeSlug : undefined; - var validImages = Object(external_this_lodash_["filter"])(attributes, function (_ref) { - var url = _ref.url; - return url; - }); - return Object(external_this_wp_blocks_["createBlock"])('core/gallery', { - images: validImages.map(function (_ref2) { - var id = _ref2.id, - url = _ref2.url, - alt = _ref2.alt, - caption = _ref2.caption; - return { - id: Object(external_this_lodash_["toString"])(id), - url: url, - alt: alt, - caption: caption - }; - }), - ids: validImages.map(function (_ref3) { - var id = _ref3.id; - return parseInt(id, 10); - }), - align: align, - sizeSlug: sizeSlug + let { + align, + sizeSlug + } = attributes[0]; // Loop through all the images and check if they have the same align and size. + + align = Object(external_lodash_["every"])(attributes, ['align', align]) ? align : undefined; + sizeSlug = Object(external_lodash_["every"])(attributes, ['sizeSlug', sizeSlug]) ? sizeSlug : undefined; + const validImages = Object(external_lodash_["filter"])(attributes, ({ + url + }) => url); + return Object(external_wp_blocks_["createBlock"])('core/gallery', { + images: validImages.map(({ + id, + url, + alt, + caption + }) => ({ + id: Object(external_lodash_["toString"])(id), + url, + alt, + caption + })), + ids: validImages.map(({ + id + }) => parseInt(id, 10)), + align, + sizeSlug }); } }, { @@ -8976,85 +8782,98 @@ attributes: { images: { type: 'array', - shortcode: function shortcode(_ref4) { - var ids = _ref4.named.ids; - return parseShortcodeIds(ids).map(function (id) { - return { - id: Object(external_this_lodash_["toString"])(id) - }; - }); + shortcode: ({ + named: { + ids + } + }) => { + return parseShortcodeIds(ids).map(id => ({ + id: Object(external_lodash_["toString"])(id) + })); } }, ids: { type: 'array', - shortcode: function shortcode(_ref5) { - var ids = _ref5.named.ids; + shortcode: ({ + named: { + ids + } + }) => { return parseShortcodeIds(ids); } }, columns: { type: 'number', - shortcode: function shortcode(_ref6) { - var _ref6$named$columns = _ref6.named.columns, - columns = _ref6$named$columns === void 0 ? '3' : _ref6$named$columns; + shortcode: ({ + named: { + columns = '3' + } + }) => { return parseInt(columns, 10); } }, linkTo: { type: 'string', - shortcode: function shortcode(_ref7) { - var _ref7$named$link = _ref7.named.link, - link = _ref7$named$link === void 0 ? 'attachment' : _ref7$named$link; - return link === 'file' ? 'media' : link; - } - } - } + shortcode: ({ + named: { + link = constants_LINK_DESTINATION_ATTACHMENT + } + }) => { + return link; + } + } + }, + + isMatch({ + named + }) { + return undefined !== named.ids; + } + }, { // When created by drag and dropping multiple files on an insertion point type: 'files', - isMatch: function isMatch(files) { - return files.length !== 1 && Object(external_this_lodash_["every"])(files, function (file) { - return file.type.indexOf('image/') === 0; - }); - }, - transform: function transform(files) { - var block = Object(external_this_wp_blocks_["createBlock"])('core/gallery', { - images: files.map(function (file) { - return shared_pickRelevantMediaFiles({ - url: Object(external_this_wp_blob_["createBlobURL"])(file) - }); - }) + + isMatch(files) { + return files.length !== 1 && Object(external_lodash_["every"])(files, file => file.type.indexOf('image/') === 0); + }, + + transform(files) { + const block = Object(external_wp_blocks_["createBlock"])('core/gallery', { + images: files.map(file => shared_pickRelevantMediaFiles({ + url: Object(external_wp_blob_["createBlobURL"])(file) + })) }); return block; } + }], to: [{ type: 'block', blocks: ['core/image'], - transform: function transform(_ref8) { - var images = _ref8.images, - align = _ref8.align, - sizeSlug = _ref8.sizeSlug, - ids = _ref8.ids; - + transform: ({ + images, + align, + sizeSlug, + ids + }) => { if (images.length > 0) { - return images.map(function (_ref9, index) { - var url = _ref9.url, - alt = _ref9.alt, - caption = _ref9.caption; - return Object(external_this_wp_blocks_["createBlock"])('core/image', { - id: ids[index], - url: url, - alt: alt, - caption: caption, - align: align, - sizeSlug: sizeSlug - }); - }); - } - - return Object(external_this_wp_blocks_["createBlock"])('core/image', { - align: align + return images.map(({ + url, + alt, + caption + }, index) => Object(external_wp_blocks_["createBlock"])('core/image', { + id: ids[index], + url, + alt, + caption, + align, + sizeSlug + })); + } + + return Object(external_wp_blocks_["createBlock"])('core/image', { + align }); } }] @@ -9066,16 +8885,20 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - - -var gallery_metadata = { +/** + * Internal dependencies + */ + + + +const gallery_metadata = { + apiVersion: 2, name: "core/gallery", + title: "Gallery", category: "media", + description: "Display multiple images in a rich gallery.", + keywords: ["images", "photos"], + textdomain: "default", attributes: { images: { type: "array", @@ -9143,8 +8966,7 @@ "default": true }, linkTo: { - type: "string", - "default": "none" + type: "string" }, sizeSlug: { type: "string", @@ -9154,17 +8976,18 @@ supports: { anchor: true, align: true - } -}; - - -var gallery_name = gallery_metadata.name; - -var gallery_settings = { - title: Object(external_this_wp_i18n_["__"])('Gallery'), - description: Object(external_this_wp_i18n_["__"])('Display multiple images in a rich gallery.'), + }, + editorStyle: "wp-block-gallery-editor", + style: "wp-block-gallery" +}; + + +const { + name: gallery_name +} = gallery_metadata; + +const gallery_settings = { icon: library_gallery, - keywords: [Object(external_this_wp_i18n_["__"])('images'), Object(external_this_wp_i18n_["__"])('photos')], example: { attributes: { columns: 2, @@ -9188,17 +9011,17 @@ * WordPress dependencies */ -var archive = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const archive = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5zM8 12.8h8v-1.5H8v1.5zm0 3h8v-1.5H8v1.5z" })); /* harmony default export */ var library_archive = (archive); -// EXTERNAL MODULE: external {"this":["wp","serverSideRender"]} -var external_this_wp_serverSideRender_ = __webpack_require__(83); -var external_this_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_serverSideRender_); +// EXTERNAL MODULE: external ["wp","serverSideRender"] +var external_wp_serverSideRender_ = __webpack_require__("JREk"); +var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/archives/edit.js @@ -9210,33 +9033,32 @@ -function ArchivesEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes; - var showPostCounts = attributes.showPostCounts, - displayAsDropdown = attributes.displayAsDropdown; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Archives settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display as dropdown'), +function ArchivesEdit({ + attributes, + setAttributes +}) { + const { + showPostCounts, + displayAsDropdown + } = attributes; + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Archives settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display as dropdown'), checked: displayAsDropdown, - onChange: function onChange() { - return setAttributes({ - displayAsDropdown: !displayAsDropdown - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Show post counts'), + onChange: () => setAttributes({ + displayAsDropdown: !displayAsDropdown + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Show post counts'), checked: showPostCounts, - onChange: function onChange() { - return setAttributes({ - showPostCounts: !showPostCounts - }); - } - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_serverSideRender_default.a, { + onChange: () => setAttributes({ + showPostCounts: !showPostCounts + }) + }))), Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(external_wp_serverSideRender_default.a, { block: "core/archives", attributes: attributes - }))); + })))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/archives/index.js @@ -9244,22 +9066,18 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var archives_metadata = { +/** + * Internal dependencies + */ + +const archives_metadata = { + apiVersion: 2, name: "core/archives", + title: "Archives", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display a monthly archive of your posts.", + textdomain: "default", + attributes: { displayAsDropdown: { type: "boolean", "default": false @@ -9272,14 +9090,15 @@ supports: { align: true, html: false - } -}; - -var archives_name = archives_metadata.name; - -var archives_settings = { - title: Object(external_this_wp_i18n_["__"])('Archives'), - description: Object(external_this_wp_i18n_["__"])('Display a monthly archive of your posts.'), + }, + editorStyle: "wp-block-archives-editor" +}; + +const { + name: archives_name +} = archives_metadata; + +const archives_settings = { icon: library_archive, example: {}, edit: ArchivesEdit @@ -9292,10 +9111,10 @@ * WordPress dependencies */ -var audio = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const audio = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M17.7 4.3c-1.2 0-2.8 0-3.8 1-.6.6-.9 1.5-.9 2.6V14c-.6-.6-1.5-1-2.5-1C8.6 13 7 14.6 7 16.5S8.6 20 10.5 20c1.5 0 2.8-1 3.3-2.3.5-.8.7-1.8.7-2.5V7.9c0-.7.2-1.2.5-1.6.6-.6 1.8-.6 2.8-.6h.3V4.3h-.4z" })); /* harmony default export */ var library_audio = (audio); @@ -9345,88 +9164,93 @@ supports: { align: true }, - save: function save(_ref) { - var attributes = _ref.attributes; - var autoplay = attributes.autoplay, - caption = attributes.caption, - loop = attributes.loop, - preload = attributes.preload, - src = attributes.src; - return Object(external_this_wp_element_["createElement"])("figure", null, Object(external_this_wp_element_["createElement"])("audio", { + + save({ + attributes + }) { + const { + autoplay, + caption, + loop, + preload, + src + } = attributes; + return Object(external_wp_element_["createElement"])("figure", null, Object(external_wp_element_["createElement"])("audio", { controls: "controls", src: src, autoPlay: autoplay, loop: loop, preload: preload - }), !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); } + }]); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/edit.js - - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - - -var audio_edit_ALLOWED_MEDIA_TYPES = ['audio']; - -function AudioEdit(_ref) { - var attributes = _ref.attributes, - noticeOperations = _ref.noticeOperations, - setAttributes = _ref.setAttributes, - onReplace = _ref.onReplace, - isSelected = _ref.isSelected, - noticeUI = _ref.noticeUI, - insertBlocksAfter = _ref.insertBlocksAfter; - var id = attributes.id, - autoplay = attributes.autoplay, - caption = attributes.caption, - loop = attributes.loop, - preload = attributes.preload, - src = attributes.src; - var mediaUpload = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core/block-editor'), - getSettings = _select.getSettings; - +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + + +const audio_edit_ALLOWED_MEDIA_TYPES = ['audio']; + +function AudioEdit({ + attributes, + noticeOperations, + setAttributes, + onReplace, + isSelected, + noticeUI, + insertBlocksAfter +}) { + const { + id, + autoplay, + caption, + loop, + preload, + src + } = attributes; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + const mediaUpload = Object(external_wp_data_["useSelect"])(select => { + const { + getSettings + } = select(external_wp_blockEditor_["store"]); return getSettings().mediaUpload; }, []); - Object(external_this_wp_element_["useEffect"])(function () { - if (!id && Object(external_this_wp_blob_["isBlobURL"])(src)) { - var file = Object(external_this_wp_blob_["getBlobByURL"])(src); + Object(external_wp_element_["useEffect"])(() => { + if (!id && Object(external_wp_blob_["isBlobURL"])(src)) { + const file = Object(external_wp_blob_["getBlobByURL"])(src); if (file) { mediaUpload({ filesList: [file], - onFileChange: function onFileChange(_ref2) { - var _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 1), - _ref3$ = _ref3[0], - mediaId = _ref3$.id, - url = _ref3$.url; - + onFileChange: ([{ + id: mediaId, + url + }]) => { setAttributes({ id: mediaId, src: url }); }, - onError: function onError(e) { + onError: e => { setAttributes({ src: undefined, id: undefined @@ -9440,8 +9264,10 @@ }, []); function toggleAttribute(attribute) { - return function (newValue) { - setAttributes(Object(defineProperty["a" /* default */])({}, attribute, newValue)); + return newValue => { + setAttributes({ + [attribute]: newValue + }); }; } @@ -9450,7 +9276,7 @@ // the editing UI. if (newSrc !== src) { // Check if there's an embed block that handles this URL. - var embedBlock = util_createUpgradedEmbedBlock({ + const embedBlock = createUpgradedEmbedBlock({ attributes: { url: newSrc } @@ -9474,7 +9300,7 @@ } function getAutoplayHelp(checked) { - return checked ? Object(external_this_wp_i18n_["__"])('Note: Autoplaying audio may cause usability issues for some visitors.') : null; + return checked ? Object(external_wp_i18n_["__"])('Autoplay may cause usability issues for some users.') : null; } // const { setAttributes, isSelected, noticeUI } = this.props; @@ -9498,8 +9324,8 @@ } if (!src) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { icon: library_audio }), onSelect: onSelectAudio, @@ -9512,7 +9338,9 @@ })); } - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaReplaceFlow"], { + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], { mediaId: id, mediaURL: src, allowedTypes: audio_edit_ALLOWED_MEDIA_TYPES, @@ -9520,59 +9348,56 @@ onSelect: onSelectAudio, onSelectURL: onSelectURL, onError: onUploadError - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Audio settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Autoplay'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Audio settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Autoplay'), onChange: toggleAttribute('autoplay'), checked: autoplay, help: getAutoplayHelp - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Loop'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Loop'), onChange: toggleAttribute('loop'), checked: loop - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { - label: Object(external_this_wp_i18n_["__"])('Preload'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { + label: Object(external_wp_i18n_["__"])('Preload'), value: preload || '' // `undefined` is required for the preload attribute to be unset. , - onChange: function onChange(value) { - return setAttributes({ - preload: value || undefined - }); - }, + onChange: value => setAttributes({ + preload: value || undefined + }), options: [{ value: '', - label: Object(external_this_wp_i18n_["__"])('Browser default') + label: Object(external_wp_i18n_["__"])('Browser default') }, { value: 'auto', - label: Object(external_this_wp_i18n_["__"])('Auto') + label: Object(external_wp_i18n_["__"])('Auto') }, { value: 'metadata', - label: Object(external_this_wp_i18n_["__"])('Metadata') + label: Object(external_wp_i18n_["__"])('Metadata') }, { value: 'none', - label: Object(external_this_wp_i18n_["__"])('None') + label: Object(external_wp_i18n_["__"])('None') }] - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].figure, null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, Object(external_this_wp_element_["createElement"])("audio", { + }))), Object(external_wp_element_["createElement"])("figure", blockProps, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], { + isDisabled: !isSelected + }, Object(external_wp_element_["createElement"])("audio", { controls: "controls", src: src - })), (!external_this_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + })), (!external_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { tagName: "figcaption", - placeholder: Object(external_this_wp_i18n_["__"])('Write caption…'), + "aria-label": Object(external_wp_i18n_["__"])('Audio caption text'), + placeholder: Object(external_wp_i18n_["__"])('Add caption'), value: caption, - onChange: function onChange(value) { - return setAttributes({ - caption: value - }); - }, + onChange: value => setAttributes({ + caption: value + }), inlineToolbar: true, - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) }))); } -/* harmony default export */ var audio_edit = (Object(external_this_wp_components_["withNotices"])(AudioEdit)); +/* harmony default export */ var audio_edit = (Object(external_wp_components_["withNotices"])(AudioEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/audio/save.js @@ -9581,20 +9406,23 @@ * WordPress dependencies */ -function audio_save_save(_ref) { - var attributes = _ref.attributes; - var autoplay = attributes.autoplay, - caption = attributes.caption, - loop = attributes.loop, - preload = attributes.preload, - src = attributes.src; - return src && Object(external_this_wp_element_["createElement"])("figure", null, Object(external_this_wp_element_["createElement"])("audio", { +function audio_save_save({ + attributes +}) { + const { + autoplay, + caption, + loop, + preload, + src + } = attributes; + return src && Object(external_wp_element_["createElement"])("figure", external_wp_blockEditor_["useBlockProps"].save(), Object(external_wp_element_["createElement"])("audio", { controls: "controls", src: src, autoPlay: autoplay, loop: loop, preload: preload - }), !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "figcaption", value: caption })); @@ -9606,51 +9434,71 @@ */ -var audio_transforms_transforms = { +const audio_transforms_transforms = { from: [{ type: 'files', - isMatch: function isMatch(files) { + + isMatch(files) { return files.length === 1 && files[0].type.indexOf('audio/') === 0; }, - transform: function transform(files) { - var file = files[0]; // We don't need to upload the media directly here + + transform(files) { + const file = files[0]; // We don't need to upload the media directly here // It's already done as part of the `componentDidMount` // in the audio block - var block = Object(external_this_wp_blocks_["createBlock"])('core/audio', { - src: Object(external_this_wp_blob_["createBlobURL"])(file) + const block = Object(external_wp_blocks_["createBlock"])('core/audio', { + src: Object(external_wp_blob_["createBlobURL"])(file) }); return block; } + }, { type: 'shortcode', tag: 'audio', attributes: { src: { type: 'string', - shortcode: function shortcode(_ref) { - var src = _ref.named.src; - return src; + shortcode: ({ + named: { + src, + mp3, + m4a, + ogg, + wav, + wma + } + }) => { + return src || mp3 || m4a || ogg || wav || wma; } }, loop: { type: 'string', - shortcode: function shortcode(_ref2) { - var loop = _ref2.named.loop; + shortcode: ({ + named: { + loop + } + }) => { return loop; } }, autoplay: { type: 'string', - shortcode: function shortcode(_ref3) { - var autoplay = _ref3.named.autoplay; + shortcode: ({ + named: { + autoplay + } + }) => { return autoplay; } }, preload: { type: 'string', - shortcode: function shortcode(_ref4) { - var preload = _ref4.named.preload; + shortcode: ({ + named: { + preload + } + }) => { return preload; } } @@ -9664,16 +9512,20 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - - -var audio_metadata = { +/** + * Internal dependencies + */ + + + +const audio_metadata = { + apiVersion: 2, name: "core/audio", + title: "Audio", category: "media", + description: "Embed a simple audio player.", + keywords: ["music", "sound", "podcast", "recording"], + textdomain: "default", attributes: { src: { type: "string", @@ -9710,18 +9562,18 @@ }, supports: { anchor: true, - align: true, - lightBlockWrapper: true - } -}; - - -var audio_name = audio_metadata.name; - -var audio_settings = { - title: Object(external_this_wp_i18n_["__"])('Audio'), - description: Object(external_this_wp_i18n_["__"])('Embed a simple audio player.'), - keywords: [Object(external_this_wp_i18n_["__"])('music'), Object(external_this_wp_i18n_["__"])('sound'), Object(external_this_wp_i18n_["__"])('podcast'), Object(external_this_wp_i18n_["__"])('recording')], + align: true + }, + editorStyle: "wp-block-audio-editor", + style: "wp-block-audio" +}; + + +const { + name: audio_name +} = audio_metadata; + +const audio_settings = { icon: library_audio, transforms: audio_transforms, deprecated: audio_deprecated, @@ -9729,85 +9581,179 @@ save: audio_save_save }; -// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js - - -/** - * WordPress dependencies - */ - -var button_button = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M19 6.5H5c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v7zM8 13h8v-1.5H8V13z" -})); -/* harmony default export */ var library_button = (button_button); +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/buttons.js + + +/** + * WordPress dependencies + */ + +const buttons_buttons = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M17 3H7c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V5c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v4zm-8-1.2h5V6.2h-5v1.6zM17 13H7c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5v-4c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v4zm-8-1.2h5v-1.5h-5v1.5z" +})); +/* harmony default export */ var library_buttons = (buttons_buttons); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/deprecated.js + + +/** + * WordPress dependencies + */ + +const buttons_deprecated_deprecated = [{ + supports: { + align: ['center', 'left', 'right'], + anchor: true + }, + + save() { + return Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + }, + + isEligible({ + align + }) { + return align && ['center', 'left', 'right'].includes(align); + }, + + migrate(attributes) { + return { ...attributes, + align: undefined, + // Floating Buttons blocks shouldn't have been supported in the + // first place. Most users using them probably expected them to + // act like content justification controls, so these blocks are + // migrated to use content justification. + // As for center-aligned Buttons blocks, the content justification + // equivalent will create an identical end result in most cases. + contentJustification: attributes.align + }; + } + +}]; +/* harmony default export */ var buttons_deprecated = (buttons_deprecated_deprecated); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/transforms.js /** * WordPress dependencies */ -/** - * Internal dependencies - */ - -var _name$category$suppor = { + +/** + * Internal dependencies + */ + +const { + name: buttons_transforms_name +} = { + apiVersion: 2, name: "core/buttons", + title: "Buttons", category: "design", + description: "Prompt visitors to take action with a group of button-style links.", + keywords: ["link"], + textdomain: "default", + attributes: { + contentJustification: { + type: "string" + }, + orientation: { + type: "string", + "default": "horizontal" + } + }, supports: { anchor: true, - align: true, - alignWide: false, - lightBlockWrapper: true - } -}, - buttons_transforms_name = _name$category$suppor.name; -var buttons_transforms_transforms = { + align: ["wide", "full"] + }, + editorStyle: "wp-block-buttons-editor", + style: "wp-block-buttons" +}; +const buttons_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/button'], - transform: function transform(buttons) { - return (// Creates the buttons block - Object(external_this_wp_blocks_["createBlock"])(buttons_transforms_name, {}, // Loop the selected buttons - buttons.map(function (attributes) { - return (// Create singular button in the buttons block - Object(external_this_wp_blocks_["createBlock"])('core/button', attributes) - ); - })) - ); + transform: buttons => // Creates the buttons block + Object(external_wp_blocks_["createBlock"])(buttons_transforms_name, {}, // Loop the selected buttons + buttons.map(attributes => // Create singular button in the buttons block + Object(external_wp_blocks_["createBlock"])('core/button', attributes))) + }, { + type: 'block', + isMultiBlock: true, + blocks: ['core/paragraph'], + transform: buttons => // Creates the buttons block + Object(external_wp_blocks_["createBlock"])(buttons_transforms_name, {}, // Loop the selected buttons + buttons.map(attributes => { + const element = Object(external_wp_richText_["__unstableCreateElement"])(document, attributes.content); // Remove any HTML tags + + const text = element.innerText || ''; // Get first url + + const link = element.querySelector('a'); + const url = link === null || link === void 0 ? void 0 : link.getAttribute('href'); // Create singular button in the buttons block + + return Object(external_wp_blocks_["createBlock"])('core/button', { + text, + url + }); + })), + isMatch: paragraphs => { + return paragraphs.every(attributes => { + const element = Object(external_wp_richText_["__unstableCreateElement"])(document, attributes.content); + const text = element.innerText || ''; + const links = element.querySelectorAll('a'); + return text.length <= 30 && links.length <= 1; + }); } }] }; /* harmony default export */ var buttons_transforms = (buttons_transforms_transforms); +// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/button.js +var library_button = __webpack_require__("oMoS"); + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/deprecated.js - -function button_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function button_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { button_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { button_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -var deprecated_migrateCustomColorsAndGradients = function migrateCustomColorsAndGradients(attributes) { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +const migrateBorderRadius = attributes => { + const { + borderRadius, + ...newAttributes + } = attributes; + + if (!borderRadius && borderRadius !== 0) { + return newAttributes; + } + + return { ...newAttributes, + style: { ...newAttributes.style, + border: { + radius: borderRadius + } + } + }; +}; + +const migrateCustomColorsAndGradients = attributes => { if (!attributes.customTextColor && !attributes.customBackgroundColor && !attributes.customGradient) { return attributes; } - var style = { + const style = { color: {} }; @@ -9823,19 +9769,19 @@ style.color.gradient = attributes.customGradient; } - return button_deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor', 'customGradient']), { - style: style - }); -}; - -var deprecated_oldColorsMigration = function oldColorsMigration(attributes) { - return deprecated_migrateCustomColorsAndGradients(Object(external_this_lodash_["omit"])(button_deprecated_objectSpread({}, attributes, { + return { ...Object(external_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor', 'customGradient']), + style + }; +}; + +const oldColorsMigration = attributes => { + return migrateCustomColorsAndGradients(Object(external_lodash_["omit"])({ ...attributes, customTextColor: attributes.textColor && '#' === attributes.textColor[0] ? attributes.textColor : undefined, customBackgroundColor: attributes.color && '#' === attributes.color[0] ? attributes.color : undefined - }), ['color', 'textColor'])); -}; - -var button_deprecated_blockAttributes = { + }, ['color', 'textColor'])); +}; + +const button_deprecated_blockAttributes = { url: { type: 'string', source: 'attribute', @@ -9854,15 +9800,18 @@ selector: 'a' } }; -var button_deprecated_deprecated = [{ - supports: { +const button_deprecated_deprecated = [{ + supports: { + anchor: true, align: true, alignWide: false, - __experimentalColor: { - gradients: true - } - }, - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + color: { + __experimentalSkipSerialization: true + }, + reusable: false, + __experimentalSelector: '.wp-block-button__link' + }, + attributes: { ...button_deprecated_blockAttributes, linkTarget: { type: 'string', source: 'attribute', @@ -9892,23 +9841,42 @@ }, style: { type: 'object' - } - }), - save: function save(_ref) { - var attributes = _ref.attributes; - var borderRadius = attributes.borderRadius, - linkTarget = attributes.linkTarget, - rel = attributes.rel, - text = attributes.text, - title = attributes.title, - url = attributes.url; - var buttonClasses = classnames_default()('wp-block-button__link', { + }, + width: { + type: 'number' + } + }, + + save({ + attributes, + className + }) { + const { + borderRadius, + linkTarget, + rel, + text, + title, + url, + width + } = attributes; + const colorProps = Object(external_wp_blockEditor_["__experimentalGetColorClassesAndStyles"])(attributes); + const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, { 'no-border-radius': borderRadius === 0 }); - var buttonStyle = { - borderRadius: borderRadius ? borderRadius + 'px' : undefined - }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + const buttonStyle = { + borderRadius: borderRadius ? borderRadius + 'px' : undefined, + ...colorProps.style + }; // The use of a `title` attribute here is soft-deprecated, but still applied + // if it had already been assigned, for the sake of backward-compatibility. + // A title will no longer be assigned for new or updated button block links. + + const wrapperClasses = classnames_default()(className, { + [`has-custom-width wp-block-button__width-${width}`]: width + }); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className: wrapperClasses + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: buttonClasses, href: url, @@ -9917,14 +9885,176 @@ value: text, target: linkTarget, rel: rel - }); - } + })); + }, + + migrate: migrateBorderRadius +}, { + supports: { + anchor: true, + align: true, + alignWide: false, + color: { + __experimentalSkipSerialization: true + }, + reusable: false, + __experimentalSelector: '.wp-block-button__link' + }, + attributes: { ...button_deprecated_blockAttributes, + linkTarget: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'target' + }, + rel: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'rel' + }, + placeholder: { + type: 'string' + }, + borderRadius: { + type: 'number' + }, + backgroundColor: { + type: 'string' + }, + textColor: { + type: 'string' + }, + gradient: { + type: 'string' + }, + style: { + type: 'object' + }, + width: { + type: 'number' + } + }, + + save({ + attributes, + className + }) { + const { + borderRadius, + linkTarget, + rel, + text, + title, + url, + width + } = attributes; + const colorProps = Object(external_wp_blockEditor_["__experimentalGetColorClassesAndStyles"])(attributes); + const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, { + 'no-border-radius': borderRadius === 0 + }); + const buttonStyle = { + borderRadius: borderRadius ? borderRadius + 'px' : undefined, + ...colorProps.style + }; // The use of a `title` attribute here is soft-deprecated, but still applied + // if it had already been assigned, for the sake of backward-compatibility. + // A title will no longer be assigned for new or updated button block links. + + const wrapperClasses = classnames_default()(className, { + [`has-custom-width wp-block-button__width-${width}`]: width + }); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className: wrapperClasses + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "a", + className: buttonClasses, + href: url, + title: title, + style: buttonStyle, + value: text, + target: linkTarget, + rel: rel + })); + }, + + migrate: migrateBorderRadius +}, { + supports: { + align: true, + alignWide: false, + color: { + gradients: true + } + }, + attributes: { ...button_deprecated_blockAttributes, + linkTarget: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'target' + }, + rel: { + type: 'string', + source: 'attribute', + selector: 'a', + attribute: 'rel' + }, + placeholder: { + type: 'string' + }, + borderRadius: { + type: 'number' + }, + backgroundColor: { + type: 'string' + }, + textColor: { + type: 'string' + }, + gradient: { + type: 'string' + }, + style: { + type: 'object' + } + }, + + save({ + attributes + }) { + const { + borderRadius, + linkTarget, + rel, + text, + title, + url + } = attributes; + const buttonClasses = classnames_default()('wp-block-button__link', { + 'no-border-radius': borderRadius === 0 + }); + const buttonStyle = { + borderRadius: borderRadius ? borderRadius + 'px' : undefined + }; + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "a", + className: buttonClasses, + href: url, + title: title, + style: buttonStyle, + value: text, + target: linkTarget, + rel: rel + }); + }, + + migrate: migrateBorderRadius }, { supports: { align: true, alignWide: false }, - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + attributes: { ...button_deprecated_blockAttributes, linkTarget: { type: 'string', source: 'attribute', @@ -9961,36 +10091,41 @@ gradient: { type: 'string' } - }), - isEligible: function isEligible(attributes) { - return !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient; - }, - migrate: deprecated_migrateCustomColorsAndGradients, - save: function save(_ref2) { - var _classnames; - - var attributes = _ref2.attributes; - var backgroundColor = attributes.backgroundColor, - borderRadius = attributes.borderRadius, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor, - customGradient = attributes.customGradient, - linkTarget = attributes.linkTarget, - gradient = attributes.gradient, - rel = attributes.rel, - text = attributes.text, - textColor = attributes.textColor, - title = attributes.title, - url = attributes.url; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = !customGradient && Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - - var gradientClass = Object(external_this_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); - - var buttonClasses = classnames_default()('wp-block-button__link', (_classnames = { - 'has-text-color': textColor || customTextColor - }, Object(defineProperty["a" /* default */])(_classnames, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames, 'has-background', backgroundColor || customBackgroundColor || customGradient || gradient), Object(defineProperty["a" /* default */])(_classnames, backgroundClass, backgroundClass), Object(defineProperty["a" /* default */])(_classnames, 'no-border-radius', borderRadius === 0), Object(defineProperty["a" /* default */])(_classnames, gradientClass, gradientClass), _classnames)); - var buttonStyle = { + }, + isEligible: attributes => !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient, + migrate: Object(external_wp_compose_["compose"])(migrateBorderRadius, migrateCustomColorsAndGradients), + + save({ + attributes + }) { + const { + backgroundColor, + borderRadius, + customBackgroundColor, + customTextColor, + customGradient, + linkTarget, + gradient, + rel, + text, + textColor, + title, + url + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = !customGradient && Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + + const gradientClass = Object(external_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); + + const buttonClasses = classnames_default()('wp-block-button__link', { + 'has-text-color': textColor || customTextColor, + [textClass]: textClass, + 'has-background': backgroundColor || customBackgroundColor || customGradient || gradient, + [backgroundClass]: backgroundClass, + 'no-border-radius': borderRadius === 0, + [gradientClass]: gradientClass + }); + const buttonStyle = { background: customGradient ? customGradient : undefined, backgroundColor: backgroundClass || customGradient || gradient ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor, @@ -9999,7 +10134,7 @@ // if it had already been assigned, for the sake of backward-compatibility. // A title will no longer be assigned for new or updated button block links. - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: buttonClasses, href: url, @@ -10010,8 +10145,9 @@ rel: rel })); } -}, { - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + +}, { + attributes: { ...button_deprecated_blockAttributes, align: { type: 'string', default: 'none' @@ -10043,45 +10179,52 @@ placeholder: { type: 'string' } - }), - isEligible: function isEligible(attribute) { + }, + + isEligible(attribute) { return attribute.className && attribute.className.includes('is-style-squared'); }, - migrate: function migrate(attributes) { - var newClassName = attributes.className; + + migrate(attributes) { + let newClassName = attributes.className; if (newClassName) { newClassName = newClassName.replace(/is-style-squared[\s]?/, '').trim(); } - return deprecated_migrateCustomColorsAndGradients(button_deprecated_objectSpread({}, attributes, { + return migrateBorderRadius(migrateCustomColorsAndGradients({ ...attributes, className: newClassName ? newClassName : undefined, borderRadius: 0 })); }, - save: function save(_ref3) { - var _classnames2; - - var attributes = _ref3.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor, - linkTarget = attributes.linkTarget, - rel = attributes.rel, - text = attributes.text, - textColor = attributes.textColor, - title = attributes.title, - url = attributes.url; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var buttonClasses = classnames_default()('wp-block-button__link', (_classnames2 = { - 'has-text-color': textColor || customTextColor - }, Object(defineProperty["a" /* default */])(_classnames2, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames2, 'has-background', backgroundColor || customBackgroundColor), Object(defineProperty["a" /* default */])(_classnames2, backgroundClass, backgroundClass), _classnames2)); - var buttonStyle = { + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + customTextColor, + linkTarget, + rel, + text, + textColor, + title, + url + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const buttonClasses = classnames_default()('wp-block-button__link', { + 'has-text-color': textColor || customTextColor, + [textClass]: textClass, + 'has-background': backgroundColor || customBackgroundColor, + [backgroundClass]: backgroundClass + }); + const buttonStyle = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: buttonClasses, href: url, @@ -10092,8 +10235,9 @@ rel: rel })); } -}, { - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + +}, { + attributes: { ...button_deprecated_blockAttributes, align: { type: 'string', default: 'none' @@ -10110,29 +10254,34 @@ customTextColor: { type: 'string' } - }), - migrate: deprecated_oldColorsMigration, - save: function save(_ref4) { - var _classnames3; - - var attributes = _ref4.attributes; - var url = attributes.url, - text = attributes.text, - title = attributes.title, - backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - customBackgroundColor = attributes.customBackgroundColor, - customTextColor = attributes.customTextColor; - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var buttonClasses = classnames_default()('wp-block-button__link', (_classnames3 = { - 'has-text-color': textColor || customTextColor - }, Object(defineProperty["a" /* default */])(_classnames3, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames3, 'has-background', backgroundColor || customBackgroundColor), Object(defineProperty["a" /* default */])(_classnames3, backgroundClass, backgroundClass), _classnames3)); - var buttonStyle = { + }, + migrate: oldColorsMigration, + + save({ + attributes + }) { + const { + url, + text, + title, + backgroundColor, + textColor, + customBackgroundColor, + customTextColor + } = attributes; + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const buttonClasses = classnames_default()('wp-block-button__link', { + 'has-text-color': textColor || customTextColor, + [textClass]: textClass, + 'has-background': backgroundColor || customBackgroundColor, + [backgroundClass]: backgroundClass + }); + const buttonStyle = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + return Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: buttonClasses, href: url, @@ -10141,8 +10290,9 @@ value: text })); } -}, { - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + +}, { + attributes: { ...button_deprecated_blockAttributes, color: { type: 'string' }, @@ -10153,23 +10303,27 @@ type: 'string', default: 'none' } - }), - save: function save(_ref5) { - var attributes = _ref5.attributes; - var url = attributes.url, - text = attributes.text, - title = attributes.title, - align = attributes.align, - color = attributes.color, - textColor = attributes.textColor; - var buttonStyle = { + }, + + save({ + attributes + }) { + const { + url, + text, + title, + align, + color, + textColor + } = attributes; + const buttonStyle = { backgroundColor: color, color: textColor }; - var linkClass = 'wp-block-button__link'; - return Object(external_this_wp_element_["createElement"])("div", { - className: "align".concat(align) - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + const linkClass = 'wp-block-button__link'; + return Object(external_wp_element_["createElement"])("div", { + className: `align${align}` + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: linkClass, href: url, @@ -10178,9 +10332,10 @@ value: text })); }, - migrate: deprecated_oldColorsMigration -}, { - attributes: button_deprecated_objectSpread({}, button_deprecated_blockAttributes, { + + migrate: oldColorsMigration +}, { + attributes: { ...button_deprecated_blockAttributes, color: { type: 'string' }, @@ -10191,21 +10346,25 @@ type: 'string', default: 'none' } - }), - save: function save(_ref6) { - var attributes = _ref6.attributes; - var url = attributes.url, - text = attributes.text, - title = attributes.title, - align = attributes.align, - color = attributes.color, - textColor = attributes.textColor; - return Object(external_this_wp_element_["createElement"])("div", { - className: "align".concat(align), + }, + + save({ + attributes + }) { + const { + url, + text, + title, + align, + color, + textColor + } = attributes; + return Object(external_wp_element_["createElement"])("div", { + className: `align${align}`, style: { backgroundColor: color } - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", href: url, title: title, @@ -10215,397 +10374,117 @@ value: text })); }, - migrate: deprecated_oldColorsMigration + + migrate: oldColorsMigration }]; /* harmony default export */ var button_deprecated = (button_deprecated_deprecated); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js -var library_link = __webpack_require__(180); +var library_link = __webpack_require__("Bpkj"); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js -var link_off = __webpack_require__(205); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/color-edit.js - - - - -function color_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function color_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { color_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { color_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -var isWebPlatform = external_this_wp_element_["Platform"].OS === 'web'; // The code in this file is copied entirely from the "color" and "style" support flags -// The flag can't be used at the moment because of the extra wrapper around -// the button block markup. - -function getBlockDOMNode(clientId) { - return document.getElementById('block-' + clientId); -} -/** - * Removed undefined values from nested object. - * - * @param {*} object - * @return {*} Object cleaned from undefined values - */ - - -var color_edit_cleanEmptyObject = function cleanEmptyObject(object) { - if (!Object(external_this_lodash_["isObject"])(object)) { - return object; - } - - var cleanedNestedObjects = Object(external_this_lodash_["pickBy"])(Object(external_this_lodash_["mapValues"])(object, cleanEmptyObject), external_this_lodash_["identity"]); - return Object(external_this_lodash_["isEqual"])(cleanedNestedObjects, {}) ? undefined : cleanedNestedObjects; -}; - -function ColorPanel(_ref) { - var settings = _ref.settings, - clientId = _ref.clientId, - _ref$enableContrastCh = _ref.enableContrastChecking, - enableContrastChecking = _ref$enableContrastCh === void 0 ? true : _ref$enableContrastCh; - var _window = window, - getComputedStyle = _window.getComputedStyle, - Node = _window.Node; - - var _useState = Object(external_this_wp_element_["useState"])(), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - detectedBackgroundColor = _useState2[0], - setDetectedBackgroundColor = _useState2[1]; - - var _useState3 = Object(external_this_wp_element_["useState"])(), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - detectedColor = _useState4[0], - setDetectedColor = _useState4[1]; - - var title = isWebPlatform ? Object(external_this_wp_i18n_["__"])('Color settings') : Object(external_this_wp_i18n_["__"])('Color Settings'); - Object(external_this_wp_element_["useEffect"])(function () { - if (isWebPlatform && !enableContrastChecking) { - return; - } - - var colorsDetectionElement = getBlockDOMNode(clientId); - - if (!colorsDetectionElement) { - return; - } - - setDetectedColor(getComputedStyle(colorsDetectionElement).color); - var backgroundColorNode = colorsDetectionElement; - var backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; - - while (backgroundColor === 'rgba(0, 0, 0, 0)' && backgroundColorNode.parentNode && backgroundColorNode.parentNode.nodeType === Node.ELEMENT_NODE) { - backgroundColorNode = backgroundColorNode.parentNode; - backgroundColor = getComputedStyle(backgroundColorNode).backgroundColor; - } - - setDetectedBackgroundColor(backgroundColor); - }); - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalPanelColorGradientSettings"], { - title: title, - initialOpen: false, - settings: settings - }, isWebPlatform && enableContrastChecking && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["ContrastChecker"], { - backgroundColor: detectedBackgroundColor, - textColor: detectedColor - }))); -} -/** - * Inspector control panel containing the color related configuration - * - * @param {Object} props - * - * @return {WPElement} Color edit element. - */ - - -function ColorEdit(props) { - var _style$color2, _style$color3, _style$color4; - - var attributes = props.attributes; - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - return select('core/block-editor').getSettings(); - }, []), - colors = _useSelect.colors, - gradients = _useSelect.gradients; // Shouldn't be needed but right now the ColorGradientsPanel - // can trigger both onChangeColor and onChangeBackground - // synchronously causing our two callbacks to override changes - // from each other. - - - var localAttributes = Object(external_this_wp_element_["useRef"])(attributes); - Object(external_this_wp_element_["useEffect"])(function () { - localAttributes.current = attributes; - }, [attributes]); - var style = attributes.style, - textColor = attributes.textColor, - backgroundColor = attributes.backgroundColor, - gradient = attributes.gradient; - var gradientValue; - - if (gradient) { - gradientValue = Object(external_this_wp_blockEditor_["getGradientValueBySlug"])(gradients, gradient); - } else { - var _style$color; - - gradientValue = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.gradient; - } - - var onChangeColor = function onChangeColor(name) { - return function (value) { - var _localAttributes$curr, _localAttributes$curr2; - - var colorObject = Object(external_this_wp_blockEditor_["getColorObjectByColorValue"])(colors, value); - var attributeName = name + 'Color'; - - var newStyle = color_edit_objectSpread({}, localAttributes.current.style, { - color: color_edit_objectSpread({}, (_localAttributes$curr = localAttributes.current) === null || _localAttributes$curr === void 0 ? void 0 : (_localAttributes$curr2 = _localAttributes$curr.style) === null || _localAttributes$curr2 === void 0 ? void 0 : _localAttributes$curr2.color, Object(defineProperty["a" /* default */])({}, name, (colorObject === null || colorObject === void 0 ? void 0 : colorObject.slug) ? undefined : value)) - }); - - var newNamedColor = (colorObject === null || colorObject === void 0 ? void 0 : colorObject.slug) ? colorObject.slug : undefined; - - var newAttributes = Object(defineProperty["a" /* default */])({ - style: color_edit_cleanEmptyObject(newStyle) - }, attributeName, newNamedColor); - - props.setAttributes(newAttributes); - localAttributes.current = color_edit_objectSpread({}, localAttributes.current, {}, newAttributes); - }; - }; - - var onChangeGradient = function onChangeGradient(value) { - var slug = Object(external_this_wp_blockEditor_["getGradientSlugByValue"])(gradients, value); - var newAttributes; - - if (slug) { - var _localAttributes$curr3, _localAttributes$curr4, _localAttributes$curr5; - - var newStyle = color_edit_objectSpread({}, (_localAttributes$curr3 = localAttributes.current) === null || _localAttributes$curr3 === void 0 ? void 0 : _localAttributes$curr3.style, { - color: color_edit_objectSpread({}, (_localAttributes$curr4 = localAttributes.current) === null || _localAttributes$curr4 === void 0 ? void 0 : (_localAttributes$curr5 = _localAttributes$curr4.style) === null || _localAttributes$curr5 === void 0 ? void 0 : _localAttributes$curr5.color, { - gradient: undefined - }) - }); - - newAttributes = { - style: color_edit_cleanEmptyObject(newStyle), - gradient: slug - }; - } else { - var _localAttributes$curr6, _localAttributes$curr7, _localAttributes$curr8; - - var _newStyle = color_edit_objectSpread({}, (_localAttributes$curr6 = localAttributes.current) === null || _localAttributes$curr6 === void 0 ? void 0 : _localAttributes$curr6.style, { - color: color_edit_objectSpread({}, (_localAttributes$curr7 = localAttributes.current) === null || _localAttributes$curr7 === void 0 ? void 0 : (_localAttributes$curr8 = _localAttributes$curr7.style) === null || _localAttributes$curr8 === void 0 ? void 0 : _localAttributes$curr8.color, { - gradient: value - }) - }); - - newAttributes = { - style: color_edit_cleanEmptyObject(_newStyle), - gradient: undefined - }; - } - - props.setAttributes(newAttributes); - localAttributes.current = color_edit_objectSpread({}, localAttributes.current, {}, newAttributes); - }; - - return Object(external_this_wp_element_["createElement"])(ColorPanel, { - enableContrastChecking: !gradient && !(style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.gradient), - clientId: props.clientId, - settings: [{ - label: Object(external_this_wp_i18n_["__"])('Text Color'), - onColorChange: onChangeColor('text'), - colorValue: Object(external_this_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, textColor, style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.text).color - }, { - label: Object(external_this_wp_i18n_["__"])('Background Color'), - onColorChange: onChangeColor('background'), - colorValue: Object(external_this_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, backgroundColor, style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.background).color, - gradientValue: gradientValue, - onGradientChange: onChangeGradient - }] - }); -} - -/* harmony default export */ var color_edit = (ColorEdit); - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/color-props.js - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - // The code in this file is copied entirely from the "color" and "style" support flags -// The flag can't be used at the moment because of the extra wrapper around -// the button block markup. - -function getColorAndStyleProps(attributes, colors) { - var _style$color, _style$color2, _style$color3, _style$color4, _classnames, _style$color5, _style$color6, _style$color7, _style$color8, _style$color9, _style$color10; - - var isEdit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - // I'd have prefered to avoid the "style" attribute usage here - var backgroundColor = attributes.backgroundColor, - textColor = attributes.textColor, - gradient = attributes.gradient, - style = attributes.style; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - - var gradientClass = Object(external_this_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); - - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()(textClass, gradientClass, (_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, backgroundClass, !(style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.gradient) && !!backgroundClass), Object(defineProperty["a" /* default */])(_classnames, 'has-text-color', textColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.text)), Object(defineProperty["a" /* default */])(_classnames, 'has-background', backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.background) || gradient || (style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.gradient)), _classnames)); - var styleProp = (style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.background) || (style === null || style === void 0 ? void 0 : (_style$color6 = style.color) === null || _style$color6 === void 0 ? void 0 : _style$color6.text) || (style === null || style === void 0 ? void 0 : (_style$color7 = style.color) === null || _style$color7 === void 0 ? void 0 : _style$color7.gradient) ? { - background: (style === null || style === void 0 ? void 0 : (_style$color8 = style.color) === null || _style$color8 === void 0 ? void 0 : _style$color8.gradient) ? style.color.gradient : undefined, - backgroundColor: (style === null || style === void 0 ? void 0 : (_style$color9 = style.color) === null || _style$color9 === void 0 ? void 0 : _style$color9.background) ? style.color.background : undefined, - color: (style === null || style === void 0 ? void 0 : (_style$color10 = style.color) === null || _style$color10 === void 0 ? void 0 : _style$color10.text) ? style.color.text : undefined - } : {}; // This is needed only for themes that don't load their color stylesheets in the editor - // We force an inline style to apply the color. - - if (isEdit) { - if (backgroundColor) { - var backgroundColorObject = Object(external_this_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, backgroundColor); - styleProp.backgroundColor = backgroundColorObject.color; - } - - if (textColor) { - var textColorObject = Object(external_this_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, textColor); - styleProp.color = textColorObject.color; - } - } - - return { - className: !!className ? className : undefined, - style: styleProp - }; -} +var link_off = __webpack_require__("Mp0b"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/edit.js - -function button_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function button_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { button_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { button_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - -var edit_NEW_TAB_REL = 'noreferrer noopener'; -var MIN_BORDER_RADIUS_VALUE = 0; -var MAX_BORDER_RADIUS_VALUE = 50; -var INITIAL_BORDER_RADIUS_POSITION = 5; - -function BorderPanel(_ref) { - var _ref$borderRadius = _ref.borderRadius, - borderRadius = _ref$borderRadius === void 0 ? '' : _ref$borderRadius, - setAttributes = _ref.setAttributes; - var initialBorderRadius = borderRadius; - var setBorderRadius = Object(external_this_wp_element_["useCallback"])(function (newBorderRadius) { - if (newBorderRadius === undefined) setAttributes({ - borderRadius: initialBorderRadius - });else setAttributes({ - borderRadius: newBorderRadius - }); - }, [setAttributes]); - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Border settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - value: borderRadius, - label: Object(external_this_wp_i18n_["__"])('Border radius'), - min: MIN_BORDER_RADIUS_VALUE, - max: MAX_BORDER_RADIUS_VALUE, - initialPosition: INITIAL_BORDER_RADIUS_POSITION, - allowReset: true, - onChange: setBorderRadius - })); -} - -function URLPicker(_ref2) { - var _ref4; - - var isSelected = _ref2.isSelected, - url = _ref2.url, - setAttributes = _ref2.setAttributes, - opensInNewTab = _ref2.opensInNewTab, - onToggleOpenInNewTab = _ref2.onToggleOpenInNewTab; - - var _useState = Object(external_this_wp_element_["useState"])(false), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - isURLPickerOpen = _useState2[0], - setIsURLPickerOpen = _useState2[1]; - - var urlIsSet = !!url; - var urlIsSetandSelected = urlIsSet && isSelected; - - var openLinkControl = function openLinkControl() { - setIsURLPickerOpen(true); - return false; // prevents default behaviour for event - }; - - var unlinkButton = function unlinkButton() { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + +const edit_NEW_TAB_REL = 'noreferrer noopener'; + +function WidthPanel({ + selectedWidth, + setAttributes +}) { + function handleChange(newWidth) { + // Check if we are toggling the width off + const width = selectedWidth === newWidth ? undefined : newWidth; // Update attributes + + setAttributes({ + width + }); + } + + return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Width settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { + "aria-label": Object(external_wp_i18n_["__"])('Button width') + }, [25, 50, 75, 100].map(widthValue => { + return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { + key: widthValue, + isSmall: true, + isPrimary: widthValue === selectedWidth, + onClick: () => handleChange(widthValue) + }, widthValue, "%"); + }))); +} + +function URLPicker({ + isSelected, + url, + setAttributes, + opensInNewTab, + onToggleOpenInNewTab, + anchorRef, + richTextRef +}) { + const [isEditingURL, setIsEditingURL] = Object(external_wp_element_["useState"])(false); + const isURLSet = !!url; + + const startEditing = event => { + event.preventDefault(); + setIsEditingURL(true); + }; + + const unlink = () => { setAttributes({ url: undefined, linkTarget: undefined, rel: undefined }); - setIsURLPickerOpen(false); - }; - - var linkControl = (isURLPickerOpen || urlIsSetandSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Popover"], { + setIsEditingURL(false); + }; + + Object(external_wp_element_["useEffect"])(() => { + if (!isSelected) { + setIsEditingURL(false); + } + }, [isSelected]); + const isLinkControlVisible = isSelected && (isEditingURL || isURLSet); + const linkControl = isLinkControlVisible && Object(external_wp_element_["createElement"])(external_wp_components_["Popover"], { position: "bottom center", - onClose: function onClose() { - return setIsURLPickerOpen(false); - } - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalLinkControl"], { + onClose: () => { + var _richTextRef$current; + + setIsEditingURL(false); + (_richTextRef$current = richTextRef.current) === null || _richTextRef$current === void 0 ? void 0 : _richTextRef$current.focus(); + }, + anchorRef: anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current, + focusOnMount: isEditingURL ? 'firstElement' : false + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLinkControl"], { className: "wp-block-navigation-link__inline-link-input", value: { - url: url, - opensInNewTab: opensInNewTab - }, - onChange: function onChange(_ref3) { - var _ref3$url = _ref3.url, - newURL = _ref3$url === void 0 ? '' : _ref3$url, - newOpensInNewTab = _ref3.opensInNewTab; + url, + opensInNewTab + }, + onChange: ({ + url: newURL = '', + opensInNewTab: newOpensInNewTab + }) => { setAttributes({ url: newURL }); @@ -10613,54 +10492,72 @@ if (opensInNewTab !== newOpensInNewTab) { onToggleOpenInNewTab(newOpensInNewTab); } - } - })); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, !urlIsSet && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + }, + onRemove: () => { + var _richTextRef$current2; + + unlink(); + (_richTextRef$current2 = richTextRef.current) === null || _richTextRef$current2 === void 0 ? void 0 : _richTextRef$current2.focus(); + }, + forceIsEditingLink: isEditingURL + })); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, !isURLSet && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { name: "link", icon: library_link["a" /* default */], - title: Object(external_this_wp_i18n_["__"])('Link'), - shortcut: external_this_wp_keycodes_["displayShortcut"].primary('k'), - onClick: openLinkControl - }), urlIsSetandSelected && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { + title: Object(external_wp_i18n_["__"])('Link'), + shortcut: external_wp_keycodes_["displayShortcut"].primary('k'), + onClick: startEditing + }), isURLSet && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { name: "link", icon: link_off["a" /* default */], - title: Object(external_this_wp_i18n_["__"])('Unlink'), - shortcut: external_this_wp_keycodes_["displayShortcut"].primaryShift('k'), - onClick: unlinkButton, + title: Object(external_wp_i18n_["__"])('Unlink'), + shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('k'), + onClick: unlink, isActive: true - }))), isSelected && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["KeyboardShortcuts"], { + })), isSelected && Object(external_wp_element_["createElement"])(external_wp_components_["KeyboardShortcuts"], { bindGlobal: true, - shortcuts: (_ref4 = {}, Object(defineProperty["a" /* default */])(_ref4, external_this_wp_keycodes_["rawShortcut"].primary('k'), openLinkControl), Object(defineProperty["a" /* default */])(_ref4, external_this_wp_keycodes_["rawShortcut"].primaryShift('k'), unlinkButton), _ref4) + shortcuts: { + [external_wp_keycodes_["rawShortcut"].primary('k')]: startEditing, + [external_wp_keycodes_["rawShortcut"].primaryShift('k')]: () => { + var _richTextRef$current3; + + unlink(); + (_richTextRef$current3 = richTextRef.current) === null || _richTextRef$current3 === void 0 ? void 0 : _richTextRef$current3.focus(); + } + } }), linkControl); } function ButtonEdit(props) { - var attributes = props.attributes, - setAttributes = props.setAttributes, - className = props.className, - isSelected = props.isSelected, - onReplace = props.onReplace, - mergeBlocks = props.mergeBlocks; - var borderRadius = attributes.borderRadius, - linkTarget = attributes.linkTarget, - placeholder = attributes.placeholder, - rel = attributes.rel, - text = attributes.text, - url = attributes.url; - var onSetLinkRel = Object(external_this_wp_element_["useCallback"])(function (value) { + var _style$border; + + const { + attributes, + setAttributes, + className, + isSelected, + onReplace, + mergeBlocks + } = props; + const { + linkTarget, + placeholder, + rel, + style, + text, + url, + width + } = attributes; + const onSetLinkRel = Object(external_wp_element_["useCallback"])(value => { setAttributes({ rel: value }); }, [setAttributes]); - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - return select('core/block-editor').getSettings(); - }, []), - colors = _useSelect.colors; - - var onToggleOpenInNewTab = Object(external_this_wp_element_["useCallback"])(function (value) { - var newLinkTarget = value ? '_blank' : undefined; - var updatedRel = rel; + const onToggleOpenInNewTab = Object(external_wp_element_["useCallback"])(value => { + const newLinkTarget = value ? '_blank' : undefined; + let updatedRel = rel; if (newLinkTarget && !rel) { updatedRel = edit_NEW_TAB_REL; @@ -10673,50 +10570,62 @@ rel: updatedRel }); }, [rel, setAttributes]); - var colorProps = getColorAndStyleProps(attributes, colors, true); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(color_edit, props), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - placeholder: placeholder || Object(external_this_wp_i18n_["__"])('Add text…'), + + const setButtonText = newText => { + // Remove anchor tags from button text content. + setAttributes({ + text: newText.replace(/<\/?a[^>]*>/g, '') + }); + }; + + const borderRadius = style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius; + const colorProps = Object(external_wp_blockEditor_["__experimentalUseColorProps"])(attributes); + const ref = Object(external_wp_element_["useRef"])(); + const richTextRef = Object(external_wp_element_["useRef"])(); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + ref + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, blockProps, { + className: classnames_default()(blockProps.className, { + [`has-custom-width wp-block-button__width-${width}`]: width, + [`has-custom-font-size`]: blockProps.style.fontSize + }) + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + ref: richTextRef, + "aria-label": Object(external_wp_i18n_["__"])('Button text'), + placeholder: placeholder || Object(external_wp_i18n_["__"])('Add text…'), value: text, - onChange: function onChange(value) { - return setAttributes({ - text: value - }); - }, + onChange: value => setButtonText(value), withoutInteractiveFormatting: true, className: classnames_default()(className, 'wp-block-button__link', colorProps.className, { 'no-border-radius': borderRadius === 0 }), - style: button_edit_objectSpread({ - borderRadius: borderRadius ? borderRadius + 'px' : undefined - }, colorProps.style), - onSplit: function onSplit(value) { - return Object(external_this_wp_blocks_["createBlock"])('core/button', button_edit_objectSpread({}, attributes, { - text: value - })); - }, + style: { + borderRadius: borderRadius ? borderRadius + 'px' : undefined, + ...colorProps.style + }, + onSplit: value => Object(external_wp_blocks_["createBlock"])('core/button', { ...attributes, + text: value + }), onReplace: onReplace, onMerge: mergeBlocks, identifier: "text" - })), Object(external_this_wp_element_["createElement"])(URLPicker, { + })), Object(external_wp_element_["createElement"])(URLPicker, { url: url, setAttributes: setAttributes, isSelected: isSelected, opensInNewTab: linkTarget === '_blank', - onToggleOpenInNewTab: onToggleOpenInNewTab - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(BorderPanel, { - borderRadius: borderRadius, + onToggleOpenInNewTab: onToggleOpenInNewTab, + anchorRef: ref, + richTextRef: richTextRef + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(WidthPanel, { + selectedWidth: width, setAttributes: setAttributes - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Link settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Open in new tab'), - onChange: onToggleOpenInNewTab, - checked: linkTarget === '_blank' - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { - label: Object(external_this_wp_i18n_["__"])('Link rel'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorAdvancedControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + label: Object(external_wp_i18n_["__"])('Link rel'), value: rel || '', onChange: onSetLinkRel - })))); + }))); } /* harmony default export */ var button_edit = (ButtonEdit); @@ -10724,46 +10633,55 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/save.js - -function save_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function save_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { save_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { save_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function button_save_save(_ref) { - var attributes = _ref.attributes; - var borderRadius = attributes.borderRadius, - linkTarget = attributes.linkTarget, - rel = attributes.rel, - text = attributes.text, - title = attributes.title, - url = attributes.url; - var colorProps = getColorAndStyleProps(attributes); - var buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function button_save_save({ + attributes, + className +}) { + var _style$border, _style$typography; + + const { + fontSize, + linkTarget, + rel, + style, + text, + title, + url, + width + } = attributes; + + if (!text) { + return null; + } + + const borderRadius = style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius; + const colorProps = Object(external_wp_blockEditor_["__experimentalGetColorClassesAndStyles"])(attributes); + const buttonClasses = classnames_default()('wp-block-button__link', colorProps.className, { 'no-border-radius': borderRadius === 0 }); - - var buttonStyle = save_objectSpread({ - borderRadius: borderRadius ? borderRadius + 'px' : undefined - }, colorProps.style); // The use of a `title` attribute here is soft-deprecated, but still applied + const buttonStyle = { + borderRadius: borderRadius ? borderRadius + 'px' : undefined, + ...colorProps.style + }; // The use of a `title` attribute here is soft-deprecated, but still applied // if it had already been assigned, for the sake of backward-compatibility. // A title will no longer be assigned for new or updated button block links. - - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + const wrapperClasses = classnames_default()(className, { + [`has-custom-width wp-block-button__width-${width}`]: width, + [`has-custom-font-size`]: fontSize || (style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.fontSize) + }); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className: wrapperClasses + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "a", className: buttonClasses, href: url, @@ -10776,27 +10694,26 @@ } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/button/index.js - - -function button_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function button_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { button_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { button_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - - -var button_metadata = { +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +const button_metadata = { + apiVersion: 2, name: "core/button", + title: "Button", category: "design", parent: ["core/buttons"], + description: "Prompt visitors to take action with a button-style link.", + keywords: ["link"], + textdomain: "default", attributes: { url: { type: "string", @@ -10830,12 +10747,6 @@ placeholder: { type: "string" }, - borderRadius: { - type: "number" - }, - style: { - type: "object" - }, backgroundColor: { type: "string" }, @@ -10844,78 +10755,125 @@ }, gradient: { type: "string" + }, + width: { + type: "number" } }, supports: { anchor: true, align: true, alignWide: false, + color: { + __experimentalSkipSerialization: true, + gradients: true + }, + typography: { + fontSize: true, + __experimentalFontFamily: true + }, reusable: false, - lightBlockWrapper: true - } -}; - -var button_name = button_metadata.name; - -var button_settings = { - title: Object(external_this_wp_i18n_["__"])('Button'), - description: Object(external_this_wp_i18n_["__"])('Prompt visitors to take action with a button-style link.'), - icon: library_button, - keywords: [Object(external_this_wp_i18n_["__"])('link')], + __experimentalBorder: { + radius: true, + __experimentalSkipSerialization: true + }, + __experimentalSelector: ".wp-block-button__link" + }, + styles: [{ + name: "fill", + label: "Fill", + isDefault: true + }, { + name: "outline", + label: "Outline" + }], + editorStyle: "wp-block-button-editor", + style: "wp-block-button" +}; + +const { + name: button_name +} = button_metadata; + +const button_settings = { + icon: library_button["a" /* default */], example: { attributes: { className: 'is-style-fill', backgroundColor: 'vivid-green-cyan', - text: Object(external_this_wp_i18n_["__"])('Call to Action') - } - }, - styles: [{ - name: 'fill', - label: Object(external_this_wp_i18n_["__"])('Fill'), - isDefault: true - }, { - name: 'outline', - label: Object(external_this_wp_i18n_["__"])('Outline') - }], + text: Object(external_wp_i18n_["__"])('Call to Action') + } + }, edit: button_edit, save: button_save_save, deprecated: button_deprecated, - merge: function merge(a, _ref) { - var _ref$text = _ref.text, - text = _ref$text === void 0 ? '' : _ref$text; - return button_objectSpread({}, a, { - text: (a.text || '') + text - }); - } + merge: (a, { + text = '' + }) => ({ ...a, + text: (a.text || '') + text + }) }; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/edit.js /** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - - -var ALLOWED_BLOCKS = [button_name]; -var BUTTONS_TEMPLATE = [['core/button']]; // Inside buttons block alignment options are not supported. - -var alignmentHooksSetting = { - isEmbedButton: true -}; - -function ButtonsEdit() { - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalAlignmentHookSettingsProvider"], { - value: alignmentHooksSetting - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +const ALLOWED_BLOCKS = [button_name]; +const BUTTONS_TEMPLATE = [['core/button']]; +const LAYOUT = { + type: 'default', + alignments: [] +}; +const VERTICAL_JUSTIFY_CONTROLS = ['left', 'center', 'right']; +const HORIZONTAL_JUSTIFY_CONTROLS = ['left', 'center', 'right', 'space-between']; + +function ButtonsEdit({ + attributes: { + contentJustification, + orientation + }, + setAttributes +}) { + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()({ + [`is-content-justification-${contentJustification}`]: contentJustification, + 'is-vertical': orientation === 'vertical' + }) + }); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])(blockProps, { allowedBlocks: ALLOWED_BLOCKS, template: BUTTONS_TEMPLATE, - orientation: "horizontal" - }))); + orientation, + __experimentalLayout: LAYOUT, + templateInsertUpdatesSelection: true + }); + const justifyControls = orientation === 'vertical' ? VERTICAL_JUSTIFY_CONTROLS : HORIZONTAL_JUSTIFY_CONTROLS; + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["JustifyContentControl"], { + allowedControls: justifyControls, + value: contentJustification, + onChange: value => setAttributes({ + contentJustification: value + }), + popoverProps: { + position: 'bottom right', + isAlternate: true + } + })), Object(external_wp_element_["createElement"])("div", innerBlocksProps)); } /* harmony default export */ var buttons_edit = (ButtonsEdit); @@ -10924,12 +10882,52 @@ /** - * WordPress dependencies - */ - -function buttons_save_save() { - return Object(external_this_wp_element_["createElement"])("div", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); -} + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function buttons_save_save({ + attributes: { + contentJustification, + orientation + } +}) { + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className: classnames_default()({ + [`is-content-justification-${contentJustification}`]: contentJustification, + 'is-vertical': orientation === 'vertical' + }) + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/variations.js +/** + * WordPress dependencies + */ + +const variations_variations = [{ + name: 'buttons-horizontal', + isDefault: true, + title: Object(external_wp_i18n_["__"])('Horizontal'), + description: Object(external_wp_i18n_["__"])('Buttons shown in a row.'), + attributes: { + orientation: 'horizontal' + }, + scope: ['transform'] +}, { + name: 'buttons-vertical', + title: Object(external_wp_i18n_["__"])('Vertical'), + description: Object(external_wp_i18n_["__"])('Buttons shown in a column.'), + attributes: { + orientation: 'vertical' + }, + scope: ['transform'] +}]; +/* harmony default export */ var buttons_variations = (variations_variations); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/buttons/index.js /** @@ -10943,27 +10941,57 @@ -var buttons_metadata = { + +const buttons_metadata = { + apiVersion: 2, name: "core/buttons", + title: "Buttons", category: "design", + description: "Prompt visitors to take action with a group of button-style links.", + keywords: ["link"], + textdomain: "default", + attributes: { + contentJustification: { + type: "string" + }, + orientation: { + type: "string", + "default": "horizontal" + } + }, supports: { anchor: true, - align: true, - alignWide: false, - lightBlockWrapper: true - } -}; - -var buttons_name = buttons_metadata.name; - -var buttons_settings = { - title: Object(external_this_wp_i18n_["__"])('Buttons'), - description: Object(external_this_wp_i18n_["__"])('Prompt visitors to take action with a group of button-style links.'), - icon: library_button, - keywords: [Object(external_this_wp_i18n_["__"])('link')], + align: ["wide", "full"] + }, + editorStyle: "wp-block-buttons-editor", + style: "wp-block-buttons" +}; + + +const { + name: buttons_name +} = buttons_metadata; + +const buttons_settings = { + icon: library_buttons, + example: { + innerBlocks: [{ + name: 'core/button', + attributes: { + text: Object(external_wp_i18n_["__"])('Find out more') + } + }, { + name: 'core/button', + attributes: { + text: Object(external_wp_i18n_["__"])('Contact us') + } + }] + }, + deprecated: buttons_deprecated, transforms: buttons_transforms, edit: buttons_edit, - save: buttons_save_save + save: buttons_save_save, + variations: buttons_variations }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/calendar.js @@ -10973,139 +11001,94 @@ * WordPress dependencies */ -var calendar = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const calendar = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" })); /* harmony default export */ var library_calendar = (calendar); -// EXTERNAL MODULE: external {"this":"moment"} -var external_this_moment_ = __webpack_require__(43); -var external_this_moment_default = /*#__PURE__*/__webpack_require__.n(external_this_moment_); +// EXTERNAL MODULE: external "moment" +var external_moment_ = __webpack_require__("wy2R"); +var external_moment_default = /*#__PURE__*/__webpack_require__.n(external_moment_); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/calendar/edit.js - - - - - - - -function calendar_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function calendar_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { calendar_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { calendar_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function calendar_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (calendar_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function calendar_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - -var edit_CalendarEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(CalendarEdit, _Component); - - var _super = calendar_edit_createSuper(CalendarEdit); - - function CalendarEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, CalendarEdit); - - _this = _super.apply(this, arguments); - _this.getYearMonth = memize_default()(_this.getYearMonth.bind(Object(assertThisInitialized["a" /* default */])(_this)), { - maxSize: 1 - }); - _this.getServerSideAttributes = memize_default()(_this.getServerSideAttributes.bind(Object(assertThisInitialized["a" /* default */])(_this)), { - maxSize: 1 - }); - return _this; - } - - Object(createClass["a" /* default */])(CalendarEdit, [{ - key: "getYearMonth", - value: function getYearMonth(date) { - if (!date) { - return {}; - } - - var momentDate = external_this_moment_default()(date); - return { - year: momentDate.year(), - month: momentDate.month() + 1 - }; - } - }, { - key: "getServerSideAttributes", - value: function getServerSideAttributes(attributes, date) { - return calendar_edit_objectSpread({}, attributes, {}, this.getYearMonth(date)); - } - }, { - key: "render", - value: function render() { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_serverSideRender_default.a, { - block: "core/calendar", - attributes: this.getServerSideAttributes(this.props.attributes, this.props.date) - })); - } - }]); - - return CalendarEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var calendar_edit = (Object(external_this_wp_data_["withSelect"])(function (select) { - var coreEditorSelect = select('core/editor'); - - if (!coreEditorSelect) { - return; - } - - var getEditedPostAttribute = coreEditorSelect.getEditedPostAttribute; - var postType = getEditedPostAttribute('type'); // Dates are used to overwrite year and month used on the calendar. - // This overwrite should only happen for 'post' post types. - // For other post types the calendar always displays the current month. - +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + +const getYearMonth = memize_default()(date => { + if (!date) { + return {}; + } + + const momentDate = external_moment_default()(date); return { - date: postType === 'post' ? getEditedPostAttribute('date') : undefined - }; -})(edit_CalendarEdit)); + year: momentDate.year(), + month: momentDate.month() + 1 + }; +}); +function CalendarEdit({ + attributes +}) { + const date = Object(external_wp_data_["useSelect"])(select => { + // FIXME: @wordpress/block-library should not depend on @wordpress/editor. + // Blocks can be loaded into a *non-post* block editor. + // eslint-disable-next-line @wordpress/data-no-store-string-literals + const editorSelectors = select('core/editor'); + + let _date; + + if (editorSelectors) { + const postType = editorSelectors.getEditedPostAttribute('type'); // Dates are used to overwrite year and month used on the calendar. + // This overwrite should only happen for 'post' post types. + // For other post types the calendar always displays the current month. + + if (postType === 'post') { + _date = editorSelectors.getEditedPostAttribute('date'); + } + } + + return _date; + }, []); + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(external_wp_serverSideRender_default.a, { + block: "core/calendar", + attributes: { ...attributes, + ...getYearMonth(date) + } + }))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/calendar/index.js /** * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var calendar_metadata = { +/** + * Internal dependencies + */ + +const calendar_metadata = { + apiVersion: 2, name: "core/calendar", + title: "Calendar", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "A calendar of your site\u2019s posts.", + keywords: ["posts", "archive"], + textdomain: "default", + attributes: { month: { type: "integer" }, @@ -11115,18 +11098,18 @@ }, supports: { align: true - } -}; - -var calendar_name = calendar_metadata.name; - -var calendar_settings = { - title: Object(external_this_wp_i18n_["__"])('Calendar'), - description: Object(external_this_wp_i18n_["__"])('A calendar of your site’s posts.'), + }, + style: "wp-block-calendar" +}; + +const { + name: calendar_name +} = calendar_metadata; + +const calendar_settings = { icon: library_calendar, - keywords: [Object(external_this_wp_i18n_["__"])('posts'), Object(external_this_wp_i18n_["__"])('archive')], example: {}, - edit: calendar_edit + edit: CalendarEdit }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/category.js @@ -11136,11 +11119,13 @@ * WordPress dependencies */ -var category_category = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" +const category_category = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z", + fillRule: "evenodd", + clipRule: "evenodd" })); /* harmony default export */ var library_category = (category_category); @@ -11151,10 +11136,10 @@ * WordPress dependencies */ -var pin = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { +const pin = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M10.44 3.02l1.82-1.82 6.36 6.35-1.83 1.82c-1.05-.68-2.48-.57-3.41.36l-.75.75c-.92.93-1.04 2.35-.35 3.41l-1.83 1.82-2.41-2.41-2.8 2.79c-.42.42-3.38 2.71-3.8 2.29s1.86-3.39 2.28-3.81l2.79-2.79L4.1 9.36l1.83-1.82c1.05.69 2.48.57 3.4-.36l.75-.75c.93-.92 1.05-2.35.36-3.41z" })); /* harmony default export */ var library_pin = (pin); @@ -11162,267 +11147,165 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/categories/edit.js - - - - - - -function categories_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (categories_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function categories_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - -var edit_CategoriesEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(CategoriesEdit, _Component); - - var _super = categories_edit_createSuper(CategoriesEdit); - - function CategoriesEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, CategoriesEdit); - - _this = _super.apply(this, arguments); - _this.toggleDisplayAsDropdown = _this.toggleDisplayAsDropdown.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.toggleShowPostCounts = _this.toggleShowPostCounts.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.toggleShowHierarchy = _this.toggleShowHierarchy.bind(Object(assertThisInitialized["a" /* default */])(_this)); - return _this; - } - - Object(createClass["a" /* default */])(CategoriesEdit, [{ - key: "toggleDisplayAsDropdown", - value: function toggleDisplayAsDropdown() { - var _this$props = this.props, - attributes = _this$props.attributes, - setAttributes = _this$props.setAttributes; - var displayAsDropdown = attributes.displayAsDropdown; - setAttributes({ - displayAsDropdown: !displayAsDropdown - }); - } - }, { - key: "toggleShowPostCounts", - value: function toggleShowPostCounts() { - var _this$props2 = this.props, - attributes = _this$props2.attributes, - setAttributes = _this$props2.setAttributes; - var showPostCounts = attributes.showPostCounts; - setAttributes({ - showPostCounts: !showPostCounts - }); - } - }, { - key: "toggleShowHierarchy", - value: function toggleShowHierarchy() { - var _this$props3 = this.props, - attributes = _this$props3.attributes, - setAttributes = _this$props3.setAttributes; - var showHierarchy = attributes.showHierarchy; - setAttributes({ - showHierarchy: !showHierarchy - }); - } - }, { - key: "getCategories", - value: function getCategories() { - var parentId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var categories = this.props.categories; - - if (!categories || !categories.length) { - return []; - } - - if (parentId === null) { - return categories; - } - - return categories.filter(function (category) { - return category.parent === parentId; - }); - } - }, { - key: "getCategoryListClassName", - value: function getCategoryListClassName(level) { - return "wp-block-categories__list wp-block-categories__list-level-".concat(level); - } - }, { - key: "renderCategoryName", - value: function renderCategoryName(category) { - if (!category.name) { - return Object(external_this_wp_i18n_["__"])('(Untitled)'); - } - - return Object(external_this_lodash_["unescape"])(category.name).trim(); - } - }, { - key: "renderCategoryList", - value: function renderCategoryList() { - var _this2 = this; - - var showHierarchy = this.props.attributes.showHierarchy; - var parentId = showHierarchy ? 0 : null; - var categories = this.getCategories(parentId); - return Object(external_this_wp_element_["createElement"])("ul", { - className: this.getCategoryListClassName(0) - }, categories.map(function (category) { - return _this2.renderCategoryListItem(category, 0); - })); - } - }, { - key: "renderCategoryListItem", - value: function renderCategoryListItem(category, level) { - var _this3 = this; - - var _this$props$attribute = this.props.attributes, - showHierarchy = _this$props$attribute.showHierarchy, - showPostCounts = _this$props$attribute.showPostCounts; - var childCategories = this.getCategories(category.id); - return Object(external_this_wp_element_["createElement"])("li", { - key: category.id - }, Object(external_this_wp_element_["createElement"])("a", { - href: category.link, - target: "_blank", - rel: "noreferrer noopener" - }, this.renderCategoryName(category)), showPostCounts && Object(external_this_wp_element_["createElement"])("span", { - className: "wp-block-categories__post-count" - }, ' ', "(", category.count, ")"), showHierarchy && !!childCategories.length && Object(external_this_wp_element_["createElement"])("ul", { - className: this.getCategoryListClassName(level + 1) - }, childCategories.map(function (childCategory) { - return _this3.renderCategoryListItem(childCategory, level + 1); - }))); - } - }, { - key: "renderCategoryDropdown", - value: function renderCategoryDropdown() { - var _this4 = this; - - var instanceId = this.props.instanceId; - var showHierarchy = this.props.attributes.showHierarchy; - var parentId = showHierarchy ? 0 : null; - var categories = this.getCategories(parentId); - var selectId = "blocks-category-select-".concat(instanceId); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["VisuallyHidden"], { - as: "label", - htmlFor: selectId - }, Object(external_this_wp_i18n_["__"])('Categories')), Object(external_this_wp_element_["createElement"])("select", { - id: selectId, - className: "wp-block-categories__dropdown" - }, categories.map(function (category) { - return _this4.renderCategoryDropdownItem(category, 0); - }))); - } - }, { - key: "renderCategoryDropdownItem", - value: function renderCategoryDropdownItem(category, level) { - var _this5 = this; - - var _this$props$attribute2 = this.props.attributes, - showHierarchy = _this$props$attribute2.showHierarchy, - showPostCounts = _this$props$attribute2.showPostCounts; - var childCategories = this.getCategories(category.id); - return [Object(external_this_wp_element_["createElement"])("option", { - key: category.id - }, Object(external_this_lodash_["times"])(level * 3, function () { - return '\xa0'; - }), this.renderCategoryName(category), !!showPostCounts ? " (".concat(category.count, ")") : ''), showHierarchy && !!childCategories.length && childCategories.map(function (childCategory) { - return _this5.renderCategoryDropdownItem(childCategory, level + 1); - })]; - } - }, { - key: "render", - value: function render() { - var _this$props4 = this.props, - attributes = _this$props4.attributes, - isRequesting = _this$props4.isRequesting; - var displayAsDropdown = attributes.displayAsDropdown, - showHierarchy = attributes.showHierarchy, - showPostCounts = attributes.showPostCounts; - var inspectorControls = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Categories settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display as dropdown'), - checked: displayAsDropdown, - onChange: this.toggleDisplayAsDropdown - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Show hierarchy'), - checked: showHierarchy, - onChange: this.toggleShowHierarchy - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Show post counts'), - checked: showPostCounts, - onChange: this.toggleShowPostCounts - }))); - - if (isRequesting) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, inspectorControls, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { - icon: library_pin, - label: Object(external_this_wp_i18n_["__"])('Categories') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null))); - } - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, inspectorControls, Object(external_this_wp_element_["createElement"])("div", { - className: this.props.className - }, displayAsDropdown ? this.renderCategoryDropdown() : this.renderCategoryList())); - } - }]); - - return CategoriesEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var categories_edit = (Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core'), - getEntityRecords = _select.getEntityRecords; - - var _select2 = select('core/data'), - isResolving = _select2.isResolving; - - var query = { - per_page: -1, - hide_empty: true - }; - return { - categories: getEntityRecords('taxonomy', 'category', query), - isRequesting: isResolving('core', 'getEntityRecords', ['taxonomy', 'category', query]) - }; -}), external_this_wp_compose_["withInstanceId"])(edit_CategoriesEdit)); +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + +function CategoriesEdit({ + attributes: { + displayAsDropdown, + showHierarchy, + showPostCounts + }, + setAttributes +}) { + const selectId = Object(external_wp_compose_["useInstanceId"])(CategoriesEdit, 'blocks-category-select'); + const { + categories, + isRequesting + } = Object(external_wp_data_["useSelect"])(select => { + const { + getEntityRecords + } = select(external_wp_coreData_["store"]); + const { + isResolving + } = select('core/data'); + const query = { + per_page: -1, + hide_empty: true, + context: 'view' + }; + return { + categories: getEntityRecords('taxonomy', 'category', query), + isRequesting: isResolving('core', 'getEntityRecords', ['taxonomy', 'category', query]) + }; + }, []); + + const getCategoriesList = parentId => { + if (!(categories !== null && categories !== void 0 && categories.length)) { + return []; + } + + if (parentId === null) { + return categories; + } + + return categories.filter(({ + parent + }) => parent === parentId); + }; + + const getCategoryListClassName = level => { + return `wp-block-categories__list wp-block-categories__list-level-${level}`; + }; + + const toggleAttribute = attributeName => newValue => setAttributes({ + [attributeName]: newValue + }); + + const renderCategoryName = name => !name ? Object(external_wp_i18n_["__"])('(Untitled)') : Object(external_lodash_["unescape"])(name).trim(); + + const renderCategoryList = () => { + const parentId = showHierarchy ? 0 : null; + const categoriesList = getCategoriesList(parentId); + return Object(external_wp_element_["createElement"])("ul", { + className: getCategoryListClassName(0) + }, categoriesList.map(category => renderCategoryListItem(category, 0))); + }; + + const renderCategoryListItem = (category, level) => { + const childCategories = getCategoriesList(category.id); + const { + id, + link, + count, + name + } = category; + return Object(external_wp_element_["createElement"])("li", { + key: id + }, Object(external_wp_element_["createElement"])("a", { + href: link, + target: "_blank", + rel: "noreferrer noopener" + }, renderCategoryName(name)), showPostCounts && Object(external_wp_element_["createElement"])("span", { + className: "wp-block-categories__post-count" + }, ` (${count})`), showHierarchy && !!childCategories.length && Object(external_wp_element_["createElement"])("ul", { + className: getCategoryListClassName(level + 1) + }, childCategories.map(childCategory => renderCategoryListItem(childCategory, level + 1)))); + }; + + const renderCategoryDropdown = () => { + const parentId = showHierarchy ? 0 : null; + const categoriesList = getCategoriesList(parentId); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { + as: "label", + htmlFor: selectId + }, Object(external_wp_i18n_["__"])('Categories')), Object(external_wp_element_["createElement"])("select", { + id: selectId, + className: "wp-block-categories__dropdown" + }, categoriesList.map(category => renderCategoryDropdownItem(category, 0)))); + }; + + const renderCategoryDropdownItem = (category, level) => { + const { + id, + count, + name + } = category; + const childCategories = getCategoriesList(id); + return [Object(external_wp_element_["createElement"])("option", { + key: id + }, Object(external_lodash_["times"])(level * 3, () => '\xa0'), renderCategoryName(name), showPostCounts && ` (${count})`), showHierarchy && !!childCategories.length && childCategories.map(childCategory => renderCategoryDropdownItem(childCategory, level + 1))]; + }; + + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Categories settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display as dropdown'), + checked: displayAsDropdown, + onChange: toggleAttribute('displayAsDropdown') + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Show hierarchy'), + checked: showHierarchy, + onChange: toggleAttribute('showHierarchy') + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Show post counts'), + checked: showPostCounts, + onChange: toggleAttribute('showPostCounts') + }))), isRequesting && Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { + icon: library_pin, + label: Object(external_wp_i18n_["__"])('Categories') + }, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)), !isRequesting && (categories === null || categories === void 0 ? void 0 : categories.length) === 0 && Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your site does not have any posts, so there is nothing to display here at the moment.')), !isRequesting && (categories === null || categories === void 0 ? void 0 : categories.length) > 0 && (displayAsDropdown ? renderCategoryDropdown() : renderCategoryList())); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/categories/index.js /** * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var categories_metadata = { +/** + * Internal dependencies + */ + +const categories_metadata = { + apiVersion: 2, name: "core/categories", + title: "Categories", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display a list of all categories.", + textdomain: "default", + attributes: { displayAsDropdown: { type: "boolean", "default": false @@ -11439,21 +11322,23 @@ supports: { align: true, html: false - } -}; - -var categories_name = categories_metadata.name; - -var categories_settings = { - title: Object(external_this_wp_i18n_["__"])('Categories'), - description: Object(external_this_wp_i18n_["__"])('Display a list of all categories.'), + }, + editorStyle: "wp-block-categories-editor", + style: "wp-block-categories" +}; + +const { + name: categories_name +} = categories_metadata; + +const categories_settings = { icon: library_category, example: {}, - edit: categories_edit + edit: CategoriesEdit }; // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js -var code = __webpack_require__(301); +var code = __webpack_require__("1Yn1"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/edit.js @@ -11462,30 +11347,26 @@ * WordPress dependencies */ -/** - * Internal dependencies - */ - - -function CodeEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].pre, null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["PlainText"], { - __experimentalVersion: 2, + +function CodeEdit({ + attributes, + setAttributes, + onRemove +}) { + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + return Object(external_wp_element_["createElement"])("pre", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { tagName: "code", value: attributes.content, - onChange: function onChange(content) { - return setAttributes({ - content: content - }); - }, - placeholder: Object(external_this_wp_i18n_["__"])('Write code…'), - "aria-label": Object(external_this_wp_i18n_["__"])('Code') - })); -} - -// EXTERNAL MODULE: external {"this":["wp","escapeHtml"]} -var external_this_wp_escapeHtml_ = __webpack_require__(89); + onChange: content => setAttributes({ + content + }), + onRemove: onRemove, + placeholder: Object(external_wp_i18n_["__"])('Write code…'), + "aria-label": Object(external_wp_i18n_["__"])('Code'), + preserveWhiteSpace: true, + __unstablePastePlainText: true + })); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/utils.js /** @@ -11493,11 +11374,6 @@ */ /** - * WordPress dependencies - */ - - -/** * Escapes ampersands, shortcodes, and links. * * @param {string} content The content of a code block. @@ -11505,7 +11381,7 @@ */ function utils_escape(content) { - return Object(external_this_lodash_["flow"])(external_this_wp_escapeHtml_["escapeEditableHTML"], escapeOpeningSquareBrackets, escapeProtocolInIsolatedUrls)(content || ''); + return Object(external_lodash_["flow"])(escapeOpeningSquareBrackets, escapeProtocolInIsolatedUrls)(content || ''); } /** * Returns the given content with all opening shortcode characters converted @@ -11548,12 +11424,21 @@ /** - * Internal dependencies - */ - -function code_save_save(_ref) { - var attributes = _ref.attributes; - return Object(external_this_wp_element_["createElement"])("pre", null, Object(external_this_wp_element_["createElement"])("code", null, utils_escape(attributes.content))); + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +function code_save_save({ + attributes +}) { + return Object(external_wp_element_["createElement"])("pre", external_wp_blockEditor_["useBlockProps"].save(), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "code", + value: utils_escape(attributes.content) + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/code/transforms.js @@ -11561,27 +11446,24 @@ * WordPress dependencies */ -var code_transforms_transforms = { +const code_transforms_transforms = { from: [{ type: 'enter', regExp: /^```$/, - transform: function transform() { - return Object(external_this_wp_blocks_["createBlock"])('core/code'); - } + transform: () => Object(external_wp_blocks_["createBlock"])('core/code') }, { type: 'block', blocks: ['core/html'], - transform: function transform(_ref) { - var content = _ref.content; - return Object(external_this_wp_blocks_["createBlock"])('core/code', { - content: content + transform: ({ + content + }) => { + return Object(external_wp_blocks_["createBlock"])('core/code', { + content }); } }, { type: 'raw', - isMatch: function isMatch(node) { - return node.nodeName === 'PRE' && node.children.length === 1 && node.firstChild.nodeName === 'CODE'; - }, + isMatch: node => node.nodeName === 'PRE' && node.children.length === 1 && node.firstChild.nodeName === 'CODE', schema: { pre: { children: { @@ -11608,35 +11490,41 @@ */ -var code_metadata = { +const code_metadata = { + apiVersion: 2, name: "core/code", + title: "Code", category: "text", + description: "Display code snippets that respect your spacing and tabs.", + textdomain: "default", attributes: { content: { type: "string", - source: "text", + source: "html", selector: "code" } }, supports: { anchor: true, - html: false, - lightBlockWrapper: true - } -}; - - -var code_name = code_metadata.name; - -var code_settings = { - title: Object(external_this_wp_i18n_["__"])('Code'), - description: Object(external_this_wp_i18n_["__"])('Display code snippets that respect your spacing and tabs.'), + typography: { + fontSize: true + } + }, + style: "wp-block-code" +}; + + +const { + name: code_name +} = code_metadata; + +const code_settings = { icon: code["a" /* default */], example: { attributes: { /* eslint-disable @wordpress/i18n-no-collapsible-whitespace */ // translators: Preserve \n markers for line breaks - content: Object(external_this_wp_i18n_["__"])('// A "block" is the abstract term used\n// to describe units of markup that\n// when composed together, form the\n// content or layout of a page.\nregisterBlockType( name, settings );') + content: Object(external_wp_i18n_["__"])('// A "block" is the abstract term used\n// to describe units of markup that\n// when composed together, form the\n// content or layout of a page.\nregisterBlockType( name, settings );') /* eslint-enable @wordpress/i18n-no-collapsible-whitespace */ } @@ -11653,10 +11541,10 @@ * WordPress dependencies */ -var columns_columns = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const columns_columns = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-4.1 1.5v10H10v-10h4.9zM5.5 17V8c0-.3.2-.5.5-.5h2.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2.6v-10H19c.3 0 .5.2.5.5v9z" })); /* harmony default export */ var library_columns = (columns_columns); @@ -11664,17 +11552,6 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/deprecated.js - -function columns_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function columns_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { columns_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { columns_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - /** * External dependencies */ @@ -11697,40 +11574,31 @@ */ function getDeprecatedLayoutColumn(originalContent) { - var doc = getDeprecatedLayoutColumn.doc; + let { + doc + } = getDeprecatedLayoutColumn; if (!doc) { doc = document.implementation.createHTMLDocument(''); getDeprecatedLayoutColumn.doc = doc; } - var columnMatch; + let columnMatch; doc.body.innerHTML = originalContent; - var _iterator = _createForOfIteratorHelper(doc.body.firstChild.classList), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var classListItem = _step.value; - - if (columnMatch = classListItem.match(/^layout-column-(\d+)$/)) { - return Number(columnMatch[1]) - 1; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } -} - -var columns_deprecated_migrateCustomColors = function migrateCustomColors(attributes) { + for (const classListItem of doc.body.firstChild.classList) { + if (columnMatch = classListItem.match(/^layout-column-(\d+)$/)) { + return Number(columnMatch[1]) - 1; + } + } +} + +const deprecated_migrateCustomColors = attributes => { if (!attributes.customTextColor && !attributes.customBackgroundColor) { return attributes; } - var style = { + const style = { color: {} }; @@ -11742,9 +11610,9 @@ style.color.background = attributes.customBackgroundColor; } - return columns_deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor']), { - style: style - }); + return { ...Object(external_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor']), + style + }; }; /* harmony default export */ var columns_deprecated = ([{ @@ -11765,31 +11633,37 @@ type: 'string' } }, - migrate: columns_deprecated_migrateCustomColors, - save: function save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var verticalAlignment = attributes.verticalAlignment, - backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()((_classnames = { + migrate: deprecated_migrateCustomColors, + + save({ + attributes + }) { + const { + verticalAlignment, + backgroundColor, + customBackgroundColor, + textColor, + customTextColor + } = attributes; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()({ 'has-background': backgroundColor || customBackgroundColor, - 'has-text-color': textColor || customTextColor - }, Object(defineProperty["a" /* default */])(_classnames, backgroundClass, backgroundClass), Object(defineProperty["a" /* default */])(_classnames, textClass, textClass), Object(defineProperty["a" /* default */])(_classnames, "are-vertically-aligned-".concat(verticalAlignment), verticalAlignment), _classnames)); - var style = { + 'has-text-color': textColor || customTextColor, + [backgroundClass]: backgroundClass, + [textClass]: textClass, + [`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", { className: className ? className : undefined, style: style - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + } + }, { attributes: { columns: { @@ -11797,14 +11671,13 @@ default: 2 } }, - isEligible: function isEligible(attributes, innerBlocks) { + + isEligible(attributes, innerBlocks) { // Since isEligible is called on every valid instance of the // Columns block and a deprecation is the unlikely case due to // its subsequent migration, optimize for the `false` condition // by performing a naive, inaccurate pass at inner blocks. - var isFastPassEligible = innerBlocks.some(function (innerBlock) { - return /layout-column-\d+/.test(innerBlock.originalContent); - }); + const isFastPassEligible = innerBlocks.some(innerBlock => /layout-column-\d+/.test(innerBlock.originalContent)); if (!isFastPassEligible) { return false; @@ -11812,14 +11685,15 @@ // accurate, durable, slower condition performed. - return innerBlocks.some(function (innerBlock) { - return getDeprecatedLayoutColumn(innerBlock.originalContent) !== undefined; - }); - }, - migrate: function migrate(attributes, innerBlocks) { - var columns = innerBlocks.reduce(function (accumulator, innerBlock) { - var originalContent = innerBlock.originalContent; - var columnIndex = getDeprecatedLayoutColumn(originalContent); + return innerBlocks.some(innerBlock => getDeprecatedLayoutColumn(innerBlock.originalContent) !== undefined); + }, + + migrate(attributes, innerBlocks) { + const columns = innerBlocks.reduce((accumulator, innerBlock) => { + const { + originalContent + } = innerBlock; + let columnIndex = getDeprecatedLayoutColumn(originalContent); if (columnIndex === undefined) { columnIndex = 0; @@ -11832,18 +11706,21 @@ accumulator[columnIndex].push(innerBlock); return accumulator; }, []); - var migratedInnerBlocks = columns.map(function (columnBlocks) { - return Object(external_this_wp_blocks_["createBlock"])('core/column', {}, columnBlocks); - }); - return [Object(external_this_lodash_["omit"])(attributes, ['columns']), migratedInnerBlocks]; - }, - save: function save(_ref2) { - var attributes = _ref2.attributes; - var columns = attributes.columns; - return Object(external_this_wp_element_["createElement"])("div", { - className: "has-".concat(columns, "-columns") - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); - } + const migratedInnerBlocks = columns.map(columnBlocks => Object(external_wp_blocks_["createBlock"])('core/column', {}, columnBlocks)); + return [Object(external_lodash_["omit"])(attributes, ['columns']), migratedInnerBlocks]; + }, + + save({ + attributes + }) { + const { + columns + } = attributes; + return Object(external_wp_element_["createElement"])("div", { + className: `has-${columns}-columns` + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + } + }, { attributes: { columns: { @@ -11851,24 +11728,30 @@ default: 2 } }, - migrate: function migrate(attributes, innerBlocks) { - attributes = Object(external_this_lodash_["omit"])(attributes, ['columns']); + + migrate(attributes, innerBlocks) { + attributes = Object(external_lodash_["omit"])(attributes, ['columns']); return [attributes, innerBlocks]; }, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var verticalAlignment = attributes.verticalAlignment, - columns = attributes.columns; - var wrapperClasses = classnames_default()("has-".concat(columns, "-columns"), Object(defineProperty["a" /* default */])({}, "are-vertically-aligned-".concat(verticalAlignment), verticalAlignment)); - return Object(external_this_wp_element_["createElement"])("div", { + + save({ + attributes + }) { + const { + verticalAlignment, + columns + } = attributes; + const wrapperClasses = classnames_default()(`has-${columns}-columns`, { + [`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + return Object(external_wp_element_["createElement"])("div", { className: wrapperClasses - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + } + }]); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/utils.js - - /** * External dependencies */ @@ -11882,8 +11765,9 @@ * @return {number} Value rounded to standard precision. */ -var toWidthPrecision = function toWidthPrecision(value) { - return Number.isFinite(value) ? parseFloat(value.toFixed(2)) : undefined; +const toWidthPrecision = value => { + const unitlessValue = parseFloat(value); + return Number.isFinite(unitlessValue) ? parseFloat(unitlessValue.toFixed(2)) : undefined; }; /** * Returns an effective width for a given block. An effective width is equal to @@ -11896,8 +11780,9 @@ */ function getEffectiveColumnWidth(block, totalBlockCount) { - var _block$attributes$wid = block.attributes.width, - width = _block$attributes$wid === void 0 ? 100 / totalBlockCount : _block$attributes$wid; + const { + width = 100 / totalBlockCount + } = block.attributes; return toWidthPrecision(width); } /** @@ -11910,11 +11795,8 @@ * @return {number} Total width occupied by blocks. */ -function getTotalColumnsWidth(blocks) { - var totalBlockCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : blocks.length; - return Object(external_this_lodash_["sumBy"])(blocks, function (block) { - return getEffectiveColumnWidth(block, totalBlockCount); - }); +function getTotalColumnsWidth(blocks, totalBlockCount = blocks.length) { + return Object(external_lodash_["sumBy"])(blocks, block => getEffectiveColumnWidth(block, totalBlockCount)); } /** * Returns an object of `clientId` → `width` of effective column widths. @@ -11926,11 +11808,12 @@ * @return {Object} Column widths. */ -function getColumnWidths(blocks) { - var totalBlockCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : blocks.length; - return blocks.reduce(function (accumulator, block) { - var width = getEffectiveColumnWidth(block, totalBlockCount); - return Object.assign(accumulator, Object(defineProperty["a" /* default */])({}, block.clientId, width)); +function getColumnWidths(blocks, totalBlockCount = blocks.length) { + return blocks.reduce((accumulator, block) => { + const width = getEffectiveColumnWidth(block, totalBlockCount); + return Object.assign(accumulator, { + [block.clientId]: width + }); }, {}); } /** @@ -11946,13 +11829,11 @@ * @return {Object} Redistributed column widths. */ -function getRedistributedColumnWidths(blocks, availableWidth) { - var totalBlockCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : blocks.length; - var totalWidth = getTotalColumnsWidth(blocks, totalBlockCount); - var difference = availableWidth - totalWidth; - var adjustment = difference / blocks.length; - return Object(external_this_lodash_["mapValues"])(getColumnWidths(blocks, totalBlockCount), function (width) { - return toWidthPrecision(width + adjustment); +function getRedistributedColumnWidths(blocks, availableWidth, totalBlockCount = blocks.length) { + const totalWidth = getTotalColumnsWidth(blocks, totalBlockCount); + return Object(external_lodash_["mapValues"])(getColumnWidths(blocks, totalBlockCount), width => { + const newWidth = availableWidth * width / totalWidth; + return toWidthPrecision(newWidth); }); } /** @@ -11964,9 +11845,12 @@ * @return {boolean} Whether columns have explicit widths. */ -function hasExplicitColumnWidths(blocks) { - return blocks.every(function (block) { - return Number.isFinite(block.attributes.width); +function hasExplicitPercentColumnWidths(blocks) { + return blocks.every(block => { + var _blockWidth$endsWith; + + const blockWidth = block.attributes.width; + return Number.isFinite(blockWidth !== null && blockWidth !== void 0 && (_blockWidth$endsWith = blockWidth.endsWith) !== null && _blockWidth$endsWith !== void 0 && _blockWidth$endsWith.call(blockWidth, '%') ? parseFloat(blockWidth) : blockWidth); }); } /** @@ -11980,21 +11864,60 @@ */ function getMappedColumnWidths(blocks, widths) { - return blocks.map(function (block) { - return Object(external_this_lodash_["merge"])({}, block, { - attributes: { - width: widths[block.clientId] - } - }); - }); + return blocks.map(block => Object(external_lodash_["merge"])({}, block, { + attributes: { + width: widths[block.clientId] + } + })); +} +/** + * Returns an array with columns widths values, parsed or no depends on `withParsing` flag. + * + * @param {WPBlock[]} blocks Block objects. + * @param {?boolean} withParsing Whether value has to be parsed. + * + * @return {Array} Column widths. + */ + +function getWidths(blocks, withParsing = true) { + return blocks.map(innerColumn => { + const innerColumnWidth = innerColumn.attributes.width || 100 / blocks.length; + return withParsing ? parseFloat(innerColumnWidth) : innerColumnWidth; + }); +} +/** + * Returns a column width with unit. + * + * @param {string} width Column width. + * @param {string} unit Column width unit. + * + * @return {string} Column width with unit. + */ + +function getWidthWithUnit(width, unit) { + width = 0 > parseFloat(width) ? '0' : width; + + if (isPercentageUnit(unit)) { + width = Math.min(width, 100); + } + + return `${width}${unit}`; +} +/** + * Returns a boolean whether passed unit is percentage + * + * @param {string} unit Column width unit. + * + * @return {boolean} Whether unit is '%'. + */ + +function isPercentageUnit(unit) { + return unit === '%'; } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/edit.js - - - /** * External dependencies */ @@ -12024,216 +11947,213 @@ * @type {string[]} */ -var edit_ALLOWED_BLOCKS = ['core/column']; - -function ColumnsEditContainer(_ref) { - var attributes = _ref.attributes, - updateAlignment = _ref.updateAlignment, - updateColumns = _ref.updateColumns, - clientId = _ref.clientId; - var verticalAlignment = attributes.verticalAlignment; - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - return { - count: select('core/block-editor').getBlockCount(clientId) - }; - }, [clientId]), - count = _useSelect.count; - - var classes = classnames_default()(Object(defineProperty["a" /* default */])({}, "are-vertically-aligned-".concat(verticalAlignment), verticalAlignment)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockVerticalAlignmentToolbar"], { +const edit_ALLOWED_BLOCKS = ['core/column']; + +function ColumnsEditContainer({ + attributes, + updateAlignment, + updateColumns, + clientId +}) { + const { + verticalAlignment + } = attributes; + const { + count + } = Object(external_wp_data_["useSelect"])(select => { + return { + count: select(external_wp_blockEditor_["store"]).getBlockCount(clientId) + }; + }, [clientId]); + const classes = classnames_default()({ + [`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classes + }); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])(blockProps, { + allowedBlocks: edit_ALLOWED_BLOCKS, + orientation: 'horizontal', + renderAppender: false + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockVerticalAlignmentToolbar"], { onChange: updateAlignment, value: verticalAlignment - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Columns'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Columns'), value: count, - onChange: function onChange(value) { - return updateColumns(count, value); - }, - min: 2, + onChange: value => updateColumns(count, value), + min: 1, max: Math.max(6, count) - }), count > 6 && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Notice"], { + }), count > 6 && Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], { status: "warning", isDismissible: false - }, Object(external_this_wp_i18n_["__"])('This column count exceeds the recommended amount and may cause visual breakage.')))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { - allowedBlocks: edit_ALLOWED_BLOCKS, - orientation: "horizontal", - __experimentalTagName: external_this_wp_blockEditor_["__experimentalBlock"].div, - __experimentalPassedProps: { - className: classes - }, - renderAppender: false - })); -} - -var ColumnsEditContainerWrapper = Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, registry) { - return { - /** - * Update all child Column blocks with a new vertical alignment setting - * based on whatever alignment is passed in. This allows change to parent - * to overide anything set on a individual column basis. - * - * @param {string} verticalAlignment the vertical alignment setting - */ - updateAlignment: function updateAlignment(verticalAlignment) { - var clientId = ownProps.clientId, - setAttributes = ownProps.setAttributes; - - var _dispatch = dispatch('core/block-editor'), - updateBlockAttributes = _dispatch.updateBlockAttributes; - - var _registry$select = registry.select('core/block-editor'), - getBlockOrder = _registry$select.getBlockOrder; // Update own alignment. - - - setAttributes({ - verticalAlignment: verticalAlignment - }); // Update all child Column Blocks to match - - var innerBlockClientIds = getBlockOrder(clientId); - innerBlockClientIds.forEach(function (innerBlockClientId) { - updateBlockAttributes(innerBlockClientId, { - verticalAlignment: verticalAlignment + }, Object(external_wp_i18n_["__"])('This column count exceeds the recommended amount and may cause visual breakage.')))), Object(external_wp_element_["createElement"])("div", innerBlocksProps)); +} + +const ColumnsEditContainerWrapper = Object(external_wp_data_["withDispatch"])((dispatch, ownProps, registry) => ({ + /** + * Update all child Column blocks with a new vertical alignment setting + * based on whatever alignment is passed in. This allows change to parent + * to overide anything set on a individual column basis. + * + * @param {string} verticalAlignment the vertical alignment setting + */ + updateAlignment(verticalAlignment) { + const { + clientId, + setAttributes + } = ownProps; + const { + updateBlockAttributes + } = dispatch(external_wp_blockEditor_["store"]); + const { + getBlockOrder + } = registry.select(external_wp_blockEditor_["store"]); // Update own alignment. + + setAttributes({ + verticalAlignment + }); // Update all child Column Blocks to match + + const innerBlockClientIds = getBlockOrder(clientId); + innerBlockClientIds.forEach(innerBlockClientId => { + updateBlockAttributes(innerBlockClientId, { + verticalAlignment + }); + }); + }, + + /** + * Updates the column count, including necessary revisions to child Column + * blocks to grant required or redistribute available space. + * + * @param {number} previousColumns Previous column count. + * @param {number} newColumns New column count. + */ + updateColumns(previousColumns, newColumns) { + const { + clientId + } = ownProps; + const { + replaceInnerBlocks + } = dispatch(external_wp_blockEditor_["store"]); + const { + getBlocks + } = registry.select(external_wp_blockEditor_["store"]); + let innerBlocks = getBlocks(clientId); + const hasExplicitWidths = hasExplicitPercentColumnWidths(innerBlocks); // Redistribute available width for existing inner blocks. + + const isAddingColumn = newColumns > previousColumns; + + if (isAddingColumn && hasExplicitWidths) { + // If adding a new column, assign width to the new column equal to + // as if it were `1 / columns` of the total available space. + const newColumnWidth = toWidthPrecision(100 / newColumns); // Redistribute in consideration of pending block insertion as + // constraining the available working width. + + const widths = getRedistributedColumnWidths(innerBlocks, 100 - newColumnWidth); + innerBlocks = [...getMappedColumnWidths(innerBlocks, widths), ...Object(external_lodash_["times"])(newColumns - previousColumns, () => { + return Object(external_wp_blocks_["createBlock"])('core/column', { + width: newColumnWidth }); - }); - }, - - /** - * Updates the column count, including necessary revisions to child Column - * blocks to grant required or redistribute available space. - * - * @param {number} previousColumns Previous column count. - * @param {number} newColumns New column count. - */ - updateColumns: function updateColumns(previousColumns, newColumns) { - var clientId = ownProps.clientId; - - var _dispatch2 = dispatch('core/block-editor'), - replaceInnerBlocks = _dispatch2.replaceInnerBlocks; - - var _registry$select2 = registry.select('core/block-editor'), - getBlocks = _registry$select2.getBlocks; - - var innerBlocks = getBlocks(clientId); - var hasExplicitWidths = hasExplicitColumnWidths(innerBlocks); // Redistribute available width for existing inner blocks. - - var isAddingColumn = newColumns > previousColumns; - - if (isAddingColumn && hasExplicitWidths) { - // If adding a new column, assign width to the new column equal to - // as if it were `1 / columns` of the total available space. - var newColumnWidth = toWidthPrecision(100 / newColumns); // Redistribute in consideration of pending block insertion as - // constraining the available working width. - - var widths = getRedistributedColumnWidths(innerBlocks, 100 - newColumnWidth); - innerBlocks = [].concat(Object(toConsumableArray["a" /* default */])(getMappedColumnWidths(innerBlocks, widths)), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["times"])(newColumns - previousColumns, function () { - return Object(external_this_wp_blocks_["createBlock"])('core/column', { - width: newColumnWidth - }); - }))); - } else if (isAddingColumn) { - innerBlocks = [].concat(Object(toConsumableArray["a" /* default */])(innerBlocks), Object(toConsumableArray["a" /* default */])(Object(external_this_lodash_["times"])(newColumns - previousColumns, function () { - return Object(external_this_wp_blocks_["createBlock"])('core/column'); - }))); - } else { - // The removed column will be the last of the inner blocks. - innerBlocks = Object(external_this_lodash_["dropRight"])(innerBlocks, previousColumns - newColumns); - - if (hasExplicitWidths) { - // Redistribute as if block is already removed. - var _widths = getRedistributedColumnWidths(innerBlocks, 100); - - innerBlocks = getMappedColumnWidths(innerBlocks, _widths); - } - } - - replaceInnerBlocks(clientId, innerBlocks, false); - } - }; -})(ColumnsEditContainer); - -var edit_createBlocksFromInnerBlocksTemplate = function createBlocksFromInnerBlocksTemplate(innerBlocksTemplate) { - return Object(external_this_lodash_["map"])(innerBlocksTemplate, function (_ref2) { - var _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 3), - name = _ref3[0], - attributes = _ref3[1], - _ref3$ = _ref3[2], - innerBlocks = _ref3$ === void 0 ? [] : _ref3$; - - return Object(external_this_wp_blocks_["createBlock"])(name, attributes, createBlocksFromInnerBlocksTemplate(innerBlocks)); - }); -}; - -var edit_ColumnsEdit = function ColumnsEdit(props) { - var clientId = props.clientId, - name = props.name; - - var _useSelect2 = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core/blocks'), - getBlockVariations = _select.getBlockVariations, - getBlockType = _select.getBlockType, - getDefaultBlockVariation = _select.getDefaultBlockVariation; - + })]; + } else if (isAddingColumn) { + innerBlocks = [...innerBlocks, ...Object(external_lodash_["times"])(newColumns - previousColumns, () => { + return Object(external_wp_blocks_["createBlock"])('core/column'); + })]; + } else { + // The removed column will be the last of the inner blocks. + innerBlocks = Object(external_lodash_["dropRight"])(innerBlocks, previousColumns - newColumns); + + if (hasExplicitWidths) { + // Redistribute as if block is already removed. + const widths = getRedistributedColumnWidths(innerBlocks, 100); + innerBlocks = getMappedColumnWidths(innerBlocks, widths); + } + } + + replaceInnerBlocks(clientId, innerBlocks); + } + +}))(ColumnsEditContainer); + +function Placeholder({ + clientId, + name, + setAttributes +}) { + const { + blockType, + defaultVariation, + variations + } = Object(external_wp_data_["useSelect"])(select => { + const { + getBlockVariations, + getBlockType, + getDefaultBlockVariation + } = select(external_wp_blocks_["store"]); return { blockType: getBlockType(name), defaultVariation: getDefaultBlockVariation(name, 'block'), - hasInnerBlocks: select('core/block-editor').getBlocks(clientId).length > 0, variations: getBlockVariations(name, 'block') }; - }, [clientId, name]), - blockType = _useSelect2.blockType, - defaultVariation = _useSelect2.defaultVariation, - hasInnerBlocks = _useSelect2.hasInnerBlocks, - variations = _useSelect2.variations; - - var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), - replaceInnerBlocks = _useDispatch.replaceInnerBlocks; - - if (hasInnerBlocks) { - return Object(external_this_wp_element_["createElement"])(ColumnsEditContainerWrapper, props); - } - - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlockVariationPicker"], { - icon: Object(external_this_lodash_["get"])(blockType, ['icon', 'src']), - label: Object(external_this_lodash_["get"])(blockType, ['title']), + }, [name]); + const { + replaceInnerBlocks + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalBlockVariationPicker"], { + icon: Object(external_lodash_["get"])(blockType, ['icon', 'src']), + label: Object(external_lodash_["get"])(blockType, ['title']), variations: variations, - onSelect: function onSelect() { - var nextVariation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultVariation; - + onSelect: (nextVariation = defaultVariation) => { if (nextVariation.attributes) { - props.setAttributes(nextVariation.attributes); + setAttributes(nextVariation.attributes); } if (nextVariation.innerBlocks) { - replaceInnerBlocks(props.clientId, edit_createBlocksFromInnerBlocksTemplate(nextVariation.innerBlocks)); + replaceInnerBlocks(clientId, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(nextVariation.innerBlocks), true); } }, allowSkip: true })); -}; - -/* harmony default export */ var columns_edit = (edit_ColumnsEdit); +} + +const ColumnsEdit = props => { + const { + clientId + } = props; + const hasInnerBlocks = Object(external_wp_data_["useSelect"])(select => select(external_wp_blockEditor_["store"]).getBlocks(clientId).length > 0, [clientId]); + const Component = hasInnerBlocks ? ColumnsEditContainerWrapper : Placeholder; + return Object(external_wp_element_["createElement"])(Component, props); +}; + +/* harmony default export */ var columns_edit = (ColumnsEdit); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -function columns_save_save(_ref) { - var attributes = _ref.attributes; - var verticalAlignment = attributes.verticalAlignment; - var className = classnames_default()(Object(defineProperty["a" /* default */])({}, "are-vertically-aligned-".concat(verticalAlignment), verticalAlignment)); - return Object(external_this_wp_element_["createElement"])("div", { - className: className ? className : undefined - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function columns_save_save({ + attributes +}) { + const { + verticalAlignment + } = attributes; + const className = classnames_default()({ + [`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/variations.js @@ -12252,16 +12172,32 @@ * @type {WPBlockVariation[]} */ -var variations_variations = [{ - name: 'two-columns-equal', - title: Object(external_this_wp_i18n_["__"])('50 / 50'), - description: Object(external_this_wp_i18n_["__"])('Two columns; equal split'), - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { +const columns_variations_variations = [{ + name: 'one-column-full', + title: Object(external_wp_i18n_["__"])('100'), + description: Object(external_wp_i18n_["__"])('One column'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + fillRule: "evenodd", + clipRule: "evenodd", + d: "m39.0625 14h-30.0625v20.0938h30.0625zm-30.0625-2c-1.10457 0-2 .8954-2 2v20.0938c0 1.1045.89543 2 2 2h30.0625c1.1046 0 2-.8955 2-2v-20.0938c0-1.1046-.8954-2-2-2z" + })), + innerBlocks: [['core/column']], + scope: ['block'] +}, { + name: 'two-columns-equal', + title: Object(external_wp_i18n_["__"])('50 / 50'), + description: Object(external_wp_i18n_["__"])('Two columns; equal split'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + width: "48", + height: "48", + viewBox: "0 0 48 48", + xmlns: "http://www.w3.org/2000/svg" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { fillRule: "evenodd", clipRule: "evenodd", d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z" @@ -12271,54 +12207,54 @@ scope: ['block'] }, { name: 'two-columns-one-third-two-thirds', - title: Object(external_this_wp_i18n_["__"])('30 / 70'), - description: Object(external_this_wp_i18n_["__"])('Two columns; one-third, two-thirds split'), - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { + title: Object(external_wp_i18n_["__"])('30 / 70'), + description: Object(external_wp_i18n_["__"])('Two columns; one-third, two-thirds split'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { fillRule: "evenodd", clipRule: "evenodd", d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z" })), innerBlocks: [['core/column', { - width: 33.33 + width: '33.33%' }], ['core/column', { - width: 66.66 + width: '66.66%' }]], scope: ['block'] }, { name: 'two-columns-two-thirds-one-third', - title: Object(external_this_wp_i18n_["__"])('70 / 30'), - description: Object(external_this_wp_i18n_["__"])('Two columns; two-thirds, one-third split'), - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { + title: Object(external_wp_i18n_["__"])('70 / 30'), + description: Object(external_wp_i18n_["__"])('Two columns; two-thirds, one-third split'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { fillRule: "evenodd", clipRule: "evenodd", d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z" })), innerBlocks: [['core/column', { - width: 66.66 + width: '66.66%' }], ['core/column', { - width: 33.33 + width: '33.33%' }]], scope: ['block'] }, { name: 'three-columns-equal', - title: Object(external_this_wp_i18n_["__"])('33 / 33 / 33'), - description: Object(external_this_wp_i18n_["__"])('Three columns; equal split'), - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { + title: Object(external_wp_i18n_["__"])('33 / 33 / 33'), + description: Object(external_wp_i18n_["__"])('Three columns; equal split'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { fillRule: "evenodd", d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z" })), @@ -12326,27 +12262,120 @@ scope: ['block'] }, { name: 'three-columns-wider-center', - title: Object(external_this_wp_i18n_["__"])('25 / 50 / 25'), - description: Object(external_this_wp_i18n_["__"])('Three columns; wide center column'), - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { + title: Object(external_wp_i18n_["__"])('25 / 50 / 25'), + description: Object(external_wp_i18n_["__"])('Three columns; wide center column'), + icon: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { width: "48", height: "48", viewBox: "0 0 48 48", xmlns: "http://www.w3.org/2000/svg" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { fillRule: "evenodd", d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM31 34H17V14h14v20zm2 0V14h6v20h-6zm-18 0H9V14h6v20z" })), innerBlocks: [['core/column', { - width: 25 + width: '25%' }], ['core/column', { - width: 50 + width: '50%' }], ['core/column', { - width: 25 + width: '25%' }]], scope: ['block'] }]; -/* harmony default export */ var columns_variations = (variations_variations); +/* harmony default export */ var columns_variations = (columns_variations_variations); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/transforms.js +/** + * WordPress dependencies + */ + +const MAXIMUM_SELECTED_BLOCKS = 6; +const columns_transforms_transforms = { + from: [{ + type: 'block', + isMultiBlock: true, + blocks: ['*'], + __experimentalConvert: blocks => { + const columnWidth = +(100 / blocks.length).toFixed(2); + const innerBlocksTemplate = blocks.map(({ + name, + attributes, + innerBlocks + }) => ['core/column', { + width: `${columnWidth}%` + }, [[name, { ...attributes + }, innerBlocks]]]); + return Object(external_wp_blocks_["createBlock"])('core/columns', {}, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocksTemplate)); + }, + isMatch: ({ + length: selectedBlocksLength + }) => selectedBlocksLength && selectedBlocksLength <= MAXIMUM_SELECTED_BLOCKS + }, { + type: 'block', + blocks: ['core/media-text'], + priority: 1, + transform: (attributes, innerBlocks) => { + const { + align, + backgroundColor, + textColor, + style, + mediaAlt: alt, + mediaId: id, + mediaPosition, + mediaSizeSlug: sizeSlug, + mediaType, + mediaUrl: url, + mediaWidth, + verticalAlignment + } = attributes; + let media; + + if (mediaType === 'image' || !mediaType) { + const imageAttrs = { + id, + alt, + url, + sizeSlug + }; + const linkAttrs = { + href: attributes.href, + linkClass: attributes.linkClass, + linkDestination: attributes.linkDestination, + linkTarget: attributes.linkTarget, + rel: attributes.rel + }; + media = ['core/image', { ...imageAttrs, + ...linkAttrs + }]; + } else { + media = ['core/video', { + id, + src: url + }]; + } + + const innerBlocksTemplate = [['core/column', { + width: `${mediaWidth}%` + }, [media]], ['core/column', { + width: `${100 - mediaWidth}%` + }, innerBlocks]]; + + if (mediaPosition === 'right') { + innerBlocksTemplate.reverse(); + } + + return Object(external_wp_blocks_["createBlock"])('core/columns', { + align, + backgroundColor, + textColor, + style, + verticalAlignment + }, Object(external_wp_blocks_["createBlocksFromInnerBlocksTemplate"])(innerBlocksTemplate)); + } + }] +}; +/* harmony default export */ var columns_transforms = (columns_transforms_transforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/columns/index.js /** @@ -12360,9 +12389,13 @@ -var columns_metadata = { +const columns_metadata = { + apiVersion: 2, name: "core/columns", + title: "Columns", category: "design", + description: "Add a block that displays content in multiple columns, then add whatever content blocks you\u2019d like.", + textdomain: "default", attributes: { verticalAlignment: { type: "string" @@ -12372,21 +12405,23 @@ anchor: true, align: ["wide", "full"], html: false, - lightBlockWrapper: true, - __experimentalColor: { + color: { gradients: true, - linkColor: true - } - } -}; - - -var columns_name = columns_metadata.name; - -var columns_settings = { - title: Object(external_this_wp_i18n_["__"])('Columns'), + link: true + } + }, + editorStyle: "wp-block-columns-editor", + style: "wp-block-columns" +}; + + + +const { + name: columns_name +} = columns_metadata; + +const columns_settings = { icon: library_columns, - description: Object(external_this_wp_i18n_["__"])('Add a block that displays content in multiple columns, then add whatever content blocks you’d like.'), variations: columns_variations, example: { innerBlocks: [{ @@ -12395,7 +12430,7 @@ name: 'core/paragraph', attributes: { /* translators: example text. */ - content: Object(external_this_wp_i18n_["__"])('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.') + content: Object(external_wp_i18n_["__"])('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et eros eu felis.') } }, { name: 'core/image', @@ -12406,7 +12441,7 @@ name: 'core/paragraph', attributes: { /* translators: example text. */ - content: Object(external_this_wp_i18n_["__"])('Suspendisse commodo neque lacus, a dictum orci interdum et.') + content: Object(external_wp_i18n_["__"])('Suspendisse commodo neque lacus, a dictum orci interdum et.') } }] }, { @@ -12415,20 +12450,21 @@ name: 'core/paragraph', attributes: { /* translators: example text. */ - content: Object(external_this_wp_i18n_["__"])('Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.') + content: Object(external_wp_i18n_["__"])('Etiam et egestas lorem. Vivamus sagittis sit amet dolor quis lobortis. Integer sed fermentum arcu, id vulputate lacus. Etiam fermentum sem eu quam hendrerit.') } }, { name: 'core/paragraph', attributes: { /* translators: example text. */ - content: Object(external_this_wp_i18n_["__"])('Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.') + content: Object(external_wp_i18n_["__"])('Nam risus massa, ullamcorper consectetur eros fermentum, porta aliquet ligula. Sed vel mauris nec enim.') } }] }] }, deprecated: columns_deprecated, edit: columns_edit, - save: columns_save_save + save: columns_save_save, + transforms: columns_transforms }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/column.js @@ -12438,56 +12474,124 @@ * WordPress dependencies */ -var column = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const column = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 6H6c-1.1 0-2 .9-2 2v9c0 1.1.9 2 2 2h13c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM6 17.5c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h3v10H6zm13.5-.5c0 .3-.2.5-.5.5h-3v-10h3c.3 0 .5.2.5.5v9z" })); /* harmony default export */ var library_column = (column); +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/deprecated.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +const column_deprecated_deprecated = [{ + attributes: { + verticalAlignment: { + type: 'string' + }, + width: { + type: 'number', + min: 0, + max: 100 + } + }, + + isEligible({ + width + }) { + return isFinite(width); + }, + + migrate(attributes) { + return { ...attributes, + width: `${attributes.width}%` + }; + }, + + save({ + attributes + }) { + const { + verticalAlignment, + width + } = attributes; + const wrapperClasses = classnames_default()({ + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + const style = { + flexBasis: width + '%' + }; + return Object(external_wp_element_["createElement"])("div", { + className: wrapperClasses, + style: style + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + } + +}]; +/* harmony default export */ var column_deprecated = (column_deprecated_deprecated); + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/edit.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - -function ColumnEdit(_ref) { - var _ref$attributes = _ref.attributes, - verticalAlignment = _ref$attributes.verticalAlignment, - width = _ref$attributes.width, - setAttributes = _ref.setAttributes, - clientId = _ref.clientId; - var classes = classnames_default()('block-core-columns', Object(defineProperty["a" /* default */])({}, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment)); - - var _useSelect = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core/block-editor'), - getBlockOrder = _select.getBlockOrder, - getBlockRootClientId = _select.getBlockRootClientId; - +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +function ColumnEdit({ + attributes: { + verticalAlignment, + width, + templateLock = false + }, + setAttributes, + clientId +}) { + const classes = classnames_default()('block-core-columns', { + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ + availableUnits: Object(external_wp_blockEditor_["useSetting"])('spacing.units') || ['%', 'px', 'em', 'rem', 'vw'] + }); + const { + columnsIds, + hasChildBlocks, + rootClientId + } = Object(external_wp_data_["useSelect"])(select => { + const { + getBlockOrder, + getBlockRootClientId + } = select(external_wp_blockEditor_["store"]); + const rootId = getBlockRootClientId(clientId); return { hasChildBlocks: getBlockOrder(clientId).length > 0, - rootClientId: getBlockRootClientId(clientId) - }; - }, [clientId]), - hasChildBlocks = _useSelect.hasChildBlocks, - rootClientId = _useSelect.rootClientId; - - var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), - updateBlockAttributes = _useDispatch.updateBlockAttributes; - - var updateAlignment = function updateAlignment(value) { + rootClientId: rootId, + columnsIds: getBlockOrder(rootId) + }; + }, [clientId]); + const { + updateBlockAttributes + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + + const updateAlignment = value => { // Update own alignment. setAttributes({ verticalAlignment: value @@ -12498,39 +12602,42 @@ }); }; - var hasWidth = Number.isFinite(width); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockVerticalAlignmentToolbar"], { + const widthWithUnit = Number.isFinite(width) ? width + '%' : width; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classes, + style: widthWithUnit ? { + flexBasis: widthWithUnit + } : undefined + }); + const columnsCount = columnsIds.length; + const currentColumnPosition = columnsIds.indexOf(clientId) + 1; + const label = Object(external_wp_i18n_["sprintf"])( + /* translators: 1: Block label (i.e. "Block: Column"), 2: Position of the selected block, 3: Total number of sibling blocks of the same type */ + Object(external_wp_i18n_["__"])('%1$s (%2$d of %3$d)'), blockProps['aria-label'], currentColumnPosition, columnsCount); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({ ...blockProps, + 'aria-label': label + }, { + templateLock, + renderAppender: hasChildBlocks ? undefined : external_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockVerticalAlignmentToolbar"], { onChange: updateAlignment, value: verticalAlignment - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Column settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Percentage width'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Column settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["__experimentalUnitControl"], { + label: Object(external_wp_i18n_["__"])('Width'), + labelPosition: "edge", + __unstableInputWidth: "80px", value: width || '', - onChange: function onChange(nextWidth) { + onChange: nextWidth => { + nextWidth = 0 > parseFloat(nextWidth) ? '0' : nextWidth; setAttributes({ width: nextWidth }); }, - min: 0, - max: 100, - step: 0.1, - required: true, - allowReset: true, - placeholder: width === undefined ? Object(external_this_wp_i18n_["__"])('Auto') : undefined - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { - templateLock: false, - renderAppender: hasChildBlocks ? undefined : function () { - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender, null); - }, - __experimentalTagName: external_this_wp_blockEditor_["__experimentalBlock"].div, - __experimentalPassedProps: { - className: classes, - style: hasWidth ? { - flexBasis: width + '%' - } : undefined - } - })); + units: units + }))), Object(external_wp_element_["createElement"])("div", innerBlocksProps)); } /* harmony default export */ var column_edit = (ColumnEdit); @@ -12538,33 +12645,38 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -function column_save_save(_ref) { - var attributes = _ref.attributes; - var verticalAlignment = attributes.verticalAlignment, - width = attributes.width; - var wrapperClasses = classnames_default()(Object(defineProperty["a" /* default */])({}, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment)); - var style; - - if (Number.isFinite(width)) { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function column_save_save({ + attributes +}) { + const { + verticalAlignment, + width + } = attributes; + const wrapperClasses = classnames_default()({ + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment + }); + let style; + + if (width) { + // Numbers are handled for backward compatibility as they can be still provided with templates. style = { - flexBasis: width + '%' - }; - } - - return Object(external_this_wp_element_["createElement"])("div", { + flexBasis: Number.isFinite(width) ? width + '%' : width + }; + } + + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ className: wrapperClasses, - style: style - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); + style + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/column/index.js @@ -12572,42 +12684,54 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - -var column_metadata = { +/** + * Internal dependencies + */ + + + +const column_metadata = { + apiVersion: 2, name: "core/column", + title: "Column", category: "text", parent: ["core/columns"], + description: "A single column within a columns block.", + textdomain: "default", attributes: { verticalAlignment: { type: "string" }, width: { - type: "number", - min: 0, - max: 100 + type: "string" + }, + templateLock: { + "enum": ["all", "insert", false] } }, supports: { anchor: true, reusable: false, html: false, - lightBlockWrapper: true - } -}; - -var column_name = column_metadata.name; - -var column_settings = { - title: Object(external_this_wp_i18n_["__"])('Column'), + color: { + gradients: true, + link: true + }, + spacing: { + padding: true + } + } +}; + +const { + name: column_name +} = column_metadata; + +const column_settings = { icon: library_column, - description: Object(external_this_wp_i18n_["__"])('A single column within a columns block.'), edit: column_edit, - save: column_save_save + save: column_save_save, + deprecated: column_deprecated }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cover.js @@ -12617,22 +12741,20 @@ * WordPress dependencies */ -var cover = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const cover = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18.7 3H5.3C4 3 3 4 3 5.3v13.4C3 20 4 21 5.3 21h13.4c1.3 0 2.3-1 2.3-2.3V5.3C21 4 20 3 18.7 3zm.8 15.7c0 .4-.4.8-.8.8H5.3c-.4 0-.8-.4-.8-.8V5.3c0-.4.4-.8.8-.8h6.2v8.9l2.5-3.1 2.5 3.1V4.5h2.2c.4 0 .8.4.8.8v13.4z" })); /* harmony default export */ var library_cover = (cover); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/shared.js - - -function shared_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function shared_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { shared_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { shared_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -var POSITION_CLASSNAMES = { +/** + * WordPress dependencies + */ + +const POSITION_CLASSNAMES = { 'top left': 'is-position-top-left', 'top center': 'is-position-top-center', 'top right': 'is-position-top-right', @@ -12644,40 +12766,22 @@ 'bottom center': 'is-position-bottom-center', 'bottom right': 'is-position-bottom-right' }; -var IMAGE_BACKGROUND_TYPE = 'image'; -var VIDEO_BACKGROUND_TYPE = 'video'; -var COVER_MIN_HEIGHT = 50; +const IMAGE_BACKGROUND_TYPE = 'image'; +const VIDEO_BACKGROUND_TYPE = 'video'; +const COVER_MIN_HEIGHT = 50; +const COVER_MAX_HEIGHT = 1000; +const COVER_DEFAULT_HEIGHT = 300; function backgroundImageStyles(url) { return url ? { - backgroundImage: "url(".concat(url, ")") + backgroundImage: `url(${url})` } : {}; } -var CSS_UNITS = [{ - value: 'px', - label: 'px', - default: 430 -}, { - value: 'em', - label: 'em', - default: 20 -}, { - value: 'rem', - label: 'rem', - default: 20 -}, { - value: 'vw', - label: 'vw', - default: 20 -}, { - value: 'vh', - label: 'vh', - default: 50 -}]; +const shared_ALLOWED_MEDIA_TYPES = ['image', 'video']; function dimRatioToClass(ratio) { return ratio === 0 || ratio === 50 || !ratio ? null : 'has-background-dim-' + 10 * Math.round(ratio / 10); } function attributesFromMedia(setAttributes) { - return function (media) { + return media => { if (!media || !media.url) { setAttributes({ url: undefined, @@ -12686,7 +12790,11 @@ return; } - var mediaType; // for media selections originated from a file upload. + if (Object(external_wp_blob_["isBlobURL"])(media.url)) { + media.type = Object(external_wp_blob_["getBlobTypeByURL"])(media.url); + } + + let mediaType; // for media selections originated from a file upload. if (media.media_type) { if (media.media_type === IMAGE_BACKGROUND_TYPE) { @@ -12705,50 +12813,64 @@ mediaType = media.type; } - setAttributes(shared_objectSpread({ + setAttributes({ url: media.url, id: media.id, - backgroundType: mediaType - }, mediaType === VIDEO_BACKGROUND_TYPE ? { - focalPoint: undefined, - hasParallax: undefined - } : {})); - }; -} -function getPositionClassName(contentPosition) { - if (contentPosition === undefined) return ''; - return POSITION_CLASSNAMES[contentPosition]; -} + backgroundType: mediaType, + ...(mediaType === VIDEO_BACKGROUND_TYPE ? { + focalPoint: undefined, + hasParallax: undefined + } : {}) + }); + }; +} +/** + * Checks of the contentPosition is the center (default) position. + * + * @param {string} contentPosition The current content position. + * @return {boolean} Whether the contentPosition is center. + */ + function isContentPositionCenter(contentPosition) { return !contentPosition || contentPosition === 'center center' || contentPosition === 'center'; } +/** + * Retrieves the className for the current contentPosition. + * The default position (center) will not have a className. + * + * @param {string} contentPosition The current content position. + * @return {string} The className assigned to the contentPosition. + */ + +function getPositionClassName(contentPosition) { + /* + * Only render a className if the contentPosition is not center (the default). + */ + if (isContentPositionCenter(contentPosition)) return ''; + return POSITION_CLASSNAMES[contentPosition]; +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/deprecated.js - -function cover_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function cover_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { cover_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { cover_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - - -var cover_deprecated_blockAttributes = { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + +/** + * Internal dependencies + */ + + +const cover_deprecated_blockAttributes = { url: { type: 'string' }, @@ -12777,8 +12899,124 @@ type: 'object' } }; -var cover_deprecated_deprecated = [{ - attributes: cover_deprecated_objectSpread({}, cover_deprecated_blockAttributes, { +const cover_deprecated_deprecated = [{ + attributes: { ...cover_deprecated_blockAttributes, + title: { + type: 'string', + source: 'html', + selector: 'p' + }, + contentAlign: { + type: 'string', + default: 'center' + }, + isRepeated: { + type: 'boolean', + default: false + }, + minHeight: { + type: 'number' + }, + minHeightUnit: { + type: 'string' + }, + gradient: { + type: 'string' + }, + customGradient: { + type: 'string' + }, + contentPosition: { + type: 'string' + } + }, + supports: { + align: true + }, + + save({ + attributes + }) { + const { + backgroundType, + gradient, + contentPosition, + customGradient, + customOverlayColor, + dimRatio, + focalPoint, + hasParallax, + isRepeated, + overlayColor, + url, + minHeight: minHeightProp, + minHeightUnit + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + + const gradientClass = Object(external_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); + + const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp; + const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType; + const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType; + const style = isImageBackground ? backgroundImageStyles(url) : {}; + const videoStyle = {}; + + if (!overlayColorClass) { + style.backgroundColor = customOverlayColor; + } + + if (customGradient && !url) { + style.background = customGradient; + } + + style.minHeight = minHeight || undefined; + let positionValue; + + if (focalPoint) { + positionValue = `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%`; + + if (isImageBackground && !hasParallax) { + style.backgroundPosition = positionValue; + } + + if (isVideoBackground) { + videoStyle.objectPosition = positionValue; + } + } + + const classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, { + 'has-background-dim': dimRatio !== 0, + 'has-parallax': hasParallax, + 'is-repeated': isRepeated, + 'has-background-gradient': gradient || customGradient, + [gradientClass]: !url && gradientClass, + 'has-custom-content-position': !isContentPositionCenter(contentPosition) + }, getPositionClassName(contentPosition)); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className: classes, + style + }), url && (gradient || customGradient) && dimRatio !== 0 && Object(external_wp_element_["createElement"])("span", { + "aria-hidden": "true", + className: classnames_default()('wp-block-cover__gradient-background', gradientClass), + style: customGradient ? { + background: customGradient + } : undefined + }), isVideoBackground && url && Object(external_wp_element_["createElement"])("video", { + className: "wp-block-cover__video-background", + autoPlay: true, + muted: true, + loop: true, + playsInline: true, + src: url, + style: videoStyle + }), Object(external_wp_element_["createElement"])("div", { + className: "wp-block-cover__inner-container" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, { + attributes: { ...cover_deprecated_blockAttributes, title: { type: 'string', source: 'html', @@ -12797,31 +13035,38 @@ customGradient: { type: 'string' } - }), - save: function save(_ref) { - var attributes = _ref.attributes; - var backgroundType = attributes.backgroundType, - gradient = attributes.gradient, - customGradient = attributes.customGradient, - customOverlayColor = attributes.customOverlayColor, - dimRatio = attributes.dimRatio, - focalPoint = attributes.focalPoint, - hasParallax = attributes.hasParallax, - overlayColor = attributes.overlayColor, - url = attributes.url, - minHeight = attributes.minHeight; - var overlayColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); - - var gradientClass = Object(external_this_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); - - var style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; + }, + supports: { + align: true + }, + + save({ + attributes + }) { + const { + backgroundType, + gradient, + customGradient, + customOverlayColor, + dimRatio, + focalPoint, + hasParallax, + overlayColor, + url, + minHeight + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + + const gradientClass = Object(external_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); + + const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; if (!overlayColorClass) { style.backgroundColor = customOverlayColor; } if (focalPoint && !hasParallax) { - style.backgroundPosition = "".concat(Math.round(focalPoint.x * 100), "% ").concat(Math.round(focalPoint.y * 100), "%"); + style.backgroundPosition = `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%`; } if (customGradient && !url) { @@ -12829,32 +13074,34 @@ } style.minHeight = minHeight || undefined; - var classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, Object(defineProperty["a" /* default */])({ + const classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, { 'has-background-dim': dimRatio !== 0, 'has-parallax': hasParallax, - 'has-background-gradient': customGradient - }, gradientClass, !url && gradientClass)); - return Object(external_this_wp_element_["createElement"])("div", { + 'has-background-gradient': customGradient, + [gradientClass]: !url && gradientClass + }); + return Object(external_wp_element_["createElement"])("div", { className: classes, style: style - }, url && (gradient || customGradient) && dimRatio !== 0 && Object(external_this_wp_element_["createElement"])("span", { + }, url && (gradient || customGradient) && dimRatio !== 0 && Object(external_wp_element_["createElement"])("span", { "aria-hidden": "true", className: classnames_default()('wp-block-cover__gradient-background', gradientClass), style: customGradient ? { background: customGradient } : undefined - }), VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_this_wp_element_["createElement"])("video", { + }), VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_wp_element_["createElement"])("video", { className: "wp-block-cover__video-background", autoPlay: true, muted: true, loop: true, src: url - }), Object(external_this_wp_element_["createElement"])("div", { + }), Object(external_wp_element_["createElement"])("div", { className: "wp-block-cover__inner-container" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } -}, { - attributes: cover_deprecated_objectSpread({}, cover_deprecated_blockAttributes, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, { + attributes: { ...cover_deprecated_blockAttributes, title: { type: 'string', source: 'html', @@ -12873,31 +13120,38 @@ customGradient: { type: 'string' } - }), - save: function save(_ref2) { - var attributes = _ref2.attributes; - var backgroundType = attributes.backgroundType, - gradient = attributes.gradient, - customGradient = attributes.customGradient, - customOverlayColor = attributes.customOverlayColor, - dimRatio = attributes.dimRatio, - focalPoint = attributes.focalPoint, - hasParallax = attributes.hasParallax, - overlayColor = attributes.overlayColor, - url = attributes.url, - minHeight = attributes.minHeight; - var overlayColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); - - var gradientClass = Object(external_this_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); - - var style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; + }, + supports: { + align: true + }, + + save({ + attributes + }) { + const { + backgroundType, + gradient, + customGradient, + customOverlayColor, + dimRatio, + focalPoint, + hasParallax, + overlayColor, + url, + minHeight + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + + const gradientClass = Object(external_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); + + const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; if (!overlayColorClass) { style.backgroundColor = customOverlayColor; } if (focalPoint && !hasParallax) { - style.backgroundPosition = "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%"); + style.backgroundPosition = `${focalPoint.x * 100}% ${focalPoint.y * 100}%`; } if (customGradient && !url) { @@ -12905,32 +13159,34 @@ } style.minHeight = minHeight || undefined; - var classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, Object(defineProperty["a" /* default */])({ + const classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, { 'has-background-dim': dimRatio !== 0, 'has-parallax': hasParallax, - 'has-background-gradient': customGradient - }, gradientClass, !url && gradientClass)); - return Object(external_this_wp_element_["createElement"])("div", { + 'has-background-gradient': customGradient, + [gradientClass]: !url && gradientClass + }); + return Object(external_wp_element_["createElement"])("div", { className: classes, style: style - }, url && (gradient || customGradient) && dimRatio !== 0 && Object(external_this_wp_element_["createElement"])("span", { + }, url && (gradient || customGradient) && dimRatio !== 0 && Object(external_wp_element_["createElement"])("span", { "aria-hidden": "true", className: classnames_default()('wp-block-cover__gradient-background', gradientClass), style: customGradient ? { background: customGradient } : undefined - }), VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_this_wp_element_["createElement"])("video", { + }), VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_wp_element_["createElement"])("video", { className: "wp-block-cover__video-background", autoPlay: true, muted: true, loop: true, src: url - }), Object(external_this_wp_element_["createElement"])("div", { + }), Object(external_wp_element_["createElement"])("div", { className: "wp-block-cover__inner-container" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } -}, { - attributes: cover_deprecated_objectSpread({}, cover_deprecated_blockAttributes, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, { + attributes: { ...cover_deprecated_blockAttributes, title: { type: 'string', source: 'html', @@ -12940,61 +13196,68 @@ type: 'string', default: 'center' } - }), + }, supports: { align: true }, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var backgroundType = attributes.backgroundType, - contentAlign = attributes.contentAlign, - customOverlayColor = attributes.customOverlayColor, - dimRatio = attributes.dimRatio, - focalPoint = attributes.focalPoint, - hasParallax = attributes.hasParallax, - overlayColor = attributes.overlayColor, - title = attributes.title, - url = attributes.url; - var overlayColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); - var style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; + + save({ + attributes + }) { + const { + backgroundType, + contentAlign, + customOverlayColor, + dimRatio, + focalPoint, + hasParallax, + overlayColor, + title, + url + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + const style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; if (!overlayColorClass) { style.backgroundColor = customOverlayColor; } if (focalPoint && !hasParallax) { - style.backgroundPosition = "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%"); - } - - var classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, Object(defineProperty["a" /* default */])({ + style.backgroundPosition = `${focalPoint.x * 100}% ${focalPoint.y * 100}%`; + } + + const classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, { 'has-background-dim': dimRatio !== 0, - 'has-parallax': hasParallax - }, "has-".concat(contentAlign, "-content"), contentAlign !== 'center')); - return Object(external_this_wp_element_["createElement"])("div", { + 'has-parallax': hasParallax, + [`has-${contentAlign}-content`]: contentAlign !== 'center' + }); + return Object(external_wp_element_["createElement"])("div", { className: classes, style: style - }, VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_this_wp_element_["createElement"])("video", { + }, VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_wp_element_["createElement"])("video", { className: "wp-block-cover__video-background", autoPlay: true, muted: true, loop: true, src: url - }), !external_this_wp_blockEditor_["RichText"].isEmpty(title) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(title) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "p", className: "wp-block-cover-text", value: title })); }, - migrate: function migrate(attributes) { - return [Object(external_this_lodash_["omit"])(attributes, ['title', 'contentAlign']), [Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + + migrate(attributes) { + return [Object(external_lodash_["omit"])(attributes, ['title', 'contentAlign']), [Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: attributes.title, align: attributes.contentAlign, fontSize: 'large', - placeholder: Object(external_this_wp_i18n_["__"])('Write title…') + placeholder: Object(external_wp_i18n_["__"])('Write title…') })]]; } -}, { - attributes: cover_deprecated_objectSpread({}, cover_deprecated_blockAttributes, { + +}, { + attributes: { ...cover_deprecated_blockAttributes, title: { type: 'string', source: 'html', @@ -13007,50 +13270,57 @@ align: { type: 'string' } - }), + }, supports: { className: false }, - save: function save(_ref4) { - var attributes = _ref4.attributes; - var url = attributes.url, - title = attributes.title, - hasParallax = attributes.hasParallax, - dimRatio = attributes.dimRatio, - align = attributes.align, - contentAlign = attributes.contentAlign, - overlayColor = attributes.overlayColor, - customOverlayColor = attributes.customOverlayColor; - var overlayColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); - var style = backgroundImageStyles(url); + + save({ + attributes + }) { + const { + url, + title, + hasParallax, + dimRatio, + align, + contentAlign, + overlayColor, + customOverlayColor + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + const style = backgroundImageStyles(url); if (!overlayColorClass) { style.backgroundColor = customOverlayColor; } - var classes = classnames_default()('wp-block-cover-image', dimRatioToClass(dimRatio), overlayColorClass, Object(defineProperty["a" /* default */])({ + const classes = classnames_default()('wp-block-cover-image', dimRatioToClass(dimRatio), overlayColorClass, { 'has-background-dim': dimRatio !== 0, - 'has-parallax': hasParallax - }, "has-".concat(contentAlign, "-content"), contentAlign !== 'center'), align ? "align".concat(align) : null); - return Object(external_this_wp_element_["createElement"])("div", { + 'has-parallax': hasParallax, + [`has-${contentAlign}-content`]: contentAlign !== 'center' + }, align ? `align${align}` : null); + return Object(external_wp_element_["createElement"])("div", { className: classes, style: style - }, !external_this_wp_blockEditor_["RichText"].isEmpty(title) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, !external_wp_blockEditor_["RichText"].isEmpty(title) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "p", className: "wp-block-cover-image-text", value: title })); }, - migrate: function migrate(attributes) { - return [Object(external_this_lodash_["omit"])(attributes, ['title', 'contentAlign', 'align']), [Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + + migrate(attributes) { + return [Object(external_lodash_["omit"])(attributes, ['title', 'contentAlign', 'align']), [Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: attributes.title, align: attributes.contentAlign, fontSize: 'large', - placeholder: Object(external_this_wp_i18n_["__"])('Write title…') + placeholder: Object(external_wp_i18n_["__"])('Write title…') })]]; } -}, { - attributes: cover_deprecated_objectSpread({}, cover_deprecated_blockAttributes, { + +}, { + attributes: { ...cover_deprecated_blockAttributes, title: { type: 'string', source: 'html', @@ -13063,69 +13333,69 @@ type: 'string', default: 'center' } - }), + }, supports: { className: false }, - save: function save(_ref5) { - var attributes = _ref5.attributes; - var url = attributes.url, - title = attributes.title, - hasParallax = attributes.hasParallax, - dimRatio = attributes.dimRatio, - align = attributes.align; - var style = backgroundImageStyles(url); - var classes = classnames_default()('wp-block-cover-image', dimRatioToClass(dimRatio), { + + save({ + attributes + }) { + const { + url, + title, + hasParallax, + dimRatio, + align + } = attributes; + const style = backgroundImageStyles(url); + const classes = classnames_default()('wp-block-cover-image', dimRatioToClass(dimRatio), { 'has-background-dim': dimRatio !== 0, 'has-parallax': hasParallax - }, align ? "align".concat(align) : null); - return Object(external_this_wp_element_["createElement"])("section", { + }, align ? `align${align}` : null); + return Object(external_wp_element_["createElement"])("section", { className: classes, style: style - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "h2", value: title })); }, - migrate: function migrate(attributes) { - return [Object(external_this_lodash_["omit"])(attributes, ['title', 'contentAlign', 'align']), [Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + + migrate(attributes) { + return [Object(external_lodash_["omit"])(attributes, ['title', 'contentAlign', 'align']), [Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: attributes.title, align: attributes.contentAlign, fontSize: 'large', - placeholder: Object(external_this_wp_i18n_["__"])('Write title…') + placeholder: Object(external_wp_i18n_["__"])('Write title…') })]]; } + }]; /* harmony default export */ var cover_deprecated = (cover_deprecated_deprecated); // EXTERNAL MODULE: ./node_modules/fast-average-color/dist/index.js -var dist = __webpack_require__(267); +var dist = __webpack_require__("FEKF"); var dist_default = /*#__PURE__*/__webpack_require__.n(dist); // EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js -var tinycolor = __webpack_require__(66); +var tinycolor = __webpack_require__("Zss7"); var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/edit.js - - - -function cover_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function cover_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { cover_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { cover_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - - -/** - * WordPress dependencies - */ +/** + * External dependencies + */ + + + +/** + * WordPress dependencies + */ + @@ -13143,13 +13413,14 @@ * Module Constants */ -var cover_edit_ALLOWED_MEDIA_TYPES = ['image', 'video']; -var INNER_BLOCKS_TEMPLATE = [['core/paragraph', { +const INNER_BLOCKS_TEMPLATE = [['core/paragraph', { align: 'center', fontSize: 'large', - placeholder: Object(external_this_wp_i18n_["__"])('Write title…') + placeholder: Object(external_wp_i18n_["__"])('Write title…') }]]; -var BoxControlVisualizer = external_this_wp_components_["__experimentalBoxControl"].__Visualizer; +const { + __Visualizer: BoxControlVisualizer +} = external_wp_components_["__experimentalBoxControl"]; function retrieveFastAverageColor() { if (!retrieveFastAverageColor.fastAverageColor) { @@ -13159,25 +13430,29 @@ return retrieveFastAverageColor.fastAverageColor; } -function CoverHeightInput(_ref) { - var onChange = _ref.onChange, - onUnitChange = _ref.onUnitChange, - _ref$unit = _ref.unit, - unit = _ref$unit === void 0 ? 'px' : _ref$unit, - _ref$value = _ref.value, - value = _ref$value === void 0 ? '' : _ref$value; - - var _useState = Object(external_this_wp_element_["useState"])(null), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - temporaryInput = _useState2[0], - setTemporaryInput = _useState2[1]; - - var instanceId = Object(external_this_wp_compose_["useInstanceId"])(external_this_wp_blockEditor_["__experimentalUnitControl"]); - var inputId = "block-cover-height-input-".concat(instanceId); - var isPx = unit === 'px'; - - var handleOnChange = function handleOnChange(unprocessedValue) { - var inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : undefined; +function CoverHeightInput({ + onChange, + onUnitChange, + unit = 'px', + value = '' +}) { + const [temporaryInput, setTemporaryInput] = Object(external_wp_element_["useState"])(null); + const instanceId = Object(external_wp_compose_["useInstanceId"])(external_wp_blockEditor_["__experimentalUnitControl"]); + const inputId = `block-cover-height-input-${instanceId}`; + const isPx = unit === 'px'; + const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ + availableUnits: Object(external_wp_blockEditor_["useSetting"])('spacing.units') || ['px', 'em', 'rem', 'vw', 'vh'], + defaultValues: { + px: '430', + em: '20', + rem: '20', + vw: '20', + vh: '50' + } + }); + + const handleOnChange = unprocessedValue => { + const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : undefined; if (isNaN(inputValue) && inputValue !== undefined) { setTemporaryInput(unprocessedValue); @@ -13186,20 +13461,24 @@ setTemporaryInput(null); onChange(inputValue); - }; - - var handleOnBlur = function handleOnBlur() { + + if (inputValue === undefined) { + onUnitChange(); + } + }; + + const handleOnBlur = () => { if (temporaryInput !== null) { setTemporaryInput(null); } }; - var inputValue = temporaryInput !== null ? temporaryInput : value; - var min = isPx ? COVER_MIN_HEIGHT : 0; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["BaseControl"], { - label: Object(external_this_wp_i18n_["__"])('Minimum height of cover'), + const inputValue = temporaryInput !== null ? temporaryInput : value; + const min = isPx ? COVER_MIN_HEIGHT : 0; + return Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { + label: Object(external_wp_i18n_["__"])('Minimum height of cover'), id: inputId - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalUnitControl"], { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalUnitControl"], { id: inputId, isResetValueOnUnitChange: true, min: min, @@ -13211,12 +13490,12 @@ maxWidth: 80 }, unit: unit, - units: CSS_UNITS, + units: units, value: inputValue })); } -var RESIZABLE_BOX_ENABLE_OPTION = { +const RESIZABLE_BOX_ENABLE_OPTION = { top: false, right: false, bottom: true, @@ -13227,38 +13506,32 @@ topLeft: false }; -function ResizableCover(_ref2) { - var className = _ref2.className, - _onResizeStart = _ref2.onResizeStart, - _onResize = _ref2.onResize, - _onResizeStop = _ref2.onResizeStop, - props = Object(objectWithoutProperties["a" /* default */])(_ref2, ["className", "onResizeStart", "onResize", "onResizeStop"]); - - var _useState3 = Object(external_this_wp_element_["useState"])(false), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - isResizing = _useState4[0], - setIsResizing = _useState4[1]; - - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResizableBox"], Object(esm_extends["a" /* default */])({ +function ResizableCover({ + className, + onResizeStart, + onResize, + onResizeStop, + ...props +}) { + const [isResizing, setIsResizing] = Object(external_wp_element_["useState"])(false); + return Object(external_wp_element_["createElement"])(external_wp_components_["ResizableBox"], Object(esm_extends["a" /* default */])({ className: classnames_default()(className, { 'is-resizing': isResizing }), enable: RESIZABLE_BOX_ENABLE_OPTION, - onResizeStart: function onResizeStart(_event, _direction, elt) { - _onResizeStart(elt.clientHeight); - - _onResize(elt.clientHeight); - }, - onResize: function onResize(_event, _direction, elt) { - _onResize(elt.clientHeight); + onResizeStart: (_event, _direction, elt) => { + onResizeStart(elt.clientHeight); + onResize(elt.clientHeight); + }, + onResize: (_event, _direction, elt) => { + onResize(elt.clientHeight); if (!isResizing) { setIsResizing(true); } }, - onResizeStop: function onResizeStop(_event, _direction, elt) { - _onResizeStop(elt.clientHeight); - + onResizeStop: (_event, _direction, elt) => { + onResizeStop(elt.clientHeight); setIsResizing(false); }, minHeight: COVER_MIN_HEIGHT @@ -13280,26 +13553,18 @@ */ -function useCoverIsDark(url) { - var dimRatio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50; - var overlayColor = arguments.length > 2 ? arguments[2] : undefined; - var elementRef = arguments.length > 3 ? arguments[3] : undefined; - - var _useState5 = Object(external_this_wp_element_["useState"])(false), - _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), - isDark = _useState6[0], - setIsDark = _useState6[1]; - - Object(external_this_wp_element_["useEffect"])(function () { +function useCoverIsDark(url, dimRatio = 50, overlayColor, elementRef) { + const [isDark, setIsDark] = Object(external_wp_element_["useState"])(false); + Object(external_wp_element_["useEffect"])(() => { // If opacity is lower than 50 the dominant color is the image or video color, // so use that color for the dark mode computation. if (url && dimRatio <= 50 && elementRef.current) { - retrieveFastAverageColor().getColorAsync(elementRef.current, function (color) { + retrieveFastAverageColor().getColorAsync(elementRef.current, color => { setIsDark(color.isDark); }); } }, [url, url && dimRatio <= 50 && elementRef.current, setIsDark]); - Object(external_this_wp_element_["useEffect"])(function () { + Object(external_wp_element_["useEffect"])(() => { // If opacity is greater than 50 the dominant color is the overlay color, // so use that color for the dark mode computation. if (dimRatio > 50 || !url) { @@ -13312,7 +13577,7 @@ setIsDark(tinycolor_default()(overlayColor).isDark()); } }, [overlayColor, dimRatio > 50 || !url, setIsDark]); - Object(external_this_wp_element_["useEffect"])(function () { + Object(external_wp_element_["useEffect"])(() => { if (!url && !overlayColor) { // Reset isDark setIsDark(false); @@ -13321,181 +13586,268 @@ return isDark; } -function CoverEdit(_ref3) { - var _classnames, _styleAttribute$spaci, _styleAttribute$visua; - - var attributes = _ref3.attributes, - setAttributes = _ref3.setAttributes, - isSelected = _ref3.isSelected, - noticeUI = _ref3.noticeUI, - overlayColor = _ref3.overlayColor, - setOverlayColor = _ref3.setOverlayColor, - toggleSelection = _ref3.toggleSelection, - noticeOperations = _ref3.noticeOperations; - var contentPosition = attributes.contentPosition, - id = attributes.id, - backgroundType = attributes.backgroundType, - dimRatio = attributes.dimRatio, - focalPoint = attributes.focalPoint, - hasParallax = attributes.hasParallax, - minHeight = attributes.minHeight, - minHeightUnit = attributes.minHeightUnit, - styleAttribute = attributes.style, - url = attributes.url; - - var _experimentalUseGrad = Object(external_this_wp_blockEditor_["__experimentalUseGradient"])(), - gradientClass = _experimentalUseGrad.gradientClass, - gradientValue = _experimentalUseGrad.gradientValue, - setGradient = _experimentalUseGrad.setGradient; - - var onSelectMedia = attributesFromMedia(setAttributes); - - var toggleParallax = function toggleParallax() { - setAttributes(cover_edit_objectSpread({ - hasParallax: !hasParallax - }, !hasParallax ? { - focalPoint: undefined - } : {})); - }; - - var isDarkElement = Object(external_this_wp_element_["useRef"])(); - var isDark = useCoverIsDark(url, dimRatio, overlayColor.color, isDarkElement); - - var _useState7 = Object(external_this_wp_element_["useState"])(null), - _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), - temporaryMinHeight = _useState8[0], - setTemporaryMinHeight = _useState8[1]; - - var removeAllNotices = noticeOperations.removeAllNotices, - createErrorNotice = noticeOperations.createErrorNotice; - var minHeightWithUnit = minHeightUnit ? "".concat(minHeight).concat(minHeightUnit) : minHeight; - - var style = cover_edit_objectSpread({}, backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}, { +function edit_mediaPosition({ + x, + y +}) { + return `${Math.round(x * 100)}% ${Math.round(y * 100)}%`; +} +/** + * Is the URL a temporary blob URL? A blob URL is one that is used temporarily while + * the media (image or video) is being uploaded and will not have an id allocated yet. + * + * @param {number} id The id of the media. + * @param {string} url The url of the media. + * + * @return {boolean} Is the URL a Blob URL. + */ + + +const isTemporaryMedia = (id, url) => !id && Object(external_wp_blob_["isBlobURL"])(url); + +function CoverPlaceholder({ + disableMediaButtons = false, + children, + noticeUI, + noticeOperations, + onSelectMedia +}) { + const { + removeAllNotices, + createErrorNotice + } = noticeOperations; + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { + icon: library_cover + }), + labels: { + title: Object(external_wp_i18n_["__"])('Cover'), + instructions: Object(external_wp_i18n_["__"])('Upload an image or video file, or pick one from your media library.') + }, + onSelect: onSelectMedia, + accept: "image/*,video/*", + allowedTypes: shared_ALLOWED_MEDIA_TYPES, + notices: noticeUI, + disableMediaButtons: disableMediaButtons, + onError: message => { + removeAllNotices(); + createErrorNotice(message); + } + }, children); +} + +function CoverEdit({ + attributes, + clientId, + isSelected, + noticeUI, + noticeOperations, + overlayColor, + setAttributes, + setOverlayColor, + toggleSelection +}) { + var _styleAttribute$spaci, _styleAttribute$visua; + + const { + contentPosition, + id, + backgroundType, + dimRatio, + focalPoint, + hasParallax, + isRepeated, + minHeight, + minHeightUnit, + style: styleAttribute, + url + } = attributes; + + const { + gradientClass, + gradientValue, + setGradient + } = Object(external_wp_blockEditor_["__experimentalUseGradient"])(); + + const onSelectMedia = attributesFromMedia(setAttributes); + const isUploadingMedia = isTemporaryMedia(id, url); + const [prevMinHeightValue, setPrevMinHeightValue] = Object(external_wp_element_["useState"])(minHeight); + const [prevMinHeightUnit, setPrevMinHeightUnit] = Object(external_wp_element_["useState"])(minHeightUnit); + const isMinFullHeight = minHeightUnit === 'vh' && minHeight === 100; + + const toggleMinFullHeight = () => { + if (isMinFullHeight) { + // If there aren't previous values, take the default ones. + if (prevMinHeightUnit === 'vh' && prevMinHeightValue === 100) { + return setAttributes({ + minHeight: undefined, + minHeightUnit: undefined + }); + } // Set the previous values of height. + + + return setAttributes({ + minHeight: prevMinHeightValue, + minHeightUnit: prevMinHeightUnit + }); + } + + setPrevMinHeightValue(minHeight); + setPrevMinHeightUnit(minHeightUnit); // Set full height. + + return setAttributes({ + minHeight: 100, + minHeightUnit: 'vh' + }); + }; + + const toggleParallax = () => { + setAttributes({ + hasParallax: !hasParallax, + ...(!hasParallax ? { + focalPoint: undefined + } : {}) + }); + }; + + const toggleIsRepeated = () => { + setAttributes({ + isRepeated: !isRepeated + }); + }; + + const isDarkElement = Object(external_wp_element_["useRef"])(); + const isDark = useCoverIsDark(url, dimRatio, overlayColor.color, isDarkElement); + const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType; + const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType; + const [temporaryMinHeight, setTemporaryMinHeight] = Object(external_wp_element_["useState"])(null); + const minHeightWithUnit = minHeightUnit ? `${minHeight}${minHeightUnit}` : minHeight; + const isImgElement = !(hasParallax || isRepeated); + const style = { ...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : { + backgroundImage: gradientValue ? gradientValue : undefined + }), backgroundColor: overlayColor.color, minHeight: temporaryMinHeight || minHeightWithUnit || undefined - }); - - if (gradientValue && !url) { - style.background = gradientValue; - } - - if (focalPoint) { - style.backgroundPosition = "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%"); - } - - var hasBackground = !!(url || overlayColor.color || gradientValue); - var controls = Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, hasBackground && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlockAlignmentMatrixToolbar"], { - label: Object(external_this_wp_i18n_["__"])('Change content position'), + }; + const mediaStyle = { + objectPosition: focalPoint && isImgElement ? edit_mediaPosition(focalPoint) : undefined + }; + const hasBackground = !!(url || overlayColor.color || gradientValue); + const showFocalPointPicker = isVideoBackground || isImageBackground && (!hasParallax || isRepeated); + + const imperativeFocalPointPreview = value => { + const [styleOfRef, property] = isDarkElement.current ? [isDarkElement.current.style, 'objectPosition'] : [ref.current.style, 'backgroundPosition']; + styleOfRef[property] = edit_mediaPosition(value); + }; + + const hasInnerBlocks = Object(external_wp_data_["useSelect"])(select => select(external_wp_blockEditor_["store"]).getBlock(clientId).innerBlocks.length > 0, [clientId]); + const controls = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalBlockAlignmentMatrixControl"], { + label: Object(external_wp_i18n_["__"])('Change content position'), value: contentPosition, - onChange: function onChange(nextPosition) { - return setAttributes({ - contentPosition: nextPosition - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaReplaceFlow"], { + onChange: nextPosition => setAttributes({ + contentPosition: nextPosition + }), + isDisabled: !hasInnerBlocks + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalBlockFullHeightAligmentControl"], { + isActive: isMinFullHeight, + onToggle: toggleMinFullHeight, + isDisabled: !hasInnerBlocks + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], { mediaId: id, mediaURL: url, - allowedTypes: cover_edit_ALLOWED_MEDIA_TYPES, + allowedTypes: shared_ALLOWED_MEDIA_TYPES, accept: "image/*,video/*", - onSelect: onSelectMedia - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, !!url && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Media settings') - }, IMAGE_BACKGROUND_TYPE === backgroundType && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Fixed background'), + onSelect: onSelectMedia, + name: !url ? Object(external_wp_i18n_["__"])('Add Media') : Object(external_wp_i18n_["__"])('Replace') + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, !!url && Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Media settings') + }, isImageBackground && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Fixed background'), checked: hasParallax, onChange: toggleParallax - }), IMAGE_BACKGROUND_TYPE === backgroundType && !hasParallax && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FocalPointPicker"], { - label: Object(external_this_wp_i18n_["__"])('Focal point picker'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Repeated background'), + checked: isRepeated, + onChange: toggleIsRepeated + })), showFocalPointPicker && Object(external_wp_element_["createElement"])(external_wp_components_["FocalPointPicker"], { + label: Object(external_wp_i18n_["__"])('Focal point picker'), url: url, value: focalPoint, - onChange: function onChange(newFocalPoint) { - return setAttributes({ - focalPoint: newFocalPoint - }); - } - }), VIDEO_BACKGROUND_TYPE === backgroundType && Object(external_this_wp_element_["createElement"])("video", { - autoPlay: true, - muted: true, - loop: true, - src: url - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelRow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + onDragStart: imperativeFocalPointPreview, + onDrag: imperativeFocalPointPreview, + onChange: newFocalPoint => setAttributes({ + focalPoint: newFocalPoint + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isSecondary: true, isSmall: true, className: "block-library-cover__reset-button", - onClick: function onClick() { - return setAttributes({ - url: undefined, - id: undefined, - backgroundType: undefined, - dimRatio: undefined, - focalPoint: undefined, - hasParallax: undefined - }); - } - }, Object(external_this_wp_i18n_["__"])('Clear Media')))), hasBackground && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Dimensions') - }, Object(external_this_wp_element_["createElement"])(CoverHeightInput, { + onClick: () => setAttributes({ + url: undefined, + id: undefined, + backgroundType: undefined, + dimRatio: undefined, + focalPoint: undefined, + hasParallax: undefined, + isRepeated: undefined + }) + }, Object(external_wp_i18n_["__"])('Clear Media')))), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Dimensions') + }, Object(external_wp_element_["createElement"])(CoverHeightInput, { value: temporaryMinHeight || minHeight, unit: minHeightUnit, - onChange: function onChange(newMinHeight) { - return setAttributes({ - minHeight: newMinHeight - }); - }, - onUnitChange: function onUnitChange(nextUnit) { - setAttributes({ - minHeightUnit: nextUnit - }); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalPanelColorGradientSettings"], { - title: Object(external_this_wp_i18n_["__"])('Overlay'), + onChange: newMinHeight => setAttributes({ + minHeight: newMinHeight + }), + onUnitChange: nextUnit => setAttributes({ + minHeightUnit: nextUnit + }) + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalPanelColorGradientSettings"], { + title: Object(external_wp_i18n_["__"])('Overlay'), initialOpen: true, settings: [{ colorValue: overlayColor.color, - gradientValue: gradientValue, + gradientValue, onColorChange: setOverlayColor, onGradientChange: setGradient, - label: Object(external_this_wp_i18n_["__"])('Color') + label: Object(external_wp_i18n_["__"])('Color') }] - }, !!url && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Opacity'), + }, !!url && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Opacity'), value: dimRatio, - onChange: function onChange(newDimRation) { - return setAttributes({ - dimRatio: newDimRation - }); - }, + onChange: newDimRation => setAttributes({ + dimRatio: newDimRation + }), min: 0, max: 100, + step: 10, required: true - }))))); - - if (!hasBackground) { - var placeholderIcon = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { - icon: library_cover - }); - - var label = Object(external_this_wp_i18n_["__"])('Cover'); - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, controls, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, { - className: "is-placeholder" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - icon: placeholderIcon, - labels: { - title: label, - instructions: Object(external_this_wp_i18n_["__"])('Upload an image or video file, or pick one from your media library.') - }, - onSelect: onSelectMedia, - accept: "image/*,video/*", - allowedTypes: cover_edit_ALLOWED_MEDIA_TYPES, - notices: noticeUI, - onError: function onError(message) { - removeAllNotices(); - createErrorNotice(message); - } - }, Object(external_this_wp_element_["createElement"])("div", { + })))); + const ref = Object(external_wp_element_["useRef"])(); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + ref + }); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({ + className: 'wp-block-cover__inner-container' + }, { + template: INNER_BLOCKS_TEMPLATE, + templateInsertUpdatesSelection: true + }); + + if (!hasInnerBlocks && !hasBackground) { + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, controls, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, blockProps, { + className: classnames_default()('is-placeholder', blockProps.className) + }), Object(external_wp_element_["createElement"])(CoverPlaceholder, { + noticeUI: noticeUI, + onSelectMedia: onSelectMedia, + noticeOperations: noticeOperations + }, Object(external_wp_element_["createElement"])("div", { className: "wp-block-cover__placeholder-background-options" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["ColorPalette"], { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["ColorPalette"], { disableCustomColors: true, value: overlayColor.color, onChange: setOverlayColor, @@ -13503,28 +13855,36 @@ }))))); } - var classes = classnames_default()(dimRatioToClass(dimRatio), (_classnames = { + const classes = classnames_default()(dimRatioToClass(dimRatio), { 'is-dark-theme': isDark, 'has-background-dim': dimRatio !== 0, - 'has-parallax': hasParallax - }, Object(defineProperty["a" /* default */])(_classnames, overlayColor.class, overlayColor.class), Object(defineProperty["a" /* default */])(_classnames, 'has-background-gradient', gradientValue), Object(defineProperty["a" /* default */])(_classnames, gradientClass, !url && gradientClass), Object(defineProperty["a" /* default */])(_classnames, 'has-custom-content-position', !isContentPositionCenter(contentPosition)), _classnames), getPositionClassName(contentPosition)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, controls, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, { - className: classes, - "data-url": url, - style: style - }, Object(external_this_wp_element_["createElement"])(BoxControlVisualizer, { + 'is-transient': isUploadingMedia, + 'has-parallax': hasParallax, + 'is-repeated': isRepeated, + [overlayColor.class]: overlayColor.class, + 'has-background-gradient': gradientValue, + [gradientClass]: !url && gradientClass, + 'has-custom-content-position': !isContentPositionCenter(contentPosition) + }, getPositionClassName(contentPosition)); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, controls, Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, blockProps, { + className: classnames_default()(classes, blockProps.className), + style: { ...style, + ...blockProps.style + }, + "data-url": url + }), Object(external_wp_element_["createElement"])(BoxControlVisualizer, { values: styleAttribute === null || styleAttribute === void 0 ? void 0 : (_styleAttribute$spaci = styleAttribute.spacing) === null || _styleAttribute$spaci === void 0 ? void 0 : _styleAttribute$spaci.padding, showValues: styleAttribute === null || styleAttribute === void 0 ? void 0 : (_styleAttribute$visua = styleAttribute.visualizers) === null || _styleAttribute$visua === void 0 ? void 0 : _styleAttribute$visua.padding - }), Object(external_this_wp_element_["createElement"])(ResizableCover, { + }), Object(external_wp_element_["createElement"])(ResizableCover, { className: "block-library-cover__resize-container", - onResizeStart: function onResizeStart() { + onResizeStart: () => { setAttributes({ minHeightUnit: 'px' }); toggleSelection(false); }, onResize: setTemporaryMinHeight, - onResizeStop: function onResizeStop(newMinHeight) { + onResizeStop: newMinHeight => { toggleSelection(true); setAttributes({ minHeight: newMinHeight @@ -13532,126 +13892,137 @@ setTemporaryMinHeight(null); }, showHandle: isSelected - }), IMAGE_BACKGROUND_TYPE === backgroundType && // Used only to programmatically check if the image is dark or not - Object(external_this_wp_element_["createElement"])("img", { - ref: isDarkElement, - "aria-hidden": true, - alt: "", - style: { - display: 'none' - }, - src: url - }), url && gradientValue && dimRatio !== 0 && Object(external_this_wp_element_["createElement"])("span", { + }), url && gradientValue && dimRatio !== 0 && Object(external_wp_element_["createElement"])("span", { "aria-hidden": "true", className: classnames_default()('wp-block-cover__gradient-background', gradientClass), style: { - background: gradientValue - } - }), VIDEO_BACKGROUND_TYPE === backgroundType && Object(external_this_wp_element_["createElement"])("video", { + backgroundImage: gradientValue + } + }), url && isImageBackground && isImgElement && Object(external_wp_element_["createElement"])("img", { + ref: isDarkElement, + className: "wp-block-cover__image-background", + alt: "", + src: url, + style: mediaStyle + }), url && isVideoBackground && Object(external_wp_element_["createElement"])("video", { ref: isDarkElement, className: "wp-block-cover__video-background", autoPlay: true, muted: true, loop: true, - src: url - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { - __experimentalTagName: "div", - __experimentalPassedProps: { - className: 'wp-block-cover__inner-container' - }, - template: INNER_BLOCKS_TEMPLATE - }))); -} - -/* harmony default export */ var cover_edit = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withDispatch"])(function (dispatch) { - var _dispatch = dispatch('core/block-editor'), - toggleSelection = _dispatch.toggleSelection; - + src: url, + style: mediaStyle + }), isUploadingMedia && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), Object(external_wp_element_["createElement"])(CoverPlaceholder, { + disableMediaButtons: true, + noticeUI: noticeUI, + onSelectMedia: onSelectMedia, + noticeOperations: noticeOperations + }), Object(external_wp_element_["createElement"])("div", innerBlocksProps))); +} + +/* harmony default export */ var cover_edit = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withDispatch"])(dispatch => { + const { + toggleSelection + } = dispatch(external_wp_blockEditor_["store"]); return { - toggleSelection: toggleSelection - }; -}), Object(external_this_wp_blockEditor_["withColors"])({ + toggleSelection + }; +}), Object(external_wp_blockEditor_["withColors"])({ overlayColor: 'background-color' -}), external_this_wp_components_["withNotices"], external_this_wp_compose_["withInstanceId"]])(CoverEdit)); +}), external_wp_components_["withNotices"], external_wp_compose_["withInstanceId"]])(CoverEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/save.js - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function cover_save_save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var backgroundType = attributes.backgroundType, - gradient = attributes.gradient, - contentPosition = attributes.contentPosition, - customGradient = attributes.customGradient, - customOverlayColor = attributes.customOverlayColor, - dimRatio = attributes.dimRatio, - focalPoint = attributes.focalPoint, - hasParallax = attributes.hasParallax, - overlayColor = attributes.overlayColor, - url = attributes.url, - minHeightProp = attributes.minHeight, - minHeightUnit = attributes.minHeightUnit; - var overlayColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); - - var gradientClass = Object(external_this_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); - - var minHeight = minHeightUnit ? "".concat(minHeightProp).concat(minHeightUnit) : minHeightProp; - var style = backgroundType === IMAGE_BACKGROUND_TYPE ? backgroundImageStyles(url) : {}; - - if (!overlayColorClass) { - style.backgroundColor = customOverlayColor; - } - - if (focalPoint && !hasParallax) { - style.backgroundPosition = "".concat(Math.round(focalPoint.x * 100), "% ").concat(Math.round(focalPoint.y * 100), "%"); - } - - if (customGradient && !url) { - style.background = customGradient; - } - - style.minHeight = minHeight || undefined; - var classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, (_classnames = { +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function cover_save_save({ + attributes +}) { + const { + backgroundType, + gradient, + contentPosition, + customGradient, + customOverlayColor, + dimRatio, + focalPoint, + hasParallax, + isRepeated, + overlayColor, + url, + id, + minHeight: minHeightProp, + minHeightUnit + } = attributes; + const overlayColorClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', overlayColor); + + const gradientClass = Object(external_wp_blockEditor_["__experimentalGetGradientClass"])(gradient); + + const minHeight = minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp; + const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType; + const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType; + const isImgElement = !(hasParallax || isRepeated); + const style = { ...(isImageBackground && !isImgElement ? backgroundImageStyles(url) : {}), + backgroundColor: !overlayColorClass ? customOverlayColor : undefined, + background: customGradient && !url ? customGradient : undefined, + minHeight: minHeight || undefined + }; + const objectPosition = // prettier-ignore + focalPoint && isImgElement ? `${Math.round(focalPoint.x * 100)}% ${Math.round(focalPoint.y * 100)}%` : undefined; + const classes = classnames_default()(dimRatioToClass(dimRatio), overlayColorClass, { 'has-background-dim': dimRatio !== 0, 'has-parallax': hasParallax, - 'has-background-gradient': gradient || customGradient - }, Object(defineProperty["a" /* default */])(_classnames, gradientClass, !url && gradientClass), Object(defineProperty["a" /* default */])(_classnames, 'has-custom-content-position', !isContentPositionCenter(contentPosition)), _classnames), getPositionClassName(contentPosition)); - return Object(external_this_wp_element_["createElement"])("div", { + 'is-repeated': isRepeated, + 'has-background-gradient': gradient || customGradient, + [gradientClass]: !url && gradientClass, + 'has-custom-content-position': !isContentPositionCenter(contentPosition) + }, getPositionClassName(contentPosition)); + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ className: classes, - style: style - }, url && (gradient || customGradient) && dimRatio !== 0 && Object(external_this_wp_element_["createElement"])("span", { + style + }), url && (gradient || customGradient) && dimRatio !== 0 && Object(external_wp_element_["createElement"])("span", { "aria-hidden": "true", className: classnames_default()('wp-block-cover__gradient-background', gradientClass), style: customGradient ? { background: customGradient } : undefined - }), VIDEO_BACKGROUND_TYPE === backgroundType && url && Object(external_this_wp_element_["createElement"])("video", { - className: "wp-block-cover__video-background", + }), isImageBackground && isImgElement && url && Object(external_wp_element_["createElement"])("img", { + className: classnames_default()('wp-block-cover__image-background', id ? `wp-image-${id}` : null), + alt: "", + src: url, + style: { + objectPosition + }, + "data-object-fit": "cover", + "data-object-position": objectPosition + }), isVideoBackground && url && Object(external_wp_element_["createElement"])("video", { + className: classnames_default()('wp-block-cover__video-background', 'intrinsic-ignore'), autoPlay: true, muted: true, loop: true, playsInline: true, - src: url - }), Object(external_this_wp_element_["createElement"])("div", { + src: url, + style: { + objectPosition + }, + "data-object-fit": "cover", + "data-object-position": objectPosition + }), Object(external_wp_element_["createElement"])("div", { className: "wp-block-cover__inner-container" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/cover/transforms.js @@ -13664,54 +14035,103 @@ */ -var cover_transforms_transforms = { +const cover_transforms_transforms = { from: [{ type: 'block', blocks: ['core/image'], - transform: function transform(_ref) { - var caption = _ref.caption, - url = _ref.url, - align = _ref.align, - id = _ref.id, - anchor = _ref.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/cover', { - title: caption, - url: url, - align: align, - id: id, - anchor: anchor - }); + transform: ({ + caption, + url, + align, + id, + anchor, + style + }) => { + var _style$color; + + return Object(external_wp_blocks_["createBlock"])('core/cover', { + url, + align, + id, + anchor, + style: { + color: { + duotone: style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone + } + } + }, [Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: caption, + fontSize: 'large' + })]); } }, { type: 'block', blocks: ['core/video'], - transform: function transform(_ref2) { - var caption = _ref2.caption, - src = _ref2.src, - align = _ref2.align, - id = _ref2.id, - anchor = _ref2.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/cover', { - title: caption, - url: src, - align: align, - id: id, - backgroundType: VIDEO_BACKGROUND_TYPE, - anchor: anchor - }); + transform: ({ + caption, + src, + align, + id, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/cover', { + url: src, + align, + id, + backgroundType: VIDEO_BACKGROUND_TYPE, + anchor + }, [Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: caption, + fontSize: 'large' + })]) + }, { + type: 'block', + blocks: ['core/group'], + isMatch: ({ + backgroundColor, + gradient, + style + }) => { + var _style$color2, _style$color3; + + /* + * Make this transformation available only if the Group has background + * or gradient set, because otherwise `Cover` block displays a Placeholder. + * + * This helps avoid arbitrary decisions about the Cover block's background + * and user confusion about the existence of previous content. + */ + return backgroundColor || (style === null || style === void 0 ? void 0 : (_style$color2 = style.color) === null || _style$color2 === void 0 ? void 0 : _style$color2.background) || (style === null || style === void 0 ? void 0 : (_style$color3 = style.color) === null || _style$color3 === void 0 ? void 0 : _style$color3.gradient) || gradient; + }, + transform: ({ + align, + anchor, + backgroundColor, + gradient, + style + }, innerBlocks) => { + var _style$color4, _style$color5; + + return Object(external_wp_blocks_["createBlock"])('core/cover', { + align, + anchor, + overlayColor: backgroundColor, + customOverlayColor: style === null || style === void 0 ? void 0 : (_style$color4 = style.color) === null || _style$color4 === void 0 ? void 0 : _style$color4.background, + gradient, + customGradient: style === null || style === void 0 ? void 0 : (_style$color5 = style.color) === null || _style$color5 === void 0 ? void 0 : _style$color5.gradient + }, innerBlocks); } }], to: [{ type: 'block', blocks: ['core/image'], - isMatch: function isMatch(_ref3) { - var backgroundType = _ref3.backgroundType, - url = _ref3.url, - overlayColor = _ref3.overlayColor, - customOverlayColor = _ref3.customOverlayColor, - gradient = _ref3.gradient, - customGradient = _ref3.customGradient; - + isMatch: ({ + backgroundType, + url, + overlayColor, + customOverlayColor, + gradient, + customGradient + }) => { if (url) { // If a url exists the transform could happen if that URL represents an image background. return backgroundType === IMAGE_BACKGROUND_TYPE; @@ -13720,31 +14140,40 @@ return !overlayColor && !customOverlayColor && !gradient && !customGradient; }, - transform: function transform(_ref4) { - var title = _ref4.title, - url = _ref4.url, - align = _ref4.align, - id = _ref4.id, - anchor = _ref4.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/image', { + transform: ({ + title, + url, + align, + id, + anchor, + style + }) => { + var _style$color6; + + return Object(external_wp_blocks_["createBlock"])('core/image', { caption: title, - url: url, - align: align, - id: id, - anchor: anchor + url, + align, + id, + anchor, + style: { + color: { + duotone: style === null || style === void 0 ? void 0 : (_style$color6 = style.color) === null || _style$color6 === void 0 ? void 0 : _style$color6.duotone + } + } }); } }, { type: 'block', blocks: ['core/video'], - isMatch: function isMatch(_ref5) { - var backgroundType = _ref5.backgroundType, - url = _ref5.url, - overlayColor = _ref5.overlayColor, - customOverlayColor = _ref5.customOverlayColor, - gradient = _ref5.gradient, - customGradient = _ref5.customGradient; - + isMatch: ({ + backgroundType, + url, + overlayColor, + customOverlayColor, + gradient, + customGradient + }) => { if (url) { // If a url exists the transform could happen if that URL represents a video background. return backgroundType === VIDEO_BACKGROUND_TYPE; @@ -13753,20 +14182,19 @@ return !overlayColor && !customOverlayColor && !gradient && !customGradient; }, - transform: function transform(_ref6) { - var title = _ref6.title, - url = _ref6.url, - align = _ref6.align, - id = _ref6.id, - anchor = _ref6.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/video', { - caption: title, - src: url, - id: id, - align: align, - anchor: anchor - }); - } + transform: ({ + title, + url, + align, + id, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/video', { + caption: title, + src: url, + id, + align, + anchor + }) }] }; /* harmony default export */ var cover_transforms = (cover_transforms_transforms); @@ -13783,9 +14211,13 @@ -var cover_metadata = { +const cover_metadata = { + apiVersion: 2, name: "core/cover", + title: "Cover", category: "media", + description: "Add an image or video with a text overlay \u2014 great for headers.", + textdomain: "default", attributes: { url: { type: "string" @@ -13797,6 +14229,10 @@ type: "boolean", "default": false }, + isRepeated: { + type: "boolean", + "default": false + }, dimRatio: { type: "number", "default": 50 @@ -13834,17 +14270,25 @@ anchor: true, align: true, html: false, - lightBlockWrapper: true, - __experimentalPadding: true - } -}; - - -var cover_name = cover_metadata.name; - -var cover_settings = { - title: Object(external_this_wp_i18n_["__"])('Cover'), - description: Object(external_this_wp_i18n_["__"])('Add an image or video with a text overlay — great for headers.'), + spacing: { + padding: true + }, + color: { + __experimentalDuotone: "> .wp-block-cover__image-background, > .wp-block-cover__video-background", + text: false, + background: false + } + }, + editorStyle: "wp-block-cover-editor", + style: "wp-block-cover" +}; + + +const { + name: cover_name +} = cover_metadata; + +const cover_settings = { icon: library_cover, example: { attributes: { @@ -13856,7 +14300,7 @@ name: 'core/paragraph', attributes: { customFontSize: 48, - content: Object(external_this_wp_i18n_["__"])('Snow Patrol'), + content: Object(external_wp_i18n_["__"])('Snow Patrol'), align: 'center' } }] @@ -13867,9 +14311,6 @@ deprecated: cover_deprecated }; -// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js -var pencil = __webpack_require__(299); - // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-controls.js @@ -13881,31 +14322,171 @@ -var embed_controls_EmbedControls = function EmbedControls(props) { - var blockSupportsResponsive = props.blockSupportsResponsive, - showEditButton = props.showEditButton, - themeSupportsResponsive = props.themeSupportsResponsive, - allowResponsive = props.allowResponsive, - getResponsiveHelp = props.getResponsiveHelp, - toggleResponsive = props.toggleResponsive, - switchBackToURLInput = props.switchBackToURLInput; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, showEditButton && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - className: "components-toolbar__control", - label: Object(external_this_wp_i18n_["__"])('Edit URL'), - icon: pencil["a" /* default */], - onClick: switchBackToURLInput - }))), themeSupportsResponsive && blockSupportsResponsive && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Media settings'), - className: "blocks-responsive" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Resize for smaller devices'), - checked: allowResponsive, - help: getResponsiveHelp, - onChange: toggleResponsive - })))); -}; - -/* harmony default export */ var embed_controls = (embed_controls_EmbedControls); +const EmbedControls = ({ + blockSupportsResponsive, + showEditButton, + themeSupportsResponsive, + allowResponsive, + getResponsiveHelp, + toggleResponsive, + switchBackToURLInput +}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, showEditButton && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + className: "components-toolbar__control", + label: Object(external_wp_i18n_["__"])('Edit URL'), + icon: library_edit["a" /* default */], + onClick: switchBackToURLInput +}))), themeSupportsResponsive && blockSupportsResponsive && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Media settings'), + className: "blocks-responsive" +}, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Resize for smaller devices'), + checked: allowResponsive, + help: getResponsiveHelp, + onChange: toggleResponsive +})))); + +/* harmony default export */ var embed_controls = (EmbedControls); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/icons.js + + +/** + * WordPress dependencies + */ + +const embedContentIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zm-6-9.5L16 12l-2.5 2.8 1.1 1L18 12l-3.5-3.5-1 1zm-3 0l-1-1L6 12l3.5 3.8 1.1-1L8 12l2.5-2.5z" +})); +const embedAudioIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM13.2 7.7c-.4.4-.7 1.1-.7 1.9v3.7c-.4-.3-.8-.4-1.3-.4-1.2 0-2.2 1-2.2 2.2 0 1.2 1 2.2 2.2 2.2.5 0 1-.2 1.4-.5.9-.6 1.4-1.6 1.4-2.6V9.6c0-.4.1-.6.2-.8.3-.3 1-.3 1.6-.3h.2V7h-.2c-.7 0-1.8 0-2.6.7z" +})); +const embedPhotoIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9.2 4.5H19c.3 0 .5.2.5.5v8.4l-3-2.9c-.3-.3-.8-.3-1 0L11.9 14 9 12c-.3-.2-.6-.2-.8 0l-3.6 2.6V9.8l4.6-5.3zm9.8 15H5c-.3 0-.5-.2-.5-.5v-2.4l4.1-3 3 1.9c.3.2.7.2.9-.1L16 12l3.5 3.4V19c0 .3-.2.5-.5.5z" +})); +const embedVideoIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V9.8l4.7-5.3H19c.3 0 .5.2.5.5v14zM10 15l5-3-5-3v6z" +})); +const embedTwitterIcon = { + foreground: '#1da1f2', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M22.23 5.924c-.736.326-1.527.547-2.357.646.847-.508 1.498-1.312 1.804-2.27-.793.47-1.67.812-2.606.996C18.325 4.498 17.258 4 16.078 4c-2.266 0-4.103 1.837-4.103 4.103 0 .322.036.635.106.935-3.41-.17-6.433-1.804-8.457-4.287-.353.607-.556 1.312-.556 2.064 0 1.424.724 2.68 1.825 3.415-.673-.022-1.305-.207-1.86-.514v.052c0 1.988 1.415 3.647 3.293 4.023-.344.095-.707.145-1.08.145-.265 0-.522-.026-.773-.074.522 1.63 2.038 2.817 3.833 2.85-1.404 1.1-3.174 1.757-5.096 1.757-.332 0-.66-.02-.98-.057 1.816 1.164 3.973 1.843 6.29 1.843 7.547 0 11.675-6.252 11.675-11.675 0-.178-.004-.355-.012-.53.802-.578 1.497-1.3 2.047-2.124z" + }))) +}; +const embedYouTubeIcon = { + foreground: '#ff0000', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z" + })) +}; +const embedFacebookIcon = { + foreground: '#3b5998', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M20 3H4c-.6 0-1 .4-1 1v16c0 .5.4 1 1 1h8.6v-7h-2.3v-2.7h2.3v-2c0-2.3 1.4-3.6 3.5-3.6 1 0 1.8.1 2.1.1v2.4h-1.4c-1.1 0-1.3.5-1.3 1.3v1.7h2.7l-.4 2.8h-2.3v7H20c.5 0 1-.4 1-1V4c0-.6-.4-1-1-1z" + })) +}; +const embedInstagramIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M12 4.622c2.403 0 2.688.01 3.637.052.877.04 1.354.187 1.67.31.42.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.67.043.95.052 1.235.052 3.638s-.01 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.42-.358.72-.673 1.036-.315.315-.615.51-1.035.673-.317.123-.794.27-1.67.31-.95.043-1.234.052-3.638.052s-2.688-.01-3.637-.052c-.877-.04-1.354-.187-1.67-.31-.42-.163-.72-.358-1.036-.673-.315-.315-.51-.615-.673-1.035-.123-.317-.27-.794-.31-1.67-.043-.95-.052-1.235-.052-3.638s.01-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.42.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.67-.31.95-.043 1.235-.052 3.638-.052M12 3c-2.444 0-2.75.01-3.71.054s-1.613.196-2.185.418c-.592.23-1.094.538-1.594 1.04-.5.5-.807 1-1.037 1.593-.223.572-.375 1.226-.42 2.184C3.01 9.25 3 9.555 3 12s.01 2.75.054 3.71.196 1.613.418 2.186c.23.592.538 1.094 1.038 1.594s1.002.808 1.594 1.038c.572.222 1.227.375 2.185.418.96.044 1.266.054 3.71.054s2.75-.01 3.71-.054 1.613-.196 2.186-.418c.592-.23 1.094-.538 1.594-1.038s.808-1.002 1.038-1.594c.222-.572.375-1.227.418-2.185.044-.96.054-1.266.054-3.71s-.01-2.75-.054-3.71-.196-1.613-.418-2.186c-.23-.592-.538-1.094-1.038-1.594s-1.002-.808-1.594-1.038c-.572-.222-1.227-.375-2.185-.418C14.75 3.01 14.445 3 12 3zm0 4.378c-2.552 0-4.622 2.07-4.622 4.622s2.07 4.622 4.622 4.622 4.622-2.07 4.622-4.622S14.552 7.378 12 7.378zM12 15c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3zm4.804-8.884c-.596 0-1.08.484-1.08 1.08s.484 1.08 1.08 1.08c.596 0 1.08-.484 1.08-1.08s-.483-1.08-1.08-1.08z" +}))); +const embedWordPressIcon = { + foreground: '#0073AA', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M12.158 12.786l-2.698 7.84c.806.236 1.657.365 2.54.365 1.047 0 2.05-.18 2.986-.51-.024-.037-.046-.078-.065-.123l-2.762-7.57zM3.008 12c0 3.56 2.07 6.634 5.068 8.092L3.788 8.342c-.5 1.117-.78 2.354-.78 3.658zm15.06-.454c0-1.112-.398-1.88-.74-2.48-.456-.74-.883-1.368-.883-2.11 0-.825.627-1.595 1.51-1.595.04 0 .078.006.116.008-1.598-1.464-3.73-2.36-6.07-2.36-3.14 0-5.904 1.613-7.512 4.053.21.008.41.012.58.012.94 0 2.395-.114 2.395-.114.484-.028.54.684.057.74 0 0-.487.058-1.03.086l3.275 9.74 1.968-5.902-1.4-3.838c-.485-.028-.944-.085-.944-.085-.486-.03-.43-.77.056-.742 0 0 1.484.114 2.368.114.94 0 2.397-.114 2.397-.114.486-.028.543.684.058.74 0 0-.488.058-1.03.086l3.25 9.665.897-2.997c.456-1.17.684-2.137.684-2.907zm1.82-3.86c.04.286.06.593.06.924 0 .912-.17 1.938-.683 3.22l-2.746 7.94c2.672-1.558 4.47-4.454 4.47-7.77 0-1.564-.4-3.033-1.1-4.314zM12 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10z" + }))) +}; +const embedSpotifyIcon = { + foreground: '#1db954', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2m4.586 14.424c-.18.295-.563.387-.857.207-2.35-1.434-5.305-1.76-8.786-.963-.335.077-.67-.133-.746-.47-.077-.334.132-.67.47-.745 3.808-.87 7.076-.496 9.712 1.115.293.18.386.563.206.857M17.81 13.7c-.226.367-.706.482-1.072.257-2.687-1.652-6.785-2.13-9.965-1.166-.413.127-.848-.106-.973-.517-.125-.413.108-.848.52-.973 3.632-1.102 8.147-.568 11.234 1.328.366.226.48.707.256 1.072m.105-2.835C14.692 8.95 9.375 8.775 6.297 9.71c-.493.15-1.016-.13-1.166-.624-.148-.495.13-1.017.625-1.167 3.532-1.073 9.404-.866 13.115 1.337.445.264.59.838.327 1.282-.264.443-.838.59-1.282.325" + })) +}; +const embedFlickrIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m6.5 7c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5zm11 0c-2.75 0-5 2.25-5 5s2.25 5 5 5 5-2.25 5-5-2.25-5-5-5z" +})); +const embedVimeoIcon = { + foreground: '#1ab7ea', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["G"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M22.396 7.164c-.093 2.026-1.507 4.8-4.245 8.32C15.323 19.16 12.93 21 10.97 21c-1.214 0-2.24-1.12-3.08-3.36-.56-2.052-1.118-4.105-1.68-6.158-.622-2.24-1.29-3.36-2.004-3.36-.156 0-.7.328-1.634.98l-.978-1.26c1.027-.903 2.04-1.806 3.037-2.71C6 3.95 7.03 3.328 7.716 3.265c1.62-.156 2.616.95 2.99 3.32.404 2.558.685 4.148.84 4.77.468 2.12.982 3.18 1.543 3.18.435 0 1.09-.687 1.963-2.064.872-1.376 1.34-2.422 1.402-3.142.125-1.187-.343-1.782-1.4-1.782-.5 0-1.013.115-1.542.34 1.023-3.35 2.977-4.976 5.862-4.883 2.14.063 3.148 1.45 3.024 4.16z" + }))) +}; +const embedRedditIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M22 11.816c0-1.256-1.02-2.277-2.277-2.277-.593 0-1.122.24-1.526.613-1.48-.965-3.455-1.594-5.647-1.69l1.17-3.702 3.18.75c.01 1.027.847 1.86 1.877 1.86 1.035 0 1.877-.84 1.877-1.877 0-1.035-.842-1.877-1.877-1.877-.77 0-1.43.466-1.72 1.13L13.55 3.92c-.204-.047-.4.067-.46.26l-1.35 4.27c-2.317.037-4.412.67-5.97 1.67-.402-.355-.917-.58-1.493-.58C3.02 9.54 2 10.56 2 11.815c0 .814.433 1.523 1.078 1.925-.037.222-.06.445-.06.673 0 3.292 4.01 5.97 8.94 5.97s8.94-2.678 8.94-5.97c0-.214-.02-.424-.052-.632.687-.39 1.154-1.12 1.154-1.964zm-3.224-7.422c.606 0 1.1.493 1.1 1.1s-.493 1.1-1.1 1.1-1.1-.494-1.1-1.1.493-1.1 1.1-1.1zm-16 7.422c0-.827.673-1.5 1.5-1.5.313 0 .598.103.838.27-.85.675-1.477 1.478-1.812 2.36-.32-.274-.525-.676-.525-1.13zm9.183 7.79c-4.502 0-8.165-2.33-8.165-5.193S7.457 9.22 11.96 9.22s8.163 2.33 8.163 5.193-3.663 5.193-8.164 5.193zM20.635 13c-.326-.89-.948-1.7-1.797-2.383.247-.186.55-.3.882-.3.827 0 1.5.672 1.5 1.5 0 .482-.23.91-.586 1.184zm-11.64 1.704c-.76 0-1.397-.616-1.397-1.376 0-.76.636-1.397 1.396-1.397.76 0 1.376.638 1.376 1.398 0 .76-.616 1.376-1.376 1.376zm7.405-1.376c0 .76-.615 1.376-1.375 1.376s-1.4-.616-1.4-1.376c0-.76.64-1.397 1.4-1.397.76 0 1.376.638 1.376 1.398zm-1.17 3.38c.15.152.15.398 0 .55-.675.674-1.728 1.002-3.22 1.002l-.01-.002-.012.002c-1.492 0-2.544-.328-3.218-1.002-.152-.152-.152-.398 0-.55.152-.152.4-.15.55 0 .52.52 1.394.775 2.67.775l.01.002.01-.002c1.276 0 2.15-.253 2.67-.775.15-.152.398-.152.55 0z" +})); +const embedTumblrIcon = { + foreground: '#35465c', + src: Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M19 3H5a2 2 0 00-2 2v14c0 1.1.9 2 2 2h14a2 2 0 002-2V5a2 2 0 00-2-2zm-5.69 14.66c-2.72 0-3.1-1.9-3.1-3.16v-3.56H8.49V8.99c1.7-.62 2.54-1.99 2.64-2.87 0-.06.06-.41.06-.58h1.9v3.1h2.17v2.3h-2.18v3.1c0 .47.13 1.3 1.2 1.26h1.1v2.36c-1.01.02-2.07 0-2.07 0z" + })) +}; +const embedAmazonIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M18.42 14.58c-.51-.66-1.05-1.23-1.05-2.5V7.87c0-1.8.15-3.45-1.2-4.68-1.05-1.02-2.79-1.35-4.14-1.35-2.6 0-5.52.96-6.12 4.14-.06.36.18.54.4.57l2.66.3c.24-.03.42-.27.48-.5.24-1.12 1.17-1.63 2.2-1.63.56 0 1.22.21 1.55.7.4.56.33 1.31.33 1.97v.36c-1.59.18-3.66.27-5.16.93a4.63 4.63 0 0 0-2.93 4.44c0 2.82 1.8 4.23 4.1 4.23 1.95 0 3.03-.45 4.53-1.98.51.72.66 1.08 1.59 1.83.18.09.45.09.63-.1v.04l2.1-1.8c.24-.21.2-.48.03-.75zm-5.4-1.2c-.45.75-1.14 1.23-1.92 1.23-1.05 0-1.65-.81-1.65-1.98 0-2.31 2.1-2.73 4.08-2.73v.6c0 1.05.03 1.92-.5 2.88z" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M21.69 19.2a17.62 17.62 0 0 1-21.6-1.57c-.23-.2 0-.5.28-.33a23.88 23.88 0 0 0 20.93 1.3c.45-.19.84.3.39.6z" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "M22.8 17.96c-.36-.45-2.22-.2-3.1-.12-.23.03-.3-.18-.05-.36 1.5-1.05 3.96-.75 4.26-.39.3.36-.1 2.82-1.5 4.02-.21.18-.42.1-.3-.15.3-.8 1.02-2.58.69-3z" +})); +const embedAnimotoIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m.0206909 21 19.8160091-13.07806 3.5831 6.20826z", + fill: "#4bc7ee" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m23.7254 19.0205-10.1074-17.18468c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418h22.5655c1.279 0 1.8019-.8905 1.1599-1.9795z", + fill: "#d4cdcb" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m.0206909 21 15.2439091-16.38571 4.3029 7.32271z", + fill: "#c3d82e" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m13.618 1.83582c-.6421-1.114428-1.7087-1.114428-2.3249 0l-11.2931 19.16418 15.2646-16.38573z", + fill: "#e4ecb0" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m.0206909 21 19.5468091-9.063 1.6621 2.8344z", + fill: "#209dbd" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m.0206909 21 17.9209091-11.82623 1.6259 2.76323z", + fill: "#7cb3c9" +})); +const embedDailymotionIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { + d: "m12.1479 18.5957c-2.4949 0-4.28131-1.7558-4.28131-4.0658 0-2.2176 1.78641-4.0965 4.09651-4.0965 2.2793 0 4.0349 1.7864 4.0349 4.1581 0 2.2794-1.7556 4.0042-3.8501 4.0042zm8.3521-18.5957-4.5329 1v7c-1.1088-1.41691-2.8028-1.8787-4.8049-1.8787-2.09443 0-3.97329.76993-5.5133 2.27917-1.72483 1.66323-2.6489 3.78863-2.6489 6.16033 0 2.5873.98562 4.8049 2.89526 6.499 1.44763 1.2936 3.17251 1.9402 5.17454 1.9402 1.9713 0 3.4498-.5236 4.8973-1.9402v1.9402h4.5329c0-7.6359 0-15.3641 0-23z", + fill: "#333436" +})); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-loading.js @@ -13916,13 +14497,11 @@ -var embed_loading_EmbedLoading = function EmbedLoading() { - return Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-embed is-loading" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null), Object(external_this_wp_element_["createElement"])("p", null, Object(external_this_wp_i18n_["__"])('Embedding…'))); -}; - -/* harmony default export */ var embed_loading = (embed_loading_EmbedLoading); +const EmbedLoading = () => Object(external_wp_element_["createElement"])("div", { + className: "wp-block-embed is-loading" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Embedding…'))); + +/* harmony default export */ var embed_loading = (EmbedLoading); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-placeholder.js @@ -13934,659 +14513,580 @@ -var embed_placeholder_EmbedPlaceholder = function EmbedPlaceholder(props) { - var icon = props.icon, - label = props.label, - value = props.value, - onSubmit = props.onSubmit, - onChange = props.onChange, - cannotEmbed = props.cannotEmbed, - fallback = props.fallback, - tryAgain = props.tryAgain; - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { +const EmbedPlaceholder = ({ + icon, + label, + value, + onSubmit, + onChange, + cannotEmbed, + fallback, + tryAgain +}) => { + return Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { icon: icon, showColors: true }), label: label, className: "wp-block-embed", - instructions: Object(external_this_wp_i18n_["__"])('Paste a link to the content you want to display on your site.') - }, Object(external_this_wp_element_["createElement"])("form", { + instructions: Object(external_wp_i18n_["__"])('Paste a link to the content you want to display on your site.') + }, Object(external_wp_element_["createElement"])("form", { onSubmit: onSubmit - }, Object(external_this_wp_element_["createElement"])("input", { + }, Object(external_wp_element_["createElement"])("input", { type: "url", value: value || '', className: "components-placeholder__input", "aria-label": label, - placeholder: Object(external_this_wp_i18n_["__"])('Enter URL to embed here…'), + placeholder: Object(external_wp_i18n_["__"])('Enter URL to embed here…'), onChange: onChange - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isPrimary: true, type: "submit" - }, Object(external_this_wp_i18n_["_x"])('Embed', 'button label'))), Object(external_this_wp_element_["createElement"])("div", { + }, Object(external_wp_i18n_["_x"])('Embed', 'button label'))), Object(external_wp_element_["createElement"])("div", { className: "components-placeholder__learn-more" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { - href: Object(external_this_wp_i18n_["__"])('https://wordpress.org/support/article/embeds/') - }, Object(external_this_wp_i18n_["__"])('Learn more about embeds'))), cannotEmbed && Object(external_this_wp_element_["createElement"])("div", { + }, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { + href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/embeds/') + }, Object(external_wp_i18n_["__"])('Learn more about embeds'))), cannotEmbed && Object(external_wp_element_["createElement"])("div", { className: "components-placeholder__error" - }, Object(external_this_wp_element_["createElement"])("div", { + }, Object(external_wp_element_["createElement"])("div", { className: "components-placeholder__instructions" - }, Object(external_this_wp_i18n_["__"])('Sorry, this content could not be embedded.')), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }, Object(external_wp_i18n_["__"])('Sorry, this content could not be embedded.')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isSecondary: true, onClick: tryAgain - }, Object(external_this_wp_i18n_["_x"])('Try again', 'button label')), ' ', Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }, Object(external_wp_i18n_["_x"])('Try again', 'button label')), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isSecondary: true, onClick: fallback - }, Object(external_this_wp_i18n_["_x"])('Convert to link', 'button label')))); -}; - -/* harmony default export */ var embed_placeholder = (embed_placeholder_EmbedPlaceholder); + }, Object(external_wp_i18n_["_x"])('Convert to link', 'button label')))); +}; + +/* harmony default export */ var embed_placeholder = (EmbedPlaceholder); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/wp-embed-preview.js - - - - - - -function wp_embed_preview_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (wp_embed_preview_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function wp_embed_preview_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * WordPress dependencies - */ - - -/** - * Browser dependencies - */ - -var wp_embed_preview_window = window, - FocusEvent = wp_embed_preview_window.FocusEvent; - -var wp_embed_preview_WpEmbedPreview = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(WpEmbedPreview, _Component); - - var _super = wp_embed_preview_createSuper(WpEmbedPreview); - - function WpEmbedPreview() { - var _this; - - Object(classCallCheck["a" /* default */])(this, WpEmbedPreview); - - _this = _super.apply(this, arguments); - _this.checkFocus = _this.checkFocus.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.node = Object(external_this_wp_element_["createRef"])(); - return _this; - } - /** - * Checks whether the wp embed iframe is the activeElement, - * if it is dispatch a focus event. - */ - - - Object(createClass["a" /* default */])(WpEmbedPreview, [{ - key: "checkFocus", - value: function checkFocus() { - var _document = document, - activeElement = _document.activeElement; - - if (activeElement.tagName !== 'IFRAME' || activeElement.parentNode !== this.node.current) { +/** + * WordPress dependencies + */ + +/** @typedef {import('@wordpress/element').WPSyntheticEvent} WPSyntheticEvent */ + +function WpEmbedPreview({ + html +}) { + const ref = Object(external_wp_element_["useRef"])(); + Object(external_wp_element_["useEffect"])(() => { + const { + ownerDocument + } = ref.current; + const { + defaultView + } = ownerDocument; + /** + * Checks for WordPress embed events signaling the height change when iframe + * content loads or iframe's window is resized. The event is sent from + * WordPress core via the window.postMessage API. + * + * References: + * window.postMessage: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage + * WordPress core embed-template on load: https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L143 + * WordPress core embed-template on resize: https://github.com/WordPress/WordPress/blob/HEAD/wp-includes/js/wp-embed-template.js#L187 + * + * @param {WPSyntheticEvent} event Message event. + */ + + function resizeWPembeds({ + data: { + secret, + message, + value + } = {} + }) { + if ([secret, message, value].some(attribute => !attribute) || message !== 'height') { return; } - var focusEvent = new FocusEvent('focus', { - bubbles: true - }); - activeElement.dispatchEvent(focusEvent); - } - }, { - key: "render", - value: function render() { - var html = this.props.html; - return Object(external_this_wp_element_["createElement"])("div", { - ref: this.node, - className: "wp-block-embed__wrapper", - dangerouslySetInnerHTML: { - __html: html - } - }); - } - }]); - - return WpEmbedPreview; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var wp_embed_preview = (Object(external_this_wp_compose_["withGlobalEvents"])({ - blur: 'checkFocus' -})(wp_embed_preview_WpEmbedPreview)); + ownerDocument.querySelectorAll(`iframe[data-secret="${secret}"`).forEach(iframe => { + if (+iframe.height !== value) { + iframe.height = value; + } + }); + } + /** + * Checks whether the wp embed iframe is the activeElement, + * if it is dispatch a focus event. + */ + + + function checkFocus() { + const { + activeElement + } = ownerDocument; + + if (activeElement.tagName !== 'IFRAME' || activeElement.parentNode !== ref.current) { + return; + } + + activeElement.focus(); + } + + defaultView.addEventListener('message', resizeWPembeds); + defaultView.addEventListener('blur', checkFocus); + return () => { + defaultView.removeEventListener('message', resizeWPembeds); + defaultView.removeEventListener('blur', checkFocus); + }; + }, []); + + const __html = Object(external_wp_element_["useMemo"])(() => { + const doc = new window.DOMParser().parseFromString(html, 'text/html'); + const iframe = doc.querySelector('iframe'); + + if (iframe) { + iframe.removeAttribute('style'); + } + + const blockQuote = doc.querySelector('blockquote'); + + if (blockQuote) { + blockQuote.style.display = 'none'; + } + + return doc.body.innerHTML; + }, [html]); + + return Object(external_wp_element_["createElement"])("div", { + ref: ref, + className: "wp-block-embed__wrapper", + dangerouslySetInnerHTML: { + __html + } + }); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/embed-preview.js - - - - - - -function embed_preview_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (embed_preview_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function embed_preview_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * Internal dependencies - */ - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - -var embed_preview_EmbedPreview = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(EmbedPreview, _Component); - - var _super = embed_preview_createSuper(EmbedPreview); - - function EmbedPreview() { - var _this; - - Object(classCallCheck["a" /* default */])(this, EmbedPreview); - - _this = _super.apply(this, arguments); - _this.hideOverlay = _this.hideOverlay.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { +/** + * Internal dependencies + */ + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +class embed_preview_EmbedPreview extends external_wp_element_["Component"] { + constructor() { + super(...arguments); + this.hideOverlay = this.hideOverlay.bind(this); + this.state = { interactive: false }; - return _this; - } - - Object(createClass["a" /* default */])(EmbedPreview, [{ - key: "hideOverlay", - value: function hideOverlay() { - // This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop - // changing, because that happens on mouse down, and the overlay immediately disappears, - // and the mouse event can end up in the preview content. We can't use onClick on - // the overlay to hide it either, because then the editor misses the mouseup event, and - // thinks we're multi-selecting blocks. - this.setState({ - interactive: true - }); - } - }, { - key: "render", - value: function render() { - var _this$props = this.props, - preview = _this$props.preview, - previewable = _this$props.previewable, - url = _this$props.url, - type = _this$props.type, - caption = _this$props.caption, - onCaptionChange = _this$props.onCaptionChange, - isSelected = _this$props.isSelected, - className = _this$props.className, - icon = _this$props.icon, - label = _this$props.label, - insertBlocksAfter = _this$props.insertBlocksAfter; - var scripts = preview.scripts; - var interactive = this.state.interactive; - var html = 'photo' === type ? util_getPhotoHtml(preview) : preview.html; - var parsedHost = new URL(url).host.split('.'); - var parsedHostBaseUrl = parsedHost.splice(parsedHost.length - 2, parsedHost.length - 1).join('.'); - var iframeTitle = Object(external_this_wp_i18n_["sprintf"])( // translators: %s: host providing embed content e.g: www.youtube.com - Object(external_this_wp_i18n_["__"])('Embedded content from %s'), parsedHostBaseUrl); - var sandboxClassnames = dedupe_default()(type, className, 'wp-block-embed__wrapper'); // Disabled because the overlay div doesn't actually have a role or functionality - // as far as the user is concerned. We're just catching the first click so that - // the block can be selected without interacting with the embed preview that the overlay covers. - - /* eslint-disable jsx-a11y/no-static-element-interactions */ - - var embedWrapper = 'wp-embed' === type ? Object(external_this_wp_element_["createElement"])(wp_embed_preview, { - html: html - }) : Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-embed__wrapper" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SandBox"], { - html: html, - scripts: scripts, - title: iframeTitle, - type: sandboxClassnames, - onFocus: this.hideOverlay - }), !interactive && Object(external_this_wp_element_["createElement"])("div", { - className: "block-library-embed__interactive-overlay", - onMouseUp: this.hideOverlay - })); - /* eslint-enable jsx-a11y/no-static-element-interactions */ - - return Object(external_this_wp_element_["createElement"])("figure", { - className: dedupe_default()(className, 'wp-block-embed', { - 'is-type-video': 'video' === type - }) - }, previewable ? embedWrapper : Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { - icon: icon, - showColors: true - }), - label: label - }, Object(external_this_wp_element_["createElement"])("p", { - className: "components-placeholder__error" - }, Object(external_this_wp_element_["createElement"])("a", { - href: url - }, url)), Object(external_this_wp_element_["createElement"])("p", { - className: "components-placeholder__error" - }, Object(external_this_wp_i18n_["sprintf"])( - /* translators: %s: host providing embed content e.g: www.youtube.com */ - Object(external_this_wp_i18n_["__"])("Embedded content from %s can't be previewed in the editor."), parsedHostBaseUrl))), (!external_this_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - tagName: "figcaption", - placeholder: Object(external_this_wp_i18n_["__"])('Write caption…'), - value: caption, - onChange: onCaptionChange, - inlineToolbar: true, - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } - })); - } - }], [{ - key: "getDerivedStateFromProps", - value: function getDerivedStateFromProps(nextProps, state) { - if (!nextProps.isSelected && state.interactive) { - // We only want to change this when the block is not selected, because changing it when - // the block becomes selected makes the overlap disappear too early. Hiding the overlay - // happens on mouseup when the overlay is clicked. - return { - interactive: false - }; - } - - return null; - } - }]); - - return EmbedPreview; -}(external_this_wp_element_["Component"]); + } + + static getDerivedStateFromProps(nextProps, state) { + if (!nextProps.isSelected && state.interactive) { + // We only want to change this when the block is not selected, because changing it when + // the block becomes selected makes the overlap disappear too early. Hiding the overlay + // happens on mouseup when the overlay is clicked. + return { + interactive: false + }; + } + + return null; + } + + hideOverlay() { + // This is called onMouseUp on the overlay. We can't respond to the `isSelected` prop + // changing, because that happens on mouse down, and the overlay immediately disappears, + // and the mouse event can end up in the preview content. We can't use onClick on + // the overlay to hide it either, because then the editor misses the mouseup event, and + // thinks we're multi-selecting blocks. + this.setState({ + interactive: true + }); + } + + render() { + const { + preview, + previewable, + url, + type, + caption, + onCaptionChange, + isSelected, + className, + icon, + label, + insertBlocksAfter + } = this.props; + const { + scripts + } = preview; + const { + interactive + } = this.state; + const html = 'photo' === type ? getPhotoHtml(preview) : preview.html; + const parsedHost = new URL(url).host.split('.'); + const parsedHostBaseUrl = parsedHost.splice(parsedHost.length - 2, parsedHost.length - 1).join('.'); + const iframeTitle = Object(external_wp_i18n_["sprintf"])( // translators: %s: host providing embed content e.g: www.youtube.com + Object(external_wp_i18n_["__"])('Embedded content from %s'), parsedHostBaseUrl); + const sandboxClassnames = dedupe_default()(type, className, 'wp-block-embed__wrapper'); // Disabled because the overlay div doesn't actually have a role or functionality + // as far as the user is concerned. We're just catching the first click so that + // the block can be selected without interacting with the embed preview that the overlay covers. + + /* eslint-disable jsx-a11y/no-static-element-interactions */ + + const embedWrapper = 'wp-embed' === type ? Object(external_wp_element_["createElement"])(WpEmbedPreview, { + html: html + }) : Object(external_wp_element_["createElement"])("div", { + className: "wp-block-embed__wrapper" + }, Object(external_wp_element_["createElement"])(external_wp_components_["SandBox"], { + html: html, + scripts: scripts, + title: iframeTitle, + type: sandboxClassnames, + onFocus: this.hideOverlay + }), !interactive && Object(external_wp_element_["createElement"])("div", { + className: "block-library-embed__interactive-overlay", + onMouseUp: this.hideOverlay + })); + /* eslint-enable jsx-a11y/no-static-element-interactions */ + + return Object(external_wp_element_["createElement"])("figure", { + className: dedupe_default()(className, 'wp-block-embed', { + 'is-type-video': 'video' === type + }) + }, previewable ? embedWrapper : Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { + icon: icon, + showColors: true + }), + label: label + }, Object(external_wp_element_["createElement"])("p", { + className: "components-placeholder__error" + }, Object(external_wp_element_["createElement"])("a", { + href: url + }, url)), Object(external_wp_element_["createElement"])("p", { + className: "components-placeholder__error" + }, Object(external_wp_i18n_["sprintf"])( + /* translators: %s: host providing embed content e.g: www.youtube.com */ + Object(external_wp_i18n_["__"])("Embedded content from %s can't be previewed in the editor."), parsedHostBaseUrl))), (!external_wp_blockEditor_["RichText"].isEmpty(caption) || isSelected) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + tagName: "figcaption", + placeholder: Object(external_wp_i18n_["__"])('Add caption'), + value: caption, + onChange: onCaptionChange, + inlineToolbar: true, + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) + })); + } + +} /* harmony default export */ var embed_preview = (embed_preview_EmbedPreview); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/edit.js - - -function embed_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function embed_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { embed_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { embed_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * Internal dependencies - */ - - - - - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ +/** + * Internal dependencies + */ + + + + + + +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + function edit_getResponsiveHelp(checked) { - return checked ? Object(external_this_wp_i18n_["__"])('This embed will preserve its aspect ratio when the browser is resized.') : Object(external_this_wp_i18n_["__"])('This embed may not preserve its aspect ratio when the browser is resized.'); -} - -function getEmbedEditComponent(title, icon) { - var responsive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - var previewable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - return function EmbedEditComponent(props) { - var attributes = props.attributes, - cannotEmbed = props.cannotEmbed, - fetching = props.fetching, - isSelected = props.isSelected, - onReplace = props.onReplace, - preview = props.preview, - setAttributes = props.setAttributes, - themeSupportsResponsive = props.themeSupportsResponsive, - tryAgain = props.tryAgain, - insertBlocksAfter = props.insertBlocksAfter; - - var _useState = Object(external_this_wp_element_["useState"])(attributes.url), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - url = _useState2[0], - setURL = _useState2[1]; - - var _useState3 = Object(external_this_wp_element_["useState"])(false), - _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), - isEditingURL = _useState4[0], - setIsEditingURL = _useState4[1]; - /** - * @return {Object} Attributes derived from the preview, merged with the current attributes. - */ - - - var getMergedAttributes = function getMergedAttributes() { - var className = attributes.className, - allowResponsive = attributes.allowResponsive; - return embed_edit_objectSpread({}, attributes, {}, getAttributesFromPreview(preview, title, className, responsive, allowResponsive)); - }; - - var handleIncomingPreview = function handleIncomingPreview() { + return checked ? Object(external_wp_i18n_["__"])('This embed will preserve its aspect ratio when the browser is resized.') : Object(external_wp_i18n_["__"])('This embed may not preserve its aspect ratio when the browser is resized.'); +} + +const EmbedEdit = props => { + const { + attributes: { + providerNameSlug, + previewable, + responsive, + url: attributesUrl + }, + attributes, + isSelected, + onReplace, + setAttributes, + insertBlocksAfter, + onFocus + } = props; + const defaultEmbedInfo = { + title: Object(external_wp_i18n_["_x"])('Embed', 'block title'), + icon: embedContentIcon + }; + const { + icon, + title + } = getEmbedInfoByProvider(providerNameSlug) || defaultEmbedInfo; + const [url, setURL] = Object(external_wp_element_["useState"])(attributesUrl); + const [isEditingURL, setIsEditingURL] = Object(external_wp_element_["useState"])(false); + const { + invalidateResolution + } = Object(external_wp_data_["useDispatch"])('core/data'); + const { + preview, + fetching, + themeSupportsResponsive, + cannotEmbed + } = Object(external_wp_data_["useSelect"])(select => { + var _embedPreview$data; + + const { + getEmbedPreview, + isPreviewEmbedFallback, + isRequestingEmbedPreview, + getThemeSupports + } = select(external_wp_coreData_["store"]); + + if (!attributesUrl) { + return { + fetching: false, + cannotEmbed: false + }; + } + + const embedPreview = getEmbedPreview(attributesUrl); + const previewIsFallback = isPreviewEmbedFallback(attributesUrl); // The external oEmbed provider does not exist. We got no type info and no html. + + const badEmbedProvider = (embedPreview === null || embedPreview === void 0 ? void 0 : embedPreview.html) === false && (embedPreview === null || embedPreview === void 0 ? void 0 : embedPreview.type) === undefined; // Some WordPress URLs that can't be embedded will cause the API to return + // a valid JSON response with no HTML and `data.status` set to 404, rather + // than generating a fallback response as other embeds do. + + const wordpressCantEmbed = (embedPreview === null || embedPreview === void 0 ? void 0 : (_embedPreview$data = embedPreview.data) === null || _embedPreview$data === void 0 ? void 0 : _embedPreview$data.status) === 404; + const validPreview = !!embedPreview && !badEmbedProvider && !wordpressCantEmbed; + return { + preview: validPreview ? embedPreview : undefined, + fetching: isRequestingEmbedPreview(attributesUrl), + themeSupportsResponsive: getThemeSupports()['responsive-embeds'], + cannotEmbed: !validPreview || previewIsFallback + }; + }, [attributesUrl]); + /** + * @return {Object} Attributes derived from the preview, merged with the current attributes. + */ + + const getMergedAttributes = () => { + const { + allowResponsive, + className + } = attributes; + return { ...attributes, + ...getAttributesFromPreview(preview, title, className, responsive, allowResponsive) + }; + }; + + const toggleResponsive = () => { + const { + allowResponsive, + className + } = attributes; + const { + html + } = preview; + const newAllowResponsive = !allowResponsive; + setAttributes({ + allowResponsive: newAllowResponsive, + className: getClassNames(html, className, responsive && newAllowResponsive) + }); + }; + + Object(external_wp_element_["useEffect"])(() => { + if (!(preview !== null && preview !== void 0 && preview.html) || !cannotEmbed || fetching) { + return; + } // At this stage, we're not fetching the preview and know it can't be embedded, + // so try removing any trailing slash, and resubmit. + + + const newURL = attributesUrl.replace(/\/$/, ''); + setURL(newURL); + setIsEditingURL(false); + setAttributes({ + url: newURL + }); + }, [preview === null || preview === void 0 ? void 0 : preview.html, attributesUrl]); // Handle incoming preview + + Object(external_wp_element_["useEffect"])(() => { + if (preview && !isEditingURL) { + // Even though we set attributes that get derived from the preview, + // we don't access them directly because for the initial render, + // the `setAttributes` call will not have taken effect. If we're + // rendering responsive content, setting the responsive classes + // after the preview has been rendered can result in unwanted + // clipping or scrollbars. The `getAttributesFromPreview` function + // that `getMergedAttributes` uses is memoized so that we're not + // calculating them on every render. setAttributes(getMergedAttributes()); if (onReplace) { - var upgradedBlock = util_createUpgradedEmbedBlock(props, getMergedAttributes()); + const upgradedBlock = createUpgradedEmbedBlock(props, getMergedAttributes()); if (upgradedBlock) { onReplace(upgradedBlock); } } - }; - - var toggleResponsive = function toggleResponsive() { - var allowResponsive = attributes.allowResponsive, - className = attributes.className; - var html = preview.html; - var newAllowResponsive = !allowResponsive; - setAttributes({ - allowResponsive: newAllowResponsive, - className: getClassNames(html, className, responsive && newAllowResponsive) - }); - }; - - Object(external_this_wp_element_["useEffect"])(function () { - if (!(preview === null || preview === void 0 ? void 0 : preview.html)) { - return; - } // If we can embed the url, bail early. - - - if (!cannotEmbed) { - return; - } // At this stage, we either have a new preview or a new URL, but we can't embed it. - // If we are already fetching the preview, bail early. - - - if (fetching) { - return; - } // At this stage, we're not fetching the preview, so we know it can't be embedded, so try - // removing any trailing slash, and resubmit. - - - var newURL = attributes.url.replace(/\/$/, ''); - setURL(newURL); - setIsEditingURL(false); - setAttributes({ - url: newURL - }); - }, [preview === null || preview === void 0 ? void 0 : preview.html, attributes.url]); - Object(external_this_wp_element_["useEffect"])(function () { - if (preview && !isEditingURL) { - handleIncomingPreview(); - } - }, [preview, isEditingURL]); - - if (fetching) { - return Object(external_this_wp_element_["createElement"])(embed_loading, null); - } // translators: %s: type of embed e.g: "YouTube", "Twitter", etc. "Embed" is used when no specific type exists - - - var label = Object(external_this_wp_i18n_["sprintf"])(Object(external_this_wp_i18n_["__"])('%s URL'), title); // No preview, or we can't embed the current URL, or we've clicked the edit button. - - if (!preview || cannotEmbed || isEditingURL) { - return Object(external_this_wp_element_["createElement"])(embed_placeholder, { - icon: icon, - label: label, - onSubmit: function onSubmit(event) { - if (event) { - event.preventDefault(); - } - - setIsEditingURL(false); - setAttributes({ - url: url - }); - }, - value: url, - cannotEmbed: cannotEmbed, - onChange: function onChange(event) { - return setURL(event.target.value); - }, - fallback: function fallback() { - return util_fallback(url, onReplace); - }, - tryAgain: tryAgain - }); - } // Even though we set attributes that get derived from the preview, - // we don't access them directly because for the initial render, - // the `setAttributes` call will not have taken effect. If we're - // rendering responsive content, setting the responsive classes - // after the preview has been rendered can result in unwanted - // clipping or scrollbars. The `getAttributesFromPreview` function - // that `getMergedAttributes` uses is memoized so that we're not - // calculating them on every render. - - - var previewAttributes = getMergedAttributes(props, title, responsive); - var caption = previewAttributes.caption, - type = previewAttributes.type, - allowResponsive = previewAttributes.allowResponsive; - var className = classnames_default()(previewAttributes.className, props.className); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(embed_controls, { - showEditButton: preview && !cannotEmbed, - themeSupportsResponsive: themeSupportsResponsive, - blockSupportsResponsive: responsive, - allowResponsive: allowResponsive, - getResponsiveHelp: edit_getResponsiveHelp, - toggleResponsive: toggleResponsive, - switchBackToURLInput: function switchBackToURLInput() { - return setIsEditingURL(true); - } - }), Object(external_this_wp_element_["createElement"])(embed_preview, { - preview: preview, - previewable: previewable, - className: className, - url: url, - type: type, - caption: caption, - onCaptionChange: function onCaptionChange(value) { - return setAttributes({ - caption: value - }); - }, - isSelected: isSelected, + } + }, [preview, isEditingURL]); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + + if (fetching) { + return Object(external_wp_element_["createElement"])(external_wp_primitives_["View"], blockProps, Object(external_wp_element_["createElement"])(embed_loading, null)); + } + + const label = external_wp_element_["Platform"].select({ + // translators: %s: type of embed e.g: "YouTube", "Twitter", etc. "Embed" is used when no specific type exists + web: Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('%s URL'), title), + native: title + }); // No preview, or we can't embed the current URL, or we've clicked the edit button. + + const showEmbedPlaceholder = !preview || cannotEmbed || isEditingURL; + + if (showEmbedPlaceholder) { + return Object(external_wp_element_["createElement"])(external_wp_primitives_["View"], blockProps, Object(external_wp_element_["createElement"])(embed_placeholder, { icon: icon, label: label, - insertBlocksAfter: insertBlocksAfter - })); - }; -} - -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/settings.js - - - -function settings_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function settings_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { settings_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { settings_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * Internal dependencies - */ - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - -var embedAttributes = { - url: { - type: 'string' - }, - caption: { - type: 'string', - source: 'html', - selector: 'figcaption' - }, - type: { - type: 'string' - }, - providerNameSlug: { - type: 'string' - }, - allowResponsive: { - type: 'boolean', - default: true - } -}; -function getEmbedBlockSettings(_ref) { - var title = _ref.title, - description = _ref.description, - icon = _ref.icon, - _ref$category = _ref.category, - category = _ref$category === void 0 ? 'embed' : _ref$category, - transforms = _ref.transforms, - _ref$keywords = _ref.keywords, - keywords = _ref$keywords === void 0 ? [] : _ref$keywords, - _ref$supports = _ref.supports, - supports = _ref$supports === void 0 ? {} : _ref$supports, - _ref$responsive = _ref.responsive, - responsive = _ref$responsive === void 0 ? true : _ref$responsive, - _ref$previewable = _ref.previewable, - previewable = _ref$previewable === void 0 ? true : _ref$previewable; - - var blockDescription = description || Object(external_this_wp_i18n_["__"])('Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.'); - - var edit = getEmbedEditComponent(title, icon, responsive, previewable); - return { - title: title, - description: blockDescription, + onFocus: onFocus, + onSubmit: event => { + if (event) { + event.preventDefault(); + } + + setIsEditingURL(false); + setAttributes({ + url + }); + }, + value: url, + cannotEmbed: cannotEmbed, + onChange: event => setURL(event.target.value), + fallback: () => util_fallback(url, onReplace), + tryAgain: () => { + invalidateResolution('core', 'getEmbedPreview', [url]); + } + })); + } // Even though we set attributes that get derived from the preview, + // we don't access them directly because for the initial render, + // the `setAttributes` call will not have taken effect. If we're + // rendering responsive content, setting the responsive classes + // after the preview has been rendered can result in unwanted + // clipping or scrollbars. The `getAttributesFromPreview` function + // that `getMergedAttributes` uses is memoized so that we're not + + + const { + caption, + type, + allowResponsive, + className: classFromPreview + } = getMergedAttributes(); + const className = classnames_default()(classFromPreview, props.className); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(embed_controls, { + showEditButton: preview && !cannotEmbed, + themeSupportsResponsive: themeSupportsResponsive, + blockSupportsResponsive: responsive, + allowResponsive: allowResponsive, + getResponsiveHelp: edit_getResponsiveHelp, + toggleResponsive: toggleResponsive, + switchBackToURLInput: () => setIsEditingURL(true) + }), Object(external_wp_element_["createElement"])(external_wp_primitives_["View"], blockProps, Object(external_wp_element_["createElement"])(embed_preview, { + preview: preview, + previewable: previewable, + className: className, + url: url, + type: type, + caption: caption, + onCaptionChange: value => setAttributes({ + caption: value + }), + isSelected: isSelected, icon: icon, - category: category, - keywords: keywords, - attributes: embedAttributes, - supports: settings_objectSpread({ - align: true - }, supports), - transforms: transforms, - edit: Object(external_this_wp_compose_["compose"])(Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { - var url = ownProps.attributes.url; - var core = select('core'); - var getEmbedPreview = core.getEmbedPreview, - isPreviewEmbedFallback = core.isPreviewEmbedFallback, - isRequestingEmbedPreview = core.isRequestingEmbedPreview, - getThemeSupports = core.getThemeSupports; - var preview = undefined !== url && getEmbedPreview(url); - var previewIsFallback = undefined !== url && isPreviewEmbedFallback(url); - var fetching = undefined !== url && isRequestingEmbedPreview(url); - var themeSupports = getThemeSupports(); // The external oEmbed provider does not exist. We got no type info and no html. - - var badEmbedProvider = !!preview && undefined === preview.type && false === preview.html; // Some WordPress URLs that can't be embedded will cause the API to return - // a valid JSON response with no HTML and `data.status` set to 404, rather - // than generating a fallback response as other embeds do. - - var wordpressCantEmbed = !!preview && preview.data && preview.data.status === 404; - var validPreview = !!preview && !badEmbedProvider && !wordpressCantEmbed; - var cannotEmbed = undefined !== url && (!validPreview || previewIsFallback); - return { - preview: validPreview ? preview : undefined, - fetching: fetching, - themeSupportsResponsive: themeSupports['responsive-embeds'], - cannotEmbed: cannotEmbed - }; - }), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { - var url = ownProps.attributes.url; - var coreData = dispatch('core/data'); - - var tryAgain = function tryAgain() { - coreData.invalidateResolution('core', 'getEmbedPreview', [url]); - }; - - return { - tryAgain: tryAgain - }; - }))(edit), - save: function save(_ref2) { - var _classnames; - - var attributes = _ref2.attributes; - var url = attributes.url, - caption = attributes.caption, - type = attributes.type, - providerNameSlug = attributes.providerNameSlug; - - if (!url) { - return null; - } - - var embedClassName = dedupe_default()('wp-block-embed', (_classnames = {}, Object(defineProperty["a" /* default */])(_classnames, "is-type-".concat(type), type), Object(defineProperty["a" /* default */])(_classnames, "is-provider-".concat(providerNameSlug), providerNameSlug), _classnames)); - return Object(external_this_wp_element_["createElement"])("figure", { - className: embedClassName - }, Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-embed__wrapper" - }, "\n".concat(url, "\n") - /* URL needs to be on its own line. */ - ), !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - tagName: "figcaption", - value: caption - })); - }, - deprecated: [{ - attributes: embedAttributes, - save: function save(_ref3) { - var _classnames2; - - var attributes = _ref3.attributes; - var url = attributes.url, - caption = attributes.caption, - type = attributes.type, - providerNameSlug = attributes.providerNameSlug; - - if (!url) { - return null; - } - - var embedClassName = dedupe_default()('wp-block-embed', (_classnames2 = {}, Object(defineProperty["a" /* default */])(_classnames2, "is-type-".concat(type), type), Object(defineProperty["a" /* default */])(_classnames2, "is-provider-".concat(providerNameSlug), providerNameSlug), _classnames2)); - return Object(external_this_wp_element_["createElement"])("figure", { - className: embedClassName - }, "\n".concat(url, "\n") - /* URL needs to be on its own line. */ - , !external_this_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - tagName: "figcaption", - value: caption - })); - } - }] - }; + label: label, + insertBlocksAfter: insertBlocksAfter + }))); +}; + +/* harmony default export */ var embed_edit = (EmbedEdit); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/save.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + +function embed_save_save({ + attributes +}) { + const { + url, + caption, + type, + providerNameSlug + } = attributes; + + if (!url) { + return null; + } + + const className = dedupe_default()('wp-block-embed', { + [`is-type-${type}`]: type, + [`is-provider-${providerNameSlug}`]: providerNameSlug, + [`wp-block-embed-${providerNameSlug}`]: providerNameSlug + }); + return Object(external_wp_element_["createElement"])("figure", external_wp_blockEditor_["useBlockProps"].save({ + className + }), Object(external_wp_element_["createElement"])("div", { + className: "wp-block-embed__wrapper" + }, `\n${url}\n` + /* URL needs to be on its own line. */ + ), !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "figcaption", + value: caption + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/transforms.js @@ -14598,17 +15098,67 @@ /** + * Internal dependencies + */ + +const transforms_metadata = { + apiVersion: 2, + name: "core/embed", + title: "Embed", + category: "embed", + description: "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.", + textdomain: "default", + attributes: { + url: { + type: "string" + }, + caption: { + type: "string", + source: "html", + selector: "figcaption" + }, + type: { + type: "string" + }, + providerNameSlug: { + type: "string" + }, + allowResponsive: { + type: "boolean", + "default": true + }, + responsive: { + type: "boolean", + "default": false + }, + previewable: { + type: "boolean", + "default": true + } + }, + supports: { + align: true + }, + editorStyle: "wp-block-embed-editor", + style: "wp-block-embed" +}; +const { + name: EMBED_BLOCK +} = transforms_metadata; +/** * Default transforms for generic embeds. */ -var embed_transforms_transforms = { +const embed_transforms_transforms = { from: [{ type: 'raw', - isMatch: function isMatch(node) { - return node.nodeName === 'P' && /^\s*(https?:\/\/\S+)\s*$/i.test(node.textContent); - }, - transform: function transform(node) { - return Object(external_this_wp_blocks_["createBlock"])('core/embed', { + isMatch: node => { + var _node$textContent, _node$textContent$mat; + + return node.nodeName === 'P' && /^\s*(https?:\/\/\S+)\s*$/i.test(node.textContent) && ((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : (_node$textContent$mat = _node$textContent.match(/https/gi)) === null || _node$textContent$mat === void 0 ? void 0 : _node$textContent$mat.length) === 1; + }, + transform: node => { + return Object(external_wp_blocks_["createBlock"])(EMBED_BLOCK, { url: node.textContent.trim() }); } @@ -14616,64 +15166,551 @@ to: [{ type: 'block', blocks: ['core/paragraph'], - transform: function transform(_ref) { - var url = _ref.url, - caption = _ref.caption; - var link = Object(external_this_wp_element_["createElement"])("a", { + transform: ({ + url, + caption + }) => { + const link = Object(external_wp_element_["createElement"])("a", { href: url }, caption || url); - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: Object(external_this_wp_element_["renderToString"])(link) + return Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: Object(external_wp_element_["renderToString"])(link) }); } }] }; /* harmony default export */ var embed_transforms = (embed_transforms_transforms); +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/variations.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */ + +/** + * Template option choices for predefined columns layouts. + * + * @type {WPBlockVariation[]} + */ + +const embed_variations_variations = [{ + name: 'twitter', + title: 'Twitter', + icon: embedTwitterIcon, + keywords: ['tweet', Object(external_wp_i18n_["__"])('social')], + description: Object(external_wp_i18n_["__"])('Embed a tweet.'), + patterns: [/^https?:\/\/(www\.)?twitter\.com\/.+/i], + attributes: { + providerNameSlug: 'twitter', + responsive: true + } +}, { + name: 'youtube', + title: 'YouTube', + icon: embedYouTubeIcon, + keywords: [Object(external_wp_i18n_["__"])('music'), Object(external_wp_i18n_["__"])('video')], + description: Object(external_wp_i18n_["__"])('Embed a YouTube video.'), + patterns: [/^https?:\/\/((m|www)\.)?youtube\.com\/.+/i, /^https?:\/\/youtu\.be\/.+/i], + attributes: { + providerNameSlug: 'youtube', + responsive: true + } +}, { + // Deprecate Facebook Embed per FB policy + // See: https://developers.facebook.com/docs/plugins/oembed-legacy + name: 'facebook', + title: 'Facebook', + icon: embedFacebookIcon, + keywords: [Object(external_wp_i18n_["__"])('social')], + description: Object(external_wp_i18n_["__"])('Embed a Facebook post.'), + scope: ['block'], + patterns: [], + attributes: { + providerNameSlug: 'facebook', + previewable: false, + responsive: true + } +}, { + // Deprecate Instagram per FB policy + // See: https://developers.facebook.com/docs/instagram/oembed-legacy + name: 'instagram', + title: 'Instagram', + icon: embedInstagramIcon, + keywords: [Object(external_wp_i18n_["__"])('image'), Object(external_wp_i18n_["__"])('social')], + description: Object(external_wp_i18n_["__"])('Embed an Instagram post.'), + scope: ['block'], + patterns: [], + attributes: { + providerNameSlug: 'instagram', + responsive: true + } +}, { + name: 'wordpress', + title: 'WordPress', + icon: embedWordPressIcon, + keywords: [Object(external_wp_i18n_["__"])('post'), Object(external_wp_i18n_["__"])('blog')], + description: Object(external_wp_i18n_["__"])('Embed a WordPress post.'), + attributes: { + providerNameSlug: 'wordpress' + } +}, { + name: 'soundcloud', + title: 'SoundCloud', + icon: embedAudioIcon, + keywords: [Object(external_wp_i18n_["__"])('music'), Object(external_wp_i18n_["__"])('audio')], + description: Object(external_wp_i18n_["__"])('Embed SoundCloud content.'), + patterns: [/^https?:\/\/(www\.)?soundcloud\.com\/.+/i], + attributes: { + providerNameSlug: 'soundcloud', + responsive: true + } +}, { + name: 'spotify', + title: 'Spotify', + icon: embedSpotifyIcon, + keywords: [Object(external_wp_i18n_["__"])('music'), Object(external_wp_i18n_["__"])('audio')], + description: Object(external_wp_i18n_["__"])('Embed Spotify content.'), + patterns: [/^https?:\/\/(open|play)\.spotify\.com\/.+/i], + attributes: { + providerNameSlug: 'spotify', + responsive: true + } +}, { + name: 'flickr', + title: 'Flickr', + icon: embedFlickrIcon, + keywords: [Object(external_wp_i18n_["__"])('image')], + description: Object(external_wp_i18n_["__"])('Embed Flickr content.'), + patterns: [/^https?:\/\/(www\.)?flickr\.com\/.+/i, /^https?:\/\/flic\.kr\/.+/i], + attributes: { + providerNameSlug: 'flickr', + responsive: true + } +}, { + name: 'vimeo', + title: 'Vimeo', + icon: embedVimeoIcon, + keywords: [Object(external_wp_i18n_["__"])('video')], + description: Object(external_wp_i18n_["__"])('Embed a Vimeo video.'), + patterns: [/^https?:\/\/(www\.)?vimeo\.com\/.+/i], + attributes: { + providerNameSlug: 'vimeo', + responsive: true + } +}, { + name: 'animoto', + title: 'Animoto', + icon: embedAnimotoIcon, + description: Object(external_wp_i18n_["__"])('Embed an Animoto video.'), + patterns: [/^https?:\/\/(www\.)?(animoto|video214)\.com\/.+/i], + attributes: { + providerNameSlug: 'animoto', + responsive: true + } +}, { + name: 'cloudup', + title: 'Cloudup', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Cloudup content.'), + patterns: [/^https?:\/\/cloudup\.com\/.+/i], + attributes: { + providerNameSlug: 'cloudup', + responsive: true + } +}, { + // Deprecated since CollegeHumor content is now powered by YouTube + name: 'collegehumor', + title: 'CollegeHumor', + icon: embedVideoIcon, + description: Object(external_wp_i18n_["__"])('Embed CollegeHumor content.'), + scope: ['block'], + patterns: [], + attributes: { + providerNameSlug: 'collegehumor', + responsive: true + } +}, { + name: 'crowdsignal', + title: 'Crowdsignal', + icon: embedContentIcon, + keywords: ['polldaddy', Object(external_wp_i18n_["__"])('survey')], + description: Object(external_wp_i18n_["__"])('Embed Crowdsignal (formerly Polldaddy) content.'), + patterns: [/^https?:\/\/((.+\.)?polldaddy\.com|poll\.fm|.+\.survey\.fm)\/.+/i], + attributes: { + providerNameSlug: 'crowdsignal', + responsive: true + } +}, { + name: 'dailymotion', + title: 'Dailymotion', + icon: embedDailymotionIcon, + keywords: [Object(external_wp_i18n_["__"])('video')], + description: Object(external_wp_i18n_["__"])('Embed a Dailymotion video.'), + patterns: [/^https?:\/\/(www\.)?dailymotion\.com\/.+/i], + attributes: { + providerNameSlug: 'dailymotion', + responsive: true + } +}, { + name: 'imgur', + title: 'Imgur', + icon: embedPhotoIcon, + description: Object(external_wp_i18n_["__"])('Embed Imgur content.'), + patterns: [/^https?:\/\/(.+\.)?imgur\.com\/.+/i], + attributes: { + providerNameSlug: 'imgur', + responsive: true + } +}, { + name: 'issuu', + title: 'Issuu', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Issuu content.'), + patterns: [/^https?:\/\/(www\.)?issuu\.com\/.+/i], + attributes: { + providerNameSlug: 'issuu', + responsive: true + } +}, { + name: 'kickstarter', + title: 'Kickstarter', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Kickstarter content.'), + patterns: [/^https?:\/\/(www\.)?kickstarter\.com\/.+/i, /^https?:\/\/kck\.st\/.+/i], + attributes: { + providerNameSlug: 'kickstarter', + responsive: true + } +}, { + name: 'meetup-com', + title: 'Meetup.com', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Meetup.com content.'), + patterns: [/^https?:\/\/(www\.)?meetu(\.ps|p\.com)\/.+/i], + attributes: { + providerNameSlug: 'meetup-com', + responsive: true + } +}, { + name: 'mixcloud', + title: 'Mixcloud', + icon: embedAudioIcon, + keywords: [Object(external_wp_i18n_["__"])('music'), Object(external_wp_i18n_["__"])('audio')], + description: Object(external_wp_i18n_["__"])('Embed Mixcloud content.'), + patterns: [/^https?:\/\/(www\.)?mixcloud\.com\/.+/i], + attributes: { + providerNameSlug: 'mixcloud', + responsive: true + } +}, { + name: 'reddit', + title: 'Reddit', + icon: embedRedditIcon, + description: Object(external_wp_i18n_["__"])('Embed a Reddit thread.'), + patterns: [/^https?:\/\/(www\.)?reddit\.com\/.+/i], + attributes: { + providerNameSlug: 'reddit', + responsive: true + } +}, { + name: 'reverbnation', + title: 'ReverbNation', + icon: embedAudioIcon, + description: Object(external_wp_i18n_["__"])('Embed ReverbNation content.'), + patterns: [/^https?:\/\/(www\.)?reverbnation\.com\/.+/i], + attributes: { + providerNameSlug: 'reverbnation', + responsive: true + } +}, { + name: 'screencast', + title: 'Screencast', + icon: embedVideoIcon, + description: Object(external_wp_i18n_["__"])('Embed Screencast content.'), + patterns: [/^https?:\/\/(www\.)?screencast\.com\/.+/i], + attributes: { + providerNameSlug: 'screencast', + responsive: true + } +}, { + name: 'scribd', + title: 'Scribd', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Scribd content.'), + patterns: [/^https?:\/\/(www\.)?scribd\.com\/.+/i], + attributes: { + providerNameSlug: 'scribd', + responsive: true + } +}, { + name: 'slideshare', + title: 'Slideshare', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Slideshare content.'), + patterns: [/^https?:\/\/(.+?\.)?slideshare\.net\/.+/i], + attributes: { + providerNameSlug: 'slideshare', + responsive: true + } +}, { + name: 'smugmug', + title: 'SmugMug', + icon: embedPhotoIcon, + description: Object(external_wp_i18n_["__"])('Embed SmugMug content.'), + patterns: [/^https?:\/\/(.+\.)?smugmug\.com\/.*/i], + attributes: { + providerNameSlug: 'smugmug', + previewable: false, + responsive: true + } +}, { + name: 'speaker-deck', + title: 'Speaker Deck', + icon: embedContentIcon, + description: Object(external_wp_i18n_["__"])('Embed Speaker Deck content.'), + patterns: [/^https?:\/\/(www\.)?speakerdeck\.com\/.+/i], + attributes: { + providerNameSlug: 'speaker-deck', + responsive: true + } +}, { + name: 'tiktok', + title: 'TikTok', + icon: embedVideoIcon, + keywords: [Object(external_wp_i18n_["__"])('video')], + description: Object(external_wp_i18n_["__"])('Embed a TikTok video.'), + patterns: [/^https?:\/\/(www\.)?tiktok\.com\/.+/i], + attributes: { + providerNameSlug: 'tiktok', + responsive: true + } +}, { + name: 'ted', + title: 'TED', + icon: embedVideoIcon, + description: Object(external_wp_i18n_["__"])('Embed a TED video.'), + patterns: [/^https?:\/\/(www\.|embed\.)?ted\.com\/.+/i], + attributes: { + providerNameSlug: 'ted', + responsive: true + } +}, { + name: 'tumblr', + title: 'Tumblr', + icon: embedTumblrIcon, + keywords: [Object(external_wp_i18n_["__"])('social')], + description: Object(external_wp_i18n_["__"])('Embed a Tumblr post.'), + patterns: [/^https?:\/\/(www\.)?tumblr\.com\/.+/i], + attributes: { + providerNameSlug: 'tumblr', + responsive: true + } +}, { + name: 'videopress', + title: 'VideoPress', + icon: embedVideoIcon, + keywords: [Object(external_wp_i18n_["__"])('video')], + description: Object(external_wp_i18n_["__"])('Embed a VideoPress video.'), + patterns: [/^https?:\/\/videopress\.com\/.+/i], + attributes: { + providerNameSlug: 'videopress', + responsive: true + } +}, { + name: 'wordpress-tv', + title: 'WordPress.tv', + icon: embedVideoIcon, + description: Object(external_wp_i18n_["__"])('Embed a WordPress.tv video.'), + patterns: [/^https?:\/\/wordpress\.tv\/.+/i], + attributes: { + providerNameSlug: 'wordpress-tv', + responsive: true + } +}, { + name: 'amazon-kindle', + title: 'Amazon Kindle', + icon: embedAmazonIcon, + keywords: [Object(external_wp_i18n_["__"])('ebook')], + description: Object(external_wp_i18n_["__"])('Embed Amazon Kindle content.'), + patterns: [/^https?:\/\/([a-z0-9-]+\.)?(amazon|amzn)(\.[a-z]{2,4})+\/.+/i, /^https?:\/\/(www\.)?(a\.co|z\.cn)\/.+/i], + attributes: { + providerNameSlug: 'amazon-kindle' + } +}]; +/** + * Add `isActive` function to all `embed` variations, if not defined. + * `isActive` function is used to find a variation match from a created + * Block by providing its attributes. + */ + +embed_variations_variations.forEach(variation => { + if (variation.isActive) return; + + variation.isActive = (blockAttributes, variationAttributes) => blockAttributes.providerNameSlug === variationAttributes.providerNameSlug; +}); +/* harmony default export */ var embed_variations = (embed_variations_variations); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/deprecated.js + + +/** + * External dependencies + */ + +/** + * Internal dependencies + */ + +const deprecated_metadata = { + apiVersion: 2, + name: "core/embed", + title: "Embed", + category: "embed", + description: "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.", + textdomain: "default", + attributes: { + url: { + type: "string" + }, + caption: { + type: "string", + source: "html", + selector: "figcaption" + }, + type: { + type: "string" + }, + providerNameSlug: { + type: "string" + }, + allowResponsive: { + type: "boolean", + "default": true + }, + responsive: { + type: "boolean", + "default": false + }, + previewable: { + type: "boolean", + "default": true + } + }, + supports: { + align: true + }, + editorStyle: "wp-block-embed-editor", + style: "wp-block-embed" +}; +/** + * WordPress dependencies + */ + + +const { + attributes: embed_deprecated_blockAttributes +} = deprecated_metadata; +const embed_deprecated_deprecated = [{ + attributes: embed_deprecated_blockAttributes, + + save({ + attributes: { + url, + caption, + type, + providerNameSlug + } + }) { + if (!url) { + return null; + } + + const embedClassName = classnames_default()('wp-block-embed', { + [`is-type-${type}`]: type, + [`is-provider-${providerNameSlug}`]: providerNameSlug + }); + return Object(external_wp_element_["createElement"])("figure", { + className: embedClassName + }, `\n${url}\n` + /* URL needs to be on its own line. */ + , !external_wp_blockEditor_["RichText"].isEmpty(caption) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { + tagName: "figcaption", + value: caption + })); + } + +}]; +/* harmony default export */ var embed_deprecated = (embed_deprecated_deprecated); + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/embed/index.js - - -function embed_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function embed_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { embed_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { embed_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * Internal dependencies - */ - - - - -/** - * WordPress dependencies - */ - - -var embed_name = 'core/embed'; -var embed_settings = getEmbedBlockSettings({ - title: Object(external_this_wp_i18n_["_x"])('Embed', 'block title'), - description: Object(external_this_wp_i18n_["__"])('Embed videos, images, tweets, audio, and other content from external sources.'), +/** + * Internal dependencies + */ + + +const embed_metadata = { + apiVersion: 2, + name: "core/embed", + title: "Embed", + category: "embed", + description: "Add a block that displays content pulled from other sites, like Twitter, Instagram or YouTube.", + textdomain: "default", + attributes: { + url: { + type: "string" + }, + caption: { + type: "string", + source: "html", + selector: "figcaption" + }, + type: { + type: "string" + }, + providerNameSlug: { + type: "string" + }, + allowResponsive: { + type: "boolean", + "default": true + }, + responsive: { + type: "boolean", + "default": false + }, + previewable: { + type: "boolean", + "default": true + } + }, + supports: { + align: true + }, + editorStyle: "wp-block-embed-editor", + style: "wp-block-embed" +}; + + + + +const { + name: embed_name +} = embed_metadata; + +const embed_settings = { icon: embedContentIcon, - // Unknown embeds should not be responsive by default. - responsive: false, - transforms: embed_transforms -}); -var embed_common = common.map(function (embedDefinition) { - var embedSettings = getEmbedBlockSettings(embedDefinition.settings); - return embed_objectSpread({}, embedDefinition, { - settings: embed_objectSpread({}, embedSettings, { - transforms: embed_transforms - }) - }); -}); -var embed_others = others.map(function (embedDefinition) { - var embedSettings = getEmbedBlockSettings(embedDefinition.settings); - return embed_objectSpread({}, embedDefinition, { - settings: embed_objectSpread({}, embedSettings, { - transforms: embed_transforms - }) - }); -}); + edit: embed_edit, + save: embed_save_save, + transforms: embed_transforms, + variations: embed_variations, + deprecated: embed_deprecated +}; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/file.js @@ -14682,10 +15719,10 @@ * WordPress dependencies */ -var file_file = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const file_file = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M19 6.2h-5.9l-.6-1.1c-.3-.7-1-1.1-1.8-1.1H5c-1.1 0-2 .9-2 2v11.8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V8.2c0-1.1-.9-2-2-2zm.5 11.6c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h5.8c.2 0 .4.1.4.3l1 2H19c.3 0 .5.2.5.5v9.5z" })); /* harmony default export */ var library_file = (file_file); @@ -14699,348 +15736,417 @@ -function FileBlockInspector(_ref) { - var hrefs = _ref.hrefs, - openInNewWindow = _ref.openInNewWindow, - showDownloadButton = _ref.showDownloadButton, - changeLinkDestinationOption = _ref.changeLinkDestinationOption, - changeOpenInNewWindow = _ref.changeOpenInNewWindow, - changeShowDownloadButton = _ref.changeShowDownloadButton; - var href = hrefs.href, - textLinkHref = hrefs.textLinkHref, - attachmentPage = hrefs.attachmentPage; - var linkDestinationOptions = [{ +/** + * Internal dependencies + */ + + +function FileBlockInspector({ + hrefs, + openInNewWindow, + showDownloadButton, + changeLinkDestinationOption, + changeOpenInNewWindow, + changeShowDownloadButton, + displayPreview, + changeDisplayPreview, + previewHeight, + changePreviewHeight +}) { + const { + href, + textLinkHref, + attachmentPage + } = hrefs; + let linkDestinationOptions = [{ value: href, - label: Object(external_this_wp_i18n_["__"])('URL') + label: Object(external_wp_i18n_["__"])('URL') }]; if (attachmentPage) { linkDestinationOptions = [{ value: href, - label: Object(external_this_wp_i18n_["__"])('Media file') + label: Object(external_wp_i18n_["__"])('Media file') }, { value: attachmentPage, - label: Object(external_this_wp_i18n_["__"])('Attachment page') + label: Object(external_wp_i18n_["__"])('Attachment page') }]; } - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Text link settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SelectControl"], { - label: Object(external_this_wp_i18n_["__"])('Link to'), + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, href.endsWith('.pdf') && Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('PDF settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Show inline embed'), + help: displayPreview ? Object(external_wp_i18n_["__"])("Note: Most phone and tablet browsers won't display embedded PDFs.") : null, + checked: !!displayPreview, + onChange: changeDisplayPreview + }), Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Height in pixels'), + min: MIN_PREVIEW_HEIGHT, + max: Math.max(MAX_PREVIEW_HEIGHT, previewHeight), + value: previewHeight, + onChange: changePreviewHeight + })), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Text link settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { + label: Object(external_wp_i18n_["__"])('Link to'), value: textLinkHref, options: linkDestinationOptions, onChange: changeLinkDestinationOption - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Open in new tab'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Open in new tab'), checked: openInNewWindow, onChange: changeOpenInNewWindow - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Download button settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Show download button'), + })), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Download button settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Show download button'), checked: showDownloadButton, onChange: changeShowDownloadButton })))); } +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/utils.js +/** + * Uses a combination of user agent matching and feature detection to determine whether + * the current browser supports rendering PDFs inline. + * + * @return {boolean} Whether or not the browser supports inline PDFs. + */ +const browserSupportsPdfs = () => { + // Most mobile devices include "Mobi" in their UA. + if (window.navigator.userAgent.indexOf('Mobi') > -1) { + return false; + } // Android tablets are the noteable exception. + + + if (window.navigator.userAgent.indexOf('Android') > -1) { + return false; + } // iPad pretends to be a Mac. + + + if (window.navigator.userAgent.indexOf('Macintosh') > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) { + return false; + } // IE only supports PDFs when there's an ActiveX object available for it. + + + if (!!(window.ActiveXObject || 'ActiveXObject' in window) && !(createActiveXObject('AcroPDF.PDF') || createActiveXObject('PDF.PdfCtrl'))) { + return false; + } + + return true; +}; +/** + * Helper function for creating ActiveX objects, catching any errors that are thrown + * when it's generated. + * + * @param {string} type The name of the ActiveX object to create. + * @return {window.ActiveXObject|undefined} The generated ActiveXObject, or null if it failed. + */ + +const createActiveXObject = type => { + let ax; + + try { + ax = new window.ActiveXObject(type); + } catch (e) { + ax = undefined; + } + + return ax; +}; +/** + * Hides all .wp-block-file__embed elements on the document. This function is only intended + * to be run on the front-end, it may have weird side effects running in the block editor. + */ + + +const hidePdfEmbedsOnUnsupportedBrowsers = () => { + if (!browserSupportsPdfs()) { + const embeds = document.getElementsByClassName('wp-block-file__embed'); + Array.from(embeds).forEach(embed => { + embed.style.display = 'none'; + }); + } +}; + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/edit.js - - - - - - - - -function file_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (file_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function file_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - -var edit_FileEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(FileEdit, _Component); - - var _super = file_edit_createSuper(FileEdit); - - function FileEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, FileEdit); - - _this = _super.apply(this, arguments); - _this.onSelectFile = _this.onSelectFile.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.confirmCopyURL = _this.confirmCopyURL.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.resetCopyConfirmation = _this.resetCopyConfirmation.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.changeLinkDestinationOption = _this.changeLinkDestinationOption.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.changeOpenInNewWindow = _this.changeOpenInNewWindow.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.changeShowDownloadButton = _this.changeShowDownloadButton.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onUploadError = _this.onUploadError.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { - hasError: false, - showCopyConfirmation: false - }; - return _this; - } - - Object(createClass["a" /* default */])(FileEdit, [{ - key: "componentDidMount", - value: function componentDidMount() { - var _this2 = this; - - var _this$props = this.props, - attributes = _this$props.attributes, - mediaUpload = _this$props.mediaUpload, - noticeOperations = _this$props.noticeOperations, - setAttributes = _this$props.setAttributes; - var downloadButtonText = attributes.downloadButtonText, - href = attributes.href; // Upload a file drag-and-dropped into the editor - - if (Object(external_this_wp_blob_["isBlobURL"])(href)) { - var file = Object(external_this_wp_blob_["getBlobByURL"])(href); - mediaUpload({ - filesList: [file], - onFileChange: function onFileChange(_ref) { - var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 1), - media = _ref2[0]; - - return _this2.onSelectFile(media); - }, - onError: function onError(message) { - _this2.setState({ - hasError: true - }); - - noticeOperations.createErrorNotice(message); - } - }); - Object(external_this_wp_blob_["revokeBlobURL"])(href); - } - - if (downloadButtonText === undefined) { - setAttributes({ - downloadButtonText: Object(external_this_wp_i18n_["_x"])('Download', 'button label') - }); - } - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - // Reset copy confirmation state when block is deselected - if (prevProps.isSelected && !this.props.isSelected) { - this.setState({ - showCopyConfirmation: false - }); - } - } - }, { - key: "onSelectFile", - value: function onSelectFile(media) { - if (media && media.url) { - this.setState({ - hasError: false - }); - this.props.setAttributes({ - href: media.url, - fileName: media.title, - textLinkHref: media.url, - id: media.id - }); - } - } - }, { - key: "onUploadError", - value: function onUploadError(message) { - var noticeOperations = this.props.noticeOperations; - noticeOperations.removeAllNotices(); - noticeOperations.createErrorNotice(message); - } - }, { - key: "confirmCopyURL", - value: function confirmCopyURL() { - this.setState({ - showCopyConfirmation: true - }); - } - }, { - key: "resetCopyConfirmation", - value: function resetCopyConfirmation() { - this.setState({ - showCopyConfirmation: false - }); - } - }, { - key: "changeLinkDestinationOption", - value: function changeLinkDestinationOption(newHref) { - // Choose Media File or Attachment Page (when file is in Media Library) - this.props.setAttributes({ - textLinkHref: newHref - }); - } - }, { - key: "changeOpenInNewWindow", - value: function changeOpenInNewWindow(newValue) { - this.props.setAttributes({ - textLinkTarget: newValue ? '_blank' : false - }); - } - }, { - key: "changeShowDownloadButton", - value: function changeShowDownloadButton(newValue) { - this.props.setAttributes({ - showDownloadButton: newValue - }); - } - }, { - key: "render", - value: function render() { - var _this3 = this; - - var _this$props2 = this.props, - className = _this$props2.className, - isSelected = _this$props2.isSelected, - attributes = _this$props2.attributes, - setAttributes = _this$props2.setAttributes, - noticeUI = _this$props2.noticeUI, - media = _this$props2.media; - var id = attributes.id, - fileName = attributes.fileName, - href = attributes.href, - textLinkHref = attributes.textLinkHref, - textLinkTarget = attributes.textLinkTarget, - showDownloadButton = attributes.showDownloadButton, - downloadButtonText = attributes.downloadButtonText; - var _this$state = this.state, - hasError = _this$state.hasError, - showCopyConfirmation = _this$state.showCopyConfirmation; - var attachmentPage = media && media.link; - - if (!href || hasError) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { - icon: library_file - }), - labels: { - title: Object(external_this_wp_i18n_["__"])('File'), - instructions: Object(external_this_wp_i18n_["__"])('Upload a file or pick one from your media library.') - }, - onSelect: this.onSelectFile, - notices: noticeUI, - onError: this.onUploadError, - accept: "*" - }); - } - - var classes = classnames_default()(className, { - 'is-transient': Object(external_this_wp_blob_["isBlobURL"])(href) - }); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(FileBlockInspector, Object(esm_extends["a" /* default */])({ - hrefs: { - href: href, - textLinkHref: textLinkHref, - attachmentPage: attachmentPage - } - }, { - openInNewWindow: !!textLinkTarget, - showDownloadButton: showDownloadButton, - changeLinkDestinationOption: this.changeLinkDestinationOption, - changeOpenInNewWindow: this.changeOpenInNewWindow, - changeShowDownloadButton: this.changeShowDownloadButton - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaReplaceFlow"], { - mediaId: id, - mediaURL: href, - accept: "*", - onSelect: this.onSelectFile, - onError: this.onUploadError - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Animate"], { - type: Object(external_this_wp_blob_["isBlobURL"])(href) ? 'loading' : null - }, function (_ref3) { - var animateClassName = _ref3.className; - return Object(external_this_wp_element_["createElement"])("div", { - className: classnames_default()(classes, animateClassName) - }, Object(external_this_wp_element_["createElement"])("div", { - className: 'wp-block-file__content-wrapper' - }, Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-file__textlink" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - tagName: "div" // must be block-level or else cursor disappears - , - value: fileName, - placeholder: Object(external_this_wp_i18n_["__"])('Write file name…'), - withoutInteractiveFormatting: true, - onChange: function onChange(text) { - return setAttributes({ - fileName: text - }); - } - })), showDownloadButton && Object(external_this_wp_element_["createElement"])("div", { - className: 'wp-block-file__button-richtext-wrapper' - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - tagName: "div" // must be block-level or else cursor disappears - , - className: 'wp-block-file__button', - value: downloadButtonText, - withoutInteractiveFormatting: true, - placeholder: Object(external_this_wp_i18n_["__"])('Add text…'), - onChange: function onChange(text) { - return setAttributes({ - downloadButtonText: text - }); - } - }))), isSelected && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ClipboardButton"], { - isSecondary: true, - text: href, - className: 'wp-block-file__copy-url-button', - onCopy: _this3.confirmCopyURL, - onFinishCopy: _this3.resetCopyConfirmation, - disabled: Object(external_this_wp_blob_["isBlobURL"])(href) - }, showCopyConfirmation ? Object(external_this_wp_i18n_["__"])('Copied!') : Object(external_this_wp_i18n_["__"])('Copy URL'))); - })); - } - }]); - - return FileEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var file_edit = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, props) { - var _select = select('core'), - getMedia = _select.getMedia; - - var _select2 = select('core/block-editor'), - getSettings = _select2.getSettings; - - var _getSettings = getSettings(), - mediaUpload = _getSettings.mediaUpload; - - var id = props.attributes.id; - return { - media: id === undefined ? undefined : getMedia(id), - mediaUpload: mediaUpload - }; -}), external_this_wp_components_["withNotices"]])(edit_FileEdit)); +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + + + +/** + * Internal dependencies + */ + + + +const MIN_PREVIEW_HEIGHT = 200; +const MAX_PREVIEW_HEIGHT = 2000; + +function ClipboardToolbarButton({ + text, + disabled +}) { + const { + createNotice + } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); + const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, () => { + createNotice('info', Object(external_wp_i18n_["__"])('Copied URL to clipboard.'), { + isDismissible: true, + type: 'snackbar' + }); + }); + return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + className: "components-clipboard-toolbar-button", + ref: ref, + disabled: disabled + }, Object(external_wp_i18n_["__"])('Copy URL')); +} + +function FileEdit({ + attributes, + isSelected, + setAttributes, + noticeUI, + noticeOperations +}) { + const { + id, + fileName, + href, + textLinkHref, + textLinkTarget, + showDownloadButton, + downloadButtonText, + displayPreview, + previewHeight + } = attributes; + const [hasError, setHasError] = Object(external_wp_element_["useState"])(false); + const { + media, + mediaUpload + } = Object(external_wp_data_["useSelect"])(select => ({ + media: id === undefined ? undefined : select(external_wp_coreData_["store"]).getMedia(id), + mediaUpload: select(external_wp_blockEditor_["store"]).getSettings().mediaUpload + }), [id]); + const { + toggleSelection + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + Object(external_wp_element_["useEffect"])(() => { + // Upload a file drag-and-dropped into the editor + if (Object(external_wp_blob_["isBlobURL"])(href)) { + const file = Object(external_wp_blob_["getBlobByURL"])(href); + mediaUpload({ + filesList: [file], + onFileChange: ([newMedia]) => onSelectFile(newMedia), + onError: message => { + setHasError(true); + noticeOperations.createErrorNotice(message); + } + }); + Object(external_wp_blob_["revokeBlobURL"])(href); + } + + if (downloadButtonText === undefined) { + changeDownloadButtonText(Object(external_wp_i18n_["_x"])('Download', 'button label')); + } + }, []); + + function onSelectFile(newMedia) { + if (newMedia && newMedia.url) { + setHasError(false); + const isPdf = newMedia.url.endsWith('.pdf'); + setAttributes({ + href: newMedia.url, + fileName: newMedia.title, + textLinkHref: newMedia.url, + id: newMedia.id, + displayPreview: isPdf ? true : undefined, + previewHeight: isPdf ? 600 : undefined + }); + } + } + + function onUploadError(message) { + setHasError(true); + noticeOperations.removeAllNotices(); + noticeOperations.createErrorNotice(message); + } + + function changeLinkDestinationOption(newHref) { + // Choose Media File or Attachment Page (when file is in Media Library) + setAttributes({ + textLinkHref: newHref + }); + } + + function changeOpenInNewWindow(newValue) { + setAttributes({ + textLinkTarget: newValue ? '_blank' : false + }); + } + + function changeShowDownloadButton(newValue) { + setAttributes({ + showDownloadButton: newValue + }); + } + + function changeDownloadButtonText(newValue) { + // Remove anchor tags from button text content. + setAttributes({ + downloadButtonText: newValue.replace(/<\/?a[^>]*>/g, '') + }); + } + + function changeDisplayPreview(newValue) { + setAttributes({ + displayPreview: newValue + }); + } + + function handleOnResizeStop(event, direction, elt, delta) { + toggleSelection(true); + const newHeight = parseInt(previewHeight + delta.height, 10); + setAttributes({ + previewHeight: newHeight + }); + } + + function changePreviewHeight(newValue) { + const newHeight = Math.max(parseInt(newValue, 10), MIN_PREVIEW_HEIGHT); + setAttributes({ + previewHeight: newHeight + }); + } + + const attachmentPage = media && media.link; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()(Object(external_wp_blob_["isBlobURL"])(href) && Object(external_wp_components_["__unstableGetAnimateClassName"])({ + type: 'loading' + }), { + 'is-transient': Object(external_wp_blob_["isBlobURL"])(href) + }) + }); + const displayPreviewInEditor = browserSupportsPdfs() && displayPreview; + + if (!href || hasError) { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { + icon: library_file + }), + labels: { + title: Object(external_wp_i18n_["__"])('File'), + instructions: Object(external_wp_i18n_["__"])('Upload a file or pick one from your media library.') + }, + onSelect: onSelectFile, + notices: noticeUI, + onError: onUploadError, + accept: "*" + })); + } + + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(FileBlockInspector, { + hrefs: { + href, + textLinkHref, + attachmentPage + }, + openInNewWindow: !!textLinkTarget, + showDownloadButton, + changeLinkDestinationOption, + changeOpenInNewWindow, + changeShowDownloadButton, + displayPreview, + changeDisplayPreview, + previewHeight, + changePreviewHeight + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], { + mediaId: id, + mediaURL: href, + accept: "*", + onSelect: onSelectFile, + onError: onUploadError + }), Object(external_wp_element_["createElement"])(ClipboardToolbarButton, { + text: href, + disabled: Object(external_wp_blob_["isBlobURL"])(href) + })), Object(external_wp_element_["createElement"])("div", blockProps, displayPreviewInEditor && Object(external_wp_element_["createElement"])(external_wp_components_["ResizableBox"], { + size: { + height: previewHeight + }, + minHeight: MIN_PREVIEW_HEIGHT, + maxHeight: MAX_PREVIEW_HEIGHT, + minWidth: "100%", + grid: [10, 10], + enable: { + top: false, + right: false, + bottom: true, + left: false, + topRight: false, + bottomRight: false, + bottomLeft: false, + topLeft: false + }, + onResizeStart: () => toggleSelection(false), + onResizeStop: handleOnResizeStop, + showHandle: isSelected + }, Object(external_wp_element_["createElement"])("object", { + className: "wp-block-file__preview", + data: href, + type: "application/pdf", + "aria-label": Object(external_wp_i18n_["__"])('Embed of the selected PDF file.') + }), !isSelected && Object(external_wp_element_["createElement"])("div", { + className: "wp-block-file__preview-overlay" + })), Object(external_wp_element_["createElement"])("div", { + className: 'wp-block-file__content-wrapper' + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + style: { + display: 'inline-block' + }, + tagName: "a" // must be block-level or else cursor disappears + , + value: fileName, + placeholder: Object(external_wp_i18n_["__"])('Write file name…'), + withoutInteractiveFormatting: true, + onChange: text => setAttributes({ + fileName: text + }), + href: textLinkHref + }), showDownloadButton && Object(external_wp_element_["createElement"])("div", { + className: 'wp-block-file__button-richtext-wrapper' + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + tagName: "div" // must be block-level or else cursor disappears + , + "aria-label": Object(external_wp_i18n_["__"])('Download button text'), + className: 'wp-block-file__button', + value: downloadButtonText, + withoutInteractiveFormatting: true, + placeholder: Object(external_wp_i18n_["__"])('Add text…'), + onChange: text => changeDownloadButtonText(text) + }))))); +} + +/* harmony default export */ var file_edit = (Object(external_wp_components_["withNotices"])(FileEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/file/save.js @@ -15049,25 +16155,43 @@ * WordPress dependencies */ -function file_save_save(_ref) { - var attributes = _ref.attributes; - var href = attributes.href, - fileName = attributes.fileName, - textLinkHref = attributes.textLinkHref, - textLinkTarget = attributes.textLinkTarget, - showDownloadButton = attributes.showDownloadButton, - downloadButtonText = attributes.downloadButtonText; - return href && Object(external_this_wp_element_["createElement"])("div", null, !external_this_wp_blockEditor_["RichText"].isEmpty(fileName) && Object(external_this_wp_element_["createElement"])("a", { + +function file_save_save({ + attributes +}) { + const { + href, + fileName, + textLinkHref, + textLinkTarget, + showDownloadButton, + downloadButtonText, + displayPreview, + previewHeight + } = attributes; + const pdfEmbedLabel = external_wp_blockEditor_["RichText"].isEmpty(fileName) ? Object(external_wp_i18n_["__"])('PDF embed') : Object(external_wp_i18n_["sprintf"])( + /* translators: %s: filename. */ + Object(external_wp_i18n_["__"])('Embed of %s.'), fileName); + return href && Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save(), displayPreview && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("object", { + className: "wp-block-file__embed", + data: href, + type: "application/pdf", + style: { + width: '100%', + height: `${previewHeight}px` + }, + "aria-label": pdfEmbedLabel + })), !external_wp_blockEditor_["RichText"].isEmpty(fileName) && Object(external_wp_element_["createElement"])("a", { href: textLinkHref, target: textLinkTarget, - rel: textLinkTarget ? 'noreferrer noopener' : false - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + rel: textLinkTarget ? 'noreferrer noopener' : undefined + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: fileName - })), showDownloadButton && Object(external_this_wp_element_["createElement"])("a", { + })), showDownloadButton && Object(external_wp_element_["createElement"])("a", { href: href, className: "wp-block-file__button", download: true - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: downloadButtonText }))); } @@ -15084,21 +16208,24 @@ -var file_transforms_transforms = { + +const file_transforms_transforms = { from: [{ type: 'files', - isMatch: function isMatch(files) { + + isMatch(files) { return files.length > 0; }, + // We define a lower priorty (higher number) than the default of 10. This // ensures that the File block is only created as a fallback. priority: 15, - transform: function transform(files) { - var blocks = []; - files.forEach(function (file) { - var blobURL = Object(external_this_wp_blob_["createBlobURL"])(file); // File will be uploaded in componentDidMount() - - blocks.push(Object(external_this_wp_blocks_["createBlock"])('core/file', { + transform: files => { + const blocks = []; + files.forEach(file => { + const blobURL = Object(external_wp_blob_["createBlobURL"])(file); // File will be uploaded in componentDidMount() + + blocks.push(Object(external_wp_blocks_["createBlock"])('core/file', { href: blobURL, fileName: file.name, textLinkHref: blobURL @@ -15109,8 +16236,8 @@ }, { type: 'block', blocks: ['core/audio'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/file', { + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/file', { href: attributes.src, fileName: attributes.caption, textLinkHref: attributes.src, @@ -15121,8 +16248,8 @@ }, { type: 'block', blocks: ['core/video'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/file', { + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/file', { href: attributes.src, fileName: attributes.caption, textLinkHref: attributes.src, @@ -15133,8 +16260,8 @@ }, { type: 'block', blocks: ['core/image'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/file', { + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/file', { href: attributes.url, fileName: attributes.caption, textLinkHref: attributes.url, @@ -15146,21 +16273,21 @@ to: [{ type: 'block', blocks: ['core/audio'], - isMatch: function isMatch(_ref) { - var id = _ref.id; - + isMatch: ({ + id + }) => { if (!id) { return false; } - var _select = Object(external_this_wp_data_["select"])('core'), - getMedia = _select.getMedia; - - var media = getMedia(id); - return !!media && Object(external_this_lodash_["includes"])(media.mime_type, 'audio'); - }, - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/audio', { + const { + getMedia + } = Object(external_wp_data_["select"])(external_wp_coreData_["store"]); + const media = getMedia(id); + return !!media && Object(external_lodash_["includes"])(media.mime_type, 'audio'); + }, + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/audio', { src: attributes.href, caption: attributes.fileName, id: attributes.id, @@ -15170,21 +16297,21 @@ }, { type: 'block', blocks: ['core/video'], - isMatch: function isMatch(_ref2) { - var id = _ref2.id; - + isMatch: ({ + id + }) => { if (!id) { return false; } - var _select2 = Object(external_this_wp_data_["select"])('core'), - getMedia = _select2.getMedia; - - var media = getMedia(id); - return !!media && Object(external_this_lodash_["includes"])(media.mime_type, 'video'); - }, - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/video', { + const { + getMedia + } = Object(external_wp_data_["select"])(external_wp_coreData_["store"]); + const media = getMedia(id); + return !!media && Object(external_lodash_["includes"])(media.mime_type, 'video'); + }, + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/video', { src: attributes.href, caption: attributes.fileName, id: attributes.id, @@ -15194,21 +16321,21 @@ }, { type: 'block', blocks: ['core/image'], - isMatch: function isMatch(_ref3) { - var id = _ref3.id; - + isMatch: ({ + id + }) => { if (!id) { return false; } - var _select3 = Object(external_this_wp_data_["select"])('core'), - getMedia = _select3.getMedia; - - var media = getMedia(id); - return !!media && Object(external_this_lodash_["includes"])(media.mime_type, 'image'); - }, - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/image', { + const { + getMedia + } = Object(external_wp_data_["select"])(external_wp_coreData_["store"]); + const media = getMedia(id); + return !!media && Object(external_lodash_["includes"])(media.mime_type, 'image'); + }, + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/image', { url: attributes.href, caption: attributes.fileName, id: attributes.id, @@ -15224,15 +16351,19 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - -var file_metadata = { +/** + * Internal dependencies + */ + + +const file_metadata = { + apiVersion: 2, name: "core/file", + title: "File", category: "media", + description: "Add a link to a downloadable file.", + keywords: ["document", "pdf", "download"], + textdomain: "default", attributes: { id: { type: "number" @@ -15265,22 +16396,31 @@ type: "string", source: "html", selector: "a[download]" + }, + displayPreview: { + type: "boolean" + }, + previewHeight: { + type: "number", + "default": 600 } }, supports: { anchor: true, align: true - } -}; - - -var file_name = file_metadata.name; - -var file_settings = { - title: Object(external_this_wp_i18n_["__"])('File'), - description: Object(external_this_wp_i18n_["__"])('Add a link to a downloadable file.'), + }, + viewScript: "file:./view.min.js", + editorStyle: "wp-block-file-editor", + style: "wp-block-file" +}; + + +const { + name: file_name +} = file_metadata; + +const file_settings = { icon: library_file, - keywords: [Object(external_this_wp_i18n_["__"])('document'), Object(external_this_wp_i18n_["__"])('pdf'), Object(external_this_wp_i18n_["__"])('download')], transforms: file_transforms, edit: file_edit, save: file_save_save @@ -15293,10 +16433,10 @@ * WordPress dependencies */ -var html_html = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const html_html = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4.8 11.4H2.1V9H1v6h1.1v-2.6h2.7V15h1.1V9H4.8v2.4zm1.9-1.3h1.7V15h1.1v-4.9h1.7V9H6.7v1.1zM16.2 9l-1.5 2.7L13.3 9h-.9l-.8 6h1.1l.5-4 1.5 2.8 1.5-2.8.5 4h1.1L17 9h-.8zm3.8 5V9h-1.1v6h3.6v-1H20z" })); /* harmony default export */ var library_html = (html_html); @@ -15304,123 +16444,66 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/edit.js - - - - - - - -function html_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (html_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function html_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * WordPress dependencies - */ - - - - - - -var edit_HTMLEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(HTMLEdit, _Component); - - var _super = html_edit_createSuper(HTMLEdit); - - function HTMLEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, HTMLEdit); - - _this = _super.apply(this, arguments); - _this.state = { - isPreview: false, - styles: [] - }; - _this.switchToHTML = _this.switchToHTML.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.switchToPreview = _this.switchToPreview.bind(Object(assertThisInitialized["a" /* default */])(_this)); - return _this; - } - - Object(createClass["a" /* default */])(HTMLEdit, [{ - key: "componentDidMount", - value: function componentDidMount() { - var styles = this.props.styles; // Default styles used to unset some of the styles - // that might be inherited from the editor style. - - var defaultStyles = "\n\t\t\thtml,body,:root {\n\t\t\t\tmargin: 0 !important;\n\t\t\t\tpadding: 0 !important;\n\t\t\t\toverflow: visible !important;\n\t\t\t\tmin-height: auto !important;\n\t\t\t}\n\t\t"; - this.setState({ - styles: [defaultStyles].concat(Object(toConsumableArray["a" /* default */])(Object(external_this_wp_blockEditor_["transformStyles"])(styles))) - }); - } - }, { - key: "switchToPreview", - value: function switchToPreview() { - this.setState({ - isPreview: true - }); - } - }, { - key: "switchToHTML", - value: function switchToHTML() { - this.setState({ - isPreview: false - }); - } - }, { - key: "render", - value: function render() { - var _this2 = this; - - var _this$props = this.props, - attributes = _this$props.attributes, - setAttributes = _this$props.setAttributes; - var _this$state = this.state, - isPreview = _this$state.isPreview, - styles = _this$state.styles; - return Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-html" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - className: "components-tab-button", - isPressed: !isPreview, - onClick: this.switchToHTML - }, Object(external_this_wp_element_["createElement"])("span", null, "HTML")), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarButton"], { - className: "components-tab-button", - isPressed: isPreview, - onClick: this.switchToPreview - }, Object(external_this_wp_element_["createElement"])("span", null, Object(external_this_wp_i18n_["__"])('Preview'))))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"].Consumer, null, function (isDisabled) { - return isPreview || isDisabled ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SandBox"], { - html: attributes.content, - styles: styles - }), !_this2.props.isSelected && Object(external_this_wp_element_["createElement"])("div", { - className: "block-library-html__preview-overlay" - })) : Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["PlainText"], { - value: attributes.content, - onChange: function onChange(content) { - return setAttributes({ - content: content - }); - }, - placeholder: Object(external_this_wp_i18n_["__"])('Write HTML…'), - "aria-label": Object(external_this_wp_i18n_["__"])('HTML') - }); - })); - } - }]); - - return HTMLEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var html_edit = (Object(external_this_wp_data_["withSelect"])(function (select) { - var _select = select('core/block-editor'), - getSettings = _select.getSettings; - - return { - styles: getSettings().styles - }; -})(edit_HTMLEdit)); +/** + * WordPress dependencies + */ + + + + + +function HTMLEdit({ + attributes, + setAttributes, + isSelected +}) { + const [isPreview, setIsPreview] = Object(external_wp_element_["useState"])(); + const styles = Object(external_wp_data_["useSelect"])(select => { + // Default styles used to unset some of the styles + // that might be inherited from the editor style. + const defaultStyles = ` + html,body,:root { + margin: 0 !important; + padding: 0 !important; + overflow: visible !important; + min-height: auto !important; + } + `; + return [defaultStyles, ...Object(external_wp_blockEditor_["transformStyles"])(select(external_wp_blockEditor_["store"]).getSettings().styles)]; + }, []); + + function switchToPreview() { + setIsPreview(true); + } + + function switchToHTML() { + setIsPreview(false); + } + + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])({ + className: 'block-library-html__edit' + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + className: "components-tab-button", + isPressed: !isPreview, + onClick: switchToHTML + }, Object(external_wp_element_["createElement"])("span", null, "HTML")), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + className: "components-tab-button", + isPressed: isPreview, + onClick: switchToPreview + }, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_i18n_["__"])('Preview'))))), Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"].Consumer, null, isDisabled => isPreview || isDisabled ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["SandBox"], { + html: attributes.content, + styles: styles + }), !isSelected && Object(external_wp_element_["createElement"])("div", { + className: "block-library-html__preview-overlay" + })) : Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PlainText"], { + value: attributes.content, + onChange: content => setAttributes({ + content + }), + placeholder: Object(external_wp_i18n_["__"])('Write HTML…'), + "aria-label": Object(external_wp_i18n_["__"])('HTML') + }))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/save.js @@ -15429,9 +16512,10 @@ * WordPress dependencies */ -function html_save_save(_ref) { - var attributes = _ref.attributes; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, attributes.content); +function html_save_save({ + attributes +}) { + return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, attributes.content); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/html/transforms.js @@ -15439,14 +16523,15 @@ * WordPress dependencies */ -var html_transforms_transforms = { +const html_transforms_transforms = { from: [{ type: 'block', blocks: ['core/code'], - transform: function transform(_ref) { - var content = _ref.content; - return Object(external_this_wp_blocks_["createBlock"])('core/html', { - content: content + transform: ({ + content + }) => { + return Object(external_wp_blocks_["createBlock"])('core/html', { + content }); } }] @@ -15464,9 +16549,14 @@ */ -var html_metadata = { +const html_metadata = { + apiVersion: 2, name: "core/html", + title: "Custom HTML", category: "widgets", + description: "Add custom HTML code and preview it as you edit.", + keywords: ["embed"], + textdomain: "default", attributes: { content: { type: "string", @@ -15477,23 +16567,23 @@ customClassName: false, className: false, html: false - } -}; - - -var html_name = html_metadata.name; - -var html_settings = { - title: Object(external_this_wp_i18n_["__"])('Custom HTML'), - description: Object(external_this_wp_i18n_["__"])('Add custom HTML code and preview it as you edit.'), + }, + editorStyle: "wp-block-html-editor" +}; + + +const { + name: html_name +} = html_metadata; + +const html_settings = { icon: library_html, - keywords: [Object(external_this_wp_i18n_["__"])('embed')], example: { attributes: { - content: '' + Object(external_this_wp_i18n_["__"])('Welcome to the wonderful world of blocks…') + '' - } - }, - edit: html_edit, + content: '' + Object(external_wp_i18n_["__"])('Welcome to the wonderful world of blocks…') + '' + } + }, + edit: HTMLEdit, save: html_save_save, transforms: html_transforms }; @@ -15505,11 +16595,11 @@ * WordPress dependencies */ -var mediaAndText = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M4 17h7V6H4v11zm9-10v1.5h7V7h-7zm0 5.5h7V11h-7v1.5zm0 4h7V15h-7v1.5z" +const mediaAndText = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M3 18h8V6H3v12zM14 7.5V9h7V7.5h-7zm0 5.3h7v-1.5h-7v1.5zm0 3.7h7V15h-7v1.5z" })); /* harmony default export */ var media_and_text = (mediaAndText); @@ -15520,14 +16610,14 @@ * WordPress dependencies */ -/* harmony default export */ var media_container_icon = (Object(external_this_wp_element_["createElement"])(external_this_wp_components_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { +/* harmony default export */ var media_container_icon = (Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M18 2l2 4h-2l-2-4h-3l2 4h-2l-2-4h-1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V2zm2 12H10V4.4L11.8 8H20z" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M14 20H4V10h3V8H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3h-2z" -}), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Path"], { +}), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], { d: "M5 19h8l-1.59-2H9.24l-.84 1.1L7 16.3 5 19z" }))); @@ -15535,15 +16625,15 @@ - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + @@ -15559,30 +16649,33 @@ * Constants */ -var media_container_ALLOWED_MEDIA_TYPES = ['image', 'video']; +const media_container_ALLOWED_MEDIA_TYPES = ['image', 'video']; function imageFillStyles(url, focalPoint) { return url ? { - backgroundImage: "url(".concat(url, ")"), - backgroundPosition: focalPoint ? "".concat(focalPoint.x * 100, "% ").concat(focalPoint.y * 100, "%") : "50% 50%" + backgroundImage: `url(${url})`, + backgroundPosition: focalPoint ? `${focalPoint.x * 100}% ${focalPoint.y * 100}%` : `50% 50%` } : {}; } - -function ResizableBoxContainer(_ref) { - var isSelected = _ref.isSelected, - isStackedOnMobile = _ref.isStackedOnMobile, - props = Object(objectWithoutProperties["a" /* default */])(_ref, ["isSelected", "isStackedOnMobile"]); - - var isMobile = Object(external_this_wp_compose_["useViewportMatch"])('small', '<'); - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ResizableBox"], Object(esm_extends["a" /* default */])({ +const ResizableBoxContainer = Object(external_wp_element_["forwardRef"])(({ + isSelected, + isStackedOnMobile, + ...props +}, ref) => { + const isMobile = Object(external_wp_compose_["useViewportMatch"])('small', '<'); + return Object(external_wp_element_["createElement"])(external_wp_components_["ResizableBox"], Object(esm_extends["a" /* default */])({ + ref: ref, showHandle: isSelected && (!isMobile || !isStackedOnMobile) }, props)); -} - -function ToolbarEditButton(_ref2) { - var mediaId = _ref2.mediaId, - mediaUrl = _ref2.mediaUrl, - onSelectMedia = _ref2.onSelectMedia; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaReplaceFlow"], { +}); + +function ToolbarEditButton({ + mediaId, + mediaUrl, + onSelectMedia +}) { + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaReplaceFlow"], { mediaId: mediaId, mediaURL: mediaUrl, allowedTypes: media_container_ALLOWED_MEDIA_TYPES, @@ -15591,23 +16684,23 @@ })); } -function PlaceholderContainer(_ref3) { - var className = _ref3.className, - noticeOperations = _ref3.noticeOperations, - noticeUI = _ref3.noticeUI, - onSelectMedia = _ref3.onSelectMedia; - - var onUploadError = function onUploadError(message) { +function PlaceholderContainer({ + className, + noticeOperations, + noticeUI, + onSelectMedia +}) { + const onUploadError = message => { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice(message); }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MediaPlaceholder"], { - icon: Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockIcon"], { + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaPlaceholder"], { + icon: Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { icon: media_container_icon }), labels: { - title: Object(external_this_wp_i18n_["__"])('Media area') + title: Object(external_wp_i18n_["__"])('Media area') }, className: className, onSelect: onSelectMedia, @@ -15618,59 +16711,57 @@ }); } -function MediaContainer(props) { - var className = props.className, - commitWidthChange = props.commitWidthChange, - focalPoint = props.focalPoint, - imageFill = props.imageFill, - isSelected = props.isSelected, - isStackedOnMobile = props.isStackedOnMobile, - mediaAlt = props.mediaAlt, - mediaId = props.mediaId, - mediaPosition = props.mediaPosition, - mediaType = props.mediaType, - mediaUrl = props.mediaUrl, - mediaWidth = props.mediaWidth, - onSelectMedia = props.onSelectMedia, - onWidthChange = props.onWidthChange; - - var _useDispatch = Object(external_this_wp_data_["useDispatch"])('core/block-editor'), - toggleSelection = _useDispatch.toggleSelection; +function MediaContainer(props, ref) { + const { + className, + commitWidthChange, + focalPoint, + imageFill, + isSelected, + isStackedOnMobile, + mediaAlt, + mediaId, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + onSelectMedia, + onWidthChange + } = props; + const { + toggleSelection + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); if (mediaType && mediaUrl) { - var onResizeStart = function onResizeStart() { + const onResizeStart = () => { toggleSelection(false); }; - var onResize = function onResize(event, direction, elt) { + const onResize = (event, direction, elt) => { onWidthChange(parseInt(elt.style.width)); }; - var onResizeStop = function onResizeStop(event, direction, elt) { + const onResizeStop = (event, direction, elt) => { toggleSelection(true); commitWidthChange(parseInt(elt.style.width)); }; - var enablePositions = { + const enablePositions = { right: mediaPosition === 'left', left: mediaPosition === 'right' }; - var backgroundStyles = mediaType === 'image' && imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; - var mediaTypeRenderers = { - image: function image() { - return Object(external_this_wp_element_["createElement"])("img", { - src: mediaUrl, - alt: mediaAlt - }); - }, - video: function video() { - return Object(external_this_wp_element_["createElement"])("video", { - controls: true, - src: mediaUrl - }); - } - }; - return Object(external_this_wp_element_["createElement"])(ResizableBoxContainer, { + const backgroundStyles = mediaType === 'image' && imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; + const mediaTypeRenderers = { + image: () => Object(external_wp_element_["createElement"])("img", { + src: mediaUrl, + alt: mediaAlt + }), + video: () => Object(external_wp_element_["createElement"])("video", { + controls: true, + src: mediaUrl + }) + }; + return Object(external_wp_element_["createElement"])(ResizableBoxContainer, { as: "figure", className: classnames_default()(className, 'editor-media-container__resizer'), style: backgroundStyles, @@ -15685,60 +16776,56 @@ onResizeStop: onResizeStop, axis: "x", isSelected: isSelected, - isStackedOnMobile: isStackedOnMobile - }, Object(external_this_wp_element_["createElement"])(ToolbarEditButton, { + isStackedOnMobile: isStackedOnMobile, + ref: ref + }, Object(external_wp_element_["createElement"])(ToolbarEditButton, { onSelectMedia: onSelectMedia, mediaUrl: mediaUrl, mediaId: mediaId - }), (mediaTypeRenderers[mediaType] || external_this_lodash_["noop"])()); - } - - return Object(external_this_wp_element_["createElement"])(PlaceholderContainer, props); -} - -/* harmony default export */ var media_container = (Object(external_this_wp_components_["withNotices"])(MediaContainer)); + }), (mediaTypeRenderers[mediaType] || external_lodash_["noop"])()); + } + + return Object(external_wp_element_["createElement"])(PlaceholderContainer, props); +} + +/* harmony default export */ var media_container = (Object(external_wp_components_["withNotices"])(Object(external_wp_element_["forwardRef"])(MediaContainer))); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/deprecated.js - -function media_text_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function media_text_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { media_text_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { media_text_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -var DEFAULT_MEDIA_WIDTH = 50; - -var media_text_deprecated_migrateCustomColors = function migrateCustomColors(attributes) { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +const DEFAULT_MEDIA_WIDTH = 50; + +const media_text_deprecated_migrateCustomColors = attributes => { if (!attributes.customBackgroundColor) { return attributes; } - var style = { + const style = { color: { background: attributes.customBackgroundColor } }; - return media_text_deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customBackgroundColor']), { - style: style - }); -}; - -var baseAttributes = { + return { ...Object(external_lodash_["omit"])(attributes, ['customBackgroundColor']), + style + }; +}; + +const baseAttributes = { align: { type: 'string', default: 'wide' @@ -15769,11 +16856,11 @@ }, isStackedOnMobile: { type: 'boolean', - default: false + default: true } }; /* harmony default export */ var media_text_deprecated = ([{ - attributes: media_text_deprecated_objectSpread({}, baseAttributes, { + attributes: { ...baseAttributes, customBackgroundColor: { type: 'string' }, @@ -15816,84 +16903,86 @@ focalPoint: { type: 'object' } - }), + }, migrate: media_text_deprecated_migrateCustomColors, - save: function save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - isStackedOnMobile = attributes.isStackedOnMobile, - mediaAlt = attributes.mediaAlt, - mediaPosition = attributes.mediaPosition, - mediaType = attributes.mediaType, - mediaUrl = attributes.mediaUrl, - mediaWidth = attributes.mediaWidth, - mediaId = attributes.mediaId, - verticalAlignment = attributes.verticalAlignment, - imageFill = attributes.imageFill, - focalPoint = attributes.focalPoint, - linkClass = attributes.linkClass, - href = attributes.href, - linkTarget = attributes.linkTarget, - rel = attributes.rel; - var newRel = Object(external_this_lodash_["isEmpty"])(rel) ? undefined : rel; - - var _image = Object(external_this_wp_element_["createElement"])("img", { + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + isStackedOnMobile, + mediaAlt, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + mediaId, + verticalAlignment, + imageFill, + focalPoint, + linkClass, + href, + linkTarget, + rel + } = attributes; + const newRel = Object(external_lodash_["isEmpty"])(rel) ? undefined : rel; + let image = Object(external_wp_element_["createElement"])("img", { src: mediaUrl, alt: mediaAlt, - className: mediaId && mediaType === 'image' ? "wp-image-".concat(mediaId) : null + className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null }); if (href) { - _image = Object(external_this_wp_element_["createElement"])("a", { + image = Object(external_wp_element_["createElement"])("a", { className: linkClass, href: href, target: linkTarget, rel: newRel - }, _image); - } - - var mediaTypeRenders = { - image: function image() { - return _image; - }, - video: function video() { - return Object(external_this_wp_element_["createElement"])("video", { - controls: true, - src: mediaUrl - }); - } - }; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var className = classnames_default()((_classnames = { + }, image); + } + + const mediaTypeRenders = { + image: () => image, + video: () => Object(external_wp_element_["createElement"])("video", { + controls: true, + src: mediaUrl + }) + }; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const className = classnames_default()({ 'has-media-on-the-right': 'right' === mediaPosition, - 'has-background': backgroundClass || customBackgroundColor - }, Object(defineProperty["a" /* default */])(_classnames, backgroundClass, backgroundClass), Object(defineProperty["a" /* default */])(_classnames, 'is-stacked-on-mobile', isStackedOnMobile), Object(defineProperty["a" /* default */])(_classnames, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment), Object(defineProperty["a" /* default */])(_classnames, 'is-image-fill', imageFill), _classnames)); - var backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; - var gridTemplateColumns; + 'has-background': backgroundClass || customBackgroundColor, + [backgroundClass]: backgroundClass, + 'is-stacked-on-mobile': isStackedOnMobile, + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, + 'is-image-fill': imageFill + }); + const backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; + let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { - gridTemplateColumns = 'right' === mediaPosition ? "auto ".concat(mediaWidth, "%") : "".concat(mediaWidth, "% auto"); - } - - var style = { + gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; + } + + const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, - gridTemplateColumns: gridTemplateColumns - }; - return Object(external_this_wp_element_["createElement"])("div", { + gridTemplateColumns + }; + return Object(external_wp_element_["createElement"])("div", { className: className, style: style - }, Object(external_this_wp_element_["createElement"])("figure", { + }, Object(external_wp_element_["createElement"])("figure", { className: "wp-block-media-text__media", style: backgroundStyles - }, (mediaTypeRenders[mediaType] || external_this_lodash_["noop"])()), Object(external_this_wp_element_["createElement"])("div", { + }, (mediaTypeRenders[mediaType] || external_lodash_["noop"])()), Object(external_wp_element_["createElement"])("div", { className: "wp-block-media-text__content" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } -}, { - attributes: media_text_deprecated_objectSpread({}, baseAttributes, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, { + attributes: { ...baseAttributes, customBackgroundColor: { type: 'string' }, @@ -15912,66 +17001,69 @@ focalPoint: { type: 'object' } - }), + }, migrate: media_text_deprecated_migrateCustomColors, - save: function save(_ref2) { - var _classnames2; - - var attributes = _ref2.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - isStackedOnMobile = attributes.isStackedOnMobile, - mediaAlt = attributes.mediaAlt, - mediaPosition = attributes.mediaPosition, - mediaType = attributes.mediaType, - mediaUrl = attributes.mediaUrl, - mediaWidth = attributes.mediaWidth, - mediaId = attributes.mediaId, - verticalAlignment = attributes.verticalAlignment, - imageFill = attributes.imageFill, - focalPoint = attributes.focalPoint; - var mediaTypeRenders = { - image: function image() { - return Object(external_this_wp_element_["createElement"])("img", { - src: mediaUrl, - alt: mediaAlt, - className: mediaId && mediaType === 'image' ? "wp-image-".concat(mediaId) : null - }); - }, - video: function video() { - return Object(external_this_wp_element_["createElement"])("video", { - controls: true, - src: mediaUrl - }); - } - }; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var className = classnames_default()((_classnames2 = { - 'has-media-on-the-right': 'right' === mediaPosition - }, Object(defineProperty["a" /* default */])(_classnames2, backgroundClass, backgroundClass), Object(defineProperty["a" /* default */])(_classnames2, 'is-stacked-on-mobile', isStackedOnMobile), Object(defineProperty["a" /* default */])(_classnames2, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment), Object(defineProperty["a" /* default */])(_classnames2, 'is-image-fill', imageFill), _classnames2)); - var backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; - var gridTemplateColumns; + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + isStackedOnMobile, + mediaAlt, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + mediaId, + verticalAlignment, + imageFill, + focalPoint + } = attributes; + const mediaTypeRenders = { + image: () => Object(external_wp_element_["createElement"])("img", { + src: mediaUrl, + alt: mediaAlt, + className: mediaId && mediaType === 'image' ? `wp-image-${mediaId}` : null + }), + video: () => Object(external_wp_element_["createElement"])("video", { + controls: true, + src: mediaUrl + }) + }; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const className = classnames_default()({ + 'has-media-on-the-right': 'right' === mediaPosition, + [backgroundClass]: backgroundClass, + 'is-stacked-on-mobile': isStackedOnMobile, + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, + 'is-image-fill': imageFill + }); + const backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; + let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { - gridTemplateColumns = 'right' === mediaPosition ? "auto ".concat(mediaWidth, "%") : "".concat(mediaWidth, "% auto"); - } - - var style = { + gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; + } + + const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, - gridTemplateColumns: gridTemplateColumns - }; - return Object(external_this_wp_element_["createElement"])("div", { + gridTemplateColumns + }; + return Object(external_wp_element_["createElement"])("div", { className: className, style: style - }, Object(external_this_wp_element_["createElement"])("figure", { + }, Object(external_wp_element_["createElement"])("figure", { className: "wp-block-media-text__media", style: backgroundStyles - }, (mediaTypeRenders[mediaType] || external_this_lodash_["noop"])()), Object(external_this_wp_element_["createElement"])("div", { + }, (mediaTypeRenders[mediaType] || external_lodash_["noop"])()), Object(external_wp_element_["createElement"])("div", { className: "wp-block-media-text__content" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } -}, { - attributes: media_text_deprecated_objectSpread({}, baseAttributes, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, { + attributes: { ...baseAttributes, customBackgroundColor: { type: 'string' }, @@ -15981,56 +17073,57 @@ selector: 'figure video,figure img', attribute: 'src' } - }), - save: function save(_ref3) { - var _classnames3; - - var attributes = _ref3.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - isStackedOnMobile = attributes.isStackedOnMobile, - mediaAlt = attributes.mediaAlt, - mediaPosition = attributes.mediaPosition, - mediaType = attributes.mediaType, - mediaUrl = attributes.mediaUrl, - mediaWidth = attributes.mediaWidth; - var mediaTypeRenders = { - image: function image() { - return Object(external_this_wp_element_["createElement"])("img", { - src: mediaUrl, - alt: mediaAlt - }); - }, - video: function video() { - return Object(external_this_wp_element_["createElement"])("video", { - controls: true, - src: mediaUrl - }); - } - }; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var className = classnames_default()((_classnames3 = { - 'has-media-on-the-right': 'right' === mediaPosition - }, Object(defineProperty["a" /* default */])(_classnames3, backgroundClass, backgroundClass), Object(defineProperty["a" /* default */])(_classnames3, 'is-stacked-on-mobile', isStackedOnMobile), _classnames3)); - var gridTemplateColumns; + }, + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + isStackedOnMobile, + mediaAlt, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth + } = attributes; + const mediaTypeRenders = { + image: () => Object(external_wp_element_["createElement"])("img", { + src: mediaUrl, + alt: mediaAlt + }), + video: () => Object(external_wp_element_["createElement"])("video", { + controls: true, + src: mediaUrl + }) + }; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const className = classnames_default()({ + 'has-media-on-the-right': 'right' === mediaPosition, + [backgroundClass]: backgroundClass, + 'is-stacked-on-mobile': isStackedOnMobile + }); + let gridTemplateColumns; if (mediaWidth !== DEFAULT_MEDIA_WIDTH) { - gridTemplateColumns = 'right' === mediaPosition ? "auto ".concat(mediaWidth, "%") : "".concat(mediaWidth, "% auto"); - } - - var style = { + gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; + } + + const style = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, - gridTemplateColumns: gridTemplateColumns - }; - return Object(external_this_wp_element_["createElement"])("div", { + gridTemplateColumns + }; + return Object(external_wp_element_["createElement"])("div", { className: className, style: style - }, Object(external_this_wp_element_["createElement"])("figure", { + }, Object(external_wp_element_["createElement"])("figure", { className: "wp-block-media-text__media" - }, (mediaTypeRenders[mediaType] || external_this_lodash_["noop"])()), Object(external_this_wp_element_["createElement"])("div", { + }, (mediaTypeRenders[mediaType] || external_lodash_["noop"])()), Object(external_wp_element_["createElement"])("div", { className: "wp-block-media-text__content" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + }]); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pull-left.js @@ -16040,11 +17133,11 @@ * WordPress dependencies */ -var pullLeft = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M4 18h6V6H4v12zm9-10v1.5h7V8h-7zm0 7.5h7V14h-7v1.5z" +const pullLeft = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M4 18h6V6H4v12zm9-9.5V10h7V8.5h-7zm0 7h7V14h-7v1.5z" })); /* harmony default export */ var pull_left = (pullLeft); @@ -16055,65 +17148,75 @@ * WordPress dependencies */ -var pullRight = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { - d: "M14 6v12h6V6h-6zM4 9.5h7V8H4v1.5zm0 6h7V14H4v1.5z" +const pullRight = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M14 6v12h6V6h-6zM4 10h7V8.5H4V10zm0 5.5h7V14H4v1.5z" })); /* harmony default export */ var pull_right = (pullRight); +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/constants.js +const DEFAULT_MEDIA_SIZE_SLUG = 'full'; + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/edit.js - - - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + + + + +/** + * Internal dependencies + */ + /** * Constants */ -var TEMPLATE = [['core/paragraph', { +const TEMPLATE = [['core/paragraph', { fontSize: 'large', - placeholder: Object(external_this_wp_i18n_["_x"])('Content…', 'content placeholder') + placeholder: Object(external_wp_i18n_["_x"])('Content…', 'content placeholder') }]]; // this limits the resize to a safe zone to avoid making broken layouts -var WIDTH_CONSTRAINT_PERCENTAGE = 15; - -var applyWidthConstraints = function applyWidthConstraints(width) { - return Math.max(WIDTH_CONSTRAINT_PERCENTAGE, Math.min(width, 100 - WIDTH_CONSTRAINT_PERCENTAGE)); -}; - -var edit_LINK_DESTINATION_MEDIA = 'media'; -var edit_LINK_DESTINATION_ATTACHMENT = 'attachment'; - -function edit_attributesFromMedia(_ref) { - var _ref$attributes = _ref.attributes, - linkDestination = _ref$attributes.linkDestination, - href = _ref$attributes.href, - setAttributes = _ref.setAttributes; - return function (media) { - var mediaType; - var src; // for media selections originated from a file upload. +const WIDTH_CONSTRAINT_PERCENTAGE = 15; + +const applyWidthConstraints = width => Math.max(WIDTH_CONSTRAINT_PERCENTAGE, Math.min(width, 100 - WIDTH_CONSTRAINT_PERCENTAGE)); + +const edit_LINK_DESTINATION_MEDIA = 'media'; +const edit_LINK_DESTINATION_ATTACHMENT = 'attachment'; + +function getImageSourceUrlBySizeSlug(image, slug) { + var _image$media_details, _image$media_details$, _image$media_details$2; + + // eslint-disable-next-line camelcase + return image === null || image === void 0 ? void 0 : (_image$media_details = image.media_details) === null || _image$media_details === void 0 ? void 0 : (_image$media_details$ = _image$media_details.sizes) === null || _image$media_details$ === void 0 ? void 0 : (_image$media_details$2 = _image$media_details$[slug]) === null || _image$media_details$2 === void 0 ? void 0 : _image$media_details$2.source_url; +} + +function edit_attributesFromMedia({ + attributes: { + linkDestination, + href + }, + setAttributes +}) { + return media => { + let mediaType; + let src; // for media selections originated from a file upload. if (media.media_type) { if (media.media_type === 'image') { @@ -16136,7 +17239,7 @@ (_media$media_details = media.media_details) === null || _media$media_details === void 0 ? void 0 : (_media$media_details$ = _media$media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.large) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.source_url); } - var newHref = href; + let newHref = href; if (linkDestination === edit_LINK_DESTINATION_MEDIA) { // Update the media link. @@ -16152,7 +17255,7 @@ setAttributes({ mediaAlt: media.alt, mediaId: media.id, - mediaType: mediaType, + mediaType, mediaUrl: src || media.url, mediaLink: media.link || undefined, href: newHref, @@ -16161,140 +17264,188 @@ }; } -function MediaTextEdit(_ref2) { - var _classnames; - - var attributes = _ref2.attributes, - isSelected = _ref2.isSelected, - setAttributes = _ref2.setAttributes; - var focalPoint = attributes.focalPoint, - href = attributes.href, - imageFill = attributes.imageFill, - isStackedOnMobile = attributes.isStackedOnMobile, - linkClass = attributes.linkClass, - linkDestination = attributes.linkDestination, - linkTarget = attributes.linkTarget, - mediaAlt = attributes.mediaAlt, - mediaId = attributes.mediaId, - mediaPosition = attributes.mediaPosition, - mediaType = attributes.mediaType, - mediaUrl = attributes.mediaUrl, - mediaWidth = attributes.mediaWidth, - rel = attributes.rel, - verticalAlignment = attributes.verticalAlignment; - var image = Object(external_this_wp_data_["useSelect"])(function (select) { - return mediaId && isSelected ? select('core').getMedia(mediaId) : null; - }, [isSelected, mediaId]); - - var _useState = Object(external_this_wp_element_["useState"])(null), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - temporaryMediaWidth = _useState2[0], - setTemporaryMediaWidth = _useState2[1]; - - var onSelectMedia = edit_attributesFromMedia({ - attributes: attributes, - setAttributes: setAttributes - }); - - var onSetHref = function onSetHref(props) { +function MediaTextEdit({ + attributes, + isSelected, + setAttributes +}) { + const { + focalPoint, + href, + imageFill, + isStackedOnMobile, + linkClass, + linkDestination, + linkTarget, + mediaAlt, + mediaId, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + rel, + verticalAlignment + } = attributes; + const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; + const image = Object(external_wp_data_["useSelect"])(select => mediaId && isSelected ? select(external_wp_coreData_["store"]).getMedia(mediaId) : null, [isSelected, mediaId]); + const refMediaContainer = Object(external_wp_element_["useRef"])(); + + const imperativeFocalPointPreview = value => { + const { + style + } = refMediaContainer.current.resizable; + const { + x, + y + } = value; + style.backgroundPosition = `${x * 100}% ${y * 100}%`; + }; + + const [temporaryMediaWidth, setTemporaryMediaWidth] = Object(external_wp_element_["useState"])(null); + const onSelectMedia = edit_attributesFromMedia({ + attributes, + setAttributes + }); + + const onSetHref = props => { setAttributes(props); }; - var onWidthChange = function onWidthChange(width) { + const onWidthChange = width => { setTemporaryMediaWidth(applyWidthConstraints(width)); }; - var commitWidthChange = function commitWidthChange(width) { + const commitWidthChange = width => { setAttributes({ mediaWidth: applyWidthConstraints(width) }); setTemporaryMediaWidth(applyWidthConstraints(width)); }; - var classNames = classnames_default()((_classnames = { + const classNames = classnames_default()({ 'has-media-on-the-right': 'right' === mediaPosition, 'is-selected': isSelected, - 'is-stacked-on-mobile': isStackedOnMobile - }, Object(defineProperty["a" /* default */])(_classnames, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment), Object(defineProperty["a" /* default */])(_classnames, 'is-image-fill', imageFill), _classnames)); - var widthString = "".concat(temporaryMediaWidth || mediaWidth, "%"); - var gridTemplateColumns = 'right' === mediaPosition ? "1fr ".concat(widthString) : "".concat(widthString, " 1fr"); - var style = { - gridTemplateColumns: gridTemplateColumns, + 'is-stacked-on-mobile': isStackedOnMobile, + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, + 'is-image-fill': imageFill + }); + const widthString = `${temporaryMediaWidth || mediaWidth}%`; + const gridTemplateColumns = 'right' === mediaPosition ? `1fr ${widthString}` : `${widthString} 1fr`; + const style = { + gridTemplateColumns, msGridColumns: gridTemplateColumns }; - var toolbarControls = [{ - icon: pull_left, - title: Object(external_this_wp_i18n_["__"])('Show media on left'), - isActive: mediaPosition === 'left', - onClick: function onClick() { - return setAttributes({ - mediaPosition: 'left' - }); - } - }, { - icon: pull_right, - title: Object(external_this_wp_i18n_["__"])('Show media on right'), - isActive: mediaPosition === 'right', - onClick: function onClick() { - return setAttributes({ - mediaPosition: 'right' - }); - } - }]; - - var onMediaAltChange = function onMediaAltChange(newMediaAlt) { + + const onMediaAltChange = newMediaAlt => { setAttributes({ mediaAlt: newMediaAlt }); }; - var onVerticalAlignmentChange = function onVerticalAlignmentChange(alignment) { + const onVerticalAlignmentChange = alignment => { setAttributes({ verticalAlignment: alignment }); }; - var mediaTextGeneralSettings = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Media & Text settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Stack on mobile'), + const imageSizes = Object(external_wp_data_["useSelect"])(select => { + const settings = select(external_wp_blockEditor_["store"]).getSettings(); + return settings === null || settings === void 0 ? void 0 : settings.imageSizes; + }); + const imageSizeOptions = Object(external_lodash_["map"])(Object(external_lodash_["filter"])(imageSizes, ({ + slug + }) => getImageSourceUrlBySizeSlug(image, slug)), ({ + name, + slug + }) => ({ + value: slug, + label: name + })); + + const updateImage = newMediaSizeSlug => { + const newUrl = getImageSourceUrlBySizeSlug(image, newMediaSizeSlug); + + if (!newUrl) { + return null; + } + + setAttributes({ + mediaUrl: newUrl, + mediaSizeSlug: newMediaSizeSlug + }); + }; + + const mediaTextGeneralSettings = Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Media & Text settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Stack on mobile'), checked: isStackedOnMobile, - onChange: function onChange() { - return setAttributes({ - isStackedOnMobile: !isStackedOnMobile - }); - } - }), mediaType === 'image' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Crop image to fill entire column'), + onChange: () => setAttributes({ + isStackedOnMobile: !isStackedOnMobile + }) + }), mediaType === 'image' && Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Crop image to fill entire column'), checked: imageFill, - onChange: function onChange() { - return setAttributes({ - imageFill: !imageFill - }); - } - }), imageFill && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["FocalPointPicker"], { - label: Object(external_this_wp_i18n_["__"])('Focal point picker'), + onChange: () => setAttributes({ + imageFill: !imageFill + }) + }), imageFill && mediaUrl && mediaType === 'image' && Object(external_wp_element_["createElement"])(external_wp_components_["FocalPointPicker"], { + label: Object(external_wp_i18n_["__"])('Focal point picker'), url: mediaUrl, value: focalPoint, - onChange: function onChange(value) { - return setAttributes({ - focalPoint: value - }); - } - }), mediaType === 'image' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextareaControl"], { - label: Object(external_this_wp_i18n_["__"])('Alt text (alternative text)'), + onChange: value => setAttributes({ + focalPoint: value + }), + onDragStart: imperativeFocalPointPreview, + onDrag: imperativeFocalPointPreview + }), mediaType === 'image' && Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], { + label: Object(external_wp_i18n_["__"])('Alt text (alternative text)'), value: mediaAlt, onChange: onMediaAltChange, - help: Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ExternalLink"], { + help: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { href: "https://www.w3.org/WAI/tutorials/images/decision-tree" - }, Object(external_this_wp_i18n_["__"])('Describe the purpose of the image')), Object(external_this_wp_i18n_["__"])('Leave empty if the image is purely decorative.')) - })); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, mediaTextGeneralSettings), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { - controls: toolbarControls - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockVerticalAlignmentToolbar"], { + }, Object(external_wp_i18n_["__"])('Describe the purpose of the image')), Object(external_wp_i18n_["__"])('Leave empty if the image is purely decorative.')) + }), mediaType === 'image' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalImageSizeControl"], { + onChangeImage: updateImage, + slug: mediaSizeSlug, + imageSizeOptions: imageSizeOptions, + isResizable: false + }), mediaUrl && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Media width'), + value: temporaryMediaWidth || mediaWidth, + onChange: commitWidthChange, + min: WIDTH_CONSTRAINT_PERCENTAGE, + max: 100 - WIDTH_CONSTRAINT_PERCENTAGE + })); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classNames, + style + }); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({ + className: 'wp-block-media-text__content' + }, { + template: TEMPLATE + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, mediaTextGeneralSettings), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockVerticalAlignmentControl"], { onChange: onVerticalAlignmentChange, value: verticalAlignment - }), mediaType === 'image' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalImageURLInputUI"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: pull_left, + title: Object(external_wp_i18n_["__"])('Show media on left'), + isActive: mediaPosition === 'left', + onClick: () => setAttributes({ + mediaPosition: 'left' + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: pull_right, + title: Object(external_wp_i18n_["__"])('Show media on right'), + isActive: mediaPosition === 'right', + onClick: () => setAttributes({ + mediaPosition: 'right' + }) + }), mediaType === 'image' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalImageURLInputUI"], { url: href || '', onChangeUrl: onSetHref, linkDestination: linkDestination, @@ -16304,33 +17455,23 @@ linkTarget: linkTarget, linkClass: linkClass, rel: rel - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalBlock"].div, { - className: classNames, - style: style - }, Object(external_this_wp_element_["createElement"])(media_container, Object(esm_extends["a" /* default */])({ + })), Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(media_container, { className: "wp-block-media-text__media", onSelectMedia: onSelectMedia, onWidthChange: onWidthChange, - commitWidthChange: commitWidthChange - }, { - focalPoint: focalPoint, - imageFill: imageFill, - isSelected: isSelected, - isStackedOnMobile: isStackedOnMobile, - mediaAlt: mediaAlt, - mediaId: mediaId, - mediaPosition: mediaPosition, - mediaType: mediaType, - mediaUrl: mediaUrl, - mediaWidth: mediaWidth - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { - __experimentalTagName: "div", - __experimentalPassedProps: { - className: 'wp-block-media-text__content' - }, - template: TEMPLATE, - templateInsertUpdatesSelection: false - }))); + commitWidthChange: commitWidthChange, + ref: refMediaContainer, + focalPoint, + imageFill, + isSelected, + isStackedOnMobile, + mediaAlt, + mediaId, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth + }), Object(external_wp_element_["createElement"])("div", innerBlocksProps))); } /* harmony default export */ var media_text_edit = (MediaTextEdit); @@ -16338,92 +17479,95 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/save.js - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -var save_DEFAULT_MEDIA_WIDTH = 50; -function media_text_save_save(_ref) { - var _classnames; - - var attributes = _ref.attributes; - var isStackedOnMobile = attributes.isStackedOnMobile, - mediaAlt = attributes.mediaAlt, - mediaPosition = attributes.mediaPosition, - mediaType = attributes.mediaType, - mediaUrl = attributes.mediaUrl, - mediaWidth = attributes.mediaWidth, - mediaId = attributes.mediaId, - verticalAlignment = attributes.verticalAlignment, - imageFill = attributes.imageFill, - focalPoint = attributes.focalPoint, - linkClass = attributes.linkClass, - href = attributes.href, - linkTarget = attributes.linkTarget, - rel = attributes.rel; - var newRel = Object(external_this_lodash_["isEmpty"])(rel) ? undefined : rel; - - var _image = Object(external_this_wp_element_["createElement"])("img", { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + + +const save_DEFAULT_MEDIA_WIDTH = 50; +function media_text_save_save({ + attributes +}) { + const { + isStackedOnMobile, + mediaAlt, + mediaPosition, + mediaType, + mediaUrl, + mediaWidth, + mediaId, + verticalAlignment, + imageFill, + focalPoint, + linkClass, + href, + linkTarget, + rel + } = attributes; + const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG; + const newRel = Object(external_lodash_["isEmpty"])(rel) ? undefined : rel; + const imageClasses = classnames_default()({ + [`wp-image-${mediaId}`]: mediaId && mediaType === 'image', + [`size-${mediaSizeSlug}`]: mediaId && mediaType === 'image' + }); + let image = Object(external_wp_element_["createElement"])("img", { src: mediaUrl, alt: mediaAlt, - className: mediaId && mediaType === 'image' ? "wp-image-".concat(mediaId) : null + className: imageClasses || null }); if (href) { - _image = Object(external_this_wp_element_["createElement"])("a", { + image = Object(external_wp_element_["createElement"])("a", { className: linkClass, href: href, target: linkTarget, rel: newRel - }, _image); - } - - var mediaTypeRenders = { - image: function image() { - return _image; - }, - video: function video() { - return Object(external_this_wp_element_["createElement"])("video", { - controls: true, - src: mediaUrl - }); - } - }; - var className = classnames_default()((_classnames = { + }, image); + } + + const mediaTypeRenders = { + image: () => image, + video: () => Object(external_wp_element_["createElement"])("video", { + controls: true, + src: mediaUrl + }) + }; + const className = classnames_default()({ 'has-media-on-the-right': 'right' === mediaPosition, - 'is-stacked-on-mobile': isStackedOnMobile - }, Object(defineProperty["a" /* default */])(_classnames, "is-vertically-aligned-".concat(verticalAlignment), verticalAlignment), Object(defineProperty["a" /* default */])(_classnames, 'is-image-fill', imageFill), _classnames)); - var backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; - var gridTemplateColumns; + 'is-stacked-on-mobile': isStackedOnMobile, + [`is-vertically-aligned-${verticalAlignment}`]: verticalAlignment, + 'is-image-fill': imageFill + }); + const backgroundStyles = imageFill ? imageFillStyles(mediaUrl, focalPoint) : {}; + let gridTemplateColumns; if (mediaWidth !== save_DEFAULT_MEDIA_WIDTH) { - gridTemplateColumns = 'right' === mediaPosition ? "auto ".concat(mediaWidth, "%") : "".concat(mediaWidth, "% auto"); - } - - var style = { - gridTemplateColumns: gridTemplateColumns - }; - return Object(external_this_wp_element_["createElement"])("div", { - className: className, - style: style - }, Object(external_this_wp_element_["createElement"])("figure", { + gridTemplateColumns = 'right' === mediaPosition ? `auto ${mediaWidth}%` : `${mediaWidth}% auto`; + } + + const style = { + gridTemplateColumns + }; + return Object(external_wp_element_["createElement"])("div", external_wp_blockEditor_["useBlockProps"].save({ + className, + style + }), Object(external_wp_element_["createElement"])("figure", { className: "wp-block-media-text__media", style: backgroundStyles - }, (mediaTypeRenders[mediaType] || external_this_lodash_["noop"])()), Object(external_this_wp_element_["createElement"])("div", { + }, (mediaTypeRenders[mediaType] || external_lodash_["noop"])()), Object(external_wp_element_["createElement"])("div", { className: "wp-block-media-text__content" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/media-text/transforms.js @@ -16431,74 +17575,76 @@ * WordPress dependencies */ -var media_text_transforms_transforms = { +const media_text_transforms_transforms = { from: [{ type: 'block', blocks: ['core/image'], - transform: function transform(_ref) { - var alt = _ref.alt, - url = _ref.url, - id = _ref.id, - anchor = _ref.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/media-text', { - mediaAlt: alt, - mediaId: id, - mediaUrl: url, - mediaType: 'image', - anchor: anchor + transform: ({ + alt, + url, + id, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/media-text', { + mediaAlt: alt, + mediaId: id, + mediaUrl: url, + mediaType: 'image', + anchor + }) + }, { + type: 'block', + blocks: ['core/video'], + transform: ({ + src, + id, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/media-text', { + mediaId: id, + mediaUrl: src, + mediaType: 'video', + anchor + }) + }], + to: [{ + type: 'block', + blocks: ['core/image'], + isMatch: ({ + mediaType, + mediaUrl + }) => { + return !mediaUrl || mediaType === 'image'; + }, + transform: ({ + mediaAlt, + mediaId, + mediaUrl, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/image', { + alt: mediaAlt, + id: mediaId, + url: mediaUrl, + anchor }); } }, { type: 'block', blocks: ['core/video'], - transform: function transform(_ref2) { - var src = _ref2.src, - id = _ref2.id, - anchor = _ref2.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/media-text', { - mediaId: id, - mediaUrl: src, - mediaType: 'video', - anchor: anchor - }); - } - }], - to: [{ - type: 'block', - blocks: ['core/image'], - isMatch: function isMatch(_ref3) { - var mediaType = _ref3.mediaType, - mediaUrl = _ref3.mediaUrl; - return !mediaUrl || mediaType === 'image'; - }, - transform: function transform(_ref4) { - var mediaAlt = _ref4.mediaAlt, - mediaId = _ref4.mediaId, - mediaUrl = _ref4.mediaUrl, - anchor = _ref4.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/image', { - alt: mediaAlt, - id: mediaId, - url: mediaUrl, - anchor: anchor - }); - } - }, { - type: 'block', - blocks: ['core/video'], - isMatch: function isMatch(_ref5) { - var mediaType = _ref5.mediaType, - mediaUrl = _ref5.mediaUrl; + isMatch: ({ + mediaType, + mediaUrl + }) => { return !mediaUrl || mediaType === 'video'; }, - transform: function transform(_ref6) { - var mediaId = _ref6.mediaId, - mediaUrl = _ref6.mediaUrl, - anchor = _ref6.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/video', { + transform: ({ + mediaId, + mediaUrl, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/video', { id: mediaId, src: mediaUrl, - anchor: anchor + anchor }); } }] @@ -16517,9 +17663,14 @@ -var media_text_metadata = { +const media_text_metadata = { + apiVersion: 2, name: "core/media-text", + title: "Media & Text", category: "media", + description: "Set media and words side-by-side for a richer layout.", + keywords: ["image", "video"], + textdomain: "default", attributes: { align: { type: "string", @@ -16582,6 +17733,9 @@ type: "number", "default": 50 }, + mediaSizeSlug: { + type: "string" + }, isStackedOnMobile: { type: "boolean", "default": true @@ -16600,22 +17754,22 @@ anchor: true, align: ["wide", "full"], html: false, - lightBlockWrapper: true, - __experimentalColor: { + color: { gradients: true, - linkColor: true - } - } -}; - - -var media_text_name = media_text_metadata.name; - -var media_text_settings = { - title: Object(external_this_wp_i18n_["__"])('Media & Text'), - description: Object(external_this_wp_i18n_["__"])('Set media and words side-by-side for a richer layout.'), + link: true + } + }, + editorStyle: "wp-block-media-text-editor", + style: "wp-block-media-text" +}; + + +const { + name: media_text_name +} = media_text_metadata; + +const media_text_settings = { icon: media_and_text, - keywords: [Object(external_this_wp_i18n_["__"])('image'), Object(external_this_wp_i18n_["__"])('video')], example: { attributes: { mediaType: 'image', @@ -16624,12 +17778,12 @@ innerBlocks: [{ name: 'core/paragraph', attributes: { - content: Object(external_this_wp_i18n_["__"])('The wren
Earns his living
Noiselessly.') + content: Object(external_wp_i18n_["__"])('The wren
Earns his living
Noiselessly.') } }, { name: 'core/paragraph', attributes: { - content: Object(external_this_wp_i18n_["__"])('— Kobayashi Issa (一茶)') + content: Object(external_wp_i18n_["__"])('— Kobayashi Issa (一茶)') } }] }, @@ -16646,10 +17800,10 @@ * WordPress dependencies */ -var comment = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const comment = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18 4H6c-1.1 0-2 .9-2 2v12.9c0 .6.5 1.1 1.1 1.1.3 0 .5-.1.8-.3L8.5 17H18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 11c0 .3-.2.5-.5.5H7.9l-2.4 2.4V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v9z" })); /* harmony default export */ var library_comment = (comment); @@ -16657,21 +17811,9 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/edit.js - - - - - - - -function latest_comments_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (latest_comments_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function latest_comments_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * WordPress dependencies - */ - +/** + * WordPress dependencies + */ @@ -16682,116 +17824,77 @@ * @type {number} */ -var MIN_COMMENTS = 1; +const MIN_COMMENTS = 1; /** * Maximum number of comments a user can show using this block. * * @type {number} */ -var MAX_COMMENTS = 100; - -var edit_LatestComments = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(LatestComments, _Component); - - var _super = latest_comments_edit_createSuper(LatestComments); - - function LatestComments() { - var _this; - - Object(classCallCheck["a" /* default */])(this, LatestComments); - - _this = _super.apply(this, arguments); - _this.setCommentsToShow = _this.setCommentsToShow.bind(Object(assertThisInitialized["a" /* default */])(_this)); // Create toggles for each attribute; we create them here rather than - // passing `this.createToggleAttribute( 'displayAvatar' )` directly to - // `onChange` to avoid re-renders. - - _this.toggleDisplayAvatar = _this.createToggleAttribute('displayAvatar'); - _this.toggleDisplayDate = _this.createToggleAttribute('displayDate'); - _this.toggleDisplayExcerpt = _this.createToggleAttribute('displayExcerpt'); - return _this; - } - - Object(createClass["a" /* default */])(LatestComments, [{ - key: "createToggleAttribute", - value: function createToggleAttribute(propName) { - var _this2 = this; - - return function () { - var value = _this2.props.attributes[propName]; - var setAttributes = _this2.props.setAttributes; - setAttributes(Object(defineProperty["a" /* default */])({}, propName, !value)); - }; - } - }, { - key: "setCommentsToShow", - value: function setCommentsToShow(commentsToShow) { - this.props.setAttributes({ - commentsToShow: commentsToShow - }); - } - }, { - key: "render", - value: function render() { - var _this$props$attribute = this.props.attributes, - commentsToShow = _this$props$attribute.commentsToShow, - displayAvatar = _this$props$attribute.displayAvatar, - displayDate = _this$props$attribute.displayDate, - displayExcerpt = _this$props$attribute.displayExcerpt; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Latest comments settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display avatar'), - checked: displayAvatar, - onChange: this.toggleDisplayAvatar - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display date'), - checked: displayDate, - onChange: this.toggleDisplayDate - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display excerpt'), - checked: displayExcerpt, - onChange: this.toggleDisplayExcerpt - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Number of comments'), - value: commentsToShow, - onChange: this.setCommentsToShow, - min: MIN_COMMENTS, - max: MAX_COMMENTS, - required: true - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_serverSideRender_default.a, { - block: "core/latest-comments", - attributes: this.props.attributes - }))); - } - }]); - - return LatestComments; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var latest_comments_edit = (edit_LatestComments); +const MAX_COMMENTS = 100; +function LatestComments({ + attributes, + setAttributes +}) { + const { + commentsToShow, + displayAvatar, + displayDate, + displayExcerpt + } = attributes; + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Latest comments settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display avatar'), + checked: displayAvatar, + onChange: () => setAttributes({ + displayAvatar: !displayAvatar + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display date'), + checked: displayDate, + onChange: () => setAttributes({ + displayDate: !displayDate + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display excerpt'), + checked: displayExcerpt, + onChange: () => setAttributes({ + displayExcerpt: !displayExcerpt + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Number of comments'), + value: commentsToShow, + onChange: value => setAttributes({ + commentsToShow: value + }), + min: MIN_COMMENTS, + max: MAX_COMMENTS, + required: true + }))), Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(external_wp_serverSideRender_default.a, { + block: "core/latest-comments", + attributes: attributes + }))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-comments/index.js /** * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var latest_comments_metadata = { +/** + * Internal dependencies + */ + +const latest_comments_metadata = { + apiVersion: 2, name: "core/latest-comments", + title: "Latest Comments", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display a list of your most recent comments.", + keywords: ["recent comments"], + textdomain: "default", + attributes: { commentsToShow: { type: "number", "default": 5, @@ -16814,18 +17917,19 @@ supports: { align: true, html: false - } -}; - -var latest_comments_name = latest_comments_metadata.name; - -var latest_comments_settings = { - title: Object(external_this_wp_i18n_["__"])('Latest Comments'), - description: Object(external_this_wp_i18n_["__"])('Display a list of your most recent comments.'), + }, + editorStyle: "wp-block-latest-comments-editor", + style: "wp-block-latest-comments" +}; + +const { + name: latest_comments_name +} = latest_comments_metadata; + +const latest_comments_settings = { icon: library_comment, - keywords: [Object(external_this_wp_i18n_["__"])('recent comments')], example: {}, - edit: latest_comments_edit + edit: LatestComments }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/post-list.js @@ -16835,35 +17939,27 @@ * WordPress dependencies */ -var postList = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const postList = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12zM7 11h2V9H7v2zm0 4h2v-2H7v2zm3-4h7V9h-7v2zm0 4h7v-2h-7v2z" })); /* harmony default export */ var post_list = (postList); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/deprecated.js - - -function latest_posts_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function latest_posts_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { latest_posts_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { latest_posts_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * Internal dependencies - */ -var deprecated_metadata = { +/** + * Internal dependencies + */ +const latest_posts_deprecated_metadata = { + apiVersion: 2, name: "core/latest-posts", + title: "Latest Posts", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display a list of your most recent posts.", + keywords: ["recent posts"], + textdomain: "default", + attributes: { categories: { type: "array", items: { @@ -16932,43 +18028,48 @@ featuredImageSizeHeight: { type: "number", "default": null + }, + addLinkToFeaturedImage: { + type: "boolean", + "default": false + } + }, + supports: { + align: true, + html: false + }, + editorStyle: "wp-block-latest-posts-editor", + style: "wp-block-latest-posts" +}; +const { + attributes: deprecated_attributes +} = latest_posts_deprecated_metadata; +/* harmony default export */ var latest_posts_deprecated = ([{ + attributes: { ...deprecated_attributes, + categories: { + type: 'string' } }, supports: { align: true, html: false - } -}; -var deprecated_attributes = deprecated_metadata.attributes; -/* harmony default export */ var latest_posts_deprecated = ([{ - attributes: latest_posts_deprecated_objectSpread({}, deprecated_attributes, { - categories: { - type: 'string' - } - }), - supports: { - align: true, - html: false - }, - migrate: function migrate(oldAttributes) { + }, + migrate: oldAttributes => { // This needs the full category object, not just the ID. - return latest_posts_deprecated_objectSpread({}, oldAttributes, { + return { ...oldAttributes, categories: [{ id: Number(oldAttributes.categories) }] - }); - }, - isEligible: function isEligible(_ref) { - var categories = _ref.categories; - return categories && 'string' === typeof categories; - }, - save: function save() { - return null; - } + }; + }, + isEligible: ({ + categories + }) => categories && 'string' === typeof categories, + save: () => null }]); -// EXTERNAL MODULE: external {"this":["wp","date"]} -var external_this_wp_date_ = __webpack_require__(79); +// EXTERNAL MODULE: external ["wp","date"] +var external_wp_date_ = __webpack_require__("FqII"); // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list.js @@ -16977,48 +18078,34 @@ * WordPress dependencies */ -var list = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const list = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4 4v1.5h16V4H4zm8 8.5h8V11h-8v1.5zM4 20h16v-1.5H4V20zm4-8c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2z" })); /* harmony default export */ var library_list = (list); // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/grid.js -var grid = __webpack_require__(302); +var grid = __webpack_require__("b2RC"); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/constants.js -var MIN_EXCERPT_LENGTH = 10; -var MAX_EXCERPT_LENGTH = 100; -var MAX_POSTS_COLUMNS = 6; +const MIN_EXCERPT_LENGTH = 10; +const MAX_EXCERPT_LENGTH = 100; +const MAX_POSTS_COLUMNS = 6; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/edit.js - - - - - - - -function latest_posts_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function latest_posts_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { latest_posts_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { latest_posts_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function latest_posts_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (latest_posts_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function latest_posts_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + @@ -17038,462 +18125,394 @@ * Module Constants */ -var CATEGORIES_LIST_QUERY = { +const CATEGORIES_LIST_QUERY = { per_page: -1 }; -var USERS_LIST_QUERY = { +const USERS_LIST_QUERY = { per_page: -1 }; - -var edit_LatestPostsEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(LatestPostsEdit, _Component); - - var _super = latest_posts_edit_createSuper(LatestPostsEdit); - - function LatestPostsEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, LatestPostsEdit); - - _this = _super.apply(this, arguments); - _this.state = { - categoriesList: [], - authorList: [] - }; - return _this; - } - - Object(createClass["a" /* default */])(LatestPostsEdit, [{ - key: "componentDidMount", - value: function componentDidMount() { - var _this2 = this; - - this.isStillMounted = true; - this.fetchRequest = external_this_wp_apiFetch_default()({ - path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/categories", CATEGORIES_LIST_QUERY) - }).then(function (categoriesList) { - if (_this2.isStillMounted) { - _this2.setState({ - categoriesList: categoriesList - }); - } - }).catch(function () { - if (_this2.isStillMounted) { - _this2.setState({ - categoriesList: [] - }); - } - }); - this.fetchRequest = external_this_wp_apiFetch_default()({ - path: Object(external_this_wp_url_["addQueryArgs"])("/wp/v2/users", USERS_LIST_QUERY) - }).then(function (authorList) { - if (_this2.isStillMounted) { - _this2.setState({ - authorList: authorList - }); - } - }).catch(function () { - if (_this2.isStillMounted) { - _this2.setState({ - authorList: [] - }); - } - }); - } - }, { - key: "componentWillUnmount", - value: function componentWillUnmount() { - this.isStillMounted = false; - } - }, { - key: "render", - value: function render() { - var _this$props = this.props, - attributes = _this$props.attributes, - setAttributes = _this$props.setAttributes, - imageSizeOptions = _this$props.imageSizeOptions, - latestPosts = _this$props.latestPosts, - defaultImageWidth = _this$props.defaultImageWidth, - defaultImageHeight = _this$props.defaultImageHeight; - var _this$state = this.state, - categoriesList = _this$state.categoriesList, - authorList = _this$state.authorList; - var displayFeaturedImage = attributes.displayFeaturedImage, - displayPostContentRadio = attributes.displayPostContentRadio, - displayPostContent = attributes.displayPostContent, - displayPostDate = attributes.displayPostDate, - displayAuthor = attributes.displayAuthor, - postLayout = attributes.postLayout, - columns = attributes.columns, - order = attributes.order, - orderBy = attributes.orderBy, - categories = attributes.categories, - selectedAuthor = attributes.selectedAuthor, - postsToShow = attributes.postsToShow, - excerptLength = attributes.excerptLength, - featuredImageAlign = attributes.featuredImageAlign, - featuredImageSizeSlug = attributes.featuredImageSizeSlug, - featuredImageSizeWidth = attributes.featuredImageSizeWidth, - featuredImageSizeHeight = attributes.featuredImageSizeHeight; - var categorySuggestions = categoriesList.reduce(function (accumulator, category) { - return latest_posts_edit_objectSpread({}, accumulator, Object(defineProperty["a" /* default */])({}, category.name, category)); - }, {}); - - var selectCategories = function selectCategories(tokens) { - var hasNoSuggestion = tokens.some(function (token) { - return typeof token === 'string' && !categorySuggestions[token]; - }); - - if (hasNoSuggestion) { - return; - } // Categories that are already will be objects, while new additions will be strings (the name). - // allCategories nomalizes the array so that they are all objects. - - - var allCategories = tokens.map(function (token) { - return typeof token === 'string' ? categorySuggestions[token] : token; - }); // We do nothing if the category is not selected - // from suggestions. - - if (Object(external_this_lodash_["includes"])(allCategories, null)) { - return false; - } - - setAttributes({ - categories: allCategories - }); - }; - - var inspectorControls = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Post content settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Post content'), - checked: displayPostContent, - onChange: function onChange(value) { - return setAttributes({ - displayPostContent: value - }); - } - }), displayPostContent && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RadioControl"], { - label: Object(external_this_wp_i18n_["__"])('Show:'), - selected: displayPostContentRadio, - options: [{ - label: Object(external_this_wp_i18n_["__"])('Excerpt'), - value: 'excerpt' - }, { - label: Object(external_this_wp_i18n_["__"])('Full post'), - value: 'full_post' - }], - onChange: function onChange(value) { - return setAttributes({ - displayPostContentRadio: value - }); - } - }), displayPostContent && displayPostContentRadio === 'excerpt' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Max number of words in excerpt'), - value: excerptLength, - onChange: function onChange(value) { - return setAttributes({ - excerptLength: value - }); - }, - min: MIN_EXCERPT_LENGTH, - max: MAX_EXCERPT_LENGTH - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Post meta settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display author name'), - checked: displayAuthor, - onChange: function onChange(value) { - return setAttributes({ - displayAuthor: value - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display post date'), - checked: displayPostDate, - onChange: function onChange(value) { - return setAttributes({ - displayPostDate: value - }); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Featured image settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display featured image'), - checked: displayFeaturedImage, - onChange: function onChange(value) { - return setAttributes({ - displayFeaturedImage: value - }); - } - }), displayFeaturedImage && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["__experimentalImageSizeControl"], { - onChange: function onChange(value) { - var newAttrs = {}; - - if (value.hasOwnProperty('width')) { - newAttrs.featuredImageSizeWidth = value.width; - } - - if (value.hasOwnProperty('height')) { - newAttrs.featuredImageSizeHeight = value.height; - } - - setAttributes(newAttrs); - }, - slug: featuredImageSizeSlug, - width: featuredImageSizeWidth, - height: featuredImageSizeHeight, - imageWidth: defaultImageWidth, - imageHeight: defaultImageHeight, - imageSizeOptions: imageSizeOptions, - onChangeImage: function onChangeImage(value) { - return setAttributes({ - featuredImageSizeSlug: value, - featuredImageSizeWidth: undefined, - featuredImageSizeHeight: undefined - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["BaseControl"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["BaseControl"].VisualLabel, null, Object(external_this_wp_i18n_["__"])('Image alignment')), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockAlignmentToolbar"], { - value: featuredImageAlign, - onChange: function onChange(value) { - return setAttributes({ - featuredImageAlign: value - }); - }, - controls: ['left', 'center', 'right'], - isCollapsed: false - })))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Sorting and filtering') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["QueryControls"], Object(esm_extends["a" /* default */])({ - order: order, - orderBy: orderBy - }, { - numberOfItems: postsToShow, - onOrderChange: function onOrderChange(value) { - return setAttributes({ - order: value - }); - }, - onOrderByChange: function onOrderByChange(value) { - return setAttributes({ - orderBy: value - }); - }, - onNumberOfItemsChange: function onNumberOfItemsChange(value) { - return setAttributes({ - postsToShow: value - }); - }, - categorySuggestions: categorySuggestions, - onCategoryChange: selectCategories, - selectedCategories: categories, - onAuthorChange: function onAuthorChange(value) { - return setAttributes({ - selectedAuthor: '' !== value ? Number(value) : undefined - }); - }, - authorList: authorList, - selectedAuthorId: selectedAuthor - })), postLayout === 'grid' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Columns'), - value: columns, - onChange: function onChange(value) { - return setAttributes({ - columns: value - }); - }, - min: 2, - max: !hasPosts ? MAX_POSTS_COLUMNS : Math.min(MAX_POSTS_COLUMNS, latestPosts.length), - required: true - }))); - var hasPosts = Array.isArray(latestPosts) && latestPosts.length; - - if (!hasPosts) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, inspectorControls, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { - icon: library_pin, - label: Object(external_this_wp_i18n_["__"])('Latest Posts') - }, !Array.isArray(latestPosts) ? Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null) : Object(external_this_wp_i18n_["__"])('No posts found.'))); - } // Removing posts from display should be instant. - - - var displayPosts = latestPosts.length > postsToShow ? latestPosts.slice(0, postsToShow) : latestPosts; - var layoutControls = [{ - icon: library_list, - title: Object(external_this_wp_i18n_["__"])('List view'), - onClick: function onClick() { - return setAttributes({ - postLayout: 'list' - }); - }, - isActive: postLayout === 'list' - }, { - icon: grid["a" /* default */], - title: Object(external_this_wp_i18n_["__"])('Grid view'), - onClick: function onClick() { - return setAttributes({ - postLayout: 'grid' - }); - }, - isActive: postLayout === 'grid' - }]; - - var dateFormat = Object(external_this_wp_date_["__experimentalGetSettings"])().formats.date; - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, inspectorControls, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { - controls: layoutControls - })), Object(external_this_wp_element_["createElement"])("ul", { - className: classnames_default()(this.props.className, Object(defineProperty["a" /* default */])({ - 'wp-block-latest-posts__list': true, - 'is-grid': postLayout === 'grid', - 'has-dates': displayPostDate, - 'has-author': displayAuthor - }, "columns-".concat(columns), postLayout === 'grid')) - }, displayPosts.map(function (post, i) { - var titleTrimmed = Object(external_this_lodash_["invoke"])(post, ['title', 'rendered', 'trim']); - var excerpt = post.excerpt.rendered; - var currentAuthor = authorList.find(function (author) { - return author.id === post.author; - }); - var excerptElement = document.createElement('div'); - excerptElement.innerHTML = excerpt; - excerpt = excerptElement.textContent || excerptElement.innerText || ''; - var imageSourceUrl = post.featuredImageSourceUrl; - var imageClasses = classnames_default()(Object(defineProperty["a" /* default */])({ - 'wp-block-latest-posts__featured-image': true - }, "align".concat(featuredImageAlign), !!featuredImageAlign)); - var needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === ''; - var postExcerpt = needsReadMore ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, excerpt.trim().split(' ', excerptLength).join(' '), Object(external_this_wp_i18n_["__"])(' … '), Object(external_this_wp_element_["createElement"])("a", { - href: post.link, - target: "_blank", - rel: "noopener noreferrer" - }, Object(external_this_wp_i18n_["__"])('Read more'))) : excerpt; - return Object(external_this_wp_element_["createElement"])("li", { - key: i - }, displayFeaturedImage && Object(external_this_wp_element_["createElement"])("div", { - className: imageClasses - }, imageSourceUrl && Object(external_this_wp_element_["createElement"])("img", { - src: imageSourceUrl, - alt: "", - style: { - maxWidth: featuredImageSizeWidth, - maxHeight: featuredImageSizeHeight - } - })), Object(external_this_wp_element_["createElement"])("a", { - href: post.link, - target: "_blank", - rel: "noreferrer noopener" - }, titleTrimmed ? Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, titleTrimmed) : Object(external_this_wp_i18n_["__"])('(no title)')), displayAuthor && currentAuthor && Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-latest-posts__post-author" - }, Object(external_this_wp_i18n_["sprintf"])( - /* translators: byline. %s: current author. */ - Object(external_this_wp_i18n_["__"])('by %s'), currentAuthor.name)), displayPostDate && post.date_gmt && Object(external_this_wp_element_["createElement"])("time", { - dateTime: Object(external_this_wp_date_["format"])('c', post.date_gmt), - className: "wp-block-latest-posts__post-date" - }, Object(external_this_wp_date_["dateI18n"])(dateFormat, post.date_gmt)), displayPostContent && displayPostContentRadio === 'excerpt' && Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-latest-posts__post-excerpt" - }, postExcerpt), displayPostContent && displayPostContentRadio === 'full_post' && Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-latest-posts__post-full-content" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], { - key: "html" - }, post.content.raw.trim()))); - }))); - } - }]); - - return LatestPostsEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var latest_posts_edit = (Object(external_this_wp_data_["withSelect"])(function (select, props) { - var _props$attributes = props.attributes, - featuredImageSizeSlug = _props$attributes.featuredImageSizeSlug, - postsToShow = _props$attributes.postsToShow, - order = _props$attributes.order, - orderBy = _props$attributes.orderBy, - categories = _props$attributes.categories, - selectedAuthor = _props$attributes.selectedAuthor; - - var _select = select('core'), - getEntityRecords = _select.getEntityRecords, - getMedia = _select.getMedia; - - var _select2 = select('core/block-editor'), - getSettings = _select2.getSettings; - - var _getSettings = getSettings(), - imageSizes = _getSettings.imageSizes, - imageDimensions = _getSettings.imageDimensions; - - var catIds = categories && categories.length > 0 ? categories.map(function (cat) { - return cat.id; - }) : []; - var latestPostsQuery = Object(external_this_lodash_["pickBy"])({ - categories: catIds, - author: selectedAuthor, - order: order, - orderby: orderBy, - per_page: postsToShow - }, function (value) { - return !Object(external_this_lodash_["isUndefined"])(value); - }); - var posts = getEntityRecords('postType', 'post', latestPostsQuery); - var imageSizeOptions = imageSizes.filter(function (_ref) { - var slug = _ref.slug; - return slug !== 'full'; - }).map(function (_ref2) { - var name = _ref2.name, - slug = _ref2.slug; - return { - value: slug, - label: name - }; - }); - return { - defaultImageWidth: Object(external_this_lodash_["get"])(imageDimensions, [featuredImageSizeSlug, 'width'], 0), - defaultImageHeight: Object(external_this_lodash_["get"])(imageDimensions, [featuredImageSizeSlug, 'height'], 0), - imageSizeOptions: imageSizeOptions, - latestPosts: !Array.isArray(posts) ? posts : posts.map(function (post) { - if (post.featured_media) { - var image = getMedia(post.featured_media); - var url = Object(external_this_lodash_["get"])(image, ['media_details', 'sizes', featuredImageSizeSlug, 'source_url'], null); +function LatestPostsEdit({ + attributes, + setAttributes +}) { + const { + postsToShow, + order, + orderBy, + categories, + selectedAuthor, + displayFeaturedImage, + displayPostContentRadio, + displayPostContent, + displayPostDate, + displayAuthor, + postLayout, + columns, + excerptLength, + featuredImageAlign, + featuredImageSizeSlug, + featuredImageSizeWidth, + featuredImageSizeHeight, + addLinkToFeaturedImage + } = attributes; + const { + imageSizeOptions, + latestPosts, + defaultImageWidth, + defaultImageHeight + } = Object(external_wp_data_["useSelect"])(select => { + const { + getEntityRecords, + getMedia + } = select(external_wp_coreData_["store"]); + const { + getSettings + } = select(external_wp_blockEditor_["store"]); + const { + imageSizes, + imageDimensions + } = getSettings(); + const catIds = categories && categories.length > 0 ? categories.map(cat => cat.id) : []; + const latestPostsQuery = Object(external_lodash_["pickBy"])({ + categories: catIds, + author: selectedAuthor, + order, + orderby: orderBy, + per_page: postsToShow + }, value => !Object(external_lodash_["isUndefined"])(value)); + const posts = getEntityRecords('postType', 'post', latestPostsQuery); + return { + defaultImageWidth: Object(external_lodash_["get"])(imageDimensions, [featuredImageSizeSlug, 'width'], 0), + defaultImageHeight: Object(external_lodash_["get"])(imageDimensions, [featuredImageSizeSlug, 'height'], 0), + imageSizeOptions: imageSizes.filter(({ + slug + }) => slug !== 'full').map(({ + name, + slug + }) => ({ + value: slug, + label: name + })), + latestPosts: !Array.isArray(posts) ? posts : posts.map(post => { + if (!post.featured_media) return post; + const image = getMedia(post.featured_media); + let url = Object(external_lodash_["get"])(image, ['media_details', 'sizes', featuredImageSizeSlug, 'source_url'], null); if (!url) { - url = Object(external_this_lodash_["get"])(image, 'source_url', null); - } - - return latest_posts_edit_objectSpread({}, post, { - featuredImageSourceUrl: url - }); - } - - return post; - }) - }; -})(edit_LatestPostsEdit)); + url = Object(external_lodash_["get"])(image, 'source_url', null); + } + + const featuredImageInfo = { + url, + // eslint-disable-next-line camelcase + alt: image === null || image === void 0 ? void 0 : image.alt_text + }; + return { ...post, + featuredImageInfo + }; + }) + }; + }, [featuredImageSizeSlug, postsToShow, order, orderBy, categories, selectedAuthor]); + const [categoriesList, setCategoriesList] = Object(external_wp_element_["useState"])([]); + const [authorList, setAuthorList] = Object(external_wp_element_["useState"])([]); + const categorySuggestions = categoriesList.reduce((accumulator, category) => ({ ...accumulator, + [category.name]: category + }), {}); + + const selectCategories = tokens => { + const hasNoSuggestion = tokens.some(token => typeof token === 'string' && !categorySuggestions[token]); + + if (hasNoSuggestion) { + return; + } // Categories that are already will be objects, while new additions will be strings (the name). + // allCategories nomalizes the array so that they are all objects. + + + const allCategories = tokens.map(token => { + return typeof token === 'string' ? categorySuggestions[token] : token; + }); // We do nothing if the category is not selected + // from suggestions. + + if (Object(external_lodash_["includes"])(allCategories, null)) { + return false; + } + + setAttributes({ + categories: allCategories + }); + }; + + const isStillMounted = Object(external_wp_element_["useRef"])(); + Object(external_wp_element_["useEffect"])(() => { + isStillMounted.current = true; + external_wp_apiFetch_default()({ + path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/categories`, CATEGORIES_LIST_QUERY) + }).then(data => { + if (isStillMounted.current) { + setCategoriesList(data); + } + }).catch(() => { + if (isStillMounted.current) { + setCategoriesList([]); + } + }); + external_wp_apiFetch_default()({ + path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/users`, USERS_LIST_QUERY) + }).then(data => { + if (isStillMounted.current) { + setAuthorList(data); + } + }).catch(() => { + if (isStillMounted.current) { + setAuthorList([]); + } + }); + return () => { + isStillMounted.current = false; + }; + }, []); + const hasPosts = !!(latestPosts !== null && latestPosts !== void 0 && latestPosts.length); + const inspectorControls = Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Post content settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Post content'), + checked: displayPostContent, + onChange: value => setAttributes({ + displayPostContent: value + }) + }), displayPostContent && Object(external_wp_element_["createElement"])(external_wp_components_["RadioControl"], { + label: Object(external_wp_i18n_["__"])('Show:'), + selected: displayPostContentRadio, + options: [{ + label: Object(external_wp_i18n_["__"])('Excerpt'), + value: 'excerpt' + }, { + label: Object(external_wp_i18n_["__"])('Full post'), + value: 'full_post' + }], + onChange: value => setAttributes({ + displayPostContentRadio: value + }) + }), displayPostContent && displayPostContentRadio === 'excerpt' && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Max number of words in excerpt'), + value: excerptLength, + onChange: value => setAttributes({ + excerptLength: value + }), + min: MIN_EXCERPT_LENGTH, + max: MAX_EXCERPT_LENGTH + })), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Post meta settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display author name'), + checked: displayAuthor, + onChange: value => setAttributes({ + displayAuthor: value + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display post date'), + checked: displayPostDate, + onChange: value => setAttributes({ + displayPostDate: value + }) + })), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Featured image settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display featured image'), + checked: displayFeaturedImage, + onChange: value => setAttributes({ + displayFeaturedImage: value + }) + }), displayFeaturedImage && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalImageSizeControl"], { + onChange: value => { + const newAttrs = {}; + + if (value.hasOwnProperty('width')) { + newAttrs.featuredImageSizeWidth = value.width; + } + + if (value.hasOwnProperty('height')) { + newAttrs.featuredImageSizeHeight = value.height; + } + + setAttributes(newAttrs); + }, + slug: featuredImageSizeSlug, + width: featuredImageSizeWidth, + height: featuredImageSizeHeight, + imageWidth: defaultImageWidth, + imageHeight: defaultImageHeight, + imageSizeOptions: imageSizeOptions, + onChangeImage: value => setAttributes({ + featuredImageSizeSlug: value, + featuredImageSizeWidth: undefined, + featuredImageSizeHeight: undefined + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { + className: "block-editor-image-alignment-control__row" + }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"].VisualLabel, null, Object(external_wp_i18n_["__"])('Image alignment')), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockAlignmentToolbar"], { + value: featuredImageAlign, + onChange: value => setAttributes({ + featuredImageAlign: value + }), + controls: ['left', 'center', 'right'], + isCollapsed: false + })), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Add link to featured image'), + checked: addLinkToFeaturedImage, + onChange: value => setAttributes({ + addLinkToFeaturedImage: value + }) + }))), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Sorting and filtering') + }, Object(external_wp_element_["createElement"])(external_wp_components_["QueryControls"], { + order, + orderBy, + numberOfItems: postsToShow, + onOrderChange: value => setAttributes({ + order: value + }), + onOrderByChange: value => setAttributes({ + orderBy: value + }), + onNumberOfItemsChange: value => setAttributes({ + postsToShow: value + }), + categorySuggestions: categorySuggestions, + onCategoryChange: selectCategories, + selectedCategories: categories, + onAuthorChange: value => setAttributes({ + selectedAuthor: '' !== value ? Number(value) : undefined + }), + authorList: authorList, + selectedAuthorId: selectedAuthor + }), postLayout === 'grid' && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Columns'), + value: columns, + onChange: value => setAttributes({ + columns: value + }), + min: 2, + max: !hasPosts ? MAX_POSTS_COLUMNS : Math.min(MAX_POSTS_COLUMNS, latestPosts.length), + required: true + }))); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()({ + 'wp-block-latest-posts__list': true, + 'is-grid': postLayout === 'grid', + 'has-dates': displayPostDate, + 'has-author': displayAuthor, + [`columns-${columns}`]: postLayout === 'grid' + }) + }); + + if (!hasPosts) { + return Object(external_wp_element_["createElement"])("div", blockProps, inspectorControls, Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { + icon: library_pin, + label: Object(external_wp_i18n_["__"])('Latest Posts') + }, !Array.isArray(latestPosts) ? Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null) : Object(external_wp_i18n_["__"])('No posts found.'))); + } // Removing posts from display should be instant. + + + const displayPosts = latestPosts.length > postsToShow ? latestPosts.slice(0, postsToShow) : latestPosts; + const layoutControls = [{ + icon: library_list, + title: Object(external_wp_i18n_["__"])('List view'), + onClick: () => setAttributes({ + postLayout: 'list' + }), + isActive: postLayout === 'list' + }, { + icon: grid["a" /* default */], + title: Object(external_wp_i18n_["__"])('Grid view'), + onClick: () => setAttributes({ + postLayout: 'grid' + }), + isActive: postLayout === 'grid' + }]; + + const dateFormat = Object(external_wp_date_["__experimentalGetSettings"])().formats.date; + + return Object(external_wp_element_["createElement"])("div", null, inspectorControls, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { + controls: layoutControls + })), Object(external_wp_element_["createElement"])("ul", blockProps, displayPosts.map((post, i) => { + const titleTrimmed = Object(external_lodash_["invoke"])(post, ['title', 'rendered', 'trim']); + let excerpt = post.excerpt.rendered; + const currentAuthor = authorList.find(author => author.id === post.author); + const excerptElement = document.createElement('div'); + excerptElement.innerHTML = excerpt; + excerpt = excerptElement.textContent || excerptElement.innerText || ''; + const { + featuredImageInfo: { + url: imageSourceUrl, + alt: featuredImageAlt + } = {} + } = post; + const imageClasses = classnames_default()({ + 'wp-block-latest-posts__featured-image': true, + [`align${featuredImageAlign}`]: !!featuredImageAlign + }); + const renderFeaturedImage = displayFeaturedImage && imageSourceUrl; + const featuredImage = renderFeaturedImage && Object(external_wp_element_["createElement"])("img", { + src: imageSourceUrl, + alt: featuredImageAlt, + style: { + maxWidth: featuredImageSizeWidth, + maxHeight: featuredImageSizeHeight + } + }); + const needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === ''; + const postExcerpt = needsReadMore ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, excerpt.trim().split(' ', excerptLength).join(' '), Object(external_wp_i18n_["__"])(' … '), Object(external_wp_element_["createElement"])("a", { + href: post.link, + rel: "noopener noreferrer" + }, Object(external_wp_i18n_["__"])('Read more'))) : excerpt; + return Object(external_wp_element_["createElement"])("li", { + key: i + }, renderFeaturedImage && Object(external_wp_element_["createElement"])("div", { + className: imageClasses + }, addLinkToFeaturedImage ? Object(external_wp_element_["createElement"])("a", { + href: post.link, + rel: "noreferrer noopener" + }, featuredImage) : featuredImage), Object(external_wp_element_["createElement"])("a", { + href: post.link, + rel: "noreferrer noopener" + }, titleTrimmed ? Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, titleTrimmed) : Object(external_wp_i18n_["__"])('(no title)')), displayAuthor && currentAuthor && Object(external_wp_element_["createElement"])("div", { + className: "wp-block-latest-posts__post-author" + }, Object(external_wp_i18n_["sprintf"])( + /* translators: byline. %s: current author. */ + Object(external_wp_i18n_["__"])('by %s'), currentAuthor.name)), displayPostDate && post.date_gmt && Object(external_wp_element_["createElement"])("time", { + dateTime: Object(external_wp_date_["format"])('c', post.date_gmt), + className: "wp-block-latest-posts__post-date" + }, Object(external_wp_date_["dateI18n"])(dateFormat, post.date_gmt)), displayPostContent && displayPostContentRadio === 'excerpt' && Object(external_wp_element_["createElement"])("div", { + className: "wp-block-latest-posts__post-excerpt" + }, postExcerpt), displayPostContent && displayPostContentRadio === 'full_post' && Object(external_wp_element_["createElement"])("div", { + className: "wp-block-latest-posts__post-full-content" + }, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], { + key: "html" + }, post.content.raw.trim()))); + }))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/latest-posts/index.js /** * WordPress dependencies */ - -/** - * Internal dependencies - */ - - - -var latest_posts_metadata = { +/** + * Internal dependencies + */ + + + +const latest_posts_metadata = { + apiVersion: 2, name: "core/latest-posts", + title: "Latest Posts", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display a list of your most recent posts.", + keywords: ["recent posts"], + textdomain: "default", + attributes: { categories: { type: "array", items: { @@ -17562,25 +18581,127 @@ featuredImageSizeHeight: { type: "number", "default": null + }, + addLinkToFeaturedImage: { + type: "boolean", + "default": false } }, supports: { align: true, html: false - } -}; -var latest_posts_name = latest_posts_metadata.name; - -var latest_posts_settings = { - title: Object(external_this_wp_i18n_["__"])('Latest Posts'), - description: Object(external_this_wp_i18n_["__"])('Display a list of your most recent posts.'), + }, + editorStyle: "wp-block-latest-posts-editor", + style: "wp-block-latest-posts" +}; +const { + name: latest_posts_name +} = latest_posts_metadata; + +const latest_posts_settings = { icon: post_list, - keywords: [Object(external_this_wp_i18n_["__"])('recent posts')], example: {}, - edit: latest_posts_edit, + edit: LatestPostsEdit, deprecated: latest_posts_deprecated }; +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/login.js + + +/** + * WordPress dependencies + */ + +const login = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M11 14.5l1.1 1.1 3-3 .5-.5-.6-.6-3-3-1 1 1.7 1.7H5v1.5h7.7L11 14.5zM16.8 5h-7c-1.1 0-2 .9-2 2v1.5h1.5V7c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v10c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5v-1.5H7.8V17c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2z" +})); +/* harmony default export */ var library_login = (login); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/edit.js + + +/** + * WordPress dependencies + */ + + + +function LoginOutEdit({ + attributes, + setAttributes +}) { + const { + displayLoginAsForm, + redirectToCurrent + } = attributes; + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Login/out settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display login as form'), + checked: displayLoginAsForm, + onChange: () => setAttributes({ + displayLoginAsForm: !displayLoginAsForm + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Redirect to current URL'), + checked: redirectToCurrent, + onChange: () => setAttributes({ + redirectToCurrent: !redirectToCurrent + }) + }))), Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])({ + className: 'logged-in' + }), Object(external_wp_element_["createElement"])("a", { + href: "#login-pseudo-link" + }, Object(external_wp_i18n_["__"])('Log out')))); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/loginout/index.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const loginout_metadata = { + apiVersion: 2, + name: "core/loginout", + title: "Login/out", + category: "theme", + description: "Show login & logout links.", + keywords: ["login", "logout", "form"], + textdomain: "default", + attributes: { + displayLoginAsForm: { + type: "boolean", + "default": false + }, + redirectToCurrent: { + type: "boolean", + "default": true + } + }, + supports: { + className: true, + typography: { + fontSize: false + } + } +}; +const { + name: loginout_name +} = loginout_metadata; + +const loginout_settings = { + icon: library_login, + edit: LoginOutEdit +}; + // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets-rtl.js @@ -17588,10 +18709,10 @@ * WordPress dependencies */ -var formatListBulletsRTL = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatListBulletsRTL = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" })); /* harmony default export */ var format_list_bullets_rtl = (formatListBulletsRTL); @@ -17603,10 +18724,10 @@ * WordPress dependencies */ -var formatListBullets = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatListBullets = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" })); /* harmony default export */ var format_list_bullets = (formatListBullets); @@ -17618,10 +18739,10 @@ * WordPress dependencies */ -var formatListNumberedRTL = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatListNumberedRTL = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M3.8 15.8h8.9v-1.5H3.8v1.5zm0-7h8.9V7.2H3.8v1.6zm14.7-2.1V10h1V5.3l-2.2.7.3 1 .9-.3zm1.2 6.1c-.5-.6-1.2-.5-1.7-.4-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5H20v-1h-.9c.3-.6.8-1.4.9-2.1 0-.3 0-.8-.3-1.1z" })); /* harmony default export */ var format_list_numbered_rtl = (formatListNumberedRTL); @@ -17633,10 +18754,10 @@ * WordPress dependencies */ -var formatListNumbered = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatListNumbered = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM5 6.7V10h1V5.3L3.8 6l.4 1 .8-.3zm-.4 5.7c-.3.1-.5.2-.7.3l.1 1.1c.2-.2.5-.4.8-.5.3-.1.6 0 .7.1.2.3 0 .8-.2 1.1-.5.8-.9 1.6-1.4 2.5h2.7v-1h-1c.3-.6.8-1.4.9-2.1.1-.3 0-.8-.2-1.1-.5-.6-1.3-.5-1.7-.4z" })); /* harmony default export */ var format_list_numbered = (formatListNumbered); @@ -17648,10 +18769,10 @@ * WordPress dependencies */ -var formatOutdentRTL = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatOutdentRTL = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM15.4697 14.9697L18.4393 12L15.4697 9.03033L16.5303 7.96967L20.0303 11.4697L20.5607 12L20.0303 12.5303L16.5303 16.0303L15.4697 14.9697Z" })); /* harmony default export */ var format_outdent_rtl = (formatOutdentRTL); @@ -17663,10 +18784,10 @@ * WordPress dependencies */ -var formatOutdent = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatOutdent = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-4-4.6l-4 4 4 4 1-1-3-3 3-3-1-1z" })); /* harmony default export */ var format_outdent = (formatOutdent); @@ -17678,10 +18799,10 @@ * WordPress dependencies */ -var formatIndentRTL = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatIndentRTL = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M20 5.5H4V4H20V5.5ZM12 12.5H4V11H12V12.5ZM20 20V18.5H4V20H20ZM20.0303 9.03033L17.0607 12L20.0303 14.9697L18.9697 16.0303L15.4697 12.5303L14.9393 12L15.4697 11.4697L18.9697 7.96967L20.0303 9.03033Z" })); /* harmony default export */ var format_indent_rtl = (formatIndentRTL); @@ -17693,10 +18814,10 @@ * WordPress dependencies */ -var formatIndent = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const formatIndent = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4 7.2v1.5h16V7.2H4zm8 8.6h8v-1.5h-8v1.5zm-8-3.5l3 3-3 3 1 1 4-4-4-4-1 1z" })); /* harmony default export */ var format_indent = (formatIndent); @@ -17711,201 +18832,192 @@ -var ordered_list_settings_OrderedListSettings = function OrderedListSettings(_ref) { - var setAttributes = _ref.setAttributes, - reversed = _ref.reversed, - start = _ref.start; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('Ordered list settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { - label: Object(external_this_wp_i18n_["__"])('Start value'), - type: "number", - onChange: function onChange(value) { - var int = parseInt(value, 10); - setAttributes({ - // It should be possible to unset the value, - // e.g. with an empty string. - start: isNaN(int) ? undefined : int - }); - }, - value: Number.isInteger(start) ? start.toString(10) : '', - step: "1" - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Reverse list numbering'), - checked: reversed || false, - onChange: function onChange(value) { - setAttributes({ - // Unset the attribute if not reversed. - reversed: value || undefined - }); - } - }))); -}; - -/* harmony default export */ var ordered_list_settings = (ordered_list_settings_OrderedListSettings); +const OrderedListSettings = ({ + setAttributes, + reversed, + start +}) => Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Ordered list settings') +}, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + label: Object(external_wp_i18n_["__"])('Start value'), + type: "number", + onChange: value => { + const int = parseInt(value, 10); + setAttributes({ + // It should be possible to unset the value, + // e.g. with an empty string. + start: isNaN(int) ? undefined : int + }); + }, + value: Number.isInteger(start) ? start.toString(10) : '', + step: "1" +}), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Reverse list numbering'), + checked: reversed || false, + onChange: value => { + setAttributes({ + // Unset the attribute if not reversed. + reversed: value || undefined + }); + } +}))); + +/* harmony default export */ var ordered_list_settings = (OrderedListSettings); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/edit.js -function list_edit_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function list_edit_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { list_edit_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { list_edit_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - - -function ListEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes, - mergeBlocks = _ref.mergeBlocks, - onReplace = _ref.onReplace, - isSelected = _ref.isSelected; - var ordered = attributes.ordered, - values = attributes.values, - type = attributes.type, - reversed = attributes.reversed, - start = attributes.start; - var tagName = ordered ? 'ol' : 'ul'; - var isRTL = Object(external_this_wp_data_["useSelect"])(function (select) { - return !!select('core/block-editor').getSettings().isRTL; - }, []); - - var controls = function controls(_ref2) { - var value = _ref2.value, - onChange = _ref2.onChange, - onFocus = _ref2.onFocus; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isSelected && Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { - type: "primary", - character: "[", - onUse: function onUse() { - onChange(Object(external_this_wp_richText_["__unstableOutdentListItems"])(value)); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { - type: "primary", - character: "]", - onUse: function onUse() { - onChange(Object(external_this_wp_richText_["__unstableIndentListItems"])(value, { - type: tagName - })); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { - type: "primary", - character: "m", - onUse: function onUse() { - onChange(Object(external_this_wp_richText_["__unstableIndentListItems"])(value, { - type: tagName - })); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichTextShortcut"], { - type: "primaryShift", - character: "m", - onUse: function onUse() { - onChange(Object(external_this_wp_richText_["__unstableOutdentListItems"])(value)); - } - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { - controls: [{ - icon: isRTL ? format_list_bullets_rtl : format_list_bullets, - title: Object(external_this_wp_i18n_["__"])('Convert to unordered list'), - isActive: Object(external_this_wp_richText_["__unstableIsActiveListType"])(value, 'ul', tagName), - onClick: function onClick() { - onChange(Object(external_this_wp_richText_["__unstableChangeListType"])(value, { - type: 'ul' - })); - onFocus(); - - if (Object(external_this_wp_richText_["__unstableIsListRootSelected"])(value)) { - setAttributes({ - ordered: false - }); - } - } - }, { - icon: isRTL ? format_list_numbered_rtl : format_list_numbered, - title: Object(external_this_wp_i18n_["__"])('Convert to ordered list'), - isActive: Object(external_this_wp_richText_["__unstableIsActiveListType"])(value, 'ol', tagName), - onClick: function onClick() { - onChange(Object(external_this_wp_richText_["__unstableChangeListType"])(value, { - type: 'ol' - })); - onFocus(); - - if (Object(external_this_wp_richText_["__unstableIsListRootSelected"])(value)) { - setAttributes({ - ordered: true - }); - } - } - }, { - icon: isRTL ? format_outdent_rtl : format_outdent, - title: Object(external_this_wp_i18n_["__"])('Outdent list item'), - shortcut: Object(external_this_wp_i18n_["_x"])('Backspace', 'keyboard key'), - isDisabled: !Object(external_this_wp_richText_["__unstableCanOutdentListItems"])(value), - onClick: function onClick() { - onChange(Object(external_this_wp_richText_["__unstableOutdentListItems"])(value)); - onFocus(); - } - }, { - icon: isRTL ? format_indent_rtl : format_indent, - title: Object(external_this_wp_i18n_["__"])('Indent list item'), - shortcut: Object(external_this_wp_i18n_["_x"])('Space', 'keyboard key'), - isDisabled: !Object(external_this_wp_richText_["__unstableCanIndentListItems"])(value), - onClick: function onClick() { - onChange(Object(external_this_wp_richText_["__unstableIndentListItems"])(value, { - type: tagName - })); - onFocus(); - } - }] - }))); - }; - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + +function ListEdit({ + attributes, + setAttributes, + mergeBlocks, + onReplace +}) { + const { + ordered, + values, + type, + reversed, + start, + placeholder + } = attributes; + const tagName = ordered ? 'ol' : 'ul'; + + const controls = ({ + value, + onChange, + onFocus + }) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichTextShortcut"], { + type: "primary", + character: "[", + onUse: () => { + onChange(Object(external_wp_richText_["__unstableOutdentListItems"])(value)); + } + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichTextShortcut"], { + type: "primary", + character: "]", + onUse: () => { + onChange(Object(external_wp_richText_["__unstableIndentListItems"])(value, { + type: tagName + })); + } + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichTextShortcut"], { + type: "primary", + character: "m", + onUse: () => { + onChange(Object(external_wp_richText_["__unstableIndentListItems"])(value, { + type: tagName + })); + } + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichTextShortcut"], { + type: "primaryShift", + character: "m", + onUse: () => { + onChange(Object(external_wp_richText_["__unstableOutdentListItems"])(value)); + } + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "block" + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: Object(external_wp_i18n_["isRTL"])() ? format_list_bullets_rtl : format_list_bullets, + title: Object(external_wp_i18n_["__"])('Unordered'), + describedBy: Object(external_wp_i18n_["__"])('Convert to unordered list'), + isActive: Object(external_wp_richText_["__unstableIsActiveListType"])(value, 'ul', tagName), + onClick: () => { + onChange(Object(external_wp_richText_["__unstableChangeListType"])(value, { + type: 'ul' + })); + onFocus(); + + if (Object(external_wp_richText_["__unstableIsListRootSelected"])(value)) { + setAttributes({ + ordered: false + }); + } + } + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: Object(external_wp_i18n_["isRTL"])() ? format_list_numbered_rtl : format_list_numbered, + title: Object(external_wp_i18n_["__"])('Ordered'), + describedBy: Object(external_wp_i18n_["__"])('Convert to ordered list'), + isActive: Object(external_wp_richText_["__unstableIsActiveListType"])(value, 'ol', tagName), + onClick: () => { + onChange(Object(external_wp_richText_["__unstableChangeListType"])(value, { + type: 'ol' + })); + onFocus(); + + if (Object(external_wp_richText_["__unstableIsListRootSelected"])(value)) { + setAttributes({ + ordered: true + }); + } + } + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: Object(external_wp_i18n_["isRTL"])() ? format_outdent_rtl : format_outdent, + title: Object(external_wp_i18n_["__"])('Outdent'), + describedBy: Object(external_wp_i18n_["__"])('Outdent list item'), + shortcut: Object(external_wp_i18n_["_x"])('Backspace', 'keyboard key'), + isDisabled: !Object(external_wp_richText_["__unstableCanOutdentListItems"])(value), + onClick: () => { + onChange(Object(external_wp_richText_["__unstableOutdentListItems"])(value)); + onFocus(); + } + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + icon: Object(external_wp_i18n_["isRTL"])() ? format_indent_rtl : format_indent, + title: Object(external_wp_i18n_["__"])('Indent'), + describedBy: Object(external_wp_i18n_["__"])('Indent list item'), + shortcut: Object(external_wp_i18n_["_x"])('Space', 'keyboard key'), + isDisabled: !Object(external_wp_richText_["__unstableCanIndentListItems"])(value), + onClick: () => { + onChange(Object(external_wp_richText_["__unstableIndentListItems"])(value, { + type: tagName + })); + onFocus(); + } + }))); + + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], Object(esm_extends["a" /* default */])({ identifier: "values", multiline: "li", - __unstableMultilineRootTag: tagName, - tagName: external_this_wp_blockEditor_["__experimentalBlock"][tagName], - onChange: function onChange(nextValues) { - return setAttributes({ - values: nextValues - }); - }, + tagName: tagName, + onChange: nextValues => setAttributes({ + values: nextValues + }), value: values, - placeholder: Object(external_this_wp_i18n_["__"])('Write list…'), + "aria-label": Object(external_wp_i18n_["__"])('List text'), + placeholder: placeholder || Object(external_wp_i18n_["__"])('List'), onMerge: mergeBlocks, - onSplit: function onSplit(value) { - return Object(external_this_wp_blocks_["createBlock"])(list_name, list_edit_objectSpread({}, attributes, { - values: value - })); - }, - __unstableOnSplitMiddle: function __unstableOnSplitMiddle() { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph'); - }, + onSplit: value => Object(external_wp_blocks_["createBlock"])(list_name, { ...attributes, + values: value + }), + __unstableOnSplitMiddle: () => Object(external_wp_blocks_["createBlock"])('core/paragraph'), onReplace: onReplace, - onRemove: function onRemove() { - return onReplace([]); - }, + onRemove: () => onReplace([]), start: start, reversed: reversed, type: type - }, controls), ordered && Object(external_this_wp_element_["createElement"])(ordered_list_settings, { + }, blockProps), controls), ordered && Object(external_wp_element_["createElement"])(ordered_list_settings, { setAttributes: setAttributes, ordered: ordered, reversed: reversed, - start: start + start: start, + placeholder: placeholder })); } @@ -17916,52 +19028,47 @@ * WordPress dependencies */ -function list_save_save(_ref) { - var attributes = _ref.attributes; - var ordered = attributes.ordered, - values = attributes.values, - type = attributes.type, - reversed = attributes.reversed, - start = attributes.start; - var tagName = ordered ? 'ol' : 'ul'; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - tagName: tagName, +function list_save_save({ + attributes +}) { + const { + ordered, + values, + type, + reversed, + start + } = attributes; + const TagName = ordered ? 'ol' : 'ul'; + return Object(external_wp_element_["createElement"])(TagName, external_wp_blockEditor_["useBlockProps"].save({ + type, + reversed, + start + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: values, - type: type, - reversed: reversed, - start: start, multiline: "li" - }); + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/transforms.js - - - -function list_transforms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function list_transforms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { list_transforms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { list_transforms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - - -function getListContentSchema(_ref) { - var phrasingContentSchema = _ref.phrasingContentSchema; - - var listContentSchema = list_transforms_objectSpread({}, phrasingContentSchema, { +/** + * WordPress dependencies + */ + + + +function getListContentSchema({ + phrasingContentSchema +}) { + const listContentSchema = { ...phrasingContentSchema, ul: {}, ol: { attributes: ['type', 'start', 'reversed'] } - }); // Recursion is needed. + }; // Recursion is needed. // Possible: ul > li > ul. // Impossible: ul > ul. - - ['ul', 'ol'].forEach(function (tag) { + ['ul', 'ol'].forEach(tag => { listContentSchema[tag].children = { li: { children: listContentSchema @@ -17971,17 +19078,18 @@ return listContentSchema; } -var list_transforms_transforms = { +const list_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, - blocks: ['core/paragraph'], - transform: function transform(blockAttributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/list', { - values: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["join"])(blockAttributes.map(function (_ref2) { - var content = _ref2.content; - var value = Object(external_this_wp_richText_["create"])({ + blocks: ['core/paragraph', 'core/heading'], + transform: blockAttributes => { + return Object(external_wp_blocks_["createBlock"])('core/list', { + values: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["join"])(blockAttributes.map(({ + content + }) => { + const value = Object(external_wp_richText_["create"])({ html: content }); @@ -17991,8 +19099,8 @@ // every line to a list item. - return Object(external_this_wp_richText_["replace"])(value, /\n/g, external_this_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]); - }), external_this_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]), + return Object(external_wp_richText_["replace"])(value, /\n/g, external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]); + }), external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]), multilineTag: 'li' }), anchor: blockAttributes.anchor @@ -18001,37 +19109,37 @@ }, { type: 'block', blocks: ['core/quote', 'core/pullquote'], - transform: function transform(_ref3) { - var value = _ref3.value, - anchor = _ref3.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/list', { - values: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["create"])({ + transform: ({ + value, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/list', { + values: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["create"])({ html: value, multilineTag: 'p' }), multilineTag: 'li' }), - anchor: anchor + anchor }); } }, { type: 'raw', selector: 'ol,ul', - schema: function schema(args) { - return { - ol: getListContentSchema(args).ol, - ul: getListContentSchema(args).ul - }; - }, - transform: function transform(node) { - var attributes = { + schema: args => ({ + ol: getListContentSchema(args).ol, + ul: getListContentSchema(args).ul + }), + + transform(node) { + const attributes = { ordered: node.nodeName === 'OL', anchor: node.id === '' ? undefined : node.id }; if (attributes.ordered) { - var type = node.getAttribute('type'); + const type = node.getAttribute('type'); if (type) { attributes.type = type; @@ -18041,7 +19149,7 @@ attributes.reversed = true; } - var start = parseInt(node.getAttribute('start'), 10); + const start = parseInt(node.getAttribute('start'), 10); if (!isNaN(start) && ( // start=1 only makes sense if the list is reversed. start !== 1 || attributes.reversed)) { @@ -18049,81 +19157,97 @@ } } - return Object(external_this_wp_blocks_["createBlock"])('core/list', list_transforms_objectSpread({}, Object(external_this_wp_blocks_["getBlockAttributes"])('core/list', node.outerHTML), {}, attributes)); - } - }].concat(Object(toConsumableArray["a" /* default */])(['*', '-'].map(function (prefix) { - return { - type: 'prefix', - prefix: prefix, - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])('core/list', { - values: "
  • ".concat(content, "
  • ") - }); - } - }; - })), Object(toConsumableArray["a" /* default */])(['1.', '1)'].map(function (prefix) { - return { - type: 'prefix', - prefix: prefix, - transform: function transform(content) { - return Object(external_this_wp_blocks_["createBlock"])('core/list', { - ordered: true, - values: "
  • ".concat(content, "
  • ") - }); - } - }; - }))), + return Object(external_wp_blocks_["createBlock"])('core/list', { ...Object(external_wp_blocks_["getBlockAttributes"])('core/list', node.outerHTML), + ...attributes + }); + } + + }, ...['*', '-'].map(prefix => ({ + type: 'prefix', + prefix, + + transform(content) { + return Object(external_wp_blocks_["createBlock"])('core/list', { + values: `
  • ${content}
  • ` + }); + } + + })), ...['1.', '1)'].map(prefix => ({ + type: 'prefix', + prefix, + + transform(content) { + return Object(external_wp_blocks_["createBlock"])('core/list', { + ordered: true, + values: `
  • ${content}
  • ` + }); + } + + }))], to: [{ type: 'block', blocks: ['core/paragraph'], - transform: function transform(_ref4) { - var values = _ref4.values; - return Object(external_this_wp_richText_["split"])(Object(external_this_wp_richText_["create"])({ - html: values, - multilineTag: 'li', - multilineWrapperTags: ['ul', 'ol'] - }), external_this_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]).map(function (piece) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: Object(external_this_wp_richText_["toHTMLString"])({ - value: piece - }) - }); - }); - } + transform: ({ + values + }) => Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ + html: values, + multilineTag: 'li', + multilineWrapperTags: ['ul', 'ol'] + }), external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]).map(piece => Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: Object(external_wp_richText_["toHTMLString"])({ + value: piece + }) + })) + }, { + type: 'block', + blocks: ['core/heading'], + transform: ({ + values + }) => Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ + html: values, + multilineTag: 'li', + multilineWrapperTags: ['ul', 'ol'] + }), external_wp_richText_["__UNSTABLE_LINE_SEPARATOR"]).map(piece => Object(external_wp_blocks_["createBlock"])('core/heading', { + content: Object(external_wp_richText_["toHTMLString"])({ + value: piece + }) + })) }, { type: 'block', blocks: ['core/quote'], - transform: function transform(_ref5) { - var values = _ref5.values, - anchor = _ref5.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/quote', { - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["create"])({ + transform: ({ + values, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/quote', { + value: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["create"])({ html: values, multilineTag: 'li', multilineWrapperTags: ['ul', 'ol'] }), multilineTag: 'p' }), - anchor: anchor + anchor }); } }, { type: 'block', blocks: ['core/pullquote'], - transform: function transform(_ref6) { - var values = _ref6.values, - anchor = _ref6.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/pullquote', { - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["create"])({ + transform: ({ + values, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/pullquote', { + value: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["create"])({ html: values, multilineTag: 'li', multilineWrapperTags: ['ul', 'ol'] }), multilineTag: 'p' }), - anchor: anchor + anchor }); } }] @@ -18131,29 +19255,28 @@ /* harmony default export */ var list_transforms = (list_transforms_transforms); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/list/index.js - - -function list_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function list_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { list_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { list_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -var list_metadata = { +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + + +const list_metadata = { + apiVersion: 2, name: "core/list", + title: "List", category: "text", + description: "Create a bulleted or numbered list.", + keywords: ["bullet list", "ordered list", "numbered list"], + textdomain: "default", attributes: { ordered: { type: "boolean", - "default": false + "default": false, + __experimentalRole: "content" }, values: { type: "string", @@ -18161,7 +19284,8 @@ selector: "ol,ul", multiline: "li", __unstableMultilineWrapperTags: ["ol", "ul"], - "default": "" + "default": "", + __experimentalRole: "content" }, type: { type: "string" @@ -18171,45 +19295,63 @@ }, reversed: { type: "boolean" + }, + placeholder: { + type: "string" } }, supports: { anchor: true, className: false, + typography: { + fontSize: true, + __experimentalFontFamily: true + }, + color: { + gradients: true + }, __unstablePasteTextInline: true, - lightBlockWrapper: true - } -}; - - -var list_name = list_metadata.name; - -var list_settings = { - title: Object(external_this_wp_i18n_["__"])('List'), - description: Object(external_this_wp_i18n_["__"])('Create a bulleted or numbered list.'), + __experimentalSelector: "ol,ul" + }, + editorStyle: "wp-block-list-editor", + style: "wp-block-list" +}; + + +const { + name: list_name +} = list_metadata; + +const list_settings = { icon: library_list, - keywords: [Object(external_this_wp_i18n_["__"])('bullet list'), Object(external_this_wp_i18n_["__"])('ordered list'), Object(external_this_wp_i18n_["__"])('numbered list')], example: { attributes: { values: '
  • Alice.
  • The White Rabbit.
  • The Cheshire Cat.
  • The Mad Hatter.
  • The Queen of Hearts.
  • ' } }, transforms: list_transforms, - merge: function merge(attributes, attributesToMerge) { - var values = attributesToMerge.values; + + merge(attributes, attributesToMerge) { + const { + values + } = attributesToMerge; if (!values || values === '
  • ') { return attributes; } - return list_objectSpread({}, attributes, { + return { ...attributes, values: attributes.values + values - }); - }, + }; + }, + edit: ListEdit, save: list_save_save }; +// EXTERNAL MODULE: external ["wp","dom"] +var external_wp_dom_ = __webpack_require__("1CF3"); + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/edit.js @@ -18223,50 +19365,56 @@ -function MissingBlockWarning(_ref) { - var attributes = _ref.attributes, - convertToHTML = _ref.convertToHTML; - var originalName = attributes.originalName, - originalUndelimitedContent = attributes.originalUndelimitedContent; - var hasContent = !!originalUndelimitedContent; - var hasHTMLBlock = Object(external_this_wp_blocks_["getBlockType"])('core/html'); - var actions = []; - var messageHTML; + +function MissingBlockWarning({ + attributes, + convertToHTML +}) { + const { + originalName, + originalUndelimitedContent + } = attributes; + const hasContent = !!originalUndelimitedContent; + const hasHTMLBlock = Object(external_wp_blocks_["getBlockType"])('core/html'); + const actions = []; + let messageHTML; if (hasContent && hasHTMLBlock) { - messageHTML = Object(external_this_wp_i18n_["sprintf"])( + messageHTML = Object(external_wp_i18n_["sprintf"])( /* translators: %s: block name */ - Object(external_this_wp_i18n_["__"])('Your site doesn’t include support for the "%s" block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.'), originalName); - actions.push(Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + Object(external_wp_i18n_["__"])('Your site doesn’t include support for the "%s" block. You can leave this block intact, convert its content to a Custom HTML block, or remove it entirely.'), originalName); + actions.push(Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { key: "convert", onClick: convertToHTML, - isLarge: true, isPrimary: true - }, Object(external_this_wp_i18n_["__"])('Keep as HTML'))); + }, Object(external_wp_i18n_["__"])('Keep as HTML'))); } else { - messageHTML = Object(external_this_wp_i18n_["sprintf"])( + messageHTML = Object(external_wp_i18n_["sprintf"])( /* translators: %s: block name */ - Object(external_this_wp_i18n_["__"])('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.'), originalName); - } - - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["Warning"], { + Object(external_wp_i18n_["__"])('Your site doesn’t include support for the "%s" block. You can leave this block intact or remove it entirely.'), originalName); + } + + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])({ + className: 'has-warning' + }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], { actions: actions - }, messageHTML), Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, originalUndelimitedContent)); -} - -var MissingEdit = Object(external_this_wp_data_["withDispatch"])(function (dispatch, _ref2) { - var clientId = _ref2.clientId, - attributes = _ref2.attributes; - - var _dispatch = dispatch('core/block-editor'), - replaceBlock = _dispatch.replaceBlock; - + }, messageHTML), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(originalUndelimitedContent))); +} + +const MissingEdit = Object(external_wp_data_["withDispatch"])((dispatch, { + clientId, + attributes +}) => { + const { + replaceBlock + } = dispatch(external_wp_blockEditor_["store"]); return { - convertToHTML: function convertToHTML() { - replaceBlock(clientId, Object(external_this_wp_blocks_["createBlock"])('core/html', { + convertToHTML() { + replaceBlock(clientId, Object(external_wp_blocks_["createBlock"])('core/html', { content: attributes.originalUndelimitedContent })); } + }; })(MissingBlockWarning); /* harmony default export */ var missing_edit = (MissingEdit); @@ -18278,10 +19426,11 @@ * WordPress dependencies */ -function missing_save_save(_ref) { - var attributes = _ref.attributes; +function missing_save_save({ + attributes +}) { // Preserve the missing block's content. - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, attributes.originalContent); + return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, attributes.originalContent); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/index.js @@ -18289,15 +19438,18 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - -var missing_metadata = { +/** + * Internal dependencies + */ + + +const missing_metadata = { + apiVersion: 2, name: "core/missing", + title: "Unsupported", category: "text", + description: "Your site doesn\u2019t include support for this block.", + textdomain: "default", attributes: { originalName: { type: "string" @@ -18319,18 +19471,21 @@ } }; -var missing_name = missing_metadata.name; - -var missing_settings = { +const { + name: missing_name +} = missing_metadata; + +const missing_settings = { name: missing_name, - title: Object(external_this_wp_i18n_["__"])('Unsupported'), - description: Object(external_this_wp_i18n_["__"])('Your site doesn’t include support for this block.'), - __experimentalLabel: function __experimentalLabel(attributes, _ref) { - var context = _ref.context; - + + __experimentalLabel(attributes, { + context + }) { if (context === 'accessibility') { - var originalName = attributes.originalName; - var originalBlockType = originalName ? Object(external_this_wp_blocks_["getBlockType"])(originalName) : undefined; + const { + originalName + } = attributes; + const originalBlockType = originalName ? Object(external_wp_blocks_["getBlockType"])(originalName) : undefined; if (originalBlockType) { return originalBlockType.settings.title || originalName; @@ -18339,6 +19494,7 @@ return ''; } }, + edit: missing_edit, save: missing_save_save }; @@ -18350,10 +19506,10 @@ * WordPress dependencies */ -var more = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const more = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M4 9v1.5h16V9H4zm12 5.5h4V13h-4v1.5zm-6 0h4V13h-4v1.5zm-6 0h4V13H4v1.5z" })); /* harmony default export */ var library_more = (more); @@ -18361,113 +19517,65 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/edit.js - - - - - - -function more_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (more_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function more_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * WordPress dependencies - */ - - - - - - - -var edit_MoreEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(MoreEdit, _Component); - - var _super = more_edit_createSuper(MoreEdit); - - function MoreEdit() { - var _this; - - Object(classCallCheck["a" /* default */])(this, MoreEdit); - - _this = _super.apply(this, arguments); - _this.onChangeInput = _this.onChangeInput.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.state = { - defaultText: Object(external_this_wp_i18n_["__"])('Read more') - }; - return _this; - } - - Object(createClass["a" /* default */])(MoreEdit, [{ - key: "onChangeInput", - value: function onChangeInput(event) { - // Set defaultText to an empty string, allowing the user to clear/replace the input field's text - this.setState({ - defaultText: '' - }); - var value = event.target.value.length === 0 ? undefined : event.target.value; - this.props.setAttributes({ - customText: value - }); - } - }, { - key: "onKeyDown", - value: function onKeyDown(event) { - var keyCode = event.keyCode; - var insertBlocksAfter = this.props.insertBlocksAfter; - - if (keyCode === external_this_wp_keycodes_["ENTER"]) { - insertBlocksAfter([Object(external_this_wp_blocks_["createBlock"])(Object(external_this_wp_blocks_["getDefaultBlockName"])())]); - } - } - }, { - key: "getHideExcerptHelp", - value: function getHideExcerptHelp(checked) { - return checked ? Object(external_this_wp_i18n_["__"])('The excerpt is hidden.') : Object(external_this_wp_i18n_["__"])('The excerpt is visible.'); - } - }, { - key: "render", - value: function render() { - var _this$props$attribute = this.props.attributes, - customText = _this$props$attribute.customText, - noTeaser = _this$props$attribute.noTeaser; - var setAttributes = this.props.setAttributes; - - var toggleHideExcerpt = function toggleHideExcerpt() { - return setAttributes({ - noTeaser: !noTeaser - }); - }; - - var defaultText = this.state.defaultText; - var value = customText !== undefined ? customText : defaultText; - var inputLength = value.length + 1.2; - var currentWidth = { - width: inputLength + 'em' - }; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Hide the excerpt on the full content page'), - checked: !!noTeaser, - onChange: toggleHideExcerpt, - help: this.getHideExcerptHelp - }))), Object(external_this_wp_element_["createElement"])("div", { - className: "wp-block-more" - }, Object(external_this_wp_element_["createElement"])("input", { - type: "text", - value: value, - onChange: this.onChangeInput, - onKeyDown: this.onKeyDown, - style: currentWidth - }))); - } - }]); - - return MoreEdit; -}(external_this_wp_element_["Component"]); - - +/** + * WordPress dependencies + */ + + + + + + +const DEFAULT_TEXT = Object(external_wp_i18n_["__"])('Read more'); + +function MoreEdit({ + attributes: { + customText, + noTeaser + }, + insertBlocksAfter, + setAttributes +}) { + const onChangeInput = event => { + setAttributes({ + customText: event.target.value !== '' ? event.target.value : undefined + }); + }; + + const onKeyDown = ({ + keyCode + }) => { + if (keyCode === external_wp_keycodes_["ENTER"]) { + insertBlocksAfter([Object(external_wp_blocks_["createBlock"])(Object(external_wp_blocks_["getDefaultBlockName"])())]); + } + }; + + const getHideExcerptHelp = checked => checked ? Object(external_wp_i18n_["__"])('The excerpt is hidden.') : Object(external_wp_i18n_["__"])('The excerpt is visible.'); + + const toggleHideExcerpt = () => setAttributes({ + noTeaser: !noTeaser + }); + + const style = { + width: `${(customText ? customText : DEFAULT_TEXT).length + 1.2}em` + }; + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Hide the excerpt on the full content page'), + checked: !!noTeaser, + onChange: toggleHideExcerpt, + help: getHideExcerptHelp + }))), Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])("div", { + className: "wp-block-more" + }, Object(external_wp_element_["createElement"])("input", { + "aria-label": Object(external_wp_i18n_["__"])('Read more link text'), + type: "text", + value: customText, + placeholder: DEFAULT_TEXT, + onChange: onChangeInput, + onKeyDown: onKeyDown, + style: style + })))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/save.js @@ -18481,13 +19589,15 @@ */ -function more_save_save(_ref) { - var attributes = _ref.attributes; - var customText = attributes.customText, - noTeaser = attributes.noTeaser; - var moreTag = customText ? "") : ''; - var noTeaserTag = noTeaser ? '' : ''; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, Object(external_this_lodash_["compact"])([moreTag, noTeaserTag]).join('\n')); +function more_save_save({ + attributes: { + customText, + noTeaser + } +}) { + const moreTag = customText ? `` : ''; + const noTeaserTag = noTeaser ? '' : ''; + return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_lodash_["compact"])([moreTag, noTeaserTag]).join('\n')); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/more/transforms.js @@ -18495,7 +19605,7 @@ * WordPress dependencies */ -var more_transforms_transforms = { +const more_transforms_transforms = { from: [{ type: 'raw', schema: { @@ -18503,14 +19613,14 @@ attributes: ['data-block'] } }, - isMatch: function isMatch(node) { - return node.dataset && node.dataset.block === 'core/more'; - }, - transform: function transform(node) { - var _node$dataset = node.dataset, - customText = _node$dataset.customText, - noTeaser = _node$dataset.noTeaser; - var attrs = {}; // Don't copy unless defined and not an empty string + isMatch: node => node.dataset && node.dataset.block === 'core/more', + + transform(node) { + const { + customText, + noTeaser + } = node.dataset; + const attrs = {}; // Don't copy unless defined and not an empty string if (customText) { attrs.customText = customText; @@ -18521,8 +19631,9 @@ attrs.noTeaser = true; } - return Object(external_this_wp_blocks_["createBlock"])('core/more', attrs); - } + return Object(external_wp_blocks_["createBlock"])('core/more', attrs); + } + }] }; /* harmony default export */ var more_transforms = (more_transforms_transforms); @@ -18532,15 +19643,19 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - -var more_metadata = { +/** + * Internal dependencies + */ + + +const more_metadata = { + apiVersion: 2, name: "core/more", + title: "More", category: "design", + description: "Content before this block will be shown in the excerpt on your archives page.", + keywords: ["read more"], + textdomain: "default", attributes: { customText: { type: "string" @@ -18555,26 +19670,29 @@ className: false, html: false, multiple: false - } -}; - - -var more_name = more_metadata.name; - -var more_settings = { - title: Object(external_this_wp_i18n_["_x"])('More', 'block name'), - description: Object(external_this_wp_i18n_["__"])('Content before this block will be shown in the excerpt on your archives page.'), + }, + editorStyle: "wp-block-more-editor" +}; + + +const { + name: more_name +} = more_metadata; + +const more_settings = { icon: library_more, example: {}, - __experimentalLabel: function __experimentalLabel(attributes, _ref) { - var context = _ref.context; - + + __experimentalLabel(attributes, { + context + }) { if (context === 'accessibility') { return attributes.customText; } }, + transforms: more_transforms, - edit: edit_MoreEdit, + edit: MoreEdit, save: more_save_save }; @@ -18585,10 +19703,10 @@ * WordPress dependencies */ -var pageBreak = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const pageBreak = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M7.8 6c0-.7.6-1.2 1.2-1.2h6c.7 0 1.2.6 1.2 1.2v3h1.5V6c0-1.5-1.2-2.8-2.8-2.8H9C7.5 3.2 6.2 4.5 6.2 6v3h1.5V6zm8.4 11c0 .7-.6 1.2-1.2 1.2H9c-.7 0-1.2-.6-1.2-1.2v-3H6.2v3c0 1.5 1.2 2.8 2.8 2.8h6c1.5 0 2.8-1.2 2.8-2.8v-3h-1.5v3zM4 11v1h16v-1H4z" })); /* harmony default export */ var page_break = (pageBreak); @@ -18600,10 +19718,11 @@ * WordPress dependencies */ + function NextPageEdit() { - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", Object(external_wp_blockEditor_["useBlockProps"])(), Object(external_wp_element_["createElement"])("div", { className: "wp-block-nextpage" - }, Object(external_this_wp_element_["createElement"])("span", null, Object(external_this_wp_i18n_["__"])('Page break'))); + }, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_i18n_["__"])('Page break')))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/save.js @@ -18614,7 +19733,7 @@ */ function nextpage_save_save() { - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["RawHTML"], null, ''); + return Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, ''); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/nextpage/transforms.js @@ -18622,7 +19741,7 @@ * WordPress dependencies */ -var nextpage_transforms_transforms = { +const nextpage_transforms_transforms = { from: [{ type: 'raw', schema: { @@ -18630,12 +19749,12 @@ attributes: ['data-block'] } }, - isMatch: function isMatch(node) { - return node.dataset && node.dataset.block === 'core/nextpage'; - }, - transform: function transform() { - return Object(external_this_wp_blocks_["createBlock"])('core/nextpage', {}); - } + isMatch: node => node.dataset && node.dataset.block === 'core/nextpage', + + transform() { + return Object(external_wp_blocks_["createBlock"])('core/nextpage', {}); + } + }] }; /* harmony default export */ var nextpage_transforms = (nextpage_transforms_transforms); @@ -18645,37 +19764,298 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - - -var nextpage_metadata = { +/** + * Internal dependencies + */ + + +const nextpage_metadata = { + apiVersion: 2, name: "core/nextpage", + title: "Page Break", category: "design", + description: "Separate your content into a multi-page experience.", + keywords: ["next page", "pagination"], parent: ["core/post-content"], + textdomain: "default", supports: { customClassName: false, className: false, html: false - } -}; - - -var nextpage_name = nextpage_metadata.name; - -var nextpage_settings = { - title: Object(external_this_wp_i18n_["__"])('Page Break'), - description: Object(external_this_wp_i18n_["__"])('Separate your content into a multi-page experience.'), + }, + editorStyle: "wp-block-nextpage-editor" +}; + + +const { + name: nextpage_name +} = nextpage_metadata; + +const nextpage_settings = { icon: page_break, - keywords: [Object(external_this_wp_i18n_["__"])('next page'), Object(external_this_wp_i18n_["__"])('pagination')], example: {}, transforms: nextpage_transforms, edit: NextPageEdit, save: nextpage_save_save }; +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pages.js + + +/** + * WordPress dependencies + */ + +const pages_pages = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M7 13.8h6v-1.5H7v1.5zM18 16V4c0-1.1-.9-2-2-2H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2zM5.5 16V4c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5zM7 10.5h8V9H7v1.5zm0-3.3h8V5.8H7v1.4zM20.2 6v13c0 .7-.6 1.2-1.2 1.2H8v1.5h11c1.5 0 2.7-1.2 2.7-2.8V6h-1.5z" +})); +/* harmony default export */ var library_pages = (pages_pages); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/convert-to-links-modal.js + + +/** + * WordPress dependencies + */ + + + + + + +const PAGE_FIELDS = ['id', 'title', 'link', 'type', 'parent']; +const MAX_PAGE_COUNT = 100; +const convertSelectedBlockToNavigationLinks = ({ + pages, + clientId, + replaceBlock, + createBlock +}) => () => { + if (!pages) { + return; + } + + const linkMap = {}; + const navigationLinks = []; + pages.forEach(({ + id, + title, + link: url, + type, + parent + }) => { + var _linkMap$id$innerBloc, _linkMap$id; + + // See if a placeholder exists. This is created if children appear before parents in list + const innerBlocks = (_linkMap$id$innerBloc = (_linkMap$id = linkMap[id]) === null || _linkMap$id === void 0 ? void 0 : _linkMap$id.innerBlocks) !== null && _linkMap$id$innerBloc !== void 0 ? _linkMap$id$innerBloc : []; + linkMap[id] = createBlock('core/navigation-link', { + id, + label: title.rendered, + url, + type, + kind: 'post-type' + }, innerBlocks); + + if (!parent) { + navigationLinks.push(linkMap[id]); + } else { + if (!linkMap[parent]) { + // Use a placeholder if the child appears before parent in list + linkMap[parent] = { + innerBlocks: [] + }; + } + + const parentLinkInnerBlocks = linkMap[parent].innerBlocks; + parentLinkInnerBlocks.push(linkMap[id]); + } + }); + replaceBlock(clientId, navigationLinks); +}; +function ConvertToLinksModal({ + onClose, + clientId +}) { + const { + pages, + pagesFinished + } = Object(external_wp_data_["useSelect"])(select => { + const { + getEntityRecords, + hasFinishedResolution + } = select(external_wp_coreData_["store"]); + const query = ['postType', 'page', { + per_page: MAX_PAGE_COUNT, + _fields: PAGE_FIELDS, + // TODO: When https://core.trac.wordpress.org/ticket/39037 REST API support for multiple orderby + // values is resolved, update 'orderby' to [ 'menu_order', 'post_title' ] to provide a consistent + // sort. + orderby: 'menu_order', + order: 'asc' + }]; + return { + pages: getEntityRecords(...query), + pagesFinished: hasFinishedResolution('getEntityRecords', query) + }; + }, [clientId]); + const { + replaceBlock + } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); + return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { + closeLabel: Object(external_wp_i18n_["__"])('Close'), + onRequestClose: onClose, + title: Object(external_wp_i18n_["__"])('Convert to links'), + className: 'wp-block-page-list-modal', + aria: { + describedby: 'wp-block-page-list-modal__description' + } + }, Object(external_wp_element_["createElement"])("p", { + id: 'wp-block-page-list-modal__description' + }, Object(external_wp_i18n_["__"])('To edit this navigation menu, convert it to single page links. This allows you to add, re-order, remove items, or edit their labels.')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])("Note: if you add new pages to your site, you'll need to add them to your navigation menu.")), Object(external_wp_element_["createElement"])("div", { + className: "wp-block-page-list-modal-buttons" + }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { + isTertiary: true, + onClick: onClose + }, Object(external_wp_i18n_["__"])('Cancel')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { + isPrimary: true, + disabled: !pagesFinished, + onClick: convertSelectedBlockToNavigationLinks({ + pages, + replaceBlock, + clientId, + createBlock: external_wp_blocks_["createBlock"] + }) + }, Object(external_wp_i18n_["__"])('Convert')))); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/edit.js + + +/** + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + + + + +/** + * Internal dependencies + */ + + // We only show the edit option when page count is <= MAX_PAGE_COUNT +// Performance of Navigation Links is not good past this value. + +const edit_MAX_PAGE_COUNT = 100; +function PageListEdit({ + context, + clientId +}) { + const { + textColor, + backgroundColor, + showSubmenuIcon, + style + } = context || {}; + const [allowConvertToLinks, setAllowConvertToLinks] = Object(external_wp_element_["useState"])(false); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: classnames_default()({ + 'has-text-color': !!textColor, + [`has-${textColor}-color`]: !!textColor, + 'has-background': !!backgroundColor, + [`has-${backgroundColor}-background-color`]: !!backgroundColor, + 'show-submenu-icons': !!showSubmenuIcon + }), + style: { ...(style === null || style === void 0 ? void 0 : style.color) + } + }); + const isParentNavigation = Object(external_wp_data_["useSelect"])(select => { + const { + getBlockParentsByBlockName + } = select(external_wp_blockEditor_["store"]); + return getBlockParentsByBlockName(clientId, 'core/navigation').length > 0; + }, [clientId]); + Object(external_wp_element_["useEffect"])(() => { + if (isParentNavigation) { + external_wp_apiFetch_default()({ + path: Object(external_wp_url_["addQueryArgs"])('/wp/v2/pages', { + per_page: 1, + _fields: ['id'] + }), + parse: false + }).then(res => { + setAllowConvertToLinks(res.headers.get('X-WP-Total') <= edit_MAX_PAGE_COUNT); + }); + } else { + setAllowConvertToLinks(false); + } + }, [isParentNavigation]); + const [isOpen, setOpen] = Object(external_wp_element_["useState"])(false); + + const openModal = () => setOpen(true); + + const closeModal = () => setOpen(false); + + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, allowConvertToLinks && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], { + group: "other" + }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + title: Object(external_wp_i18n_["__"])('Edit'), + onClick: openModal + }, Object(external_wp_i18n_["__"])('Edit'))), allowConvertToLinks && isOpen && Object(external_wp_element_["createElement"])(ConvertToLinksModal, { + onClose: closeModal, + clientId: clientId + }), Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_serverSideRender_default.a, { + block: "core/page-list" + }))); +} + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/page-list/index.js +/** + * WordPress dependencies + */ + +/** + * Internal dependencies + */ + +const page_list_metadata = { + apiVersion: 2, + name: "core/page-list", + title: "Page List", + category: "widgets", + description: "Display a list of all pages.", + keywords: ["menu", "navigation"], + textdomain: "default", + usesContext: ["textColor", "customTextColor", "backgroundColor", "customBackgroundColor", "fontSize", "customFontSize", "showSubmenuIcon", "style"], + supports: { + reusable: false, + html: false + }, + editorStyle: "wp-block-page-list-editor", + style: "wp-block-page-list" +}; + +const { + name: page_list_name +} = page_list_metadata; + +const page_list_settings = { + icon: library_pages, + example: {}, + edit: PageListEdit +}; + // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/preformatted.js @@ -18683,10 +20063,10 @@ * WordPress dependencies */ -var preformatted = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const preformatted = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v12zM7 16.5h6V15H7v1.5zm4-4h6V11h-6v1.5zM9 11H7v1.5h2V11zm6 5.5h2V15h-2v1.5z" })); /* harmony default export */ var library_preformatted = (preformatted); @@ -18694,33 +20074,39 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/edit.js -/** - * WordPress dependencies - */ - - -function PreformattedEdit(_ref) { - var attributes = _ref.attributes, - mergeBlocks = _ref.mergeBlocks, - setAttributes = _ref.setAttributes, - className = _ref.className, - style = _ref.style; - var content = attributes.content; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - tagName: external_this_wp_blockEditor_["__experimentalBlock"].pre, + +/** + * WordPress dependencies + */ + + +function PreformattedEdit({ + attributes, + mergeBlocks, + setAttributes, + onRemove +}) { + const { + content + } = attributes; + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], Object(esm_extends["a" /* default */])({ + tagName: "pre", identifier: "content", preserveWhiteSpace: true, value: content, - onChange: function onChange(nextContent) { + onChange: nextContent => { setAttributes({ content: nextContent }); }, - placeholder: Object(external_this_wp_i18n_["__"])('Write preformatted text…'), - className: className, - style: style, + onRemove: onRemove, + "aria-label": Object(external_wp_i18n_["__"])('Preformatted text'), + placeholder: Object(external_wp_i18n_["__"])('Write preformatted text…'), onMerge: mergeBlocks - }); + }, blockProps, { + __unstablePastePlainText: true + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/save.js @@ -18730,13 +20116,15 @@ * WordPress dependencies */ -function preformatted_save_save(_ref) { - var attributes = _ref.attributes; - var content = attributes.content; - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { - tagName: "pre", +function preformatted_save_save({ + attributes +}) { + const { + content + } = attributes; + return Object(external_wp_element_["createElement"])("pre", external_wp_blockEditor_["useBlockProps"].save(), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: content - }); + })); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/preformatted/transforms.js @@ -18744,44 +20132,36 @@ * WordPress dependencies */ -var preformatted_transforms_transforms = { +const preformatted_transforms_transforms = { from: [{ type: 'block', blocks: ['core/code', 'core/paragraph'], - transform: function transform(_ref) { - var content = _ref.content, - anchor = _ref.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/preformatted', { - content: content, - anchor: anchor - }); - } + transform: ({ + content, + anchor + }) => Object(external_wp_blocks_["createBlock"])('core/preformatted', { + content, + anchor + }) }, { type: 'raw', - isMatch: function isMatch(node) { - return node.nodeName === 'PRE' && !(node.children.length === 1 && node.firstChild.nodeName === 'CODE'); - }, - schema: function schema(_ref2) { - var phrasingContentSchema = _ref2.phrasingContentSchema; - return { - pre: { - children: phrasingContentSchema - } - }; - } + isMatch: node => node.nodeName === 'PRE' && !(node.children.length === 1 && node.firstChild.nodeName === 'CODE'), + schema: ({ + phrasingContentSchema + }) => ({ + pre: { + children: phrasingContentSchema + } + }) }], to: [{ type: 'block', blocks: ['core/paragraph'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', attributes); - } + transform: attributes => Object(external_wp_blocks_["createBlock"])('core/paragraph', attributes) }, { type: 'block', blocks: ['core/code'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/code', attributes); - } + transform: attributes => Object(external_wp_blocks_["createBlock"])('core/code', attributes) }] }; /* harmony default export */ var preformatted_transforms = (preformatted_transforms_transforms); @@ -18797,36 +20177,47 @@ */ -var preformatted_metadata = { +const preformatted_metadata = { + apiVersion: 2, name: "core/preformatted", + title: "Preformatted", category: "text", + description: "Add text that respects your spacing and tabs, and also allows styling.", + textdomain: "default", attributes: { content: { type: "string", source: "html", selector: "pre", "default": "", - __unstablePreserveWhiteSpace: true + __unstablePreserveWhiteSpace: true, + __experimentalRole: "content" } }, supports: { anchor: true, - lightBlockWrapper: true - } -}; - - -var preformatted_name = preformatted_metadata.name; - -var preformatted_settings = { - title: Object(external_this_wp_i18n_["__"])('Preformatted'), - description: Object(external_this_wp_i18n_["__"])('Add text that respects your spacing and tabs, and also allows styling.'), + color: { + gradients: true + }, + typography: { + fontSize: true + } + }, + style: "wp-block-preformatted" +}; + + +const { + name: preformatted_name +} = preformatted_metadata; + +const preformatted_settings = { icon: library_preformatted, example: { attributes: { /* eslint-disable @wordpress/i18n-no-collapsible-whitespace */ // translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work. - content: Object(external_this_wp_i18n_["__"])('EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\nWindow, very small in the distance, illuminated.\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;') + content: Object(external_wp_i18n_["__"])('EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\nWindow, very small in the distance, illuminated.\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;') /* eslint-enable @wordpress/i18n-no-collapsible-whitespace */ } @@ -18834,11 +20225,13 @@ transforms: preformatted_transforms, edit: PreformattedEdit, save: preformatted_save_save, - merge: function merge(attributes, attributesToMerge) { + + merge(attributes, attributesToMerge) { return { content: attributes.content + attributesToMerge.content }; } + }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pullquote.js @@ -18848,44 +20241,37 @@ * WordPress dependencies */ -var pullquote = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const pullquote = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18 8H6c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2zm.5 6c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-4c0-.3.2-.5.5-.5h12c.3 0 .5.2.5.5v4zM4 4v1.5h16V4H4zm0 16h16v-1.5H4V20z" })); /* harmony default export */ var library_pullquote = (pullquote); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/shared.js -var SOLID_COLOR_STYLE_NAME = 'solid-color'; -var SOLID_COLOR_CLASS = "is-style-".concat(SOLID_COLOR_STYLE_NAME); +const SOLID_COLOR_CLASS = `is-style-solid-color`; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/deprecated.js - - -function pullquote_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function pullquote_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { pullquote_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { pullquote_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - - -var pullquote_deprecated_blockAttributes = { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + +/** + * Internal dependencies + */ + + +const pullquote_deprecated_blockAttributes = { value: { type: 'string', source: 'html', @@ -18917,15 +20303,15 @@ return; } - var matches = styleString.match(/border-color:([^;]+)[;]?/); + const matches = styleString.match(/border-color:([^;]+)[;]?/); if (matches && matches[1]) { return matches[1]; } } -var pullquote_deprecated_deprecated = [{ - attributes: pullquote_deprecated_objectSpread({}, pullquote_deprecated_blockAttributes, { +const pullquote_deprecated_deprecated = [{ + attributes: { ...pullquote_deprecated_blockAttributes, // figureStyle is an attribute that never existed. // We are using it as a way to access the styles previously applied to the figure. figureStyle: { @@ -18933,25 +20319,30 @@ selector: 'figure', attribute: 'style' } - }), - save: function save(_ref) { - var attributes = _ref.attributes; - var mainColor = attributes.mainColor, - customMainColor = attributes.customMainColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor, - value = attributes.value, - citation = attributes.citation, - className = attributes.className, - figureStyle = attributes.figureStyle; - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); - var figureClasses, figureStyles; // Is solid color style + }, + + save({ + attributes + }) { + const { + mainColor, + customMainColor, + textColor, + customTextColor, + value, + citation, + className, + figureStyle + } = attributes; + const isSolidColorStyle = Object(external_lodash_["includes"])(className, SOLID_COLOR_CLASS); + let figureClasses, figureStyles; // Is solid color style if (isSolidColorStyle) { - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', mainColor); - figureClasses = classnames_default()(Object(defineProperty["a" /* default */])({ - 'has-background': backgroundClass || customMainColor - }, backgroundClass, backgroundClass)); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', mainColor); + figureClasses = classnames_default()({ + 'has-background': backgroundClass || customMainColor, + [backgroundClass]: backgroundClass + }); figureStyles = { backgroundColor: backgroundClass ? undefined : customMainColor }; // Is normal style and a custom color is being used ( we can set a style directly with its value) @@ -18966,73 +20357,82 @@ // because meanwhile a change in the editor made it impossible to query color settings in the save function. // Here instead of querying the color settings to know the color value, we retrieve the value // directly from the style previously serialized. - var borderColor = parseBorderColor(figureStyle); + const borderColor = parseBorderColor(figureStyle); figureStyles = { - borderColor: borderColor - }; - } - - var blockquoteTextColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var blockquoteClasses = (textColor || customTextColor) && classnames_default()('has-text-color', Object(defineProperty["a" /* default */])({}, blockquoteTextColorClass, blockquoteTextColorClass)); - var blockquoteStyles = blockquoteTextColorClass ? undefined : { + borderColor + }; + } + + const blockquoteTextColorClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const blockquoteClasses = (textColor || customTextColor) && classnames_default()('has-text-color', { + [blockquoteTextColorClass]: blockquoteTextColorClass + }); + const blockquoteStyles = blockquoteTextColorClass ? undefined : { color: customTextColor }; - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", { className: figureClasses, style: figureStyles - }, Object(external_this_wp_element_["createElement"])("blockquote", { + }, Object(external_wp_element_["createElement"])("blockquote", { className: blockquoteClasses, style: blockquoteStyles - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: value, multiline: true - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation }))); }, - migrate: function migrate(_ref2) { - var className = _ref2.className, - figureStyle = _ref2.figureStyle, - mainColor = _ref2.mainColor, - attributes = Object(objectWithoutProperties["a" /* default */])(_ref2, ["className", "figureStyle", "mainColor"]); - - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); // If is the default style, and a main color is set, + + migrate({ + className, + figureStyle, + mainColor, + ...attributes + }) { + const isSolidColorStyle = Object(external_lodash_["includes"])(className, SOLID_COLOR_CLASS); // If is the default style, and a main color is set, // migrate the main color value into a custom color. // The custom color value is retrived by parsing the figure styles. if (!isSolidColorStyle && mainColor && figureStyle) { - var borderColor = parseBorderColor(figureStyle); + const borderColor = parseBorderColor(figureStyle); if (borderColor) { - return pullquote_deprecated_objectSpread({}, attributes, { - className: className, + return { ...attributes, + className, customMainColor: borderColor - }); - } - } - - return pullquote_deprecated_objectSpread({ - className: className, - mainColor: mainColor - }, attributes); - } + }; + } + } + + return { + className, + mainColor, + ...attributes + }; + } + }, { attributes: pullquote_deprecated_blockAttributes, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var mainColor = attributes.mainColor, - customMainColor = attributes.customMainColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor, - value = attributes.value, - citation = attributes.citation, - className = attributes.className; - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); - var figureClass, figureStyles; // Is solid color style + + save({ + attributes + }) { + const { + mainColor, + customMainColor, + textColor, + customTextColor, + value, + citation, + className + } = attributes; + const isSolidColorStyle = Object(external_lodash_["includes"])(className, SOLID_COLOR_CLASS); + let figureClass, figureStyles; // Is solid color style if (isSolidColorStyle) { - figureClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', mainColor); + figureClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', mainColor); if (!figureClass) { figureStyles = { @@ -19046,48 +20446,57 @@ }; // Is normal style and a named color is being used, we need to retrieve the color value to set the style, // as there is no expectation that themes create classes that set border colors. } else if (mainColor) { - var colors = Object(external_this_lodash_["get"])(Object(external_this_wp_data_["select"])('core/block-editor').getSettings(), ['colors'], []); - var colorObject = Object(external_this_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, mainColor); + const colors = Object(external_lodash_["get"])(Object(external_wp_data_["select"])(external_wp_blockEditor_["store"]).getSettings(), ['colors'], []); + const colorObject = Object(external_wp_blockEditor_["getColorObjectByAttributeValues"])(colors, mainColor); figureStyles = { borderColor: colorObject.color }; } - var blockquoteTextColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var blockquoteClasses = textColor || customTextColor ? classnames_default()('has-text-color', Object(defineProperty["a" /* default */])({}, blockquoteTextColorClass, blockquoteTextColorClass)) : undefined; - var blockquoteStyle = blockquoteTextColorClass ? undefined : { + const blockquoteTextColorClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const blockquoteClasses = textColor || customTextColor ? classnames_default()('has-text-color', { + [blockquoteTextColorClass]: blockquoteTextColorClass + }) : undefined; + const blockquoteStyle = blockquoteTextColorClass ? undefined : { color: customTextColor }; - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", { className: figureClass, style: figureStyles - }, Object(external_this_wp_element_["createElement"])("blockquote", { + }, Object(external_wp_element_["createElement"])("blockquote", { className: blockquoteClasses, style: blockquoteStyle - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: value, multiline: true - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation }))); } -}, { - attributes: pullquote_deprecated_objectSpread({}, pullquote_deprecated_blockAttributes), - save: function save(_ref4) { - var attributes = _ref4.attributes; - var value = attributes.value, - citation = attributes.citation; - return Object(external_this_wp_element_["createElement"])("blockquote", null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + +}, { + attributes: { ...pullquote_deprecated_blockAttributes + }, + + save({ + attributes + }) { + const { + value, + citation + } = attributes; + return Object(external_wp_element_["createElement"])("blockquote", null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: value, multiline: true - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation })); } -}, { - attributes: pullquote_deprecated_objectSpread({}, pullquote_deprecated_blockAttributes, { + +}, { + attributes: { ...pullquote_deprecated_blockAttributes, citation: { type: 'string', source: 'html', @@ -19097,269 +20506,235 @@ type: 'string', default: 'none' } - }), - save: function save(_ref5) { - var attributes = _ref5.attributes; - var value = attributes.value, - citation = attributes.citation, - align = attributes.align; - return Object(external_this_wp_element_["createElement"])("blockquote", { - className: "align".concat(align) - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, + + save({ + attributes + }) { + const { + value, + citation, + align + } = attributes; + return Object(external_wp_element_["createElement"])("blockquote", { + className: `align${align}` + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: value, multiline: true - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "footer", value: citation })); } + }]; /* harmony default export */ var pullquote_deprecated = (pullquote_deprecated_deprecated); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/figure.js -var Figure = 'figure'; +const Figure = 'figure'; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/blockquote.js -var BlockQuote = 'blockquote'; +const BlockQuote = 'blockquote'; // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/edit.js - - - - - - - - -function pullquote_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (pullquote_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function pullquote_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - - -/** - * Internal dependencies - */ - - - -var edit_PullQuoteEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(PullQuoteEdit, _Component); - - var _super = pullquote_edit_createSuper(PullQuoteEdit); - - function PullQuoteEdit(props) { - var _this; - - Object(classCallCheck["a" /* default */])(this, PullQuoteEdit); - - _this = _super.call(this, props); - _this.wasTextColorAutomaticallyComputed = false; - _this.pullQuoteMainColorSetter = _this.pullQuoteMainColorSetter.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.pullQuoteTextColorSetter = _this.pullQuoteTextColorSetter.bind(Object(assertThisInitialized["a" /* default */])(_this)); - return _this; - } - - Object(createClass["a" /* default */])(PullQuoteEdit, [{ - key: "pullQuoteMainColorSetter", - value: function pullQuoteMainColorSetter(colorValue) { - var _this$props = this.props, - colorUtils = _this$props.colorUtils, - textColor = _this$props.textColor, - setAttributes = _this$props.setAttributes, - setTextColor = _this$props.setTextColor, - setMainColor = _this$props.setMainColor, - className = _this$props.className; - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); - var needTextColor = !textColor.color || this.wasTextColorAutomaticallyComputed; - var shouldSetTextColor = isSolidColorStyle && needTextColor && colorValue; - - if (isSolidColorStyle) { - // If we use the solid color style, set the color using the normal mechanism. - setMainColor(colorValue); - } else { - // If we use the default style, set the color as a custom color to force the usage of an inline style. - // Default style uses a border color for which classes are not available. - setAttributes({ - customMainColor: colorValue - }); - } - - if (shouldSetTextColor) { - this.wasTextColorAutomaticallyComputed = true; +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + + + +/** + * Internal dependencies + */ + + + +/** + * Internal dependencies + */ + + + +function PullQuoteEdit({ + colorUtils, + textColor, + attributes: { + value, + citation + }, + setAttributes, + setTextColor, + setMainColor, + mainColor, + isSelected, + insertBlocksAfter +}) { + const wasTextColorAutomaticallyComputed = Object(external_wp_element_["useRef"])(false); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + const { + style = {}, + className + } = blockProps; + const isSolidColorStyle = Object(external_lodash_["includes"])(className, SOLID_COLOR_CLASS); + const newBlockProps = { ...blockProps, + className: classnames_default()(className, { + 'has-background': isSolidColorStyle && mainColor.color, + [mainColor.class]: isSolidColorStyle && mainColor.class + }), + style: isSolidColorStyle ? { ...style, + backgroundColor: mainColor.color + } : { ...style, + borderColor: mainColor.color + } + }; + + function pullQuoteMainColorSetter(colorValue) { + const needTextColor = !textColor.color || wasTextColorAutomaticallyComputed.current; + const shouldSetTextColor = isSolidColorStyle && needTextColor; + + if (isSolidColorStyle) { + // If we use the solid color style, set the color using the normal mechanism. + setMainColor(colorValue); + } else { + // If we use the default style, set the color as a custom color to force the usage of an inline style. + // Default style uses a border color for which classes are not available. + setAttributes({ + customMainColor: colorValue + }); + } + + if (shouldSetTextColor) { + if (colorValue) { + wasTextColorAutomaticallyComputed.current = true; setTextColor(colorUtils.getMostReadableColor(colorValue)); - } - } - }, { - key: "pullQuoteTextColorSetter", - value: function pullQuoteTextColorSetter(colorValue) { - var setTextColor = this.props.setTextColor; - setTextColor(colorValue); - this.wasTextColorAutomaticallyComputed = false; - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - var _this$props2 = this.props, - attributes = _this$props2.attributes, - className = _this$props2.className, - mainColor = _this$props2.mainColor, - setAttributes = _this$props2.setAttributes; // If the block includes a named color and we switched from the - // solid color style to the default style. - - if (attributes.mainColor && !Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS) && Object(external_this_lodash_["includes"])(prevProps.className, SOLID_COLOR_CLASS)) { - // Remove the named color, and set the color as a custom color. - // This is done because named colors use classes, in the default style we use a border color, - // and themes don't set classes for border colors. - setAttributes({ - mainColor: undefined, - customMainColor: mainColor.color - }); - } - } - }, { - key: "render", - value: function render() { - var _this$props3 = this.props, - attributes = _this$props3.attributes, - mainColor = _this$props3.mainColor, - textColor = _this$props3.textColor, - setAttributes = _this$props3.setAttributes, - isSelected = _this$props3.isSelected, - className = _this$props3.className, - insertBlocksAfter = _this$props3.insertBlocksAfter; - var value = attributes.value, - citation = attributes.citation; - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); - var figureStyles = isSolidColorStyle ? { - backgroundColor: mainColor.color - } : { - borderColor: mainColor.color - }; - var figureClasses = classnames_default()(className, Object(defineProperty["a" /* default */])({ - 'has-background': isSolidColorStyle && mainColor.color - }, mainColor.class, isSolidColorStyle && mainColor.class)); - var blockquoteStyles = { - color: textColor.color - }; - var blockquoteClasses = textColor.color && classnames_default()('has-text-color', Object(defineProperty["a" /* default */])({}, textColor.class, textColor.class)); - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(Figure, { - style: figureStyles, - className: figureClasses - }, Object(external_this_wp_element_["createElement"])(BlockQuote, { - style: blockquoteStyles, - className: blockquoteClasses - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - identifier: "value", - multiline: true, - value: value, - onChange: function onChange(nextValue) { - return setAttributes({ - value: nextValue - }); - }, - placeholder: // translators: placeholder text used for the quote - Object(external_this_wp_i18n_["__"])('Write quote…'), - textAlign: "center" - }), (!external_this_wp_blockEditor_["RichText"].isEmpty(citation) || isSelected) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - identifier: "citation", - value: citation, - placeholder: // translators: placeholder text used for the citation - Object(external_this_wp_i18n_["__"])('Write citation…'), - onChange: function onChange(nextCitation) { - return setAttributes({ - citation: nextCitation - }); - }, - className: "wp-block-pullquote__citation", - __unstableMobileNoFocusOnMount: true, - textAlign: "center", - __unstableOnSplitAtEnd: function __unstableOnSplitAtEnd() { - return insertBlocksAfter(Object(external_this_wp_blocks_["createBlock"])('core/paragraph')); - } - }))), external_this_wp_element_["Platform"].OS === 'web' && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["PanelColorSettings"], { - title: Object(external_this_wp_i18n_["__"])('Color settings'), - colorSettings: [{ - value: mainColor.color, - onChange: this.pullQuoteMainColorSetter, - label: Object(external_this_wp_i18n_["__"])('Main color') - }, { - value: textColor.color, - onChange: this.pullQuoteTextColorSetter, - label: Object(external_this_wp_i18n_["__"])('Text color') - }] - }, isSolidColorStyle && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["ContrastChecker"], Object(esm_extends["a" /* default */])({ - textColor: textColor.color, - backgroundColor: mainColor.color - }, { - isLargeText: false - }))))); - } - }]); - - return PullQuoteEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var pullquote_edit = (Object(external_this_wp_blockEditor_["withColors"])({ + } else if (wasTextColorAutomaticallyComputed.current) { + // We have to unset our previously computed text color on unsetting the main color. + wasTextColorAutomaticallyComputed.current = false; + setTextColor(); + } + } + } + + function pullQuoteTextColorSetter(colorValue) { + setTextColor(colorValue); + wasTextColorAutomaticallyComputed.current = false; + } + + Object(external_wp_element_["useEffect"])(() => { + // If the block includes a named color and we switched from the + // solid color style to the default style. + if (mainColor && !isSolidColorStyle) { + // Remove the named color, and set the color as a custom color. + // This is done because named colors use classes, in the default style we use a border color, + // and themes don't set classes for border colors. + setAttributes({ + mainColor: undefined, + customMainColor: mainColor.color + }); + } + }, [isSolidColorStyle, mainColor]); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(Figure, newBlockProps, Object(external_wp_element_["createElement"])(BlockQuote, { + style: { + color: textColor.color + }, + className: textColor.color && classnames_default()('has-text-color', { + [textColor.class]: textColor.class + }) + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + identifier: "value", + multiline: true, + value: value, + onChange: nextValue => setAttributes({ + value: nextValue + }), + "aria-label": Object(external_wp_i18n_["__"])('Pullquote text'), + placeholder: // translators: placeholder text used for the quote + Object(external_wp_i18n_["__"])('Add quote'), + textAlign: "center" + }), (!external_wp_blockEditor_["RichText"].isEmpty(citation) || isSelected) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + identifier: "citation", + value: citation, + "aria-label": Object(external_wp_i18n_["__"])('Pullquote citation text'), + placeholder: // translators: placeholder text used for the citation + Object(external_wp_i18n_["__"])('Add citation'), + onChange: nextCitation => setAttributes({ + citation: nextCitation + }), + className: "wp-block-pullquote__citation", + __unstableMobileNoFocusOnMount: true, + textAlign: "center", + __unstableOnSplitAtEnd: () => insertBlocksAfter(Object(external_wp_blocks_["createBlock"])('core/paragraph')) + }))), external_wp_element_["Platform"].OS === 'web' && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["PanelColorSettings"], { + title: Object(external_wp_i18n_["__"])('Color'), + colorSettings: [{ + value: mainColor.color, + onChange: pullQuoteMainColorSetter, + label: Object(external_wp_i18n_["__"])('Main color') + }, { + value: textColor.color, + onChange: pullQuoteTextColorSetter, + label: Object(external_wp_i18n_["__"])('Text color') + }] + }, isSolidColorStyle && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["ContrastChecker"], { + textColor: textColor.color, + backgroundColor: mainColor.color, + isLargeText: false + })))); +} + +/* harmony default export */ var pullquote_edit = (Object(external_wp_blockEditor_["withColors"])({ mainColor: 'background-color', textColor: 'color' -})(edit_PullQuoteEdit)); +})(PullQuoteEdit)); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/save.js - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - -function pullquote_save_save(_ref) { - var attributes = _ref.attributes; - var mainColor = attributes.mainColor, - customMainColor = attributes.customMainColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor, - value = attributes.value, - citation = attributes.citation, - className = attributes.className; - var isSolidColorStyle = Object(external_this_lodash_["includes"])(className, SOLID_COLOR_CLASS); - var figureClasses, figureStyles; // Is solid color style +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + +/** + * Internal dependencies + */ + + +function pullquote_save_save({ + attributes +}) { + const { + mainColor, + customMainColor, + textColor, + customTextColor, + value, + citation, + className + } = attributes; + const isSolidColorStyle = Object(external_lodash_["includes"])(className, SOLID_COLOR_CLASS); + let figureClasses, figureStyles; // Is solid color style if (isSolidColorStyle) { - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', mainColor); - figureClasses = classnames_default()(Object(defineProperty["a" /* default */])({ - 'has-background': backgroundClass || customMainColor - }, backgroundClass, backgroundClass)); + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', mainColor); + figureClasses = classnames_default()({ + 'has-background': backgroundClass || customMainColor, + [backgroundClass]: backgroundClass + }); figureStyles = { backgroundColor: backgroundClass ? undefined : customMainColor }; // Is normal style and a custom color is being used ( we can set a style directly with its value) @@ -19369,54 +20744,47 @@ }; } - var blockquoteTextColorClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var blockquoteClasses = (textColor || customTextColor) && classnames_default()('has-text-color', Object(defineProperty["a" /* default */])({}, blockquoteTextColorClass, blockquoteTextColorClass)); - var blockquoteStyles = blockquoteTextColorClass ? undefined : { + const blockquoteTextColorClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const blockquoteClasses = (textColor || customTextColor) && classnames_default()('has-text-color', { + [blockquoteTextColorClass]: blockquoteTextColorClass + }); + const blockquoteStyles = blockquoteTextColorClass ? undefined : { color: customTextColor }; - return Object(external_this_wp_element_["createElement"])("figure", { + return Object(external_wp_element_["createElement"])("figure", external_wp_blockEditor_["useBlockProps"].save({ className: figureClasses, style: figureStyles - }, Object(external_this_wp_element_["createElement"])("blockquote", { + }), Object(external_wp_element_["createElement"])("blockquote", { className: blockquoteClasses, style: blockquoteStyles - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { value: value, multiline: true - }), !external_this_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"].Content, { + }), !external_wp_blockEditor_["RichText"].isEmpty(citation) && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"].Content, { tagName: "cite", value: citation }))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/pullquote/transforms.js - - - - -function pullquote_transforms_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function pullquote_transforms_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { pullquote_transforms_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { pullquote_transforms_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * WordPress dependencies - */ - - -var pullquote_transforms_transforms = { +/** + * WordPress dependencies + */ + + +const pullquote_transforms_transforms = { from: [{ type: 'block', isMultiBlock: true, blocks: ['core/paragraph'], - transform: function transform(attributes) { - return Object(external_this_wp_blocks_["createBlock"])('core/pullquote', { - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: Object(external_this_wp_richText_["join"])(attributes.map(function (_ref) { - var content = _ref.content; - return Object(external_this_wp_richText_["create"])({ - html: content - }); - }), "\u2028"), + transform: attributes => { + return Object(external_wp_blocks_["createBlock"])('core/pullquote', { + value: Object(external_wp_richText_["toHTMLString"])({ + value: Object(external_wp_richText_["join"])(attributes.map(({ + content + }) => Object(external_wp_richText_["create"])({ + html: content + })), '\u2028'), multilineTag: 'p' }), anchor: attributes.anchor @@ -19425,44 +20793,44 @@ }, { type: 'block', blocks: ['core/heading'], - transform: function transform(_ref2) { - var content = _ref2.content, - anchor = _ref2.anchor; - return Object(external_this_wp_blocks_["createBlock"])('core/pullquote', { - value: "

    ".concat(content, "

    "), - anchor: anchor + transform: ({ + content, + anchor + }) => { + return Object(external_wp_blocks_["createBlock"])('core/pullquote', { + value: `

    ${content}

    `, + anchor }); } }], to: [{ type: 'block', blocks: ['core/paragraph'], - transform: function transform(_ref3) { - var value = _ref3.value, - citation = _ref3.citation; - var paragraphs = []; + transform: ({ + value, + citation + }) => { + const paragraphs = []; if (value && value !== '

    ') { - paragraphs.push.apply(paragraphs, Object(toConsumableArray["a" /* default */])(Object(external_this_wp_richText_["split"])(Object(external_this_wp_richText_["create"])({ + paragraphs.push(...Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ html: value, multilineTag: 'p' - }), "\u2028").map(function (piece) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { - content: Object(external_this_wp_richText_["toHTMLString"])({ - value: piece - }) - }); + }), '\u2028').map(piece => Object(external_wp_blocks_["createBlock"])('core/paragraph', { + content: Object(external_wp_richText_["toHTMLString"])({ + value: piece + }) }))); } if (citation && citation !== '

    ') { - paragraphs.push(Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + paragraphs.push(Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: citation })); } if (paragraphs.length === 0) { - return Object(external_this_wp_blocks_["createBlock"])('core/paragraph', { + return Object(external_wp_blocks_["createBlock"])('core/paragraph', { content: '' }); } @@ -19472,26 +20840,26 @@ }, { type: 'block', blocks: ['core/heading'], - transform: function transform(_ref4) { - var value = _ref4.value, - citation = _ref4.citation, - attrs = Object(objectWithoutProperties["a" /* default */])(_ref4, ["value", "citation"]); - + transform: ({ + value, + citation, + ...attrs + }) => { // If there is no pullquote content, use the citation as the // content of the resulting heading. A nonexistent citation // will result in an empty heading. if (value === '

    ') { - return Object(external_this_wp_blocks_["createBlock"])('core/heading', { + return Object(external_wp_blocks_["createBlock"])('core/heading', { content: citation }); } - var pieces = Object(external_this_wp_richText_["split"])(Object(external_this_wp_richText_["create"])({ + const pieces = Object(external_wp_richText_["split"])(Object(external_wp_richText_["create"])({ html: value, multilineTag: 'p' - }), "\u2028"); - var headingBlock = Object(external_this_wp_blocks_["createBlock"])('core/heading', { - content: Object(external_this_wp_richText_["toHTMLString"])({ + }), '\u2028'); + const headingBlock = Object(external_wp_blocks_["createBlock"])('core/heading', { + content: Object(external_wp_richText_["toHTMLString"])({ value: pieces[0] }) }); @@ -19500,14 +20868,14 @@ return headingBlock; } - var quotePieces = pieces.slice(1); - var pullquoteBlock = Object(external_this_wp_blocks_["createBlock"])('core/pullquote', pullquote_transforms_objectSpread({}, attrs, { - citation: citation, - value: Object(external_this_wp_richText_["toHTMLString"])({ - value: quotePieces.length ? Object(external_this_wp_richText_["join"])(pieces.slice(1), "\u2028") : Object(external_this_wp_richText_["create"])(), + const quotePieces = pieces.slice(1); + const pullquoteBlock = Object(external_wp_blocks_["createBlock"])('core/pullquote', { ...attrs, + citation, + value: Object(external_wp_richText_["toHTMLString"])({ + value: quotePieces.length ? Object(external_wp_richText_["join"])(pieces.slice(1), '\u2028') : Object(external_wp_richText_["create"])(), multilineTag: 'p' }) - })); + }); return [headingBlock, pullquoteBlock]; } }] @@ -19526,22 +20894,27 @@ - -var pullquote_metadata = { +const pullquote_metadata = { + apiVersion: 2, name: "core/pullquote", + title: "Pullquote", category: "text", + description: "Give special visual emphasis to a quote from your text.", + textdomain: "default", attributes: { value: { type: "string", source: "html", selector: "blockquote", - multiline: "p" + multiline: "p", + __experimentalRole: "content" }, citation: { type: "string", source: "html", selector: "cite", - "default": "" + "default": "", + __experimentalRole: "content" }, mainColor: { type: "string" @@ -19559,408 +20932,140 @@ supports: { anchor: true, align: ["left", "right", "wide", "full"] - } -}; - - -var pullquote_name = pullquote_metadata.name; - -var pullquote_settings = { - title: Object(external_this_wp_i18n_["__"])('Pullquote'), - description: Object(external_this_wp_i18n_["__"])('Give special visual emphasis to a quote from your text.'), + }, + styles: [{ + name: "default", + label: "Default", + isDefault: true + }, { + name: "solid-color", + label: "Solid color" + }], + editorStyle: "wp-block-pullquote-editor", + style: "wp-block-pullquote" +}; + + +const { + name: pullquote_name +} = pullquote_metadata; + +const pullquote_settings = { icon: library_pullquote, example: { attributes: { value: '

    ' + // translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg. - Object(external_this_wp_i18n_["__"])('One of the hardest things to do in technology is disrupt yourself.') + '

    ', - citation: Object(external_this_wp_i18n_["__"])('Matt Mullenweg') - } - }, - styles: [{ - name: 'default', - label: Object(external_this_wp_i18n_["_x"])('Default', 'block style'), - isDefault: true - }, { - name: SOLID_COLOR_STYLE_NAME, - label: Object(external_this_wp_i18n_["__"])('Solid color') - }], + Object(external_wp_i18n_["__"])('One of the hardest things to do in technology is disrupt yourself.') + '

    ', + citation: Object(external_wp_i18n_["__"])('Matt Mullenweg') + } + }, transforms: pullquote_transforms, edit: pullquote_edit, save: pullquote_save_save, deprecated: pullquote_deprecated }; -// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/edit-panel/index.js - - - - - - - - -function edit_panel_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (edit_panel_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function edit_panel_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * WordPress dependencies - */ - - - - - - -var edit_panel_ReusableBlockEditPanel = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(ReusableBlockEditPanel, _Component); - - var _super = edit_panel_createSuper(ReusableBlockEditPanel); - - function ReusableBlockEditPanel() { - var _this; - - Object(classCallCheck["a" /* default */])(this, ReusableBlockEditPanel); - - _this = _super.apply(this, arguments); - _this.titleField = Object(external_this_wp_element_["createRef"])(); - _this.editButton = Object(external_this_wp_element_["createRef"])(); - _this.handleFormSubmit = _this.handleFormSubmit.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.handleTitleChange = _this.handleTitleChange.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.handleTitleKeyDown = _this.handleTitleKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this)); - return _this; - } - - Object(createClass["a" /* default */])(ReusableBlockEditPanel, [{ - key: "componentDidMount", - value: function componentDidMount() { - // Select the input text when the form opens. - if (this.props.isEditing && this.titleField.current) { - this.titleField.current.select(); - } - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - // Select the input text only once when the form opens. - if (!prevProps.isEditing && this.props.isEditing) { - this.titleField.current.select(); - } // Move focus back to the Edit button after pressing the Escape key or Save. - - - if ((prevProps.isEditing || prevProps.isSaving) && !this.props.isEditing && !this.props.isSaving) { - this.editButton.current.focus(); - } - } - }, { - key: "handleFormSubmit", - value: function handleFormSubmit(event) { - event.preventDefault(); - this.props.onSave(); - } - }, { - key: "handleTitleChange", - value: function handleTitleChange(event) { - this.props.onChangeTitle(event.target.value); - } - }, { - key: "handleTitleKeyDown", - value: function handleTitleKeyDown(event) { - if (event.keyCode === external_this_wp_keycodes_["ESCAPE"]) { - event.stopPropagation(); - this.props.onCancel(); - } - } - }, { - key: "render", - value: function render() { - var _this$props = this.props, - isEditing = _this$props.isEditing, - title = _this$props.title, - isSaving = _this$props.isSaving, - isEditDisabled = _this$props.isEditDisabled, - onEdit = _this$props.onEdit, - instanceId = _this$props.instanceId; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, !isEditing && !isSaving && Object(external_this_wp_element_["createElement"])("div", { - className: "reusable-block-edit-panel" - }, Object(external_this_wp_element_["createElement"])("b", { - className: "reusable-block-edit-panel__info" - }, title), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - ref: this.editButton, - isSecondary: true, - className: "reusable-block-edit-panel__button", - disabled: isEditDisabled, - onClick: onEdit - }, Object(external_this_wp_i18n_["__"])('Edit'))), (isEditing || isSaving) && Object(external_this_wp_element_["createElement"])("form", { - className: "reusable-block-edit-panel", - onSubmit: this.handleFormSubmit - }, Object(external_this_wp_element_["createElement"])("label", { - htmlFor: "reusable-block-edit-panel__title-".concat(instanceId), - className: "reusable-block-edit-panel__label" - }, Object(external_this_wp_i18n_["__"])('Name:')), Object(external_this_wp_element_["createElement"])("input", { - ref: this.titleField, - type: "text", - disabled: isSaving, - className: "reusable-block-edit-panel__title", - value: title, - onChange: this.handleTitleChange, - onKeyDown: this.handleTitleKeyDown, - id: "reusable-block-edit-panel__title-".concat(instanceId) - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { - type: "submit", - isSecondary: true, - isBusy: isSaving, - disabled: !title || isSaving, - className: "reusable-block-edit-panel__button" - }, Object(external_this_wp_i18n_["__"])('Save')))); - } - }]); - - return ReusableBlockEditPanel; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var edit_panel = (Object(external_this_wp_compose_["withInstanceId"])(edit_panel_ReusableBlockEditPanel)); +// EXTERNAL MODULE: external ["wp","reusableBlocks"] +var external_wp_reusableBlocks_ = __webpack_require__("diJD"); + +// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/ungroup.js + + +/** + * WordPress dependencies + */ + +const ungroup = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { + d: "M18 4h-7c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 9c0 .3-.2.5-.5.5h-7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7zm-5 5c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h1V9H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-1h-1.5v1z" +})); +/* harmony default export */ var library_ungroup = (ungroup); // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/edit.js - - - - - - -function block_edit_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (block_edit_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; } - -function block_edit_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -/** - * External dependencies - */ - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - - - -var edit_ReusableBlockEdit = /*#__PURE__*/function (_Component) { - Object(inherits["a" /* default */])(ReusableBlockEdit, _Component); - - var _super = block_edit_createSuper(ReusableBlockEdit); - - function ReusableBlockEdit(_ref) { - var _this; - - var reusableBlock = _ref.reusableBlock; - - Object(classCallCheck["a" /* default */])(this, ReusableBlockEdit); - - _this = _super.apply(this, arguments); - _this.startEditing = _this.startEditing.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.stopEditing = _this.stopEditing.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setBlocks = _this.setBlocks.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.setTitle = _this.setTitle.bind(Object(assertThisInitialized["a" /* default */])(_this)); - _this.save = _this.save.bind(Object(assertThisInitialized["a" /* default */])(_this)); - - if (reusableBlock) { - // Start in edit mode when we're working with a newly created reusable block - _this.state = { - isEditing: reusableBlock.isTemporary, - title: reusableBlock.title, - blocks: Object(external_this_wp_blocks_["parse"])(reusableBlock.content) - }; - } else { - // Start in preview mode when we're working with an existing reusable block - _this.state = { - isEditing: false, - title: null, - blocks: [] - }; - } - - return _this; - } - - Object(createClass["a" /* default */])(ReusableBlockEdit, [{ - key: "componentDidMount", - value: function componentDidMount() { - if (!this.props.reusableBlock) { - this.props.fetchReusableBlock(); - } - } - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - if (prevProps.reusableBlock !== this.props.reusableBlock && this.state.title === null) { - this.setState({ - title: this.props.reusableBlock.title, - blocks: Object(external_this_wp_blocks_["parse"])(this.props.reusableBlock.content) - }); - } - } - }, { - key: "startEditing", - value: function startEditing() { - var reusableBlock = this.props.reusableBlock; - this.setState({ - isEditing: true, - title: reusableBlock.title, - blocks: Object(external_this_wp_blocks_["parse"])(reusableBlock.content) - }); - } - }, { - key: "stopEditing", - value: function stopEditing() { - this.setState({ - isEditing: false, - title: null, - blocks: [] - }); - } - }, { - key: "setBlocks", - value: function setBlocks(blocks) { - this.setState({ - blocks: blocks - }); - } - }, { - key: "setTitle", - value: function setTitle(title) { - this.setState({ - title: title - }); - } - }, { - key: "save", - value: function save() { - var _this$props = this.props, - onChange = _this$props.onChange, - onSave = _this$props.onSave; - var _this$state = this.state, - blocks = _this$state.blocks, - title = _this$state.title; - var content = Object(external_this_wp_blocks_["serialize"])(blocks); - onChange({ - title: title, - content: content - }); - onSave(); - this.stopEditing(); - } - }, { - key: "render", - value: function render() { - var _this$props2 = this.props, - isSelected = _this$props2.isSelected, - reusableBlock = _this$props2.reusableBlock, - isFetching = _this$props2.isFetching, - isSaving = _this$props2.isSaving, - canUpdateBlock = _this$props2.canUpdateBlock, - settings = _this$props2.settings; - var _this$state2 = this.state, - isEditing = _this$state2.isEditing, - title = _this$state2.title, - blocks = _this$state2.blocks; - - if (!reusableBlock && isFetching) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Spinner"], null)); - } - - if (!reusableBlock) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], null, Object(external_this_wp_i18n_["__"])('Block has been deleted or is unavailable.')); - } - - var element = Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockEditorProvider"], { - settings: settings, - value: blocks, - onChange: this.setBlocks, - onInput: this.setBlocks - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["WritingFlow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockList"], null))); - - if (!isEditing) { - element = Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, element); - } - - return Object(external_this_wp_element_["createElement"])("div", { - className: "block-library-block__reusable-block-container" - }, (isSelected || isEditing) && Object(external_this_wp_element_["createElement"])(edit_panel, { - isEditing: isEditing, - title: title !== null ? title : reusableBlock.title, - isSaving: isSaving && !reusableBlock.isTemporary, - isEditDisabled: !canUpdateBlock, - onEdit: this.startEditing, - onChangeTitle: this.setTitle, - onSave: this.save, - onCancel: this.stopEditing - }), element); - } - }]); - - return ReusableBlockEdit; -}(external_this_wp_element_["Component"]); - -/* harmony default export */ var block_edit = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, ownProps) { - var _select = select('core/editor'), - getReusableBlock = _select.__experimentalGetReusableBlock, - isFetchingReusableBlock = _select.__experimentalIsFetchingReusableBlock, - isSavingReusableBlock = _select.__experimentalIsSavingReusableBlock; - - var _select2 = select('core'), - canUser = _select2.canUser; - - var _select3 = select('core/block-editor'), - __experimentalGetParsedReusableBlock = _select3.__experimentalGetParsedReusableBlock, - getSettings = _select3.getSettings; - - var ref = ownProps.attributes.ref; - var reusableBlock = getReusableBlock(ref); - return { - reusableBlock: reusableBlock, - isFetching: isFetchingReusableBlock(ref), - isSaving: isSavingReusableBlock(ref), - blocks: reusableBlock ? __experimentalGetParsedReusableBlock(reusableBlock.id) : null, - canUpdateBlock: !!reusableBlock && !reusableBlock.isTemporary && !!canUser('update', 'blocks', ref), - settings: getSettings() - }; -}), Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps) { - var _dispatch = dispatch('core/editor'), - fetchReusableBlocks = _dispatch.__experimentalFetchReusableBlocks, - updateReusableBlock = _dispatch.__experimentalUpdateReusableBlock, - saveReusableBlock = _dispatch.__experimentalSaveReusableBlock; - - var ref = ownProps.attributes.ref; - return { - fetchReusableBlock: Object(external_this_lodash_["partial"])(fetchReusableBlocks, ref), - onChange: Object(external_this_lodash_["partial"])(updateReusableBlock, ref), - onSave: Object(external_this_lodash_["partial"])(saveReusableBlock, ref) - }; -})])(edit_ReusableBlockEdit)); +/** + * WordPress dependencies + */ + + + + + + + +function ReusableBlockEdit({ + attributes: { + ref + }, + clientId +}) { + const [hasAlreadyRendered, RecursionProvider] = Object(external_wp_blockEditor_["__experimentalUseNoRecursiveRenders"])(ref); + const { + isMissing, + hasResolved + } = Object(external_wp_data_["useSelect"])(select => { + const persistedBlock = select(external_wp_coreData_["store"]).getEntityRecord('postType', 'wp_block', ref); + const hasResolvedBlock = select(external_wp_coreData_["store"]).hasFinishedResolution('getEntityRecord', ['postType', 'wp_block', ref]); + return { + hasResolved: hasResolvedBlock, + isMissing: hasResolvedBlock && !persistedBlock + }; + }, [ref, clientId]); + const { + __experimentalConvertBlockToStatic: convertBlockToStatic + } = Object(external_wp_data_["useDispatch"])(external_wp_reusableBlocks_["store"]); + const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('postType', 'wp_block', { + id: ref + }); + const [title, setTitle] = Object(external_wp_coreData_["useEntityProp"])('postType', 'wp_block', 'title', ref); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({}, { + value: blocks, + onInput, + onChange, + renderAppender: blocks !== null && blocks !== void 0 && blocks.length ? undefined : external_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender + }); + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + + if (hasAlreadyRendered) { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], null, Object(external_wp_i18n_["__"])('Block cannot be rendered inside itself.'))); + } + + if (isMissing) { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], null, Object(external_wp_i18n_["__"])('Block has been deleted or is unavailable.'))); + } + + if (!hasResolved) { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null))); + } + + return Object(external_wp_element_["createElement"])(RecursionProvider, null, Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + onClick: () => convertBlockToStatic(clientId), + label: Object(external_wp_i18n_["__"])('Convert to regular blocks'), + icon: library_ungroup, + showTooltip: true + }))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + label: Object(external_wp_i18n_["__"])('Name'), + value: title, + onChange: setTitle + }))), Object(external_wp_element_["createElement"])("div", { + className: "block-library-block__reusable-block-container" + }, Object(external_wp_element_["createElement"])("div", innerBlocksProps)))); +} // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/block/index.js /** - * WordPress dependencies - */ - -/** - * Internal dependencies - */ - -var block_metadata = { + * Internal dependencies + */ +const block_metadata = { + apiVersion: 2, name: "core/block", + title: "Reusable block", category: "reusable", + description: "Create and save content to reuse across your site. Update the block, and the changes apply everywhere it\u2019s used.", + textdomain: "default", attributes: { ref: { type: "number" @@ -19970,15 +21075,16 @@ customClassName: false, html: false, inserter: false - } -}; - -var block_name = block_metadata.name; - -var block_settings = { - title: Object(external_this_wp_i18n_["__"])('Reusable Block'), - description: Object(external_this_wp_i18n_["__"])('Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used.'), - edit: block_edit + }, + editorStyle: "wp-block-editor" +}; + +const { + name: block_name +} = block_metadata; + +const block_settings = { + edit: ReusableBlockEdit }; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/rss.js @@ -19988,10 +21094,10 @@ * WordPress dependencies */ -var rss = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const rss = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M5 10.2h-.8v1.5H5c1.9 0 3.8.8 5.1 2.1 1.4 1.4 2.1 3.2 2.1 5.1v.8h1.5V19c0-2.3-.9-4.5-2.6-6.2-1.6-1.6-3.8-2.6-6.1-2.6zm10.4-1.6C12.6 5.8 8.9 4.2 5 4.2h-.8v1.5H5c3.5 0 6.9 1.4 9.4 3.9s3.9 5.8 3.9 9.4v.8h1.5V19c0-3.9-1.6-7.6-4.4-10.4zM4 20h3v-3H4v3z" })); /* harmony default export */ var library_rss = (rss); @@ -19999,41 +21105,39 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/rss/edit.js - - -/** - * WordPress dependencies - */ - - - - - - -var DEFAULT_MIN_ITEMS = 1; -var DEFAULT_MAX_ITEMS = 10; -function RSSEdit(_ref) { - var attributes = _ref.attributes, - setAttributes = _ref.setAttributes; - - var _useState = Object(external_this_wp_element_["useState"])(!attributes.feedURL), - _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), - isEditing = _useState2[0], - setIsEditing = _useState2[1]; - - var blockLayout = attributes.blockLayout, - columns = attributes.columns, - displayAuthor = attributes.displayAuthor, - displayDate = attributes.displayDate, - displayExcerpt = attributes.displayExcerpt, - excerptLength = attributes.excerptLength, - feedURL = attributes.feedURL, - itemsToShow = attributes.itemsToShow; +/** + * WordPress dependencies + */ + + + + + + +const DEFAULT_MIN_ITEMS = 1; +const DEFAULT_MAX_ITEMS = 10; +function RSSEdit({ + attributes, + setAttributes +}) { + const [isEditing, setIsEditing] = Object(external_wp_element_["useState"])(!attributes.feedURL); + const { + blockLayout, + columns, + displayAuthor, + displayDate, + displayExcerpt, + excerptLength, + feedURL, + itemsToShow + } = attributes; function toggleAttribute(propName) { - return function () { - var value = attributes[propName]; - setAttributes(Object(defineProperty["a" /* default */])({}, propName, !value)); + return () => { + const value = attributes[propName]; + setAttributes({ + [propName]: !value + }); }; } @@ -20045,106 +21149,94 @@ } } + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + if (isEditing) { - return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Placeholder"], { + return Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_components_["Placeholder"], { icon: library_rss, label: "RSS" - }, Object(external_this_wp_element_["createElement"])("form", { + }, Object(external_wp_element_["createElement"])("form", { onSubmit: onSubmitURL, className: "wp-block-rss__placeholder-form" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["TextControl"], { - placeholder: Object(external_this_wp_i18n_["__"])('Enter URL here…'), + }, Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], { + placeholder: Object(external_wp_i18n_["__"])('Enter URL here…'), value: feedURL, - onChange: function onChange(value) { - return setAttributes({ - feedURL: value - }); - }, + onChange: value => setAttributes({ + feedURL: value + }), className: "wp-block-rss__placeholder-input" - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Button"], { + }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { isPrimary: true, type: "submit" - }, Object(external_this_wp_i18n_["__"])('Use URL')))); - } - - var toolbarControls = [{ - icon: pencil["a" /* default */], - title: Object(external_this_wp_i18n_["__"])('Edit RSS URL'), - onClick: function onClick() { - return setIsEditing(true); - } + }, Object(external_wp_i18n_["__"])('Use URL'))))); + } + + const toolbarControls = [{ + icon: library_edit["a" /* default */], + title: Object(external_wp_i18n_["__"])('Edit RSS URL'), + onClick: () => setIsEditing(true) }, { icon: library_list, - title: Object(external_this_wp_i18n_["__"])('List view'), - onClick: function onClick() { - return setAttributes({ - blockLayout: 'list' - }); - }, + title: Object(external_wp_i18n_["__"])('List view'), + onClick: () => setAttributes({ + blockLayout: 'list' + }), isActive: blockLayout === 'list' }, { icon: grid["a" /* default */], - title: Object(external_this_wp_i18n_["__"])('Grid view'), - onClick: function onClick() { - return setAttributes({ - blockLayout: 'grid' - }); - }, + title: Object(external_wp_i18n_["__"])('Grid view'), + onClick: () => setAttributes({ + blockLayout: 'grid' + }), isActive: blockLayout === 'grid' }]; - return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToolbarGroup"], { + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], { controls: toolbarControls - })), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InspectorControls"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["PanelBody"], { - title: Object(external_this_wp_i18n_["__"])('RSS settings') - }, Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Number of items'), + })), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('RSS settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Number of items'), value: itemsToShow, - onChange: function onChange(value) { - return setAttributes({ - itemsToShow: value - }); - }, + onChange: value => setAttributes({ + itemsToShow: value + }), min: DEFAULT_MIN_ITEMS, max: DEFAULT_MAX_ITEMS, required: true - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display author'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display author'), checked: displayAuthor, onChange: toggleAttribute('displayAuthor') - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display date'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display date'), checked: displayDate, onChange: toggleAttribute('displayDate') - }), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["ToggleControl"], { - label: Object(external_this_wp_i18n_["__"])('Display excerpt'), + }), Object(external_wp_element_["createElement"])(external_wp_components_["ToggleControl"], { + label: Object(external_wp_i18n_["__"])('Display excerpt'), checked: displayExcerpt, onChange: toggleAttribute('displayExcerpt') - }), displayExcerpt && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Max number of words in excerpt'), + }), displayExcerpt && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Max number of words in excerpt'), value: excerptLength, - onChange: function onChange(value) { - return setAttributes({ - excerptLength: value - }); - }, + onChange: value => setAttributes({ + excerptLength: value + }), min: 10, max: 100, required: true - }), blockLayout === 'grid' && Object(external_this_wp_element_["createElement"])(external_this_wp_components_["RangeControl"], { - label: Object(external_this_wp_i18n_["__"])('Columns'), + }), blockLayout === 'grid' && Object(external_wp_element_["createElement"])(external_wp_components_["RangeControl"], { + label: Object(external_wp_i18n_["__"])('Columns'), value: columns, - onChange: function onChange(value) { - return setAttributes({ - columns: value - }); - }, + onChange: value => setAttributes({ + columns: value + }), min: 2, max: 6, required: true - }))), Object(external_this_wp_element_["createElement"])(external_this_wp_components_["Disabled"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_serverSideRender_default.a, { + }))), Object(external_wp_element_["createElement"])("div", blockProps, Object(external_wp_element_["createElement"])(external_wp_components_["Disabled"], null, Object(external_wp_element_["createElement"])(external_wp_serverSideRender_default.a, { block: "core/rss", attributes: attributes - }))); + })))); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/rss/index.js @@ -20152,22 +21244,19 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var rss_metadata = { +/** + * Internal dependencies + */ + +const rss_metadata = { + apiVersion: 2, name: "core/rss", + title: "RSS", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Display entries from any RSS or Atom feed.", + keywords: ["atom", "feed"], + textdomain: "default", + attributes: { columns: { type: "number", "default": 2 @@ -20204,16 +21293,17 @@ supports: { align: true, html: false - } -}; - -var rss_name = rss_metadata.name; - -var rss_settings = { - title: Object(external_this_wp_i18n_["__"])('RSS'), - description: Object(external_this_wp_i18n_["__"])('Display entries from any RSS or Atom feed.'), + }, + editorStyle: "wp-block-rss-editor", + style: "wp-block-rss" +}; + +const { + name: rss_name +} = rss_metadata; + +const rss_settings = { icon: library_rss, - keywords: [Object(external_this_wp_i18n_["__"])('atom'), Object(external_this_wp_i18n_["__"])('feed')], example: { attributes: { feedURL: 'https://wordpress.org' @@ -20222,59 +21312,406 @@ edit: RSSEdit }; +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/icons.js + + +/** + * WordPress dependencies + */ + +const buttonOnly = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "7", + y: "10", + width: "10", + height: "4", + rx: "1", + fill: "currentColor" +})); +const buttonOutside = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4.75", + y: "15.25", + width: "6.5", + height: "9.5", + transform: "rotate(-90 4.75 15.25)", + stroke: "currentColor", + strokeWidth: "1.5", + fill: "none" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "16", + y: "10", + width: "4", + height: "4", + rx: "1", + fill: "currentColor" +})); +const buttonInside = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4.75", + y: "15.25", + width: "6.5", + height: "14.5", + transform: "rotate(-90 4.75 15.25)", + stroke: "currentColor", + strokeWidth: "1.5", + fill: "none" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "14", + y: "10", + width: "4", + height: "4", + rx: "1", + fill: "currentColor" +})); +const noButton = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4.75", + y: "15.25", + width: "6.5", + height: "14.5", + transform: "rotate(-90 4.75 15.25)", + stroke: "currentColor", + fill: "none", + strokeWidth: "1.5" +})); +const buttonWithIcon = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4.75", + y: "7.75", + width: "14.5", + height: "8.5", + rx: "1.25", + stroke: "currentColor", + fill: "none", + strokeWidth: "1.5" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "8", + y: "11", + width: "8", + height: "2", + fill: "currentColor" +})); +const toggleLabel = Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4.75", + y: "17.25", + width: "5.5", + height: "14.5", + transform: "rotate(-90 4.75 17.25)", + stroke: "currentColor", + fill: "none", + strokeWidth: "1.5" +}), Object(external_wp_element_["createElement"])(external_wp_components_["Rect"], { + x: "4", + y: "7", + width: "10", + height: "2", + fill: "currentColor" +})); + +// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/utils.js +/** + * Constants + */ +const PC_WIDTH_DEFAULT = 50; +const PX_WIDTH_DEFAULT = 350; +const MIN_WIDTH = 220; +const MIN_WIDTH_UNIT = 'px'; +/** + * Returns a boolean whether passed unit is percentage + * + * @param {string} unit Block width unit. + * + * @return {boolean} Whether unit is '%'. + */ + +function utils_isPercentageUnit(unit) { + return unit === '%'; +} + // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/edit.js /** - * WordPress dependencies - */ - - -function SearchEdit(_ref) { - var className = _ref.className, - attributes = _ref.attributes, - setAttributes = _ref.setAttributes; - var label = attributes.label, - placeholder = attributes.placeholder, - buttonText = attributes.buttonText; - return Object(external_this_wp_element_["createElement"])("div", { - className: className - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { + * External dependencies + */ + +/** + * WordPress dependencies + */ + + + + + + +/** + * Internal dependencies + */ + + + // Used to calculate border radius adjustment to avoid "fat" corners when +// button is placed inside wrapper. + +const DEFAULT_INNER_PADDING = 4; +function SearchEdit({ + className, + attributes, + setAttributes, + toggleSelection, + isSelected +}) { + var _style$border; + + const { + label, + showLabel, + placeholder, + width, + widthUnit, + align, + buttonText, + buttonPosition, + buttonUseIcon, + style + } = attributes; + const borderRadius = style === null || style === void 0 ? void 0 : (_style$border = style.border) === null || _style$border === void 0 ? void 0 : _style$border.radius; + const unitControlInstanceId = Object(external_wp_compose_["useInstanceId"])(external_wp_blockEditor_["__experimentalUnitControl"]); + const unitControlInputId = `wp-block-search__width-${unitControlInstanceId}`; + const units = Object(external_wp_components_["__experimentalUseCustomUnits"])({ + availableUnits: ['%', 'px'], + defaultValues: { + '%': PC_WIDTH_DEFAULT, + px: PX_WIDTH_DEFAULT + } + }); + + const getBlockClassNames = () => { + return classnames_default()(className, 'button-inside' === buttonPosition ? 'wp-block-search__button-inside' : undefined, 'button-outside' === buttonPosition ? 'wp-block-search__button-outside' : undefined, 'no-button' === buttonPosition ? 'wp-block-search__no-button' : undefined, 'button-only' === buttonPosition ? 'wp-block-search__button-only' : undefined, !buttonUseIcon && 'no-button' !== buttonPosition ? 'wp-block-search__text-button' : undefined, buttonUseIcon && 'no-button' !== buttonPosition ? 'wp-block-search__icon-button' : undefined); + }; + + const getButtonPositionIcon = () => { + switch (buttonPosition) { + case 'button-inside': + return buttonInside; + + case 'button-outside': + return buttonOutside; + + case 'no-button': + return noButton; + + case 'button-only': + return buttonOnly; + } + }; + + const getResizableSides = () => { + if ('button-only' === buttonPosition) { + return {}; + } + + return { + right: align === 'right' ? false : true, + left: align === 'right' ? true : false + }; + }; + + const renderTextField = () => { + return Object(external_wp_element_["createElement"])("input", { + className: "wp-block-search__input", + style: { + borderRadius + }, + "aria-label": Object(external_wp_i18n_["__"])('Optional placeholder text') // We hide the placeholder field's placeholder when there is a value. This + // stops screen readers from reading the placeholder field's placeholder + // which is confusing. + , + placeholder: placeholder ? undefined : Object(external_wp_i18n_["__"])('Optional placeholder…'), + value: placeholder, + onChange: event => setAttributes({ + placeholder: event.target.value + }) + }); + }; + + const renderButton = () => { + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, buttonUseIcon && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { + icon: library_search["a" /* default */], + className: "wp-block-search__button", + style: { + borderRadius + } + }), !buttonUseIcon && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { + className: "wp-block-search__button", + style: { + borderRadius + }, + "aria-label": Object(external_wp_i18n_["__"])('Button text'), + placeholder: Object(external_wp_i18n_["__"])('Add button text…'), + withoutInteractiveFormatting: true, + value: buttonText, + onChange: html => setAttributes({ + buttonText: html + }) + })); + }; + + const controls = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + title: Object(external_wp_i18n_["__"])('Toggle search label'), + icon: toggleLabel, + onClick: () => { + setAttributes({ + showLabel: !showLabel + }); + }, + className: showLabel ? 'is-pressed' : undefined + }), Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { + icon: getButtonPositionIcon(), + label: Object(external_wp_i18n_["__"])('Change button position') + }, ({ + onClose + }) => Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { + className: "wp-block-search__button-position-menu" + }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { + icon: noButton, + onClick: () => { + setAttributes({ + buttonPosition: 'no-button' + }); + onClose(); + } + }, Object(external_wp_i18n_["__"])('No Button')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { + icon: buttonOutside, + onClick: () => { + setAttributes({ + buttonPosition: 'button-outside' + }); + onClose(); + } + }, Object(external_wp_i18n_["__"])('Button Outside')), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { + icon: buttonInside, + onClick: () => { + setAttributes({ + buttonPosition: 'button-inside' + }); + onClose(); + } + }, Object(external_wp_i18n_["__"])('Button Inside')))), 'no-button' !== buttonPosition && Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { + title: Object(external_wp_i18n_["__"])('Use button with icon'), + icon: buttonWithIcon, + onClick: () => { + setAttributes({ + buttonUseIcon: !buttonUseIcon + }); + }, + className: buttonUseIcon ? 'is-pressed' : undefined + }))), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { + title: Object(external_wp_i18n_["__"])('Display Settings') + }, Object(external_wp_element_["createElement"])(external_wp_components_["BaseControl"], { + label: Object(external_wp_i18n_["__"])('Width'), + id: unitControlInputId + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalUnitControl"], { + id: unitControlInputId, + min: `${MIN_WIDTH}${MIN_WIDTH_UNIT}`, + onChange: newWidth => { + const filteredWidth = widthUnit === '%' && parseInt(newWidth, 10) > 100 ? 100 : newWidth; + setAttributes({ + width: parseInt(filteredWidth, 10) + }); + }, + onUnitChange: newUnit => { + setAttributes({ + width: '%' === newUnit ? PC_WIDTH_DEFAULT : PX_WIDTH_DEFAULT, + widthUnit: newUnit + }); + }, + style: { + maxWidth: 80 + }, + value: `${width}${widthUnit}`, + unit: widthUnit, + units: units + }), Object(external_wp_element_["createElement"])(external_wp_components_["ButtonGroup"], { + className: "wp-block-search__components-button-group", + "aria-label": Object(external_wp_i18n_["__"])('Percentage Width') + }, [25, 50, 75, 100].map(widthValue => { + return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { + key: widthValue, + isSmall: true, + isPrimary: `${widthValue}%` === `${width}${widthUnit}`, + onClick: () => setAttributes({ + width: widthValue, + widthUnit: '%' + }) + }, widthValue, "%"); + })))))); + + const getWrapperStyles = () => { + var _style$border2; + + if ('button-inside' === buttonPosition && style !== null && style !== void 0 && (_style$border2 = style.border) !== null && _style$border2 !== void 0 && _style$border2.radius) { + var _style$border3; + + // We have button inside wrapper and a border radius value to apply. + // Add default padding so we don't get "fat" corners. + const outerRadius = parseInt(style === null || style === void 0 ? void 0 : (_style$border3 = style.border) === null || _style$border3 === void 0 ? void 0 : _style$border3.radius, 10) + DEFAULT_INNER_PADDING; + return { + borderRadius: `${outerRadius}px` + }; + } + + return undefined; + }; + + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])({ + className: getBlockClassNames() + }); + return Object(external_wp_element_["createElement"])("div", blockProps, controls, showLabel && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["RichText"], { className: "wp-block-search__label", - "aria-label": Object(external_this_wp_i18n_["__"])('Label text'), - placeholder: Object(external_this_wp_i18n_["__"])('Add label…'), + "aria-label": Object(external_wp_i18n_["__"])('Label text'), + placeholder: Object(external_wp_i18n_["__"])('Add label…'), withoutInteractiveFormatting: true, value: label, - onChange: function onChange(html) { - return setAttributes({ - label: html - }); - } - }), Object(external_this_wp_element_["createElement"])("input", { - className: "wp-block-search__input", - "aria-label": Object(external_this_wp_i18n_["__"])('Optional placeholder text') // We hide the placeholder field's placeholder when there is a value. This - // stops screen readers from reading the placeholder field's placeholder - // which is confusing. - , - placeholder: placeholder ? undefined : Object(external_this_wp_i18n_["__"])('Optional placeholder…'), - value: placeholder, - onChange: function onChange(event) { - return setAttributes({ - placeholder: event.target.value - }); - } - }), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], { - className: "wp-block-search__button", - "aria-label": Object(external_this_wp_i18n_["__"])('Button text'), - placeholder: Object(external_this_wp_i18n_["__"])('Add button text…'), - withoutInteractiveFormatting: true, - value: buttonText, - onChange: function onChange(html) { - return setAttributes({ - buttonText: html - }); - } - })); + onChange: html => setAttributes({ + label: html + }) + }), Object(external_wp_element_["createElement"])(external_wp_components_["ResizableBox"], { + size: { + width: `${width}${widthUnit}` + }, + className: "wp-block-search__inside-wrapper", + style: getWrapperStyles(), + minWidth: MIN_WIDTH, + enable: getResizableSides(), + onResizeStart: (event, direction, elt) => { + setAttributes({ + width: parseInt(elt.offsetWidth, 10), + widthUnit: 'px' + }); + toggleSelection(false); + }, + onResizeStop: (event, direction, elt, delta) => { + setAttributes({ + width: parseInt(width + delta.width, 10) + }); + toggleSelection(true); + }, + showHandle: isSelected + }, ('button-inside' === buttonPosition || 'button-outside' === buttonPosition) && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, renderTextField(), renderButton()), 'button-only' === buttonPosition && renderButton(), 'no-button' === buttonPosition && renderTextField())); } // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/variations.js @@ -20282,12 +21719,12 @@ * WordPress dependencies */ -var search_variations_variations = [{ +const search_variations_variations = [{ name: 'default', isDefault: true, attributes: { - buttonText: Object(external_this_wp_i18n_["__"])('Search'), - label: Object(external_this_wp_i18n_["__"])('Search') + buttonText: Object(external_wp_i18n_["__"])('Search'), + label: Object(external_wp_i18n_["__"])('Search') } }]; /* harmony default export */ var search_variations = (search_variations_variations); @@ -20297,47 +21734,70 @@ * WordPress dependencies */ - -/** - * Internal dependencies - */ - -var search_metadata = { +/** + * Internal dependencies + */ + +const search_metadata = { + apiVersion: 2, name: "core/search", + title: "Search", category: "widgets", - attributes: { - align: { - type: "string", - "enum": ["left", "center", "right", "wide", "full"] - }, - className: { - type: "string" - }, + description: "Help visitors find your content.", + keywords: ["find"], + textdomain: "default", + attributes: { label: { - type: "string" + type: "string", + __experimentalRole: "content" + }, + showLabel: { + type: "boolean", + "default": true }, placeholder: { type: "string", - "default": "" + "default": "", + __experimentalRole: "content" + }, + width: { + type: "number" + }, + widthUnit: { + type: "string" }, buttonText: { - type: "string" - } - }, - supports: { - align: true, + type: "string", + __experimentalRole: "content" + }, + buttonPosition: { + type: "string", + "default": "button-outside" + }, + buttonUseIcon: { + type: "boolean", + "default": false + } + }, + supports: { + align: ["left", "center", "right"], + __experimentalBorder: { + radius: true, + __experimentalSkipSerialization: true + }, html: false - } -}; - - -var search_name = search_metadata.name; - -var search_settings = { - title: Object(external_this_wp_i18n_["__"])('Search'), - description: Object(external_this_wp_i18n_["__"])('Help visitors find your content.'), - icon: search["a" /* default */], - keywords: [Object(external_this_wp_i18n_["__"])('find')], + }, + editorStyle: "wp-block-search-editor", + style: "wp-block-search" +}; + + +const { + name: search_name +} = search_metadata; + +const search_settings = { + icon: library_search["a" /* default */], example: {}, variations: search_variations, edit: SearchEdit @@ -20350,10 +21810,10 @@ * WordPress dependencies */ -var group = Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["SVG"], { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, Object(external_this_wp_element_["createElement"])(external_this_wp_primitives_["Path"], { +const group = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], { d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" })); /* harmony default export */ var library_group = (group); @@ -20361,34 +21821,29 @@ // CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/group/deprecated.js - -function group_deprecated_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function group_deprecated_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { group_deprecated_ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { group_deprecated_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/** - * External dependencies - */ - - -/** - * WordPress dependencies - */ - - - -var deprecated_migrateAttributes = function migrateAttributes(attributes) { +/** + * External dependencies + */ + + +/** + * WordPress dependencies + */ + + + +const migrateAttributes = attributes => { if (!attributes.tagName) { - attributes = group_deprecated_objectSpread({}, attributes, { + attributes = { ...attributes, tagName: 'div' - }); + }; } if (!attributes.customTextColor && !attributes.customBackgroundColor) { return attributes; } - var style = { + const style = { color: {} }; @@ -20400,12 +21855,49 @@ style.color.background = attributes.customBackgroundColor; } - return group_deprecated_objectSpread({}, Object(external_this_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor']), { - style: style - }); -}; - -var group_deprecated_deprecated = [// Version of the block without global styles support + return { ...Object(external_lodash_["omit"])(attributes, ['customTextColor', 'customBackgroundColor']), + style + }; +}; + +const group_deprecated_deprecated = [// Version of the block with the double div. +{ + attributes: { + tagName: { + type: 'string', + default: 'div' + }, + templateLock: { + type: 'string' + } + }, + supports: { + align: ['wide', 'full'], + anchor: true, + color: { + gradients: true, + link: true + }, + spacing: { + padding: true + }, + __experimentalBorder: { + radius: true + } + }, + + save({ + attributes + }) { + const { + tagName: Tag + } = attributes; + return Object(external_wp_element_["createElement"])(Tag, external_wp_blockEditor_["useBlockProps"].save(), Object(external_wp_element_["createElement"])("div", { + className: "wp-block-group__inner-container" + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + +}, // Version of the block without global styles support { attributes: { backgroundColor: { @@ -20426,30 +21918,35 @@ anchor: true, html: false }, - migrate: deprecated_migrateAttributes, - save: function save(_ref) { - var attributes = _ref.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()(backgroundClass, textClass, { + migrate: migrateAttributes, + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + textColor, + customTextColor + } = attributes; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()(backgroundClass, textClass, { 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor }); - var styles = { + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", { className: className, style: styles - }, Object(external_this_wp_element_["createElement"])("div", { + }, Object(external_wp_element_["createElement"])("div", { className: "wp-block-group__inner-container" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + }, // Version of the group block with a bug that made text color class not applied. { attributes: { @@ -20466,35 +21963,40 @@ type: 'string' } }, - migrate: deprecated_migrateAttributes, + migrate: migrateAttributes, supports: { align: ['wide', 'full'], anchor: true, html: false }, - save: function save(_ref2) { - var attributes = _ref2.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor, - textColor = attributes.textColor, - customTextColor = attributes.customTextColor; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var textClass = Object(external_this_wp_blockEditor_["getColorClassName"])('color', textColor); - var className = classnames_default()(backgroundClass, { + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor, + textColor, + customTextColor + } = attributes; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const textClass = Object(external_wp_blockEditor_["getColorClassName"])('color', textColor); + const className = classnames_default()(backgroundClass, { 'has-text-color': textColor || customTextColor, 'has-background': backgroundColor || customBackgroundColor }); - var styles = { + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor, color: textClass ? undefined : customTextColor }; - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", { className: className, style: styles - }, Object(external_this_wp_element_["createElement"])("div", { + }, Object(external_wp_element_["createElement"])("div", { className: "wp-block-group__inner-container" - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null))); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null))); + } + }, // v1 of group block. Deprecated to add an inner-container div around `InnerBlocks.Content`. { attributes: { @@ -20510,23 +22012,28 @@ anchor: true, html: false }, - migrate: deprecated_migrateAttributes, - save: function save(_ref3) { - var attributes = _ref3.attributes; - var backgroundColor = attributes.backgroundColor, - customBackgroundColor = attributes.customBackgroundColor; - var backgroundClass = Object(external_this_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); - var className = classnames_default()(backgroundClass, { + migrate: migrateAttributes, + + save({ + attributes + }) { + const { + backgroundColor, + customBackgroundColor + } = attributes; + const backgroundClass = Object(external_wp_blockEditor_["getColorClassName"])('background-color', backgroundColor); + const className = classnames_default()(backgroundClass, { 'has-background': backgroundColor || customBackgroundColor }); - var styles = { + const styles = { backgroundColor: backgroundClass ? undefined : customBackgroundColor }; - return Object(external_this_wp_element_["createElement"])("div", { + return Object(external_wp_element_["createElement"])("div", { className: className, style: styles - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].Content, null)); - } + }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InnerBlocks"].Content, null)); + } + }]; /* harmony default export */ var group_deprecated = (group_deprecated_deprecated); @@ -20539,29 +22046,92 @@ -function GroupEdit(_ref) { - var attributes = _ref.attributes, - className = _ref.className, - clientId = _ref.clientId; - var hasInnerBlocks = Object(external_this_wp_data_["useSelect"])(function (select) { - var _select = select('core/block-editor'), - getBlock = _select.getBlock; - - var block = getBlock(clientId); - return !!(block && block.innerBlocks.length); + + + +function GroupEdit({ + attributes, + setAttributes, + clientId +}) { + const { + hasInnerBlocks, + themeSupportsLayout + } = Object(external_wp_data_["useSelect"])(select => { + var _getSettings; + + const { + getBlock, + getSettings + } = select(external_wp_blockEditor_["store"]); + const block = getBlock(clientId); + return { + hasInnerBlocks: !!(block && block.innerBlocks.length), + themeSupportsLayout: (_getSettings = getSettings()) === null || _getSettings === void 0 ? void 0 : _getSettings.supportsLayout + }; }, [clientId]); - var BlockWrapper = external_this_wp_blockEditor_["__experimentalBlock"][attributes.tagName]; - return Object(external_this_wp_element_["createElement"])(BlockWrapper, { - className: className - }, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"], { - renderAppender: hasInnerBlocks ? undefined : function () { - return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender, null); - }, - __experimentalTagName: "div", - __experimentalPassedProps: { - className: 'wp-block-group__inner-container' - } - })); + const defaultLayout = Object(external_wp_blockEditor_["useSetting"])('layout') || {}; + const { + tagName: TagName = 'div', + templateLock, + layout = {} + } = attributes; + const usedLayout = !!layout && layout.inherit ? defaultLayout : layout; + const { + contentSize, + wideSize + } = usedLayout; + + const _layout = Object(external_wp_element_["useMemo"])(() => { + if (themeSupportsLayout) { + const alignments = contentSize || wideSize ? ['wide', 'full', 'left', 'center', 'right'] : ['left', 'center', 'right']; + return { + type: 'default', + // Find a way to inject this in the support flag code (hooks). + alignments + }; + } + + return undefined; + }, [themeSupportsLayout, contentSize, wideSize]); + + const blockProps = Object(external_wp_blockEditor_["useBlockProps"])(); + const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])(themeSupportsLayout ? blockProps : { + className: 'wp-block-group__inner-container' + }, { + templateLock, + renderAppender: hasInnerBlocks ? undefined : external_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender, + __experimentalLayout: _layout + }); + return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["InspectorAdvancedControls"], null, Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], { + label: Object(external_wp_i18n_["__"])('HTML element'), + options: [{ + label: Object(external_wp_i18n_["__"])('Default (
    )'), + value: 'div' + }, { + label: '
    ', + value: 'header' + }, { + label: '
    ', + value: 'main' + }, { + label: '
    ', + value: 'section' + }, { + label: '
    ', + value: 'article' + }, { + label: '