Version Description
- 13th July 2021 =
- Add initial support for WordPress mobile app
- Fix incorrect behaviour of drag handles in Safari
- Fix sticky block styles
- Fix image right alignment
Download this release
Release Info
Developer | johnny5 |
Plugin | Layout Grid Block |
Version | 1.7 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.7
- block.json +9 -0
- editor.css +49 -49
- index.asset.php +1 -1
- index.js +1 -1
- index.php +1 -1
- readme.txt +8 -2
block.json
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "jetpack/layout-grid",
|
3 |
+
"title": "Layout Grid",
|
4 |
+
"description": "A Gutenberg container block to let you align items consistently across a global grid.",
|
5 |
+
"category": "design",
|
6 |
+
"editorScript": "file:./index.js",
|
7 |
+
"editorStyle": "file:./editor.css",
|
8 |
+
"style": "file:./style.css"
|
9 |
+
}
|
editor.css
CHANGED
@@ -7,15 +7,21 @@
|
|
7 |
left: 0;
|
8 |
bottom: 0;
|
9 |
right: 0;
|
10 |
-
display: grid;
|
11 |
-
grid-gap: 24px;
|
12 |
-
grid-template-columns: repeat(12, 1fr);
|
13 |
-
padding-left: 24px;
|
14 |
-
padding-right: 24px;
|
15 |
-
z-index: 0;
|
16 |
color: rgba(0, 0, 0, 0.03); }
|
17 |
.is-selected .wpcom-overlay-grid {
|
18 |
position: absolute; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
.is-dark-theme .wpcom-overlay-grid {
|
20 |
color: rgba(255, 255, 255, 0.15); }
|
21 |
.wpcom-overlay-grid .wpcom-overlay-grid__column {
|
@@ -704,47 +710,41 @@ body.is-resizing [data-type="jetpack/layout-grid"] {
|
|
704 |
/**
|
705 |
* Individual column alignment for the editor
|
706 |
*/
|
707 |
-
.wp-block-jetpack-layout-grid-editor
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
.wp-block-jetpack-layout-grid-editor.are-vertically-aligned-bottom [data-type="jetpack/layout-grid-column"].wp-block {
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
.wp-block-jetpack-layout-grid-editor.column1-grid__valign-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
.wp-block-jetpack-layout-grid-editor.column2-grid__valign-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
.wp-block-jetpack-layout-grid-editor.
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
.wp-block-jetpack-layout-grid-editor.
|
738 |
-
|
739 |
-
|
740 |
-
.wp-block-jetpack-layout-grid-editor.column3-grid__valign-bottom [data-type="jetpack/layout-grid-column"].wp-block:nth-child(3) {
|
741 |
-
align-self: flex-end; }
|
742 |
-
|
743 |
-
.wp-block-jetpack-layout-grid-editor.column4-grid__valign-top [data-type="jetpack/layout-grid-column"].wp-block:nth-child(4) {
|
744 |
-
align-self: flex-start; }
|
745 |
-
|
746 |
-
.wp-block-jetpack-layout-grid-editor.column4-grid__valign-center [data-type="jetpack/layout-grid-column"].wp-block:nth-child(4) {
|
747 |
-
align-self: center; }
|
748 |
|
749 |
-
|
750 |
-
|
|
|
|
|
|
7 |
left: 0;
|
8 |
bottom: 0;
|
9 |
right: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
color: rgba(0, 0, 0, 0.03); }
|
11 |
.is-selected .wpcom-overlay-grid {
|
12 |
position: absolute; }
|
13 |
+
.wpcom-overlay-grid > .wpcom-overlay-grid__inner {
|
14 |
+
top: 0;
|
15 |
+
left: 0;
|
16 |
+
bottom: 0;
|
17 |
+
right: 0;
|
18 |
+
display: grid;
|
19 |
+
grid-gap: 24px;
|
20 |
+
grid-template-columns: repeat(12, 1fr);
|
21 |
+
height: 100%;
|
22 |
+
padding-left: 24px;
|
23 |
+
padding-right: 24px;
|
24 |
+
z-index: 0; }
|
25 |
.is-dark-theme .wpcom-overlay-grid {
|
26 |
color: rgba(255, 255, 255, 0.15); }
|
27 |
.wpcom-overlay-grid .wpcom-overlay-grid__column {
|
710 |
/**
|
711 |
* Individual column alignment for the editor
|
712 |
*/
|
713 |
+
.wp-block-jetpack-layout-grid-editor {
|
714 |
+
position: relative; }
|
715 |
+
.wp-block-jetpack-layout-grid-editor.are-vertically-aligned-top [data-type="jetpack/layout-grid-column"].wp-block {
|
716 |
+
align-self: flex-start; }
|
717 |
+
.wp-block-jetpack-layout-grid-editor.are-vertically-aligned-center [data-type="jetpack/layout-grid-column"].wp-block {
|
718 |
+
align-self: center; }
|
719 |
+
.wp-block-jetpack-layout-grid-editor.are-vertically-aligned-bottom [data-type="jetpack/layout-grid-column"].wp-block {
|
720 |
+
align-self: flex-end; }
|
721 |
+
.wp-block-jetpack-layout-grid-editor.column1-grid__valign-top [data-type="jetpack/layout-grid-column"].wp-block:nth-child(1) {
|
722 |
+
align-self: flex-start; }
|
723 |
+
.wp-block-jetpack-layout-grid-editor.column1-grid__valign-center [data-type="jetpack/layout-grid-column"].wp-block:nth-child(1) {
|
724 |
+
align-self: center; }
|
725 |
+
.wp-block-jetpack-layout-grid-editor.column1-grid__valign-bottom [data-type="jetpack/layout-grid-column"].wp-block:nth-child(1) {
|
726 |
+
align-self: flex-end; }
|
727 |
+
.wp-block-jetpack-layout-grid-editor.column2-grid__valign-top [data-type="jetpack/layout-grid-column"].wp-block:nth-child(2) {
|
728 |
+
align-self: flex-start; }
|
729 |
+
.wp-block-jetpack-layout-grid-editor.column2-grid__valign-center [data-type="jetpack/layout-grid-column"].wp-block:nth-child(2) {
|
730 |
+
align-self: center; }
|
731 |
+
.wp-block-jetpack-layout-grid-editor.column2-grid__valign-bottom [data-type="jetpack/layout-grid-column"].wp-block:nth-child(2) {
|
732 |
+
align-self: flex-end; }
|
733 |
+
.wp-block-jetpack-layout-grid-editor.column3-grid__valign-top [data-type="jetpack/layout-grid-column"].wp-block:nth-child(3) {
|
734 |
+
align-self: flex-start; }
|
735 |
+
.wp-block-jetpack-layout-grid-editor.column3-grid__valign-center [data-type="jetpack/layout-grid-column"].wp-block:nth-child(3) {
|
736 |
+
align-self: center; }
|
737 |
+
.wp-block-jetpack-layout-grid-editor.column3-grid__valign-bottom [data-type="jetpack/layout-grid-column"].wp-block:nth-child(3) {
|
738 |
+
align-self: flex-end; }
|
739 |
+
.wp-block-jetpack-layout-grid-editor.column4-grid__valign-top [data-type="jetpack/layout-grid-column"].wp-block:nth-child(4) {
|
740 |
+
align-self: flex-start; }
|
741 |
+
.wp-block-jetpack-layout-grid-editor.column4-grid__valign-center [data-type="jetpack/layout-grid-column"].wp-block:nth-child(4) {
|
742 |
+
align-self: center; }
|
743 |
+
.wp-block-jetpack-layout-grid-editor.column4-grid__valign-bottom [data-type="jetpack/layout-grid-column"].wp-block:nth-child(4) {
|
744 |
+
align-self: flex-end; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
|
746 |
+
/**
|
747 |
+
* Image alignment for the editor
|
748 |
+
*/
|
749 |
+
.wp-block[data-align=right] > .wp-block-image {
|
750 |
+
float: right; }
|
index.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-polyfill', 'wp-primitives'), 'version' => 'eb793df9c90358b0e8a4e46b2cbc9d65');
|
index.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var i=o.apply(null,r);i&&e.push(i)}else if("object"===c)for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.compose},function(e,t,n){var r=n(27);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(28).default,o=n(6);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.blocks},function(e,t,n){var r=n(24),o=n(25),c=n(21),i=n(26);e.exports=function(e){return r(e)||o(e)||c(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.keycodes},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(20);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(29);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(30),o=n(31),c=n(21),i=n(32);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(20);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var c,i=e[Symbol.iterator]();!(_n=(c=i.next()).done)&&(n.push(c.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==i.return||i.return()}finally{if(r)throw o}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),c=n(16),i=n(2),a=n(10),l=n.n(a),u=n(17),s=n.n(u),p=n(11),d=n.n(p),f=n(12),b=n.n(f),g=n(6),m=n.n(g),v=n(14),h=n.n(v),y=n(15),O=n.n(y),j=n(7),_=n.n(j),w=n(0),k=n(18),x=n(5),E=n.n(x),S=n(4),C=n(3),M=n(19),P=n(8),B=n(13),A=n(9),z=Object(w.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(w.createElement)(A.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})),D=Object(w.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(w.createElement)(A.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})),R=Object(w.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(w.createElement)(A.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"}));function T(){return[{value:"small",label:Object(i.__)("Small","layout-grid")},{value:"medium",label:Object(i.__)("Medium","layout-grid")},{value:"large",label:Object(i.__)("Large","layout-grid")},{value:"huge",label:Object(i.__)("Huge","layout-grid")}]}var V=function(){return[{label:Object(i.__)("1 column","layout-grid"),value:1},{label:Object(i.__)("2 columns","layout-grid"),value:2},{label:Object(i.__)("3 columns","layout-grid"),value:3},{label:Object(i.__)("4 columns","layout-grid"),value:4}]},N=function(){return[{value:"Desktop",label:Object(i.__)("Desktop","layout-grid"),icon:z},{value:"Tablet",label:Object(i.__)("Tablet","layout-grid"),icon:D},{value:"Mobile",label:Object(i.__)("Mobile","layout-grid"),icon:R}]},G=["Desktop","Tablet","Mobile"];function L(e,t){return"column".concat(e+1).concat(t,"Span")}function I(e,t){return"column".concat(e+1).concat(t,"Offset")}var H=function(e){return"Tablet"===e?8:"Mobile"===e?4:12};function U(e,t,n){return"Tablet"===e?3===t&&2===n?H(e):t>1?H(e)/2:H(e):"Mobile"===e?H(e):H(e)/t}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var K=function(e,t){return"column".concat(e+1,"-grid__span-").concat(t)},W=function(e,t){return"column".concat(e+1,"-grid__start-").concat(t)},$=function(e,t){return"column".concat(e+1,"-grid__row-").concat(t)},q=function(e,t){return"column".concat(e+1,"-grid__valign-").concat(t)},J=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__span-").concat(t)},Q=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__start-").concat(t)},Y=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__row-").concat(t)};function Z(e,t){return Math.floor(e/t)}function ee(e,t){return e%t}function te(e,t,n,r){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return{name:e,column:t,value:n,device:r,enabled:o}}function ne(e,t,n){for(var r=[],o=H(e),c=function(e,t,n){for(var r=[],o=0,c=0;c<e;c++){var i=L(c,t),a=I(c,t),l=n[i]||U(t,e,c),u=n[a]||0;r.push({position:o+u,span:l}),o+=u,o+=l}return r}(t,e,n),i=0;i<c.length;i++){var a=c[i],l=a.span,u=a.position,s=Z(u,o),p=ee(u,o);r.push(te("span",i,l,e)),r.push(te("offset",i,p+1,e,p>0)),r.push(te("row",i,s+1,e))}return r}function re(e,t){var n={};return e.filter((function(e){return e.enabled&&t[e.name]})).map((function(e){return n[t[e.name](e.column,e.value,e.device)]=!0})),n}function oe(e){return e?e.replace(/column\d-\w*-grid__\w*-\d*/g,"").replace(/column\d-grid__\w*-\d*/g,"").replace(/\s{2,}/,"").replace(/wp-block-jetpack-layout-gutter__\w*/,"").replace(/is-vertically-aligned-\w*/,"").replace(/are-vertically-aligned-\w*/):e}function ce(e){var t=e.gutterSize;return{"wp-block-jetpack-layout-gutter__nowrap":!e.addGutterEnds,"wp-block-jetpack-layout-gutter__none":"none"===t,"wp-block-jetpack-layout-gutter__small":"small"===t,"wp-block-jetpack-layout-gutter__medium":"medium"===t,"wp-block-jetpack-layout-gutter__huge":"huge"===t}}var ie=n(22),ae=n.n(ie),le=function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(w.createElement)(C.Path,{d:"M7 12v24h34V12H7zm32 22H9V14h30v20z"}))},ue=function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(w.createElement)(C.Path,{d:"M7,12v24h34V12H7z M23,34H9V14h14V34z M39,34H25V14h14V34z"}))},se=function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(w.createElement)(C.Path,{d:"M7 12v24h34V12H7zm23 2h9v20h-9V14zm-2 20h-8V14h8v20zM9 14h9v20H9V14z"}))},pe=function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(w.createElement)(C.Path,{d:"M7 12v24h34V12H7zm8 22H9V14h6v20zm8 0h-6V14h6v20zm8 0h-6V14h6v20zm8 0h-6V14h6v20z"}))},de=function(e){var t=e.columns,n=ae()(e,["columns"]);return 4===t?Object(w.createElement)(pe,n):3===t?Object(w.createElement)(se,n):2===t?Object(w.createElement)(ue,n):Object(w.createElement)(le,n)},fe=function(e){var t=e.direction,n=e.height,r=e.xPos,o=e.top,c=e.isSelected,i=E()("wpcom-overlay-resize__handle","components-resizable-box__container",{"is-selected":c}),a={height:n+"px",width:r+"px",top:o+"px"},l={left:r+"px"},u=E()("components-resizable-box__handle","components-resizable-box__side-handle",{"components-resizable-box__handle-left":"left"===t,"components-resizable-box__handle-right":"right"===t});return Object(w.createElement)("div",{className:i,style:a},Object(w.createElement)("span",null,Object(w.createElement)("div",{className:u,style:l})))};var be=function(e){h()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=_()(t);if(n){var o=_()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return O()(this,e)});function c(e){var t;return d()(this,c),t=r.call(this,e),o()(m()(t),"onMouseDown",(function(e){var n=e.target;if((0===e.button||e.touches)&&(n.dataset.resizeRight||n.dataset.resizeLeft)){t.block=n.closest(".wp-block");var r=t.block.getBoundingClientRect(),o=r.height,c=r.right,i=r.left,a=r.top,l=n.getBoundingClientRect().width,u=t.getChildPosition(t.block),s=n.dataset.resizeLeft;t.setState({resizingColumn:u,xPos:t.getAdjustedOffset(t.getMouseX(e),l),height:o,width:l,top:t.getAdjustedTop(a),direction:s?"left":"right",max:s?t.getAdjustedOffset(c,l):t.getAdjustedOffset(i,l)}),0===e.button?(document.addEventListener("mousemove",t.onMouseMove),document.addEventListener("mouseup",t.onMouseUp),e.preventDefault()):(document.addEventListener("touchmove",t.onMouseMove),document.addEventListener("touchend",t.onMouseUp)),e.stopPropagation()}})),o()(m()(t),"onMouseMove",(function(e){e.stopPropagation(),void 0===e.touches&&e.preventDefault();var n=t.block.getBoundingClientRect().height;t.setState({xPos:t.getRestrictedOffset(t.getAdjustedOffset(t.getMouseX(e))),height:n});var r=t.getNearestColumn(t.state.direction,e);r&&t.props.onResize(t.state.resizingColumn,r)})),o()(m()(t),"onMouseUp",(function(e){t.setState({resizingColumn:-1}),document.removeEventListener("mousemove",t.onMouseMove),document.removeEventListener("mouseup",t.onMouseUp),document.removeEventListener("touchmove",t.onMouseMove),document.removeEventListener("touchend",t.onMouseUp)})),t.containerRef=Object(w.createRef)(),t.state={resizingColumn:-1,xPos:0,height:0},t}return b()(c,[{key:"getNearestColumn",value:function(e,t){var n=this.props,r=n.totalColumns,o=n.layoutGrid,c=o.getStart(this.state.resizingColumn),i=o.getSpan(this.state.resizingColumn),a=Math.min(r,Math.max(0,function(e,t,n,r){var o=e.getBoundingClientRect(),c=o.width/r,i=t-o.x,a=Math.floor(i/c),l=i%c;return"left"===n?l<=c/2?a:a+1:l<c/2?a:a+1}(this.containerRef.current,this.getMouseX(t),e,r)));if("left"===e){if(a===c)return null;var l=Math.abs(a-c),u={start:a,span:a>c?i-l:i+l,direction:e};return u.start>=c+i?null:(u.span=Math.max(1,u.span),u)}return{span:Math.max(1,a-c),direction:e}}},{key:"getMouseX",value:function(e){var t=e.clientX,n=e.targetTouches;return t||n&&n[0].clientX}},{key:"getAdjustedOffset",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.state.width,r=t>0?t:n;return e-this.containerRef.current.getBoundingClientRect().left-r/2}},{key:"getAdjustedTop",value:function(e){return e-this.containerRef.current.getBoundingClientRect().top}},{key:"getRestrictedOffset",value:function(e){var t=this.state,n=t.direction,r=t.max,o=t.width;return"left"===n?Math.min(r-o,e):Math.max(r+o,e)}},{key:"getChildPosition",value:function(e){for(var t=0;null!==e.previousSibling;)e=e.previousSibling,t++;return t}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.children,r=e.isSelected,o=this.state,c=o.resizingColumn,i=o.xPos,a=o.height,l=E()(t,-1!==c?"wp-block-jetpack-layout-grid__resizing":null);return Object(w.createElement)("div",{className:l,onMouseDown:this.onMouseDown,onTouchStart:this.onMouseDown,ref:this.containerRef},-1!==c&&Object(w.createElement)(fe,{direction:this.state.direction,height:a,xPos:i,top:this.state.top,isSelected:r}),n)}}]),c}(w.Component);function ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ve=function(){function e(t,n,r){d()(this,e),this.attributes=t,this.device=n,this.columnCount=r}return b()(e,[{key:"getGridValues",value:function(){for(var e={},t=0;t<this.columnCount;t++){var n=U(this.device,this.columnCount,t);e[L(t,this.device)]=this.getSpan(t)||n,e[I(t,this.device)]=this.getOffset(t)}return e}},{key:"applyAdjustments",value:function(e){for(var t=this.getGridValues(),n=0;n<e.length;n++)t=me(me({},t),e[n]);return t}},{key:"getSpanAdjustment",value:function(e,t){return o()({},L(e,this.device),t)}},{key:"getAdjustOffset",value:function(e,t){return o()({},I(e,this.device),t)}},{key:"getShrinkOffset",value:function(e,t){var n=this.getOffset(e),r=t>=n?n:t;return{adjustment:this.getAdjustOffset(e,n-r),offsetUsed:r}}},{key:"hasOverlaps",value:function(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=t+1;r<e.length;r++){var o=e[r];if(n.start>o.start&&n.start<o.end)return!0;if(n.end>o.start&&n.end<o.end)return!0}return!1}},{key:"validateGrid",value:function(e){for(var t,n,r=[],o=H(this.device),c=0,i=0,a=0;a<this.columnCount;a++){var l=e[L(a,this.device)],u=e[I(a,this.device)];if((i+=u)>=o&&(i-=o),(i+=l)>o)return!1;r.push({start:c+u,end:c+u+l}),c+=l+u}return!(c>(t=this.device,n=this.columnCount,"Tablet"===t&&n>2?2*H(t):"Mobile"===t?H(t)*n:H(t))||this.hasOverlaps(r))}},{key:"getEndAdjustments",value:function(e,t){var n=[];if(t<0)return[this.getAdjustOffset(e,this.getOffset(e)+Math.abs(t))];if(t>0)for(var r=e;r<this.columnCount&&t>0;r++){var o=this.getShrinkOffset(r,Math.abs(t));n.push(o.adjustment),t-=o.offsetUsed}return n}},{key:"getStartMovedLeft",value:function(e,t){for(var n=[],r=e;r>=0&&t>0;r--){var o=this.getShrinkOffset(r,t);n.push(o.adjustment),t-=o.offsetUsed}return n}},{key:"getStartAdjustments",value:function(e,t){var n=this.getOffset(e),r=this.getOffsetFromStart(e,t),o=r-n;return o<0?this.getStartMovedLeft(e,Math.abs(o)):[this.getAdjustOffset(e,r)]}},{key:"getSpan",value:function(e){return this.attributes[L(e,this.device)]}},{key:"getOffset",value:function(e){return this.attributes[I(e,this.device)]}},{key:"getStart",value:function(e){for(var t=0,n=0;n<e;n++)t+=this.getSpan(n)+this.getOffset(n);var r=Math.max(1,Math.floor(t/H(this.device)));return(t+this.getOffset(e))%(r*H(this.device))}},{key:"getOffsetFromStart",value:function(e,t){if(0===e)return t;var n=t-this.getStart(e);return this.getOffset(e)+n}},{key:"convertOffsetToStart",value:function(e,t){return this.getStart(e)+(t-this.getOffset(e))}},{key:"getAdjustedGrid",value:function(e,t){var n=t.start,r=void 0===n?this.getStart(e):n,o=t.span,c=void 0===o?this.getSpan(e):o,i=[];r!==this.getStart(e)&&c!==this.getSpan(e)?i=(i=i.concat(this.getStartAdjustments(e,r))).concat(this.getSpanAdjustment(e,c)):c!==this.getSpan(e)?i=(i=i.concat(this.getSpanAdjustment(e,c))).concat(this.getEndAdjustments(e+1,c-this.getSpan(e))):r!==this.getStart(e)&&(i=(i=i.concat(this.getStartAdjustments(e,r))).concat(this.getEndAdjustments(e+1,r-this.getStart(e))));var a=this.applyAdjustments(i);return i.length>0&&this.validateGrid(a)?a:null}}]),e}(),he=n(23),ye=n.n(he),Oe=function(e){var t=e.viewPort,n=e.updateViewport,r=Object(P.useDispatch)("core/edit-post").__experimentalSetPreviewDeviceType,o=Object(P.useSelect)((function(e){return e("core/edit-post").__experimentalGetPreviewDeviceType()}),[]),c=Object(B.useResizeObserver)(),i=ye()(c,2),a=i[0],l=i[1],u=Object(B.useViewportMatch)("medium","<"),s=Object(B.useViewportMatch)("small","<");return Object(w.useEffect)((function(){var e=function(e,t){return e?"Mobile":t?"Tablet":"Desktop"}(s,u);e!==t&&n(e)}),[l]),Object(w.createElement)(w.Fragment,null,a,!s&&Object(w.createElement)(S.BlockControls,null,Object(w.createElement)(C.Dropdown,{renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return Object(w.createElement)(C.ToolbarGroup,null,Object(w.createElement)(C.Button,{"aria-expanded":t,onClick:n,icon:N().find((function(e){return e.value===o})).icon}))},renderContent:function(){return Object(w.createElement)(C.MenuGroup,null,Object(w.createElement)(C.MenuItemsChoice,{value:o,onSelect:function(e){return r(e)},choices:N()}))}})))};function je(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?je(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var we=["jetpack/layout-grid-column"],ke=function(e){h()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=_()(t);if(n){var o=_()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return O()(this,e)});function c(e){var t;return d()(this,c),t=r.call(this,e),o()(m()(t),"onChangeLayout",(function(e){for(var n={},r=0;r<e;r++)for(var o=0;o<G.length;o++){var c=U(G[o],e,r);n[L(r,G[o])]=c,n[I(r,G[o])]=0}t.props.updateColumns(t.props.columns,e,n)})),o()(m()(t),"onResize",(function(e,n){var r=t.props,o=r.attributes,c=r.columns,i=new ve(o,t.getPreviewMode(),c).getAdjustedGrid(e,n);i&&t.adjustGrid(i)})),o()(m()(t),"onChangeSpan",(function(e,n,r){var o=t.props,c=o.attributes,i=o.columns,a=new ve(c,n,i).getAdjustedGrid(e,{span:parseInt(r,10)});a&&t.adjustGrid(a)})),o()(m()(t),"onChangeOffset",(function(e,n,r){var o=t.props,c=o.attributes,i=o.columns,a=new ve(c,n,i),l=a.getAdjustedGrid(e,{start:a.convertOffsetToStart(e,parseInt(r,10))});l&&t.adjustGrid(l)})),t.overlayRef=Object(w.createRef)(),t.state={inspectorDeviceType:"Desktop",viewPort:"Desktop"},t}return b()(c,[{key:"adjustGrid",value:function(e){var t=this.props,n=t.setAttributes,r=t.attributes;n(_e(_e({},e),{},{className:oe(r.className)}))}},{key:"renderDeviceSettings",value:function(e,t,n){for(var r=this,o=new ve(n,t,this.props.columns),c=[],a=function(n){var a=o.getSpan(n)||U(t,e,n),l=o.getOffset(n)||0;c.push(Object(w.createElement)("div",{className:"jetpack-layout-grid-settings",key:n},Object(w.createElement)("strong",null,Object(i.__)("Column","layout-grid")," ",n+1),Object(w.createElement)("div",{className:"jetpack-layout-grid-settings__group"},Object(w.createElement)(C.TextControl,{type:"number",label:Object(i.__)("Offset","layout-grid"),value:l||0,min:0,max:H(t)-1,onChange:function(e){return r.onChangeOffset(n,t,e)}}),Object(w.createElement)(C.TextControl,{type:"number",label:Object(i.__)("Span","layout-grid"),value:a,min:1,max:H(t),onChange:function(e){return r.onChangeSpan(n,t,e)}}))))},l=0;l<e;l++)a(l);return c}},{key:"canResizeBreakpoint",value:function(e){return!(!this.overlayRef||!this.overlayRef.current)&&this.overlayRef.current.getBoundingClientRect().width/H(e)>50}},{key:"updateInspectorDevice",value:function(e){this.setState({inspectorDeviceType:e}),"Mobile"!==this.state.viewPort&&this.props.setPreviewDeviceType(e)}},{key:"getPreviewMode",value:function(){return this.props.isBlockOrPatternPreview?"Desktop":"Desktop"===this.state.viewPort||"Mobile"===this.props.previewDeviceType?this.props.previewDeviceType:this.state.viewPort}},{key:"getInspectorMode",value:function(){return"Desktop"===this.state.viewPort?this.props.previewDeviceType:this.state.inspectorDeviceType}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.attributes,c=void 0===r?{}:r,a=t.isSelected,l=t.columns,u=t.setAttributes,s=t.updateAlignment,p=t.columnAttributes,d=this.state.viewPort,f=this.getPreviewMode(),b=this.getInspectorMode(),g=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=ne(e,t,n),c={span:K,offset:W,row:$},i={},a=0;a<t;a++)r[a].verticalAlignment&&r[a].verticalAlignment!==n.verticalAlignment&&(i[q(a,r[a].verticalAlignment)]=!0);return F(F({},re(o,c)),i)}(f,l,c,p),m=c.gutterSize,v=c.addGutterEnds,h=c.verticalAlignment,y=new ve(c,f,l),O=E()(oe(n).replace("layout-grid","layout-grid-editor"),"wp-block-jetpack-editor",g,o()({"wp-block-jetpack-layout-tablet":"Tablet"===f,"wp-block-jetpack-layout-desktop":"Desktop"===f,"wp-block-jetpack-layout-mobile":"Mobile"===f,"wp-block-jetpack-layout-resizable":this.canResizeBreakpoint(f)},"are-vertically-aligned-".concat(h),h),ce(c));if(0===l)return Object(w.createElement)(C.Placeholder,{icon:"layout",label:Object(i.__)("Choose Layout","layout-grid"),instructions:Object(i.__)("Select a layout to start with:","layout-grid"),className:O},Object(w.createElement)("ul",{className:"block-editor-inner-blocks__template-picker-options"},V().map((function(t){return Object(w.createElement)("li",{key:t.value},Object(w.createElement)(C.IconButton,{isSecondary:!0,icon:Object(w.createElement)(de,{columns:t.value}),onClick:function(){return e.onChangeLayout(t.value)},className:"block-editor-inner-blocks__template-picker-option",label:t.label}))}))));var j=Object(w.createElement)(C.ToggleControl,{label:Object(i.__)("Add end gutters","layout-grid"),help:v?Object(i.__)("Toggle off to remove the spacing left and right of the grid.","layout-grid"):Object(i.__)("Toggle on to add space left and right of the layout grid. ","layout-grid"),checked:v,onChange:function(e){return u({addGutterEnds:e})}});return Object(w.createElement)(w.Fragment,null,Object(w.createElement)(Oe,{currentViewport:d,updateViewport:function(t){return e.setState({viewPort:t,inspectorDeviceType:t})}}),Object(w.createElement)(be,{className:O,onResize:this.onResize,totalColumns:H(f),layoutGrid:y,isSelected:a},Object(w.createElement)("div",{className:"wpcom-overlay-grid",ref:this.overlayRef},Object(k.times)(H(f)).map((function(e){return Object(w.createElement)("div",{className:"wpcom-overlay-grid__column",key:e})}))),Object(w.createElement)(S.InnerBlocks,{template:null,templateLock:"all",allowedBlocks:we}),Object(w.createElement)(S.InspectorControls,null,Object(w.createElement)(C.PanelBody,{title:Object(i.__)("Layout","layout-grid")},Object(w.createElement)("div",{className:"jetpack-layout-grid-columns block-editor-block-styles"},V().map((function(t){return Object(w.createElement)("div",{key:t.value,className:E()("block-editor-block-styles__item",{"is-active":l===t.value}),onClick:function(){return e.onChangeLayout(t.value)},onKeyDown:function(n){M.ENTER!==n.keyCode&&M.SPACE!==n.keyCode||(n.preventDefault(),e.onChangeLayout(t.value))},role:"button",tabIndex:"0","aria-label":t.label},Object(w.createElement)("div",{className:"block-editor-block-styles__item-preview"},Object(w.createElement)(de,{columns:t.value})),Object(w.createElement)("div",{className:"editor-block-styles__item-label block-editor-block-styles__item-label"},t.label))}))),Object(w.createElement)("p",null,Object(w.createElement)("em",null,Object(i.__)("Changing the number of columns will reset your layout and could remove content.","layout-grid")))),Object(w.createElement)(C.PanelBody,{title:Object(i.__)("Responsive Breakpoints","layout-grid")},Object(w.createElement)("p",null,Object(w.createElement)("em",null,Object(i.__)("Note that previewing your post will show your browser's breakpoint, not the currently selected one.","layout-grid"))),Object(w.createElement)(C.ButtonGroup,null,N().map((function(t){return Object(w.createElement)(C.Button,{key:t.value,isPrimary:t.value===b,onClick:function(){return e.updateInspectorDevice(t.value)}},t.label)}))),this.renderDeviceSettings(l,b,c)),Object(w.createElement)(C.PanelBody,{title:Object(i.__)("Gutter","layout-grid")},Object(w.createElement)("p",null,Object(i.__)("Gutter size","layout-grid")),Object(w.createElement)(C.SelectControl,{value:m,onChange:function(e){return u({gutterSize:e,addGutterEnds:"none"!==e&&v})},options:[{value:"none",label:Object(i.__)("No gutter","layout-grid")}].concat(T())}),"none"===m?Object(w.createElement)(C.Disabled,null,j):j))),Object(w.createElement)(S.BlockControls,null,Object(w.createElement)(S.BlockVerticalAlignmentToolbar,{onChange:s,value:h})))}}]),c}(w.Component),xe=Object(B.compose)([Object(P.withDispatch)((function(e,t,n){return{updateAlignment:function(r){var o=t.clientId,c=t.setAttributes,i=e("core/block-editor").updateBlockAttributes,a=n.select("core/block-editor").getBlockOrder;c({verticalAlignment:r}),a(o).forEach((function(e){i(e,{verticalAlignment:r})}))},updateColumns:function(r,o,i){var a=t.clientId,l=e("core/block-editor").replaceBlock,u=function(e,t,n){if(n>t)return[].concat(s()(e),s()(Object(k.times)(n-t,(function(){return Object(c.createBlock)("jetpack/layout-grid-column")}))));var r=s()(e),o=0;return r.reverse(),(r=r.filter((function(e){return!(o<t-n&&0===e.innerBlocks.length&&(o++,1))}))).slice(Math.max(0,t-n-o)).reverse()}((0,n.select("core/block-editor").getBlocks)(a),r,o);l(a,Object(c.createBlock)(t.name,_e(_e(_e({},t.attributes),i),{},{className:oe(t.attributes.className)}),u))},setPreviewDeviceType:function(t){(0,e("core/edit-post").__experimentalSetPreviewDeviceType)(t)}}})),Object(P.withSelect)((function(e,t){var n=t.clientId,r=e("core/block-editor"),o=r.getBlockOrder,c=r.getBlockCount,i=r.getBlocksByClientId,a=e("core/edit-post").__experimentalGetPreviewDeviceType,l=void 0===a?null:a;return{columns:c(n),columnAttributes:o(n).map((function(e){return i(e)[0].attributes})),previewDeviceType:l()}}))])((function(e){return Object(w.createElement)(C.Disabled.Consumer,null,(function(t){return Object(w.createElement)(ke,l()({},e,{isBlockOrPatternPreview:t}))}))}));var Ee=function(e){h()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=_()(t);if(n){var o=_()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return O()(this,e)});function c(e){var t;return d()(this,c),t=r.call(this,e),o()(m()(t),"onLeftIn",(function(){t.setState({direction:"left"}),document.addEventListener("mouseup",t.onLeftOut)})),o()(m()(t),"onLeftOut",(function(){t.setState({direction:null}),document.removeEventListener("mouseup",t.onLeftOut)})),o()(m()(t),"onRightIn",(function(){t.setState({direction:"right"}),document.addEventListener("mouseup",t.onRightOut)})),o()(m()(t),"onRightOut",(function(){t.setState({direction:null}),document.removeEventListener("mouseup",t.onRightOut)})),t.state={direction:null},t}return b()(c,[{key:"render",value:function(){var e,t=this.props,n=t.className,r=t.hasChildBlocks,c=t.backgroundColor,a=t.setBackgroundColor,l=t.attributes,u=t.setAttributes,s=t.updateAlignment,p=l.padding,d=l.verticalAlignment,f=this.state.direction,b=E()(n,c.class,(e={},o()(e,"wp-block-jetpack-layout-grid__padding-"+p,!0),o()(e,"has-background",c.color),o()(e,"components-resizable-box__container",!0),o()(e,c.class,c.class),o()(e,"wp-blocks-jetpack-layout-grid__showleft","right"===f),o()(e,"wp-blocks-jetpack-layout-grid__showright","left"===f),o()(e,"is-vertically-aligned-".concat(d),d),e)),g={backgroundColor:c.color};return Object(w.createElement)("div",{className:b,style:g},Object(w.createElement)("span",{className:"wp-blocks-jetpack-layout-grid__resize-handles"},Object(w.createElement)("div",{className:"components-resizable-box__handle components-resizable-box__side-handle components-resizable-box__handle-right",onMouseDown:this.onRightIn,"data-resize-right":!0}),Object(w.createElement)("div",{className:"components-resizable-box__handle components-resizable-box__side-handle components-resizable-box__handle-left",onMouseDown:this.onLeftIn,"data-resize-left":!0})),Object(w.createElement)(S.InnerBlocks,{templateLock:!1,renderAppender:r?void 0:function(){return Object(w.createElement)(S.InnerBlocks.ButtonBlockAppender,null)}}),Object(w.createElement)(S.InspectorControls,null,Object(w.createElement)(S.PanelColorSettings,{title:Object(i.__)("Column Color","layout-grid"),initialOpen:!0,colorSettings:[{value:c.color,onChange:a,label:Object(i.__)("Background","layout-grid")}]}),Object(w.createElement)(C.PanelBody,{title:Object(i.__)("Column Padding","layout-grid")},Object(w.createElement)("p",null,Object(i.__)("Choose padding for this column:","layout-grid")),Object(w.createElement)(C.SelectControl,{value:p,onChange:function(e){return u({padding:e})},options:[{value:"none",label:Object(i.__)("No padding","layout-grid")}].concat(T())}))),Object(w.createElement)(S.BlockControls,null,Object(w.createElement)(S.BlockVerticalAlignmentToolbar,{onChange:s,value:d})))}}]),c}(w.Component),Se=Object(B.compose)(Object(S.withColors)("backgroundColor"),Object(P.withSelect)((function(e,t){var n=t.clientId;return{hasChildBlocks:(0,e("core/block-editor").getBlockOrder)(n).length>0}})),Object(P.withDispatch)((function(e,t,n){return{updateAlignment:function(r){var o=t.clientId,c=t.setAttributes,i=e("core/block-editor").updateBlockAttributes,a=n.select("core/block-editor").getBlockRootClientId;c({verticalAlignment:r}),i(a(o),{verticalAlignment:null})}}})))(Ee),Ce=[{attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},padding:{type:"string",default:"none"},verticalAlignment:{type:"string"}},save:function(e){var t,n=e.attributes,r=void 0===n?{}:n,c=r.className,i=r.backgroundColor,a=r.customBackgroundColor,l=r.padding,u=r.verticalAlignment,s=Object(S.getColorClassName)("background-color",i),p=E()(c,(t={},o()(t,"wp-block-jetpack-layout-grid__padding-"+l,!0),o()(t,"has-background",i),o()(t,s,s),o()(t,"is-vertically-aligned-".concat(u),u),t)),d={backgroundColor:s?void 0:a};return Object(w.createElement)("div",{className:p,style:d},Object(w.createElement)(S.InnerBlocks.Content,null))}}];function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}Object(c.registerBlockType)("jetpack/layout-grid",{title:Object(i.__)("Layout Grid","layout-grid"),description:Object(i.__)("Align blocks to a global grid, with support for responsive breakpoints.","layout-grid"),icon:function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),Object(w.createElement)(C.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-7.5 11.5H6c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h5.5v10zm4 0H13v-10h2.5v10zm4-.5c0 .3-.2.5-.5.5h-2v-10h2c.3 0 .5.2.5.5v9z"}))},category:"design",supports:{align:["full"],html:!1},example:{attributes:{columns:2},innerBlocks:[{name:"jetpack/layout-grid-column",innerBlocks:[{name:"core/paragraph",attributes:{customFontSize:32,content:Object(i.__)("<strong>Snow Patrol</strong>","layout-grid"),align:"center"}}]},{name:"jetpack/layout-grid-column",innerBlocks:[{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Windbuchencom.jpg"}}]}]},attributes:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({align:{type:"string",default:"full"},gutterSize:{type:"string",default:"large"},addGutterEnds:{type:"boolean",default:!0},verticalAlignment:{type:"string"}},function(e,t){for(var n={},r=function(e){t.map((function(t){n[L(e,t)]={type:"number"},n[I(e,t)]={type:"number",default:0}}))},o=0;o<e;o++)r(o);return n}(4,G)),edit:xe,save:function(e){var t=e.attributes,n=e.innerBlocks,r=t.className,o=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},r={span:J,offset:Q,row:Y},o=0;o<G.length;o++)n=F(F({},n),re(ne(G[o],e,t),r));return t.addGutterEnds||(n["wp-block-jetpack-layout-gutter__nowrap"]=!0),t.verticalAlignment&&"top"!==t.verticalAlignment&&(n["are-vertically-aligned-".concat(t.verticalAlignment)]=!0),n}(n.length,t),c=E()(oe(r),o,ce(t));return Object(w.createElement)("div",{className:c},Object(w.createElement)(S.InnerBlocks.Content,null))}}),Object(c.registerBlockType)("jetpack/layout-grid-column",{description:Object(i.__)("A column used inside a Layout Grid block.","layout-grid"),title:Object(i.__)("Column","layout-grid"),icon:function(e){return Object(w.createElement)(C.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),Object(w.createElement)(C.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-2zM5.5 17V8c0-.3.2-.5.5-.5h5.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2v-10h2c.3 0 .5.2.5.5v9z"}))},category:"design",parent:["jetpack/layout-grid"],supports:{inserter:!1,reusable:!1,html:!1},attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},padding:{type:"string",default:"none"},verticalAlignment:{type:"string"}},edit:Se,save:function(e){var t,n=e.attributes,r=void 0===n?{}:n,c=r.className,i=r.backgroundColor,a=r.customBackgroundColor,l=r.padding,u=r.verticalAlignment,s=Object(S.getColorClassName)("background-color",i),p=E()(c,(t={},o()(t,"wp-block-jetpack-layout-grid__padding-"+l,!0),o()(t,"has-background",i||a),o()(t,s,s),o()(t,"is-vertically-aligned-".concat(u),u),t)),d={backgroundColor:s?void 0:a};return Object(w.createElement)("div",{className:p,style:d},Object(w.createElement)(S.InnerBlocks.Content,null))},deprecated:Ce})}]);
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wp.components},function(e,t){e.exports=window.wp.blockEditor},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===c)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.data},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.primitives},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.compose},function(e,t,n){var r=n(24);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(25).default,o=n(6);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.blocks},function(e,t,n){var r=n(30),o=n(31),c=n(19),i=n(32);e.exports=function(e){return r(e)||o(e)||c(e)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){var r=n(20);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.lodash},function(e,t,n){var r=n(26);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(27),o=n(28),c=n(19),i=n(29);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=n){var r,o,c=[],_n=!0,i=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(c.push(r.value),!t||c.length!==t);_n=!0);}catch(e){i=!0,o=e}finally{try{_n||null==n.return||n.return()}finally{if(i)throw o}}return c}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(20);e.exports=function(e){if(Array.isArray(e))return r(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),c=n(16),i=n(2),a=n(10),l=n.n(a),u=n(11),s=n.n(u),p=n(12),d=n.n(p),f=n(6),b=n.n(f),g=n(14),v=n.n(g),m=n(15),h=n.n(m),y=n(8),O=n.n(y),j=n(0),w=n(21),_=n(5),k=n.n(_),x=n(4),E=n(3),S=n(18),C=n(13),M=n(9),P=Object(j.createElement)(M.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(j.createElement)(M.Path,{d:"M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z"})),A=Object(j.createElement)(M.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(j.createElement)(M.Path,{d:"M17 4H7c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H7c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h10c.3 0 .5.2.5.5v12zm-7.5-.5h4V16h-4v1.5z"})),B=Object(j.createElement)(M.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(j.createElement)(M.Path,{d:"M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z"}));function z(){return[{value:"small",label:Object(i.__)("Small","layout-grid")},{value:"medium",label:Object(i.__)("Medium","layout-grid")},{value:"large",label:Object(i.__)("Large","layout-grid")},{value:"huge",label:Object(i.__)("Huge","layout-grid")}]}var D=function(){return[{label:Object(i.__)("1 column","layout-grid"),value:1},{label:Object(i.__)("2 columns","layout-grid"),value:2},{label:Object(i.__)("3 columns","layout-grid"),value:3},{label:Object(i.__)("4 columns","layout-grid"),value:4}]},R=function(){return[{value:"Desktop",label:Object(i.__)("Desktop","layout-grid"),icon:P},{value:"Tablet",label:Object(i.__)("Tablet","layout-grid"),icon:A},{value:"Mobile",label:Object(i.__)("Mobile","layout-grid"),icon:B}]},T=["Desktop","Tablet","Mobile"];function V(e,t){return"column".concat(e+1).concat(t,"Span")}function N(e,t){return"column".concat(e+1).concat(t,"Offset")}var G=function(e){return"Tablet"===e?8:"Mobile"===e?4:12};function I(e,t,n){return"Tablet"===e?3===t&&2===n?G(e):t>1?G(e)/2:G(e):"Mobile"===e?G(e):G(e)/t}function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var U=function(e,t){return"column".concat(e+1,"-grid__span-").concat(t)},X=function(e,t){return"column".concat(e+1,"-grid__start-").concat(t)},F=function(e,t){return"column".concat(e+1,"-grid__row-").concat(t)},K=function(e,t){return"column".concat(e+1,"-grid__valign-").concat(t)},W=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__span-").concat(t)},Z=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__start-").concat(t)},$=function(e,t,n){return"column".concat(e+1,"-").concat(n.toLowerCase(),"-grid__row-").concat(t)};function q(e,t){return Math.floor(e/t)}function J(e,t){return e%t}function Q(e,t,n,r){var o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return{name:e,column:t,value:n,device:r,enabled:o}}function Y(e,t,n){for(var r=[],o=G(e),c=function(e,t,n){for(var r=[],o=0,c=0;c<e;c++){var i=V(c,t),a=N(c,t),l=n[i]||I(t,e,c),u=n[a]||0;r.push({position:o+u,span:l}),o+=u,o+=l}return r}(t,e,n),i=0;i<c.length;i++){var a=c[i],l=a.span,u=a.position,s=q(u,o),p=J(u,o);r.push(Q("span",i,l,e)),r.push(Q("offset",i,p+1,e,p>0)),r.push(Q("row",i,s+1,e))}return r}function ee(e,t){var n={};return e.filter((function(e){return e.enabled&&t[e.name]})).map((function(e){return n[t[e.name](e.column,e.value,e.device)]=!0})),n}function te(e){return e?e.replace(/column\d-\w*-grid__\w*-\d*/g,"").replace(/column\d-grid__\w*-\d*/g,"").replace(/\s{2,}/,"").replace(/wp-block-jetpack-layout-gutter__\w*/,"").replace(/is-vertically-aligned-\w*/,"").replace(/is-style-[A-Za-z-_]*/,"").replace(/are-vertically-aligned-\w*/):e}function ne(e){var t=e.gutterSize;return{"wp-block-jetpack-layout-gutter__nowrap":!e.addGutterEnds,"wp-block-jetpack-layout-gutter__none":"none"===t,"wp-block-jetpack-layout-gutter__small":"small"===t,"wp-block-jetpack-layout-gutter__medium":"medium"===t,"wp-block-jetpack-layout-gutter__huge":"huge"===t}}var re=n(22),oe=n.n(re),ce=["columns"],ie=function(e){return Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(j.createElement)(E.Path,{d:"M7 12v24h34V12H7zm32 22H9V14h30v20z"}))},ae=function(e){return Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(j.createElement)(E.Path,{d:"M7,12v24h34V12H7z M23,34H9V14h14V34z M39,34H25V14h14V34z"}))},le=function(e){return Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(j.createElement)(E.Path,{d:"M7 12v24h34V12H7zm23 2h9v20h-9V14zm-2 20h-8V14h8v20zM9 14h9v20H9V14z"}))},ue=function(e){return Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48"},e),Object(j.createElement)(E.Path,{d:"M7 12v24h34V12H7zm8 22H9V14h6v20zm8 0h-6V14h6v20zm8 0h-6V14h6v20zm8 0h-6V14h6v20z"}))},se=function(e){var t=e.columns,n=oe()(e,ce);return 4===t?Object(j.createElement)(ue,n):3===t?Object(j.createElement)(le,n):2===t?Object(j.createElement)(ae,n):Object(j.createElement)(ie,n)},pe=function(e){var t=e.direction,n=e.height,r=e.xPos,o=e.top,c=e.isSelected,i=k()("wpcom-overlay-resize__handle","components-resizable-box__container",{"is-selected":c}),a={height:n+"px",width:r+"px",top:o+"px"},l={left:r+"px"},u=k()("components-resizable-box__handle","components-resizable-box__side-handle",{"components-resizable-box__handle-left":"left"===t,"components-resizable-box__handle-right":"right"===t});return Object(j.createElement)("div",{className:i,style:a},Object(j.createElement)("span",null,Object(j.createElement)("div",{className:u,style:l})))};var de=function(e){v()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=O()(t);if(n){var o=O()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return h()(this,e)});function c(e){var t;return s()(this,c),t=r.call(this,e),o()(b()(t),"onMouseDown",(function(e){var n=e.target;if((0===e.button||e.touches)&&(n.dataset.resizeRight||n.dataset.resizeLeft)){t.block=n.closest(".wp-block");var r=t.block.getBoundingClientRect(),o=r.height,c=r.right,i=r.left,a=r.top,l=n.getBoundingClientRect().width,u=t.getChildPosition(t.block),s=n.dataset.resizeLeft;t.setState({resizingColumn:u,xPos:t.getAdjustedOffset(t.getMouseX(e),l),height:o,width:l,top:t.getAdjustedTop(a),direction:s?"left":"right",max:s?t.getAdjustedOffset(c,l):t.getAdjustedOffset(i,l)}),0===e.button?(document.addEventListener("mousemove",t.onMouseMove),document.addEventListener("mouseup",t.onMouseUp),e.preventDefault()):(document.addEventListener("touchmove",t.onMouseMove),document.addEventListener("touchend",t.onMouseUp)),e.stopPropagation()}})),o()(b()(t),"onMouseMove",(function(e){e.stopPropagation(),void 0===e.touches&&e.preventDefault();var n=t.block.getBoundingClientRect().height;t.setState({xPos:t.getRestrictedOffset(t.getAdjustedOffset(t.getMouseX(e))),height:n});var r=t.getNearestColumn(t.state.direction,e);r&&t.props.onResize(t.state.resizingColumn,r)})),o()(b()(t),"onMouseUp",(function(e){t.setState({resizingColumn:-1}),document.removeEventListener("mousemove",t.onMouseMove),document.removeEventListener("mouseup",t.onMouseUp),document.removeEventListener("touchmove",t.onMouseMove),document.removeEventListener("touchend",t.onMouseUp)})),t.containerRef=Object(j.createRef)(),t.state={resizingColumn:-1,xPos:0,height:0},t}return d()(c,[{key:"getNearestColumn",value:function(e,t){var n=this.props,r=n.totalColumns,o=n.layoutGrid,c=o.getStart(this.state.resizingColumn),i=o.getSpan(this.state.resizingColumn),a=Math.min(r,Math.max(0,function(e,t,n,r){var o=e.getBoundingClientRect(),c=o.width/r,i=t-o.x,a=Math.floor(i/c),l=i%c;return"left"===n?l<=c/2?a:a+1:l<c/2?a:a+1}(this.containerRef.current,this.getMouseX(t),e,r)));if("left"===e){if(a===c)return null;var l=Math.abs(a-c),u={start:a,span:a>c?i-l:i+l,direction:e};return u.start>=c+i?null:(u.span=Math.max(1,u.span),u)}return{span:Math.max(1,a-c),direction:e}}},{key:"getMouseX",value:function(e){var t=e.clientX,n=e.targetTouches;return t||n&&n[0].clientX}},{key:"getAdjustedOffset",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.state.width,r=t>0?t:n;return e-this.containerRef.current.getBoundingClientRect().left-r/2}},{key:"getAdjustedTop",value:function(e){return e-this.containerRef.current.getBoundingClientRect().top}},{key:"getRestrictedOffset",value:function(e){var t=this.state,n=t.direction,r=t.max,o=t.width;return"left"===n?Math.min(r-o,e):Math.max(r+o,e)}},{key:"getChildPosition",value:function(e){for(var t=0;null!==e.previousSibling;)e=e.previousSibling,t++;return t}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.children,r=e.isSelected,o=this.state,c=o.resizingColumn,i=o.xPos,a=o.height,l=k()(t,-1!==c?"wp-block-jetpack-layout-grid__resizing":null);return Object(j.createElement)("div",{className:l,onMouseDown:this.onMouseDown,onTouchStart:this.onMouseDown,ref:this.containerRef},-1!==c&&Object(j.createElement)(pe,{direction:this.state.direction,height:a,xPos:i,top:this.state.top,isSelected:r}),n)}}]),c}(j.Component);function fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fe(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ge=function(){function e(t,n,r){s()(this,e),this.attributes=t,this.device=n,this.columnCount=r}return d()(e,[{key:"getGridValues",value:function(){for(var e={},t=0;t<this.columnCount;t++){var n=I(this.device,this.columnCount,t);e[V(t,this.device)]=this.getSpan(t)||n,e[N(t,this.device)]=this.getOffset(t)}return e}},{key:"applyAdjustments",value:function(e){for(var t=this.getGridValues(),n=0;n<e.length;n++)t=be(be({},t),e[n]);return t}},{key:"getSpanAdjustment",value:function(e,t){return o()({},V(e,this.device),t)}},{key:"getAdjustOffset",value:function(e,t){return o()({},N(e,this.device),t)}},{key:"getShrinkOffset",value:function(e,t){var n=this.getOffset(e),r=t>=n?n:t;return{adjustment:this.getAdjustOffset(e,n-r),offsetUsed:r}}},{key:"hasOverlaps",value:function(e){for(var t=0;t<e.length;t++)for(var n=e[t],r=t+1;r<e.length;r++){var o=e[r];if(n.start>o.start&&n.start<o.end)return!0;if(n.end>o.start&&n.end<o.end)return!0}return!1}},{key:"validateGrid",value:function(e){for(var t,n,r=[],o=G(this.device),c=0,i=0,a=0;a<this.columnCount;a++){var l=e[V(a,this.device)],u=e[N(a,this.device)];if((i+=u)>=o&&(i-=o),(i+=l)>o)return!1;r.push({start:c+u,end:c+u+l}),c+=l+u}return!(c>(t=this.device,n=this.columnCount,"Tablet"===t&&n>2?2*G(t):"Mobile"===t?G(t)*n:G(t))||this.hasOverlaps(r))}},{key:"getEndAdjustments",value:function(e,t){var n=[];if(t<0)return[this.getAdjustOffset(e,this.getOffset(e)+Math.abs(t))];if(t>0)for(var r=e;r<this.columnCount&&t>0;r++){var o=this.getShrinkOffset(r,Math.abs(t));n.push(o.adjustment),t-=o.offsetUsed}return n}},{key:"getStartMovedLeft",value:function(e,t){for(var n=[],r=e;r>=0&&t>0;r--){var o=this.getShrinkOffset(r,t);n.push(o.adjustment),t-=o.offsetUsed}return n}},{key:"getStartAdjustments",value:function(e,t){var n=this.getOffset(e),r=this.getOffsetFromStart(e,t),o=r-n;return o<0?this.getStartMovedLeft(e,Math.abs(o)):[this.getAdjustOffset(e,r)]}},{key:"getSpan",value:function(e){return this.attributes[V(e,this.device)]}},{key:"getOffset",value:function(e){return this.attributes[N(e,this.device)]}},{key:"getStart",value:function(e){for(var t=0,n=0;n<e;n++)t+=this.getSpan(n)+this.getOffset(n);var r=Math.max(1,Math.floor(t/G(this.device)));return(t+this.getOffset(e))%(r*G(this.device))}},{key:"getOffsetFromStart",value:function(e,t){if(0===e)return t;var n=t-this.getStart(e);return this.getOffset(e)+n}},{key:"convertOffsetToStart",value:function(e,t){return this.getStart(e)+(t-this.getOffset(e))}},{key:"getAdjustedGrid",value:function(e,t){var n=t.start,r=void 0===n?this.getStart(e):n,o=t.span,c=void 0===o?this.getSpan(e):o,i=[];r!==this.getStart(e)&&c!==this.getSpan(e)?i=(i=i.concat(this.getStartAdjustments(e,r))).concat(this.getSpanAdjustment(e,c)):c!==this.getSpan(e)?i=(i=i.concat(this.getSpanAdjustment(e,c))).concat(this.getEndAdjustments(e+1,c-this.getSpan(e))):r!==this.getStart(e)&&(i=(i=i.concat(this.getStartAdjustments(e,r))).concat(this.getEndAdjustments(e+1,r-this.getStart(e))));var a=this.applyAdjustments(i);return i.length>0&&this.validateGrid(a)?a:null}}]),e}(),ve=n(23),me=n.n(ve),he=n(7),ye=function(e){var t=e.viewPort,n=e.updateViewport,r=Object(he.useDispatch)("core/edit-post").__experimentalSetPreviewDeviceType,o=Object(he.useSelect)((function(e){return e("core/edit-post").__experimentalGetPreviewDeviceType()}),[]),c=Object(C.useResizeObserver)(),i=me()(c,2),a=i[0],l=i[1],u=Object(C.useViewportMatch)("medium","<"),s=Object(C.useViewportMatch)("small","<");return Object(j.useEffect)((function(){var e=function(e,t){return e?"Mobile":t?"Tablet":"Desktop"}(s,u);e!==t&&n(e)}),[l]),Object(j.createElement)(j.Fragment,null,a,!s&&Object(j.createElement)(x.BlockControls,null,Object(j.createElement)(E.Dropdown,{renderToggle:function(e){var t=e.isOpen,n=e.onToggle;return Object(j.createElement)(E.ToolbarGroup,null,Object(j.createElement)(E.Button,{"aria-expanded":t,onClick:n,icon:R().find((function(e){return e.value===o})).icon}))},renderContent:function(){return Object(j.createElement)(E.MenuGroup,null,Object(j.createElement)(E.MenuItemsChoice,{value:o,onSelect:function(e){return r(e)},choices:R()}))}})))},Oe=n(17),je=n.n(Oe);function we(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?we(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):we(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ke(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ke(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ke(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ee=["jetpack/layout-grid-column"],Se=function(e){v()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=O()(t);if(n){var o=O()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return h()(this,e)});function c(e){var t;return s()(this,c),t=r.call(this,e),o()(b()(t),"onChangeLayout",(function(e){for(var n={},r=0;r<e;r++)for(var o=0;o<T.length;o++){var c=I(T[o],e,r);n[V(r,T[o])]=c,n[N(r,T[o])]=0}t.props.updateColumns(t.props.columns,e,n)})),o()(b()(t),"onResize",(function(e,n){var r=t.props,o=r.attributes,c=r.columns,i=new ge(o,t.getPreviewMode(),c).getAdjustedGrid(e,n);i&&t.adjustGrid(i)})),o()(b()(t),"onChangeSpan",(function(e,n,r){var o=t.props,c=o.attributes,i=o.columns,a=new ge(c,n,i).getAdjustedGrid(e,{span:parseInt(r,10)});a&&t.adjustGrid(a)})),o()(b()(t),"onChangeOffset",(function(e,n,r){var o=t.props,c=o.attributes,i=o.columns,a=new ge(c,n,i),l=a.getAdjustedGrid(e,{start:a.convertOffsetToStart(e,parseInt(r,10))});l&&t.adjustGrid(l)})),t.overlayRef=Object(j.createRef)(),t.state={inspectorDeviceType:"Desktop",viewPort:"Desktop"},t}return d()(c,[{key:"adjustGrid",value:function(e){var t=this.props,n=t.setAttributes,r=t.attributes;n(xe(xe({},e),{},{className:te(r.className)}))}},{key:"renderDeviceSettings",value:function(e,t,n){for(var r=this,o=new ge(n,t,this.props.columns),c=[],a=function(n){var a=o.getSpan(n)||I(t,e,n),l=o.getOffset(n)||0;c.push(Object(j.createElement)("div",{className:"jetpack-layout-grid-settings",key:n},Object(j.createElement)("strong",null,Object(i.__)("Column","layout-grid")," ",n+1),Object(j.createElement)("div",{className:"jetpack-layout-grid-settings__group"},Object(j.createElement)(E.TextControl,{type:"number",label:Object(i.__)("Offset","layout-grid"),value:l||0,min:0,max:G(t)-1,onChange:function(e){return r.onChangeOffset(n,t,e)}}),Object(j.createElement)(E.TextControl,{type:"number",label:Object(i.__)("Span","layout-grid"),value:a,min:1,max:G(t),onChange:function(e){return r.onChangeSpan(n,t,e)}}))))},l=0;l<e;l++)a(l);return c}},{key:"canResizeBreakpoint",value:function(e){return!(!this.overlayRef||!this.overlayRef.current)&&this.overlayRef.current.getBoundingClientRect().width/G(e)>50}},{key:"updateInspectorDevice",value:function(e){this.setState({inspectorDeviceType:e}),"Mobile"!==this.state.viewPort&&this.props.setPreviewDeviceType(e)}},{key:"getPreviewMode",value:function(){return this.props.isBlockOrPatternPreview?"Desktop":"Desktop"===this.state.viewPort||"Mobile"===this.props.previewDeviceType?this.props.previewDeviceType:this.state.viewPort}},{key:"getInspectorMode",value:function(){return"Desktop"===this.state.viewPort?this.props.previewDeviceType:this.state.inspectorDeviceType}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.attributes,c=void 0===r?{}:r,a=t.isSelected,l=t.columns,u=t.setAttributes,s=t.updateAlignment,p=t.columnAttributes,d=this.state.viewPort,f=this.getPreviewMode(),b=this.getInspectorMode(),g=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=Y(e,t,n),c={span:U,offset:X,row:F},i={},a=0;a<t;a++)r[a].verticalAlignment&&r[a].verticalAlignment!==n.verticalAlignment&&(i[K(a,r[a].verticalAlignment)]=!0);return H(H({},ee(o,c)),i)}(f,l,c,p),v=c.gutterSize,m=c.addGutterEnds,h=c.verticalAlignment,y=new ge(c,f,l),O=k()(te(n).replace("layout-grid","layout-grid-editor"),"wp-block-jetpack-editor",g,o()({"wp-block-jetpack-layout-tablet":"Tablet"===f,"wp-block-jetpack-layout-desktop":"Desktop"===f,"wp-block-jetpack-layout-mobile":"Mobile"===f,"wp-block-jetpack-layout-resizable":this.canResizeBreakpoint(f)},"are-vertically-aligned-".concat(h),h),ne(c));if(0===l)return Object(j.createElement)(E.Placeholder,{icon:"layout",label:Object(i.__)("Choose Layout","layout-grid"),instructions:Object(i.__)("Select a layout to start with:","layout-grid"),className:O},Object(j.createElement)("ul",{className:"block-editor-inner-blocks__template-picker-options"},D().map((function(t){return Object(j.createElement)("li",{key:t.value},Object(j.createElement)(E.IconButton,{isSecondary:!0,icon:Object(j.createElement)(se,{columns:t.value}),onClick:function(){return e.onChangeLayout(t.value)},className:"block-editor-inner-blocks__template-picker-option",label:t.label}))}))));var _=Object(j.createElement)(E.ToggleControl,{label:Object(i.__)("Add end gutters","layout-grid"),help:m?Object(i.__)("Toggle off to remove the spacing left and right of the grid.","layout-grid"):Object(i.__)("Toggle on to add space left and right of the layout grid. ","layout-grid"),checked:m,onChange:function(e){return u({addGutterEnds:e})}});return Object(j.createElement)(j.Fragment,null,Object(j.createElement)(ye,{currentViewport:d,updateViewport:function(t){return e.setState({viewPort:t,inspectorDeviceType:t})}}),Object(j.createElement)(de,{className:O,onResize:this.onResize,totalColumns:G(f),layoutGrid:y,isSelected:a},Object(j.createElement)("div",{className:"wpcom-overlay-grid",ref:this.overlayRef},Object(j.createElement)("div",{className:"wpcom-overlay-grid__inner"},Object(w.times)(G(f)).map((function(e){return Object(j.createElement)("div",{className:"wpcom-overlay-grid__column",key:e})})))),Object(j.createElement)(x.InnerBlocks,{template:null,templateLock:"all",allowedBlocks:Ee}),Object(j.createElement)(x.InspectorControls,null,Object(j.createElement)(E.PanelBody,{title:Object(i.__)("Layout","layout-grid")},Object(j.createElement)("div",{className:"jetpack-layout-grid-columns block-editor-block-styles"},D().map((function(t){return Object(j.createElement)("div",{key:t.value,className:k()("block-editor-block-styles__item",{"is-active":l===t.value}),onClick:function(){return e.onChangeLayout(t.value)},onKeyDown:function(n){S.ENTER!==n.keyCode&&S.SPACE!==n.keyCode||(n.preventDefault(),e.onChangeLayout(t.value))},role:"button",tabIndex:"0","aria-label":t.label},Object(j.createElement)("div",{className:"block-editor-block-styles__item-preview"},Object(j.createElement)(se,{columns:t.value})),Object(j.createElement)("div",{className:"editor-block-styles__item-label block-editor-block-styles__item-label"},t.label))}))),Object(j.createElement)("p",null,Object(j.createElement)("em",null,Object(i.__)("Changing the number of columns will reset your layout and could remove content.","layout-grid")))),Object(j.createElement)(E.PanelBody,{title:Object(i.__)("Responsive Breakpoints","layout-grid")},Object(j.createElement)("p",null,Object(j.createElement)("em",null,Object(i.__)("Note that previewing your post will show your browser's breakpoint, not the currently selected one.","layout-grid"))),Object(j.createElement)(E.ButtonGroup,null,R().map((function(t){return Object(j.createElement)(E.Button,{key:t.value,isPrimary:t.value===b,onClick:function(){return e.updateInspectorDevice(t.value)}},t.label)}))),this.renderDeviceSettings(l,b,c)),Object(j.createElement)(E.PanelBody,{title:Object(i.__)("Gutter","layout-grid")},Object(j.createElement)("p",null,Object(i.__)("Gutter size","layout-grid")),Object(j.createElement)(E.SelectControl,{value:v,onChange:function(e){return u({gutterSize:e,addGutterEnds:"none"!==e&&m})},options:[{value:"none",label:Object(i.__)("No gutter","layout-grid")}].concat(z())}),"none"===v?Object(j.createElement)(E.Disabled,null,_):_))),Object(j.createElement)(x.BlockControls,null,Object(j.createElement)(x.BlockVerticalAlignmentToolbar,{onChange:s,value:h})))}}]),c}(j.Component),Ce=Object(C.compose)([Object(he.withDispatch)((function(e,t,n){return{updateAlignment:function(r){var o=t.clientId,c=t.setAttributes,i=e("core/block-editor").updateBlockAttributes,a=n.select("core/block-editor").getBlockOrder;c({verticalAlignment:r}),a(o).forEach((function(e){i(e,{verticalAlignment:r})}))}}})),Object(he.withDispatch)((function(e,t,n){return{updateColumns:function(r,o,i){var a=t.clientId,l=e("core/block-editor").replaceBlock,u=function(e,t,n){if(n>t)return[].concat(je()(e),je()(Array.from({length:n-t},(function(){return Object(c.createBlock)("jetpack/layout-grid-column")}))));var r=je()(e),o=0;return r.reverse(),(r=r.filter((function(e){return!(o<t-n&&0===e.innerBlocks.length&&(o++,1))}))).slice(Math.max(0,t-n-o)).reverse()}((0,n.select("core/block-editor").getBlocks)(a),r,o);l(a,Object(c.createBlock)(t.name,_e(_e(_e({},t.attributes),i),{},{className:te(t.attributes.className)}),u))}}})),Object(he.withDispatch)((function(e){return{setPreviewDeviceType:function(t){(0,e("core/edit-post").__experimentalSetPreviewDeviceType)(t)}}})),Object(he.withSelect)((function(e,t){var n=t.clientId;return{columns:(0,e("core/block-editor").getBlockCount)(n)}})),Object(he.withSelect)((function(e,t){var n=t.clientId,r=e("core/block-editor"),o=r.getBlockOrder,c=r.getBlocksByClientId;return{columnAttributes:o(n).map((function(e){return c(e)[0].attributes}))}})),Object(he.withSelect)((function(e){var t=e("core/edit-post").__experimentalGetPreviewDeviceType;return{previewDeviceType:(void 0===t?null:t)()}}))])((function(e){return Object(j.createElement)(E.Disabled.Consumer,null,(function(t){return Object(j.createElement)(Se,l()({},e,{isBlockOrPatternPreview:t}))}))}));var Me=function(e){v()(c,e);var t,n,r=(t=c,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=O()(t);if(n){var o=O()(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return h()(this,e)});function c(e){var t;return s()(this,c),t=r.call(this,e),o()(b()(t),"onLeftIn",(function(){t.setState({direction:"left"}),document.addEventListener("mouseup",t.onLeftOut)})),o()(b()(t),"onLeftOut",(function(){t.setState({direction:null}),document.removeEventListener("mouseup",t.onLeftOut)})),o()(b()(t),"onRightIn",(function(){t.setState({direction:"right"}),document.addEventListener("mouseup",t.onRightOut)})),o()(b()(t),"onRightOut",(function(){t.setState({direction:null}),document.removeEventListener("mouseup",t.onRightOut)})),t.state={direction:null},t}return d()(c,[{key:"render",value:function(){var e,t=this.props,n=t.className,r=t.hasChildBlocks,c=t.backgroundColor,a=t.setBackgroundColor,l=t.attributes,u=t.setAttributes,s=t.updateAlignment,p=l.padding,d=l.verticalAlignment,f=this.state.direction,b=k()(n,c.class,(e={},o()(e,"wp-block-jetpack-layout-grid__padding-"+p,!0),o()(e,"has-background",c.color),o()(e,"components-resizable-box__container",!0),o()(e,c.class,c.class),o()(e,"wp-blocks-jetpack-layout-grid__showleft","right"===f),o()(e,"wp-blocks-jetpack-layout-grid__showright","left"===f),o()(e,"is-vertically-aligned-".concat(d),d),e)),g={backgroundColor:c.color};return Object(j.createElement)("div",{className:b,style:g},Object(j.createElement)("span",{className:"wp-blocks-jetpack-layout-grid__resize-handles"},Object(j.createElement)("div",{className:"components-resizable-box__handle components-resizable-box__side-handle components-resizable-box__handle-right",onMouseDown:this.onRightIn,"data-resize-right":!0}),Object(j.createElement)("div",{className:"components-resizable-box__handle components-resizable-box__side-handle components-resizable-box__handle-left",onMouseDown:this.onLeftIn,"data-resize-left":!0})),Object(j.createElement)(x.InnerBlocks,{templateLock:!1,renderAppender:r?void 0:function(){return Object(j.createElement)(x.InnerBlocks.ButtonBlockAppender,null)}}),Object(j.createElement)(x.InspectorControls,null,Object(j.createElement)(x.PanelColorSettings,{title:Object(i.__)("Column Color","layout-grid"),initialOpen:!0,colorSettings:[{value:c.color,onChange:a,label:Object(i.__)("Background","layout-grid")}]}),Object(j.createElement)(E.PanelBody,{title:Object(i.__)("Column Padding","layout-grid")},Object(j.createElement)("p",null,Object(i.__)("Choose padding for this column:","layout-grid")),Object(j.createElement)(E.SelectControl,{value:p,onChange:function(e){return u({padding:e})},options:[{value:"none",label:Object(i.__)("No padding","layout-grid")}].concat(z())}))),Object(j.createElement)(x.BlockControls,null,Object(j.createElement)(x.BlockVerticalAlignmentToolbar,{onChange:s,value:d})))}}]),c}(j.Component),Pe=Object(C.compose)(Object(x.withColors)("backgroundColor"),Object(he.withSelect)((function(e,t){var n=t.clientId;return{hasChildBlocks:(0,e("core/block-editor").getBlockOrder)(n).length>0}})),Object(he.withDispatch)((function(e,t,n){return{updateAlignment:function(r){var o=t.clientId,c=t.setAttributes,i=e("core/block-editor").updateBlockAttributes,a=n.select("core/block-editor").getBlockRootClientId;c({verticalAlignment:r}),i(a(o),{verticalAlignment:null})}}})))(Me),Ae=[{attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},padding:{type:"string",default:"none"},verticalAlignment:{type:"string"}},save:function(e){var t,n=e.attributes,r=void 0===n?{}:n,c=r.className,i=r.backgroundColor,a=r.customBackgroundColor,l=r.padding,u=r.verticalAlignment,s=Object(x.getColorClassName)("background-color",i),p=k()(c,(t={},o()(t,"wp-block-jetpack-layout-grid__padding-"+l,!0),o()(t,"has-background",i),o()(t,s,s),o()(t,"is-vertically-aligned-".concat(u),u),t)),d={backgroundColor:s?void 0:a};return Object(j.createElement)("div",{className:p,style:d},Object(j.createElement)(x.InnerBlocks.Content,null))}}];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}Object(c.registerBlockType)("jetpack/layout-grid",{title:Object(i.__)("Layout Grid","layout-grid"),description:Object(i.__)("Align blocks to a global grid, with support for responsive breakpoints.","layout-grid"),icon:function(e){return e.size&&(e.width=e.size,e.height=e.size),Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),Object(j.createElement)(E.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-7.5 11.5H6c-.3 0-.5-.2-.5-.5V8c0-.3.2-.5.5-.5h5.5v10zm4 0H13v-10h2.5v10zm4-.5c0 .3-.2.5-.5.5h-2v-10h2c.3 0 .5.2.5.5v9z"}))},category:"design",supports:{align:["full"],html:!1},example:{attributes:{columns:2},innerBlocks:[{name:"jetpack/layout-grid-column",innerBlocks:[{name:"core/paragraph",attributes:{customFontSize:32,content:Object(i.__)("<strong>Snow Patrol</strong>","layout-grid"),align:"center"}}]},{name:"jetpack/layout-grid-column",innerBlocks:[{name:"core/image",attributes:{url:"https://s.w.org/images/core/5.3/Windbuchencom.jpg"}}]}]},attributes:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({align:{type:"string",default:"full"},gutterSize:{type:"string",default:"large"},addGutterEnds:{type:"boolean",default:!0},verticalAlignment:{type:"string"}},function(e,t){for(var n={},r=function(e){t.map((function(t){n[V(e,t)]={type:"number"},n[N(e,t)]={type:"number",default:0}}))},o=0;o<e;o++)r(o);return n}(4,T)),edit:Ce,save:function(e){var t=e.attributes,n=e.innerBlocks,r=t.className,o=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={},r={span:W,offset:Z,row:$},o=0;o<T.length;o++)n=H(H({},n),ee(Y(T[o],e,t),r));return t.addGutterEnds||(n["wp-block-jetpack-layout-gutter__nowrap"]=!0),t.verticalAlignment&&"top"!==t.verticalAlignment&&(n["are-vertically-aligned-".concat(t.verticalAlignment)]=!0),n}(n.length,t),c=k()(te(r),o,ne(t));return Object(j.createElement)("div",{className:c},Object(j.createElement)(x.InnerBlocks.Content,null))}}),Object(c.registerBlockType)("jetpack/layout-grid-column",{description:Object(i.__)("A column used inside a Layout Grid block.","layout-grid"),title:Object(i.__)("Column","layout-grid"),icon:function(e){return Object(j.createElement)(E.SVG,l()({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},e),Object(j.createElement)(E.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-2zM5.5 17V8c0-.3.2-.5.5-.5h5.5v10H6c-.3 0-.5-.2-.5-.5zm14 0c0 .3-.2.5-.5.5h-2v-10h2c.3 0 .5.2.5.5v9z"}))},category:"design",parent:["jetpack/layout-grid"],supports:{inserter:!1,reusable:!1,html:!1},attributes:{backgroundColor:{type:"string"},customBackgroundColor:{type:"string"},padding:{type:"string",default:"none"},verticalAlignment:{type:"string"}},edit:Pe,save:function(e){var t,n=e.attributes,r=void 0===n?{}:n,c=r.className,i=r.backgroundColor,a=r.customBackgroundColor,l=r.padding,u=r.verticalAlignment,s=Object(x.getColorClassName)("background-color",i),p=k()(c,(t={},o()(t,"wp-block-jetpack-layout-grid__padding-"+l,!0),o()(t,"has-background",i||a),o()(t,s,s),o()(t,"is-vertically-aligned-".concat(u),u),t)),d={backgroundColor:s?void 0:a};return Object(j.createElement)("div",{className:p,style:d},Object(j.createElement)(x.InnerBlocks.Content,null))},deprecated:Ae})}]);
|
index.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Layout Grid
|
4 |
* Description: Let any blocks align to a global grid
|
5 |
-
* Version: 1.
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com
|
8 |
* License: GPL v2 or later
|
2 |
/**
|
3 |
* Plugin Name: Layout Grid
|
4 |
* Description: Let any blocks align to a global grid
|
5 |
+
* Version: 1.7
|
6 |
* Author: Automattic
|
7 |
* Author URI: https://automattic.com
|
8 |
* License: GPL v2 or later
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Layout Grid Block ===
|
2 |
Contributors: automattic, jasmussen, johnny5, mkaz
|
3 |
Stable tag: trunk
|
4 |
-
Tested up to: 5.
|
5 |
Requires at least: 5.6
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
8 |
-
Tags: blocks, layout, grid, design
|
9 |
|
10 |
A Gutenberg container block to let you align items consistently across a global grid.
|
11 |
|
@@ -24,6 +24,12 @@ You can follow development, file an issue, suggest features, and view the source
|
|
24 |
|
25 |
== Changelog ==
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
= 1.6 - 26th March 2021 =
|
28 |
* Remove deprecated Gutenberg functions
|
29 |
* Restore hyphenation behaviour to 1.3 - it caused too many issues
|
1 |
=== Layout Grid Block ===
|
2 |
Contributors: automattic, jasmussen, johnny5, mkaz
|
3 |
Stable tag: trunk
|
4 |
+
Tested up to: 5.8
|
5 |
Requires at least: 5.6
|
6 |
License: GPLv2 or later
|
7 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
8 |
+
Tags: blocks, layout, grid, design, block
|
9 |
|
10 |
A Gutenberg container block to let you align items consistently across a global grid.
|
11 |
|
24 |
|
25 |
== Changelog ==
|
26 |
|
27 |
+
= 1.7 - 13th July 2021 =
|
28 |
+
* Add initial support for WordPress mobile app
|
29 |
+
* Fix incorrect behaviour of drag handles in Safari
|
30 |
+
* Fix sticky block styles
|
31 |
+
* Fix image right alignment
|
32 |
+
|
33 |
= 1.6 - 26th March 2021 =
|
34 |
* Remove deprecated Gutenberg functions
|
35 |
* Restore hyphenation behaviour to 1.3 - it caused too many issues
|