@wordpress/block-editor 9.3.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-pattern-setup/index.js +3 -9
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-preview/auto.js +21 -5
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-edit-visually-button.js +70 -0
- package/build/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js +6 -2
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +4 -1
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +3 -10
- package/build/components/block-title/use-block-display-title.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +2 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/duotone/components.js +145 -0
- package/build/components/duotone/components.js.map +1 -0
- package/build/components/duotone/index.js +40 -0
- package/build/components/duotone/index.js.map +1 -0
- package/build/components/duotone/utils.js +38 -0
- package/build/components/duotone/utils.js.map +1 -0
- package/build/components/duotone-control/index.js +17 -5
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/index.js +14 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/index.js +3 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +1 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +4 -4
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -7
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +3 -0
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +4 -13
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +20 -5
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/elements/index.js +11 -3
- package/build/elements/index.js.map +1 -1
- package/build/hooks/aria-label.js +71 -0
- package/build/hooks/aria-label.js.map +1 -0
- package/build/hooks/duotone.js +33 -160
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +3 -7
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +6 -4
- package/build/hooks/layout.js.map +1 -1
- package/build/index.js +0 -7
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +2 -2
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +10 -14
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +18 -9
- package/build/store/reducer.js.map +1 -1
- package/build/utils/selection.js +34 -0
- package/build/utils/selection.js.map +1 -0
- package/build-module/components/block-pattern-setup/index.js +3 -9
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +3 -8
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-preview/auto.js +20 -5
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-edit-visually-button.js +56 -0
- package/build-module/components/block-settings-menu/block-edit-visually-button.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +6 -3
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +5 -2
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +3 -9
- package/build-module/components/block-title/use-block-display-title.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +2 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/duotone/components.js +130 -0
- package/build-module/components/duotone/components.js.map +1 -0
- package/build-module/components/duotone/index.js +3 -0
- package/build-module/components/duotone/index.js.map +1 -0
- package/build-module/components/duotone/utils.js +30 -0
- package/build-module/components/duotone/utils.js.map +1 -0
- package/build-module/components/duotone-control/index.js +18 -6
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -2
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +5 -3
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -6
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +2 -0
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +3 -11
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +20 -5
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/elements/index.js +7 -1
- package/build-module/elements/index.js.map +1 -1
- package/build-module/hooks/aria-label.js +59 -0
- package/build-module/hooks/aria-label.js.map +1 -0
- package/build-module/hooks/duotone.js +22 -140
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +6 -4
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +2 -2
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +6 -11
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +19 -10
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils/selection.js +24 -0
- package/build-module/utils/selection.js.map +1 -0
- package/build-style/style-rtl.css +5 -1
- package/build-style/style.css +5 -1
- package/package.json +28 -28
- package/src/components/block-draggable/test/helpers.native.js +3 -3
- package/src/components/block-list/style.scss +1 -1
- package/src/components/block-pattern-setup/index.js +2 -10
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -9
- package/src/components/block-preview/auto.js +17 -3
- package/src/components/block-settings-menu/block-edit-visually-button.js +52 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +3 -2
- package/src/components/block-settings-menu/index.js +15 -11
- package/src/components/block-settings-menu-controls/index.js +3 -2
- package/src/components/block-title/use-block-display-title.js +9 -7
- package/src/components/colors-gradients/dropdown.js +1 -0
- package/src/components/duotone/components.js +133 -0
- package/src/components/duotone/index.js +7 -0
- package/src/components/duotone/utils.js +25 -0
- package/src/components/duotone-control/index.js +12 -7
- package/src/components/duotone-control/style.scss +5 -0
- package/src/components/index.js +1 -0
- package/src/components/inserter/index.js +3 -5
- package/src/components/link-control/test/fixtures/index.js +3 -4
- package/src/components/link-control/test/index.js +58 -69
- package/src/components/media-placeholder/index.js +1 -0
- package/src/components/media-placeholder/index.native.js +9 -5
- package/src/components/media-replace-flow/index.js +2 -8
- package/src/components/media-upload/README.md +8 -0
- package/src/components/publish-date-time-picker/index.js +2 -0
- package/src/components/responsive-block-control/README.md +3 -1
- package/src/components/responsive-block-control/test/index.js +1 -2
- package/src/components/rich-text/use-input-rules.js +6 -15
- package/src/components/rich-text/use-paste-handler.js +17 -5
- package/src/elements/index.js +8 -1
- package/src/elements/test/index.js +18 -0
- package/src/hooks/aria-label.js +67 -0
- package/src/hooks/duotone.js +18 -139
- package/src/hooks/index.js +1 -1
- package/src/hooks/layout.js +20 -9
- package/src/index.js +0 -1
- package/src/layouts/flex.js +2 -2
- package/src/store/actions.js +8 -21
- package/src/store/reducer.js +21 -9
- package/src/store/test/reducer.js +138 -10
- package/src/store/test/selectors.js +3 -6
- package/src/utils/selection.js +26 -0
- package/src/utils/test/selection.js +39 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { addFilter } from '@wordpress/hooks';
|
|
5
|
+
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
+
const ARIA_LABEL_SCHEMA = {
|
|
7
|
+
type: 'string',
|
|
8
|
+
source: 'attribute',
|
|
9
|
+
attribute: 'aria-label',
|
|
10
|
+
selector: '*'
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Filters registered block settings, extending attributes with ariaLabel using aria-label
|
|
14
|
+
* of the first node.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} settings Original block settings.
|
|
17
|
+
*
|
|
18
|
+
* @return {Object} Filtered block settings.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export function addAttribute(settings) {
|
|
22
|
+
var _settings$attributes, _settings$attributes$;
|
|
23
|
+
|
|
24
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
25
|
+
if (settings !== null && settings !== void 0 && (_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 && (_settings$attributes$ = _settings$attributes.ariaLabel) !== null && _settings$attributes$ !== void 0 && _settings$attributes$.type) {
|
|
26
|
+
return settings;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (hasBlockSupport(settings, 'ariaLabel')) {
|
|
30
|
+
// Gracefully handle if settings.attributes is undefined.
|
|
31
|
+
settings.attributes = { ...settings.attributes,
|
|
32
|
+
ariaLabel: ARIA_LABEL_SCHEMA
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return settings;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Override props assigned to save component to inject aria-label, if block
|
|
40
|
+
* supports ariaLabel. This is only applied if the block's save result is an
|
|
41
|
+
* element and not a markup string.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} extraProps Additional props applied to save element.
|
|
44
|
+
* @param {Object} blockType Block type.
|
|
45
|
+
* @param {Object} attributes Current block attributes.
|
|
46
|
+
*
|
|
47
|
+
* @return {Object} Filtered props applied to save element.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export function addSaveProps(extraProps, blockType, attributes) {
|
|
51
|
+
if (hasBlockSupport(blockType, 'ariaLabel')) {
|
|
52
|
+
extraProps['aria-label'] = attributes.ariaLabel === '' ? null : attributes.ariaLabel;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return extraProps;
|
|
56
|
+
}
|
|
57
|
+
addFilter('blocks.registerBlockType', 'core/ariaLabel/attribute', addAttribute);
|
|
58
|
+
addFilter('blocks.getSaveContent.extraProps', 'core/ariaLabel/save-props', addSaveProps);
|
|
59
|
+
//# sourceMappingURL=aria-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/aria-label.js"],"names":["addFilter","hasBlockSupport","ARIA_LABEL_SCHEMA","type","source","attribute","selector","addAttribute","settings","attributes","ariaLabel","addSaveProps","extraProps","blockType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA,MAAMC,iBAAiB,GAAG;AACzBC,EAAAA,IAAI,EAAE,QADmB;AAEzBC,EAAAA,MAAM,EAAE,WAFiB;AAGzBC,EAAAA,SAAS,EAAE,YAHc;AAIzBC,EAAAA,QAAQ,EAAE;AAJe,CAA1B;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,YAAT,CAAuBC,QAAvB,EAAkC;AAAA;;AACxC;AACA,MAAKA,QAAL,aAAKA,QAAL,uCAAKA,QAAQ,CAAEC,UAAf,0EAAK,qBAAsBC,SAA3B,kDAAK,sBAAiCP,IAAtC,EAA6C;AAC5C,WAAOK,QAAP;AACA;;AACD,MAAKP,eAAe,CAAEO,QAAF,EAAY,WAAZ,CAApB,EAAgD;AAC/C;AACAA,IAAAA,QAAQ,CAACC,UAAT,GAAsB,EACrB,GAAGD,QAAQ,CAACC,UADS;AAErBC,MAAAA,SAAS,EAAER;AAFU,KAAtB;AAIA;;AAED,SAAOM,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,YAAT,CAAuBC,UAAvB,EAAmCC,SAAnC,EAA8CJ,UAA9C,EAA2D;AACjE,MAAKR,eAAe,CAAEY,SAAF,EAAa,WAAb,CAApB,EAAiD;AAChDD,IAAAA,UAAU,CAAE,YAAF,CAAV,GACCH,UAAU,CAACC,SAAX,KAAyB,EAAzB,GAA8B,IAA9B,GAAqCD,UAAU,CAACC,SADjD;AAEA;;AAED,SAAOE,UAAP;AACA;AAEDZ,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRO,YAHQ,CAAT;AAKAP,SAAS,CACR,kCADQ,EAER,2BAFQ,EAGRW,YAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\nconst ARIA_LABEL_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'aria-label',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with ariaLabel using aria-label\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( settings?.attributes?.ariaLabel?.type ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'ariaLabel' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tariaLabel: ARIA_LABEL_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject aria-label, if block\n * supports ariaLabel. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'ariaLabel' ) ) {\n\t\textraProps[ 'aria-label' ] =\n\t\t\tattributes.ariaLabel === '' ? null : attributes.ariaLabel;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/ariaLabel/attribute',\n\taddAttribute\n);\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/ariaLabel/save-props',\n\taddSaveProps\n);\n"]}
|
|
@@ -5,14 +5,13 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
* External dependencies
|
|
6
6
|
*/
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
-
import {
|
|
8
|
+
import { extend } from 'colord';
|
|
9
9
|
import namesPlugin from 'colord/plugins/names';
|
|
10
10
|
/**
|
|
11
11
|
* WordPress dependencies
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
15
|
-
import { SVG } from '@wordpress/components';
|
|
16
15
|
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
17
16
|
import { addFilter } from '@wordpress/hooks';
|
|
18
17
|
import { useMemo, useContext, createPortal } from '@wordpress/element';
|
|
@@ -22,155 +21,47 @@ import { useMemo, useContext, createPortal } from '@wordpress/element';
|
|
|
22
21
|
|
|
23
22
|
import { BlockControls, __experimentalDuotoneControl as DuotoneControl, useSetting } from '../components';
|
|
24
23
|
import BlockList from '../components/block-list';
|
|
24
|
+
import { __unstableDuotoneFilter as DuotoneFilter, __unstableDuotoneStylesheet as DuotoneStylesheet, __unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet } from '../components/duotone';
|
|
25
25
|
const EMPTY_ARRAY = [];
|
|
26
26
|
extend([namesPlugin]);
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param {string[]} colors Array of RBG color strings.
|
|
31
|
-
*
|
|
32
|
-
* @return {Object} R, G, and B values.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
export function getValuesFromColors() {
|
|
36
|
-
let colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
37
|
-
const values = {
|
|
38
|
-
r: [],
|
|
39
|
-
g: [],
|
|
40
|
-
b: [],
|
|
41
|
-
a: []
|
|
42
|
-
};
|
|
43
|
-
colors.forEach(color => {
|
|
44
|
-
const rgbColor = colord(color).toRgb();
|
|
45
|
-
values.r.push(rgbColor.r / 255);
|
|
46
|
-
values.g.push(rgbColor.g / 255);
|
|
47
|
-
values.b.push(rgbColor.b / 255);
|
|
48
|
-
values.a.push(rgbColor.a);
|
|
49
|
-
});
|
|
50
|
-
return values;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Values for the SVG `feComponentTransfer`.
|
|
54
|
-
*
|
|
55
|
-
* @typedef Values {Object}
|
|
56
|
-
* @property {number[]} r Red values.
|
|
57
|
-
* @property {number[]} g Green values.
|
|
58
|
-
* @property {number[]} b Blue values.
|
|
59
|
-
* @property {number[]} a Alpha values.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Stylesheet for rendering the duotone filter.
|
|
28
|
+
* SVG and stylesheet needed for rendering the duotone filter.
|
|
64
29
|
*
|
|
65
|
-
* @param {Object} props
|
|
30
|
+
* @param {Object} props Duotone props.
|
|
66
31
|
* @param {string} props.selector Selector to apply the filter to.
|
|
67
|
-
* @param {string} props.id
|
|
32
|
+
* @param {string} props.id Unique id for this duotone filter.
|
|
33
|
+
* @param {string[]|"unset"} props.colors Array of RGB color strings ordered from dark to light.
|
|
68
34
|
*
|
|
69
35
|
* @return {WPElement} Duotone element.
|
|
70
36
|
*/
|
|
71
37
|
|
|
72
|
-
function
|
|
38
|
+
function InlineDuotone(_ref) {
|
|
73
39
|
let {
|
|
74
40
|
selector,
|
|
75
|
-
id
|
|
76
|
-
} = _ref;
|
|
77
|
-
const css = `
|
|
78
|
-
${selector} {
|
|
79
|
-
filter: url( #${id} );
|
|
80
|
-
}
|
|
81
|
-
`;
|
|
82
|
-
return createElement("style", null, css);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* SVG for rendering the duotone filter.
|
|
86
|
-
*
|
|
87
|
-
* @param {Object} props Duotone props.
|
|
88
|
-
* @param {string} props.id Unique id for this duotone filter.
|
|
89
|
-
* @param {Values} props.values R, G, B, and A values to filter with.
|
|
90
|
-
*
|
|
91
|
-
* @return {WPElement} Duotone element.
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
function DuotoneFilter(_ref2) {
|
|
96
|
-
let {
|
|
97
41
|
id,
|
|
98
|
-
|
|
99
|
-
} =
|
|
100
|
-
return createElement(SVG, {
|
|
101
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
102
|
-
viewBox: "0 0 0 0",
|
|
103
|
-
width: "0",
|
|
104
|
-
height: "0",
|
|
105
|
-
focusable: "false",
|
|
106
|
-
role: "none",
|
|
107
|
-
style: {
|
|
108
|
-
visibility: 'hidden',
|
|
109
|
-
position: 'absolute',
|
|
110
|
-
left: '-9999px',
|
|
111
|
-
overflow: 'hidden'
|
|
112
|
-
}
|
|
113
|
-
}, createElement("defs", null, createElement("filter", {
|
|
114
|
-
id: id
|
|
115
|
-
}, createElement("feColorMatrix", {
|
|
116
|
-
// Use sRGB instead of linearRGB so transparency looks correct.
|
|
117
|
-
colorInterpolationFilters: "sRGB",
|
|
118
|
-
type: "matrix" // Use perceptual brightness to convert to grayscale.
|
|
119
|
-
,
|
|
120
|
-
values: " .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 .299 .587 .114 0 0 "
|
|
121
|
-
}), createElement("feComponentTransfer", {
|
|
122
|
-
// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.
|
|
123
|
-
colorInterpolationFilters: "sRGB"
|
|
124
|
-
}, createElement("feFuncR", {
|
|
125
|
-
type: "table",
|
|
126
|
-
tableValues: values.r.join(' ')
|
|
127
|
-
}), createElement("feFuncG", {
|
|
128
|
-
type: "table",
|
|
129
|
-
tableValues: values.g.join(' ')
|
|
130
|
-
}), createElement("feFuncB", {
|
|
131
|
-
type: "table",
|
|
132
|
-
tableValues: values.b.join(' ')
|
|
133
|
-
}), createElement("feFuncA", {
|
|
134
|
-
type: "table",
|
|
135
|
-
tableValues: values.a.join(' ')
|
|
136
|
-
})), createElement("feComposite", {
|
|
137
|
-
// Re-mask the image with the original transparency since the feColorMatrix above loses that information.
|
|
138
|
-
in2: "SourceGraphic",
|
|
139
|
-
operator: "in"
|
|
140
|
-
}))));
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* SVG and stylesheet needed for rendering the duotone filter.
|
|
144
|
-
*
|
|
145
|
-
* @param {Object} props Duotone props.
|
|
146
|
-
* @param {string} props.selector Selector to apply the filter to.
|
|
147
|
-
* @param {string} props.id Unique id for this duotone filter.
|
|
148
|
-
* @param {Values} props.values R, G, B, and A values to filter with.
|
|
149
|
-
*
|
|
150
|
-
* @return {WPElement} Duotone element.
|
|
151
|
-
*/
|
|
42
|
+
colors
|
|
43
|
+
} = _ref;
|
|
152
44
|
|
|
45
|
+
if (colors === 'unset') {
|
|
46
|
+
return createElement(DuotoneUnsetStylesheet, {
|
|
47
|
+
selector: selector
|
|
48
|
+
});
|
|
49
|
+
}
|
|
153
50
|
|
|
154
|
-
function InlineDuotone(_ref3) {
|
|
155
|
-
let {
|
|
156
|
-
selector,
|
|
157
|
-
id,
|
|
158
|
-
values
|
|
159
|
-
} = _ref3;
|
|
160
51
|
return createElement(Fragment, null, createElement(DuotoneFilter, {
|
|
161
52
|
id: id,
|
|
162
|
-
|
|
53
|
+
colors: colors
|
|
163
54
|
}), createElement(DuotoneStylesheet, {
|
|
164
55
|
id: id,
|
|
165
56
|
selector: selector
|
|
166
57
|
}));
|
|
167
58
|
}
|
|
168
59
|
|
|
169
|
-
function useMultiOriginPresets(
|
|
60
|
+
function useMultiOriginPresets(_ref2) {
|
|
170
61
|
let {
|
|
171
62
|
presetSetting,
|
|
172
63
|
defaultSetting
|
|
173
|
-
} =
|
|
64
|
+
} = _ref2;
|
|
174
65
|
const disableDefault = !useSetting(defaultSetting);
|
|
175
66
|
const userPresets = useSetting(`${presetSetting}.custom`) || EMPTY_ARRAY;
|
|
176
67
|
const themePresets = useSetting(`${presetSetting}.theme`) || EMPTY_ARRAY;
|
|
@@ -178,13 +69,13 @@ function useMultiOriginPresets(_ref4) {
|
|
|
178
69
|
return useMemo(() => [...userPresets, ...themePresets, ...(disableDefault ? EMPTY_ARRAY : defaultPresets)], [disableDefault, userPresets, themePresets, defaultPresets]);
|
|
179
70
|
}
|
|
180
71
|
|
|
181
|
-
function DuotonePanel(
|
|
72
|
+
function DuotonePanel(_ref3) {
|
|
182
73
|
var _style$color;
|
|
183
74
|
|
|
184
75
|
let {
|
|
185
76
|
attributes,
|
|
186
77
|
setAttributes
|
|
187
|
-
} =
|
|
78
|
+
} = _ref3;
|
|
188
79
|
const style = attributes === null || attributes === void 0 ? void 0 : attributes.style;
|
|
189
80
|
const duotone = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.duotone;
|
|
190
81
|
const duotonePalette = useMultiOriginPresets({
|
|
@@ -306,9 +197,9 @@ const withDuotoneStyles = createHigherOrderComponent(BlockListBlock => props =>
|
|
|
306
197
|
var _props$attributes, _props$attributes$sty, _props$attributes$sty2;
|
|
307
198
|
|
|
308
199
|
const duotoneSupport = getBlockSupport(props.name, 'color.__experimentalDuotone');
|
|
309
|
-
const
|
|
200
|
+
const colors = props === null || props === void 0 ? void 0 : (_props$attributes = props.attributes) === null || _props$attributes === void 0 ? void 0 : (_props$attributes$sty = _props$attributes.style) === null || _props$attributes$sty === void 0 ? void 0 : (_props$attributes$sty2 = _props$attributes$sty.color) === null || _props$attributes$sty2 === void 0 ? void 0 : _props$attributes$sty2.duotone;
|
|
310
201
|
|
|
311
|
-
if (!duotoneSupport || !
|
|
202
|
+
if (!duotoneSupport || !colors) {
|
|
312
203
|
return createElement(BlockListBlock, props);
|
|
313
204
|
}
|
|
314
205
|
|
|
@@ -322,20 +213,11 @@ const withDuotoneStyles = createHigherOrderComponent(BlockListBlock => props =>
|
|
|
322
213
|
return createElement(Fragment, null, element && createPortal(createElement(InlineDuotone, {
|
|
323
214
|
selector: selectorsGroup,
|
|
324
215
|
id: id,
|
|
325
|
-
|
|
216
|
+
colors: colors
|
|
326
217
|
}), element), createElement(BlockListBlock, _extends({}, props, {
|
|
327
218
|
className: className
|
|
328
219
|
})));
|
|
329
220
|
}, 'withDuotoneStyles');
|
|
330
|
-
export function PresetDuotoneFilter(_ref6) {
|
|
331
|
-
let {
|
|
332
|
-
preset
|
|
333
|
-
} = _ref6;
|
|
334
|
-
return createElement(DuotoneFilter, {
|
|
335
|
-
id: `wp-duotone-${preset.slug}`,
|
|
336
|
-
values: getValuesFromColors(preset.colors)
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
221
|
addFilter('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes);
|
|
340
222
|
addFilter('editor.BlockEdit', 'core/editor/duotone/with-editor-controls', withDuotoneControls);
|
|
341
223
|
addFilter('editor.BlockListBlock', 'core/editor/duotone/with-styles', withDuotoneStyles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","colord","extend","namesPlugin","getBlockSupport","hasBlockSupport","SVG","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","BlockControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","EMPTY_ARRAY","getValuesFromColors","colors","values","r","g","b","a","forEach","color","rgbColor","toRgb","push","DuotoneStylesheet","selector","id","css","DuotoneFilter","visibility","position","left","overflow","join","InlineDuotone","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","scopeSelector","scope","scopes","split","selectors","selectorsScoped","outer","inner","trim","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","__unstableElementContext","PresetDuotoneFilter","preset","slug"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,GAAT,QAAoB,uBAApB;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,UAHD,QAIO,eAJP;AAKA,OAAOC,SAAP,MAAsB,0BAAtB;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEAhB,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASgB,mBAAT,GAA4C;AAAA,MAAdC,MAAc,uEAAL,EAAK;AAClD,QAAMC,MAAM,GAAG;AAAEC,IAAAA,CAAC,EAAE,EAAL;AAASC,IAAAA,CAAC,EAAE,EAAZ;AAAgBC,IAAAA,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BADQ,EAER,0CAFQ,EAGRyD,mBAHQ,CAAT;AAKAzD,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGRuE,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { SVG } from '@wordpress/components';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * Convert a list of colors to an object of R, G, and B values.\n *\n * @param {string[]} colors Array of RBG color strings.\n *\n * @return {Object} R, G, and B values.\n */\nexport function getValuesFromColors( colors = [] ) {\n\tconst values = { r: [], g: [], b: [], a: [] };\n\n\tcolors.forEach( ( color ) => {\n\t\tconst rgbColor = colord( color ).toRgb();\n\t\tvalues.r.push( rgbColor.r / 255 );\n\t\tvalues.g.push( rgbColor.g / 255 );\n\t\tvalues.b.push( rgbColor.b / 255 );\n\t\tvalues.a.push( rgbColor.a );\n\t} );\n\n\treturn values;\n}\n\n/**\n * Values for the SVG `feComponentTransfer`.\n *\n * @typedef Values {Object}\n * @property {number[]} r Red values.\n * @property {number[]} g Green values.\n * @property {number[]} b Blue values.\n * @property {number[]} a Alpha values.\n */\n\n/**\n * Stylesheet for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n *\n * @return {WPElement} Duotone element.\n */\nfunction DuotoneStylesheet( { selector, id } ) {\n\tconst css = `\n${ selector } {\n\tfilter: url( #${ id } );\n}\n`;\n\treturn <style>{ css }</style>;\n}\n\n/**\n * SVG for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {Values} props.values R, G, B, and A values to filter with.\n *\n * @return {WPElement} Duotone element.\n */\nfunction DuotoneFilter( { id, values } ) {\n\treturn (\n\t\t<SVG\n\t\t\txmlnsXlink=\"http://www.w3.org/1999/xlink\"\n\t\t\tviewBox=\"0 0 0 0\"\n\t\t\twidth=\"0\"\n\t\t\theight=\"0\"\n\t\t\tfocusable=\"false\"\n\t\t\trole=\"none\"\n\t\t\tstyle={ {\n\t\t\t\tvisibility: 'hidden',\n\t\t\t\tposition: 'absolute',\n\t\t\t\tleft: '-9999px',\n\t\t\t\toverflow: 'hidden',\n\t\t\t} }\n\t\t>\n\t\t\t<defs>\n\t\t\t\t<filter id={ id }>\n\t\t\t\t\t<feColorMatrix\n\t\t\t\t\t\t// Use sRGB instead of linearRGB so transparency looks correct.\n\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t\ttype=\"matrix\"\n\t\t\t\t\t\t// Use perceptual brightness to convert to grayscale.\n\t\t\t\t\t\tvalues=\"\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\t.299 .587 .114 0 0\n\t\t\t\t\t\t\"\n\t\t\t\t\t/>\n\t\t\t\t\t<feComponentTransfer\n\t\t\t\t\t\t// Use sRGB instead of linearRGB to be consistent with how CSS gradients work.\n\t\t\t\t\t\tcolorInterpolationFilters=\"sRGB\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<feFuncR\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.r.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncG\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.g.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncB\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.b.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<feFuncA\n\t\t\t\t\t\t\ttype=\"table\"\n\t\t\t\t\t\t\ttableValues={ values.a.join( ' ' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</feComponentTransfer>\n\t\t\t\t\t<feComposite\n\t\t\t\t\t\t// Re-mask the image with the original transparency since the feColorMatrix above loses that information.\n\t\t\t\t\t\tin2=\"SourceGraphic\"\n\t\t\t\t\t\toperator=\"in\"\n\t\t\t\t\t/>\n\t\t\t\t</filter>\n\t\t\t</defs>\n\t\t</SVG>\n\t);\n}\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {Values} props.values R, G, B, and A values to filter with.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, values } ) {\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } values={ values } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && <DuotonePanel { ...props } /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst values = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! values ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<InlineDuotone\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tvalues={ getValuesFromColors( values ) }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\nexport function PresetDuotoneFilter( { preset } ) {\n\treturn (\n\t\t<DuotoneFilter\n\t\t\tid={ `wp-duotone-${ preset.slug }` }\n\t\t\tvalues={ getValuesFromColors( preset.colors ) }\n\t\t/>\n\t);\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/duotone.js"],"names":["classnames","extend","namesPlugin","getBlockSupport","hasBlockSupport","createHigherOrderComponent","useInstanceId","addFilter","useMemo","useContext","createPortal","BlockControls","__experimentalDuotoneControl","DuotoneControl","useSetting","BlockList","__unstableDuotoneFilter","DuotoneFilter","__unstableDuotoneStylesheet","DuotoneStylesheet","__unstableDuotoneUnsetStylesheet","DuotoneUnsetStylesheet","EMPTY_ARRAY","InlineDuotone","selector","id","colors","useMultiOriginPresets","presetSetting","defaultSetting","disableDefault","userPresets","themePresets","defaultPresets","DuotonePanel","attributes","setAttributes","style","duotone","color","duotonePalette","colorPalette","disableCustomColors","disableCustomDuotone","length","newDuotone","newStyle","addDuotoneAttributes","settings","Object","assign","type","withDuotoneControls","BlockEdit","props","hasDuotoneSupport","name","scopeSelector","scope","scopes","split","selectors","selectorsScoped","forEach","outer","inner","push","trim","join","withDuotoneStyles","BlockListBlock","duotoneSupport","selectorsGroup","className","element","__unstableElementContext"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,YAA9B,QAAkD,oBAAlD;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,UAHD,QAIO,eAJP;AAKA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SACCC,uBAAuB,IAAIC,aAD5B,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,gCAAgC,IAAIC,sBAHrC,QAIO,uBAJP;AAMA,MAAMC,WAAW,GAAG,EAApB;AAEArB,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASqB,aAAT,OAAmD;AAAA,MAA3B;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAZ;AAAgBC,IAAAA;AAAhB,GAA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KAxC,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGR6C,mBAHQ,CAAT;AAKA7C,SAAS,CACR,uBADQ,EAER,iCAFQ,EAGR8D,iBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { useMemo, useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockControls,\n\t__experimentalDuotoneControl as DuotoneControl,\n\tuseSetting,\n} from '../components';\nimport BlockList from '../components/block-list';\nimport {\n\t__unstableDuotoneFilter as DuotoneFilter,\n\t__unstableDuotoneStylesheet as DuotoneStylesheet,\n\t__unstableDuotoneUnsetStylesheet as DuotoneUnsetStylesheet,\n} from '../components/duotone';\n\nconst EMPTY_ARRAY = [];\n\nextend( [ namesPlugin ] );\n\n/**\n * SVG and stylesheet needed for rendering the duotone filter.\n *\n * @param {Object} props Duotone props.\n * @param {string} props.selector Selector to apply the filter to.\n * @param {string} props.id Unique id for this duotone filter.\n * @param {string[]|\"unset\"} props.colors Array of RGB color strings ordered from dark to light.\n *\n * @return {WPElement} Duotone element.\n */\nfunction InlineDuotone( { selector, id, colors } ) {\n\tif ( colors === 'unset' ) {\n\t\treturn <DuotoneUnsetStylesheet selector={ selector } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<DuotoneFilter id={ id } colors={ colors } />\n\t\t\t<DuotoneStylesheet id={ id } selector={ selector } />\n\t\t</>\n\t);\n}\n\nfunction useMultiOriginPresets( { presetSetting, defaultSetting } ) {\n\tconst disableDefault = ! useSetting( defaultSetting );\n\tconst userPresets =\n\t\tuseSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;\n\tconst themePresets =\n\t\tuseSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;\n\tconst defaultPresets =\n\t\tuseSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;\n\treturn useMemo(\n\t\t() => [\n\t\t\t...userPresets,\n\t\t\t...themePresets,\n\t\t\t...( disableDefault ? EMPTY_ARRAY : defaultPresets ),\n\t\t],\n\t\t[ disableDefault, userPresets, themePresets, defaultPresets ]\n\t);\n}\n\nfunction DuotonePanel( { attributes, setAttributes } ) {\n\tconst style = attributes?.style;\n\tconst duotone = style?.color?.duotone;\n\n\tconst duotonePalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.duotone',\n\t\tdefaultSetting: 'color.defaultDuotone',\n\t} );\n\tconst colorPalette = useMultiOriginPresets( {\n\t\tpresetSetting: 'color.palette',\n\t\tdefaultSetting: 'color.defaultPalette',\n\t} );\n\tconst disableCustomColors = ! useSetting( 'color.custom' );\n\tconst disableCustomDuotone =\n\t\t! useSetting( 'color.customDuotone' ) ||\n\t\t( colorPalette?.length === 0 && disableCustomColors );\n\n\tif ( duotonePalette?.length === 0 && disableCustomDuotone ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<DuotoneControl\n\t\t\t\tduotonePalette={ duotonePalette }\n\t\t\t\tcolorPalette={ colorPalette }\n\t\t\t\tdisableCustomDuotone={ disableCustomDuotone }\n\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\tvalue={ duotone }\n\t\t\t\tonChange={ ( newDuotone ) => {\n\t\t\t\t\tconst newStyle = {\n\t\t\t\t\t\t...style,\n\t\t\t\t\t\tcolor: {\n\t\t\t\t\t\t\t...style?.color,\n\t\t\t\t\t\t\tduotone: newDuotone,\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t\tsetAttributes( { style: newStyle } );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include\n * the `duotone` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addDuotoneAttributes( settings ) {\n\tif ( ! hasBlockSupport( settings, 'color.__experimentalDuotone' ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default\n\t// values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include toolbar controls for duotone if the\n * block supports duotone.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst hasDuotoneSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasDuotoneSupport && <DuotonePanel { ...props } /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneControls'\n);\n\n/**\n * Function that scopes a selector with another one. This works a bit like\n * SCSS nesting except the `&` operator isn't supported.\n *\n * @example\n * ```js\n * const scope = '.a, .b .c';\n * const selector = '> .x, .y';\n * const merged = scopeSelector( scope, selector );\n * // merged is '.a > .x, .a .y, .b .c > .x, .b .c .y'\n * ```\n *\n * @param {string} scope Selector to scope to.\n * @param {string} selector Original selector.\n *\n * @return {string} Scoped selector.\n */\nfunction scopeSelector( scope, selector ) {\n\tconst scopes = scope.split( ',' );\n\tconst selectors = selector.split( ',' );\n\n\tconst selectorsScoped = [];\n\tscopes.forEach( ( outer ) => {\n\t\tselectors.forEach( ( inner ) => {\n\t\t\tselectorsScoped.push( `${ outer.trim() } ${ inner.trim() }` );\n\t\t} );\n\t} );\n\n\treturn selectorsScoped.join( ', ' );\n}\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nconst withDuotoneStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst duotoneSupport = getBlockSupport(\n\t\t\tprops.name,\n\t\t\t'color.__experimentalDuotone'\n\t\t);\n\t\tconst colors = props?.attributes?.style?.color?.duotone;\n\n\t\tif ( ! duotoneSupport || ! colors ) {\n\t\t\treturn <BlockListBlock { ...props } />;\n\t\t}\n\n\t\tconst id = `wp-duotone-${ useInstanceId( BlockListBlock ) }`;\n\n\t\t// Extra .editor-styles-wrapper specificity is needed in the editor\n\t\t// since we're not using inline styles to apply the filter. We need to\n\t\t// override duotone applied by global styles and theme.json.\n\t\tconst selectorsGroup = scopeSelector(\n\t\t\t`.editor-styles-wrapper .${ id }`,\n\t\t\tduotoneSupport\n\t\t);\n\n\t\tconst className = classnames( props?.className, id );\n\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ element &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<InlineDuotone\n\t\t\t\t\t\t\tselector={ selectorsGroup }\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withDuotoneStyles'\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/duotone/add-attributes',\n\taddDuotoneAttributes\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/duotone/with-editor-controls',\n\twithDuotoneControls\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/duotone/with-styles',\n\twithDuotoneStyles\n);\n"]}
|
|
@@ -5,6 +5,7 @@ import './compat';
|
|
|
5
5
|
import './align';
|
|
6
6
|
import './lock';
|
|
7
7
|
import './anchor';
|
|
8
|
+
import './aria-label';
|
|
8
9
|
import './custom-class-name';
|
|
9
10
|
import './generated-class-name';
|
|
10
11
|
import './style';
|
|
@@ -19,5 +20,4 @@ export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
|
19
20
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
20
21
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|
|
21
22
|
export { useCachedTruthy } from './use-cached-truthy';
|
|
22
|
-
export { PresetDuotoneFilter } from './duotone';
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy"
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/index.js"],"names":["useCustomSides","getBorderClassesAndStyles","useBorderProps","getColorClassesAndStyles","useColorProps","getSpacingClassesAndStyles","useCachedTruthy"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,UAAP;AACA,OAAO,SAAP;AACA,OAAO,QAAP;AACA,OAAO,UAAP;AACA,OAAO,cAAP;AACA,OAAO,qBAAP;AACA,OAAO,wBAAP;AACA,OAAO,SAAP;AACA,OAAO,YAAP;AACA,OAAO,SAAP;AACA,OAAO,WAAP;AACA,OAAO,aAAP;AACA,OAAO,UAAP;AACA,OAAO,UAAP;AAEA,SAASA,cAAT,QAA+B,cAA/B;AACA,SAASC,yBAAT,EAAoCC,cAApC,QAA0D,oBAA1D;AACA,SAASC,wBAAT,EAAmCC,aAAnC,QAAwD,mBAAxD;AACA,SAASC,0BAAT,QAA2C,qBAA3C;AACA,SAASC,eAAT,QAAgC,qBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './compat';\nimport './align';\nimport './lock';\nimport './anchor';\nimport './aria-label';\nimport './custom-class-name';\nimport './generated-class-name';\nimport './style';\nimport './settings';\nimport './color';\nimport './duotone';\nimport './font-size';\nimport './border';\nimport './layout';\n\nexport { useCustomSides } from './dimensions';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { useCachedTruthy } from './use-cached-truthy';\n"]}
|
|
@@ -126,15 +126,17 @@ function LayoutPanel(_ref) {
|
|
|
126
126
|
|
|
127
127
|
return createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, {
|
|
128
128
|
title: __('Layout')
|
|
129
|
-
}, showInheritToggle && createElement(ToggleControl, {
|
|
130
|
-
label: __('
|
|
131
|
-
checked:
|
|
129
|
+
}, showInheritToggle && createElement(Fragment, null, createElement(ToggleControl, {
|
|
130
|
+
label: __('Inner blocks use full width'),
|
|
131
|
+
checked: !inherit,
|
|
132
132
|
onChange: () => setAttributes({
|
|
133
133
|
layout: {
|
|
134
134
|
inherit: !inherit
|
|
135
135
|
}
|
|
136
136
|
})
|
|
137
|
-
}),
|
|
137
|
+
}), createElement("p", {
|
|
138
|
+
className: "block-editor-hooks__layout-controls-helptext"
|
|
139
|
+
}, !!inherit ? __('Nested blocks use theme content width with options for full and wide widths.') : __('Nested blocks will fill the width of this container.'))), !inherit && allowSwitching && createElement(LayoutTypeSwitcher, {
|
|
138
140
|
type: type,
|
|
139
141
|
onChange: onChangeType
|
|
140
142
|
}), !inherit && layoutType && createElement(layoutType.inspectorControls, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","has","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","layoutBlockSupportKey","getLayoutClasses","attributes","layoutClassnames","layout","orientation","push","justifyContent","flexWrap","LayoutPanel","setAttributes","name","blockName","defaultThemeLayout","themeSupportsLayout","select","getSettings","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","type","inherit","usedLayout","layoutType","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","className","style"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,EAAcC,SAAd,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,eAAT,EAA0BC,eAA1B,QAAiD,mBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,WAFD,EAGCC,aAHD,EAICC,SAJD,QAKO,uBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,UAA1C;AACA,SAASC,iBAAT,QAAkC,eAAlC;AACA,OAAOC,UAAP,MAAuB,2BAAvB;AACA,SAASC,WAAT,QAA4B,iCAA5B;AACA,OAAOC,SAAP,MAAsB,0BAAtB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,YAA9C;AAEA,MAAMC,qBAAqB,GAAG,sBAA9B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,gBAAT,CAA2BC,UAA3B,EAAwC;AAAA;;AACvC,QAAMC,gBAAgB,GAAG,EAAzB;;AAEA,MAAK,CAAED,UAAU,CAACE,MAAlB,EAA2B;AAC1B,WAAOD,gBAAP;AACA;;A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,EAAEC;AAAX,MACLzC,eAAe,CAAE6B,IAAF,EAAQX,qBAAR,CAAf,IAAkD,EADnD;AAEA,QAAM2B,UAAU,GAAGvB,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEsB,OAAR,GAChBb,kBADgB,GAEhBT,MAAM,IAAImB,kBAAV,IAAgC,EAFnC;AAGA,QAAM0B,aAAa,GAAGJ,wBAAwB,GAC3C5C,gBAAgB,CAAEC,UAAF,CAD2B,GAE3C,IAFH;AAGA,QAAMgD,SAAS,GAAG1E,UAAU,CAC3BiE,KAD2B,aAC3BA,KAD2B,uBAC3BA,KAAK,CAAES,SADoB,EAE3B;AACC,KAAG,gBAAgBJ,EAAI,EAAvB,GAA4BD;AAD7B,GAF2B,EAK3BI,aAL2B,CAA5B;AAQA,SACC,8BACGJ,wBAAwB,IACzBE,OADC,IAEDxD,YAAY,CACX,cAAC,WAAD;AACC,IAAA,SAAS,EAAGoB,IADb;AAEC,IAAA,QAAQ,EAAI,iBAAiBmC,EAAI,EAFlC;AAGC,IAAA,MAAM,EAAGnB,UAHV;AAIC,IAAA,KAAK,EAAGzB,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEiD;AAJrB,IADW,EAOXJ,OAPW,CAHd,EAYC,cAAC,cAAD,eAAqBN,KAArB;AAA6B,IAAA,SAAS,EAAGS;AAAzC,KAZD,CADD;AAgBA,CA3CwD,CAAnD;AA8CPrE,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRwD,YAHQ,CAAT;AAKAxD,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGR8D,gBAHQ,CAAT;AAKA9D,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGR0D,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { has, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Array } attributes Array of block attributes.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction getLayoutClasses( attributes ) {\n\tconst layoutClassnames = [];\n\n\tif ( ! attributes.layout ) {\n\t\treturn layoutClassnames;\n\t}\n\n\tif ( attributes?.layout?.orientation ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-${ kebabCase( attributes.layout.orientation ) }`\n\t\t);\n\t}\n\n\tif ( attributes?.layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tattributes.layout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif (\n\t\tattributes?.layout?.flexWrap &&\n\t\tattributes.layout.flexWrap === 'nowrap'\n\t) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and that the default / flow layout type is in use, as this is the only one that supports inheritance.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type || layout?.type === 'default' || layout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, type = 'default' } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow`\n\t * layout and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif ( type === 'default' && ! themeSupportsLayout ) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Inherit default layout' ) }\n\t\t\t\t\t\t\tchecked={ !! inherit }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlayout: { inherit: ! inherit },\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( has( settings.attributes, [ 'layout', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst shouldRenderLayoutStyles = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout = layout?.inherit\n\t\t\t? defaultThemeLayout\n\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = shouldRenderLayoutStyles\n\t\t\t? getLayoutClasses( attributes )\n\t\t\t: null;\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles,\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ `.wp-container-${ id }` }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/layout.js"],"names":["classnames","has","kebabCase","createHigherOrderComponent","useInstanceId","addFilter","getBlockSupport","hasBlockSupport","useSelect","Button","ButtonGroup","ToggleControl","PanelBody","__","useContext","createPortal","store","blockEditorStore","InspectorControls","useSetting","LayoutStyle","BlockList","getLayoutType","getLayoutTypes","layoutBlockSupportKey","getLayoutClasses","attributes","layoutClassnames","layout","orientation","push","justifyContent","flexWrap","LayoutPanel","setAttributes","name","blockName","defaultThemeLayout","themeSupportsLayout","select","getSettings","supportsLayout","layoutBlockSupport","allowSwitching","allowEditing","allowInheriting","default","defaultBlockLayout","showInheritToggle","type","inherit","usedLayout","layoutType","onChangeType","newType","onChangeLayout","newLayout","LayoutTypeSwitcher","onChange","map","label","addAttribute","settings","withInspectorControls","BlockEdit","props","supportLayout","withLayoutStyles","BlockListBlock","shouldRenderLayoutStyles","id","element","__unstableElementContext","layoutClasses","className","style"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,GAAT,EAAcC,SAAd,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,EAAqCC,aAArC,QAA0D,oBAA1D;AAC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AC3BiE,KAD2B,aAC3BA,KAD2B,uBAC3BA,KAAK,CAAES,SADoB,EAE3B;AACC,KAAG,gBAAgBJ,EAAI,EAAvB,GAA4BD;AAD7B,GAF2B,EAK3BI,aAL2B,CAA5B;AAQA,SACC,8BACGJ,wBAAwB,IACzBE,OADC,IAEDxD,YAAY,CACX,cAAC,WAAD;AACC,IAAA,SAAS,EAAGoB,IADb;AAEC,IAAA,QAAQ,EAAI,iBAAiBmC,EAAI,EAFlC;AAGC,IAAA,MAAM,EAAGnB,UAHV;AAIC,IAAA,KAAK,EAAGzB,UAAH,aAAGA,UAAH,uBAAGA,UAAU,CAAEiD;AAJrB,IADW,EAOXJ,OAPW,CAHd,EAYC,cAAC,cAAD,eAAqBN,KAArB;AAA6B,IAAA,SAAS,EAAGS;AAAzC,KAZD,CADD;AAgBA,CA3CwD,CAAnD;AA8CPrE,SAAS,CACR,0BADQ,EAER,0BAFQ,EAGRwD,YAHQ,CAAT;AAKAxD,SAAS,CACR,uBADQ,EAER,uCAFQ,EAGR8D,gBAHQ,CAAT;AAKA9D,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGR0D,qBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { has, kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tButtonGroup,\n\tToggleControl,\n\tPanelBody,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useContext, createPortal } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { InspectorControls } from '../components';\nimport useSetting from '../components/use-setting';\nimport { LayoutStyle } from '../components/block-list/layout';\nimport BlockList from '../components/block-list';\nimport { getLayoutType, getLayoutTypes } from '../layouts';\n\nconst layoutBlockSupportKey = '__experimentalLayout';\n\n/**\n * Generates the utility classnames for the given blocks layout attributes.\n * This method was primarily added to reintroduce classnames that were removed\n * in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather\n * than providing an extensive list of all possible layout classes. The plan is to\n * have the style engine generate a more extensive list of utility classnames which\n * will then replace this method.\n *\n * @param { Array } attributes Array of block attributes.\n *\n * @return { Array } Array of CSS classname strings.\n */\nfunction getLayoutClasses( attributes ) {\n\tconst layoutClassnames = [];\n\n\tif ( ! attributes.layout ) {\n\t\treturn layoutClassnames;\n\t}\n\n\tif ( attributes?.layout?.orientation ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-${ kebabCase( attributes.layout.orientation ) }`\n\t\t);\n\t}\n\n\tif ( attributes?.layout?.justifyContent ) {\n\t\tlayoutClassnames.push(\n\t\t\t`is-content-justification-${ kebabCase(\n\t\t\t\tattributes.layout.justifyContent\n\t\t\t) }`\n\t\t);\n\t}\n\n\tif (\n\t\tattributes?.layout?.flexWrap &&\n\t\tattributes.layout.flexWrap === 'nowrap'\n\t) {\n\t\tlayoutClassnames.push( 'is-nowrap' );\n\t}\n\n\treturn layoutClassnames;\n}\n\nfunction LayoutPanel( { setAttributes, attributes, name: blockName } ) {\n\tconst { layout } = attributes;\n\tconst defaultThemeLayout = useSetting( 'layout' );\n\tconst themeSupportsLayout = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn getSettings().supportsLayout;\n\t}, [] );\n\n\tconst layoutBlockSupport = getBlockSupport(\n\t\tblockName,\n\t\tlayoutBlockSupportKey,\n\t\t{}\n\t);\n\tconst {\n\t\tallowSwitching,\n\t\tallowEditing = true,\n\t\tallowInheriting = true,\n\t\tdefault: defaultBlockLayout,\n\t} = layoutBlockSupport;\n\n\tif ( ! allowEditing ) {\n\t\treturn null;\n\t}\n\n\t// Only show the inherit toggle if it's supported,\n\t// a default theme layout is set (e.g. one that provides `contentSize` and/or `wideSize` values),\n\t// and that the default / flow layout type is in use, as this is the only one that supports inheritance.\n\tconst showInheritToggle = !! (\n\t\tallowInheriting &&\n\t\t!! defaultThemeLayout &&\n\t\t( ! layout?.type || layout?.type === 'default' || layout?.inherit )\n\t);\n\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { inherit = false, type = 'default' } = usedLayout;\n\t/**\n\t * `themeSupportsLayout` is only relevant to the `default/flow`\n\t * layout and it should not be taken into account when other\n\t * `layout` types are used.\n\t */\n\tif ( type === 'default' && ! themeSupportsLayout ) {\n\t\treturn null;\n\t}\n\tconst layoutType = getLayoutType( type );\n\n\tconst onChangeType = ( newType ) =>\n\t\tsetAttributes( { layout: { type: newType } } );\n\tconst onChangeLayout = ( newLayout ) =>\n\t\tsetAttributes( { layout: newLayout } );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Layout' ) }>\n\t\t\t\t\t{ showInheritToggle && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Inner blocks use full width' ) }\n\t\t\t\t\t\t\t\tchecked={ ! inherit }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tlayout: { inherit: ! inherit },\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t\t\t\t{ !! inherit\n\t\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks use theme content width with options for full and wide widths.'\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'Nested blocks will fill the width of this container.'\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && allowSwitching && (\n\t\t\t\t\t\t<LayoutTypeSwitcher\n\t\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\t\tonChange={ onChangeType }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t\t\t<layoutType.inspectorControls\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ ! inherit && layoutType && (\n\t\t\t\t<layoutType.toolBarControls\n\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\tonChange={ onChangeLayout }\n\t\t\t\t\tlayoutBlockSupport={ layoutBlockSupport }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction LayoutTypeSwitcher( { type, onChange } ) {\n\treturn (\n\t\t<ButtonGroup>\n\t\t\t{ getLayoutTypes().map( ( { name, label } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ name }\n\t\t\t\t\t\tisPressed={ type === name }\n\t\t\t\t\t\tonClick={ () => onChange( name ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</Button>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ButtonGroup>\n\t);\n}\n\n/**\n * Filters registered block settings, extending attributes to include `layout`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\tif ( has( settings.attributes, [ 'layout', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, layoutBlockSupportKey ) ) {\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tlayout: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include layout controls\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withInspectorControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { name: blockName } = props;\n\t\tconst supportLayout = hasBlockSupport(\n\t\t\tblockName,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\n\t\treturn [\n\t\t\tsupportLayout && <LayoutPanel key=\"layout\" { ...props } />,\n\t\t\t<BlockEdit key=\"edit\" { ...props } />,\n\t\t];\n\t},\n\t'withInspectorControls'\n);\n\n/**\n * Override the default block element to add the layout styles.\n *\n * @param {Function} BlockListBlock Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withLayoutStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst { name, attributes } = props;\n\t\tconst shouldRenderLayoutStyles = hasBlockSupport(\n\t\t\tname,\n\t\t\tlayoutBlockSupportKey\n\t\t);\n\t\tconst id = useInstanceId( BlockListBlock );\n\t\tconst defaultThemeLayout = useSetting( 'layout' ) || {};\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\t\tconst { layout } = attributes;\n\t\tconst { default: defaultBlockLayout } =\n\t\t\tgetBlockSupport( name, layoutBlockSupportKey ) || {};\n\t\tconst usedLayout = layout?.inherit\n\t\t\t? defaultThemeLayout\n\t\t\t: layout || defaultBlockLayout || {};\n\t\tconst layoutClasses = shouldRenderLayoutStyles\n\t\t\t? getLayoutClasses( attributes )\n\t\t\t: null;\n\t\tconst className = classnames(\n\t\t\tprops?.className,\n\t\t\t{\n\t\t\t\t[ `wp-container-${ id }` ]: shouldRenderLayoutStyles,\n\t\t\t},\n\t\t\tlayoutClasses\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldRenderLayoutStyles &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\tblockName={ name }\n\t\t\t\t\t\t\tselector={ `.wp-container-${ id }` }\n\t\t\t\t\t\t\tlayout={ usedLayout }\n\t\t\t\t\t\t\tstyle={ attributes?.style }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\t\t\t\t<BlockListBlock { ...props } className={ className } />\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/layout/addAttribute',\n\taddAttribute\n);\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/layout/with-layout-styles',\n\twithLayoutStyles\n);\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/layout/with-inspector-controls',\n\twithInspectorControls\n);\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import './hooks';
|
|
5
|
-
export {
|
|
5
|
+
export { getBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles, useBorderProps as __experimentalUseBorderProps, getColorClassesAndStyles as __experimentalGetColorClassesAndStyles, useColorProps as __experimentalUseColorProps, useCustomSides as __experimentalUseCustomSides, getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles, useCachedTruthy } from './hooks';
|
|
6
6
|
export * from './components';
|
|
7
7
|
export * from './elements';
|
|
8
8
|
export * from './utils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/index.js"],"names":["getBorderClassesAndStyles","__experimentalGetBorderClassesAndStyles","useBorderProps","__experimentalUseBorderProps","getColorClassesAndStyles","__experimentalGetColorClassesAndStyles","useColorProps","__experimentalUseColorProps","useCustomSides","__experimentalUseCustomSides","getSpacingClassesAndStyles","__experimentalGetSpacingClassesAndStyles","useCachedTruthy","storeConfig","store","SETTINGS_DEFAULTS"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AACA,SACCA,yBAAyB,IAAIC,uCAD9B,EAECC,cAAc,IAAIC,4BAFnB,EAGCC,wBAAwB,IAAIC,sCAH7B,EAICC,aAAa,IAAIC,2BAJlB,EAKCC,cAAc,IAAIC,4BALnB,EAMCC,0BAA0B,IAAIC,wCAN/B,EAOCC,eAPD,QAQO,SARP;AASA,cAAc,cAAd;AACA,cAAc,YAAd;AACA,cAAc,SAAd;AACA,SAASC,WAAT,EAAsBC,KAAtB,QAAmC,SAAnC;AACA,SAASC,iBAAT,QAAkC,kBAAlC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\nexport {\n\tgetBorderClassesAndStyles as __experimentalGetBorderClassesAndStyles,\n\tuseBorderProps as __experimentalUseBorderProps,\n\tgetColorClassesAndStyles as __experimentalGetColorClassesAndStyles,\n\tuseColorProps as __experimentalUseColorProps,\n\tuseCustomSides as __experimentalUseCustomSides,\n\tgetSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,\n\tuseCachedTruthy,\n} from './hooks';\nexport * from './components';\nexport * from './elements';\nexport * from './utils';\nexport { storeConfig, store } from './store';\nexport { SETTINGS_DEFAULTS } from './store/defaults';\n"]}
|
|
@@ -294,14 +294,14 @@ function OrientationControl(_ref8) {
|
|
|
294
294
|
return createElement("fieldset", {
|
|
295
295
|
className: "block-editor-hooks__flex-layout-orientation-controls"
|
|
296
296
|
}, createElement("legend", null, __('Orientation')), createElement(Button, {
|
|
297
|
-
label: '
|
|
297
|
+
label: __('Horizontal'),
|
|
298
298
|
icon: arrowRight,
|
|
299
299
|
isPressed: orientation === 'horizontal',
|
|
300
300
|
onClick: () => onChange({ ...layout,
|
|
301
301
|
orientation: 'horizontal'
|
|
302
302
|
})
|
|
303
303
|
}), createElement(Button, {
|
|
304
|
-
label: '
|
|
304
|
+
label: __('Vertical'),
|
|
305
305
|
icon: arrowDown,
|
|
306
306
|
isPressed: orientation === 'vertical',
|
|
307
307
|
onClick: () => onChange({ ...layout,
|