@wordpress/block-editor 12.19.1 → 12.19.3
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/build/components/block-tools/insertion-point.js +4 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +5 -10
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +4 -3
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +61 -24
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +3 -3
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +8 -6
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/iframe/index.js +4 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/rich-text/index.js +7 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +1 -0
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-enter.js +1 -0
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +25 -26
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/hooks/background.js +4 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +0 -17
- package/build/hooks/use-bindings-attributes.js.map +1 -1
- package/build/hooks/utils.js +8 -4
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/get-block-settings.js +17 -4
- package/build/store/get-block-settings.js.map +1 -1
- package/build/store/index.js +0 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +5 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-keys.js +8 -0
- package/build/store/private-keys.js.map +1 -0
- package/build/store/private-selectors.js +6 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -12
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -2
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +6 -11
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -4
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +61 -25
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +3 -3
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +9 -7
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/rich-text/index.js +7 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +1 -0
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +1 -0
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +25 -26
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/hooks/background.js +4 -2
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +0 -17
- package/build-module/hooks/use-bindings-attributes.js.map +1 -1
- package/build-module/hooks/utils.js +8 -4
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/get-block-settings.js +16 -4
- package/build-module/store/get-block-settings.js.map +1 -1
- package/build-module/store/index.js +0 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +5 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +1 -0
- package/build-module/store/private-selectors.js +5 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +0 -10
- package/build-style/style.css +0 -10
- package/package.json +31 -31
- package/src/components/block-tools/insertion-point.js +6 -1
- package/src/components/global-styles/advanced-panel.js +6 -12
- package/src/components/global-styles/border-panel.js +4 -6
- package/src/components/global-styles/get-global-styles-changes.js +68 -28
- package/src/components/global-styles/shadow-panel-components.js +3 -3
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/get-global-styles-changes.js +114 -75
- package/src/components/global-styles/typography-panel.js +11 -7
- package/src/components/iframe/index.js +4 -1
- package/src/components/inserter/media-tab/media-preview.js +6 -1
- package/src/components/rich-text/index.js +12 -5
- package/src/components/rich-text/index.native.js +1 -0
- package/src/components/rich-text/use-enter.js +1 -0
- package/src/components/rich-text/use-paste-handler.js +26 -25
- package/src/hooks/background.js +5 -2
- package/src/hooks/use-bindings-attributes.js +0 -21
- package/src/hooks/utils.js +24 -8
- package/src/private-apis.js +2 -0
- package/src/store/get-block-settings.js +15 -4
- package/src/store/index.js +0 -2
- package/src/store/private-actions.js +9 -0
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +4 -7
- package/src/store/reducer.js +0 -10
- package/src/store/selectors.js +7 -15
- package/src/store/utils.js +7 -2
- package/build/store/resolvers.js +0 -27
- package/build/store/resolvers.js.map +0 -1
- package/build-module/store/resolvers.js +0 -20
- package/build-module/store/resolvers.js.map +0 -1
- package/src/store/resolvers.js +0 -17
package/build/store/utils.js
CHANGED
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getAllPatternsDependants = exports.checkAllowListRecursive = exports.checkAllowList = void 0;
|
|
7
|
+
var _privateKeys = require("./private-keys");
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
7
12
|
const checkAllowList = (list, item, defaultResult = null) => {
|
|
8
13
|
if (typeof list === 'boolean') {
|
|
9
14
|
return list;
|
|
@@ -38,8 +43,8 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
|
|
38
43
|
return true;
|
|
39
44
|
};
|
|
40
45
|
exports.checkAllowListRecursive = checkAllowListRecursive;
|
|
41
|
-
const getAllPatternsDependants = state => {
|
|
42
|
-
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings.
|
|
46
|
+
const getAllPatternsDependants = select => state => {
|
|
47
|
+
return [state.settings.__experimentalBlockPatterns, state.settings.__experimentalUserPatternCategories, state.settings.__experimentalReusableBlocks, state.settings[_privateKeys.selectBlockPatternsKey]?.(select), state.blockPatterns];
|
|
43
48
|
};
|
|
44
49
|
exports.getAllPatternsDependants = getAllPatternsDependants;
|
|
45
50
|
//# sourceMappingURL=utils.js.map
|
package/build/store/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["checkAllowList","list","item","defaultResult","Array","isArray","includes","exports","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","
|
|
1
|
+
{"version":3,"names":["_privateKeys","require","checkAllowList","list","item","defaultResult","Array","isArray","includes","exports","checkAllowListRecursive","blocks","allowedBlockTypes","blocksQueue","length","block","shift","isAllowed","name","blockName","innerBlocks","forEach","innerBlock","push","getAllPatternsDependants","select","state","settings","__experimentalBlockPatterns","__experimentalUserPatternCategories","__experimentalReusableBlocks","selectBlockPatternsKey","blockPatterns"],"sources":["@wordpress/block-editor/src/store/utils.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { selectBlockPatternsKey } from './private-keys';\n\nexport const checkAllowList = ( list, item, defaultResult = null ) => {\n\tif ( typeof list === 'boolean' ) {\n\t\treturn list;\n\t}\n\tif ( Array.isArray( list ) ) {\n\t\t// TODO: when there is a canonical way to detect that we are editing a post\n\t\t// the following check should be changed to something like:\n\t\t// if ( list.includes( 'core/post-content' ) && getEditorMode() === 'post-content' && item === null )\n\t\tif ( list.includes( 'core/post-content' ) && item === null ) {\n\t\t\treturn true;\n\t\t}\n\t\treturn list.includes( item );\n\t}\n\treturn defaultResult;\n};\n\nexport const checkAllowListRecursive = ( blocks, allowedBlockTypes ) => {\n\tif ( typeof allowedBlockTypes === 'boolean' ) {\n\t\treturn allowedBlockTypes;\n\t}\n\n\tconst blocksQueue = [ ...blocks ];\n\twhile ( blocksQueue.length > 0 ) {\n\t\tconst block = blocksQueue.shift();\n\n\t\tconst isAllowed = checkAllowList(\n\t\t\tallowedBlockTypes,\n\t\t\tblock.name || block.blockName,\n\t\t\ttrue\n\t\t);\n\t\tif ( ! isAllowed ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tblock.innerBlocks?.forEach( ( innerBlock ) => {\n\t\t\tblocksQueue.push( innerBlock );\n\t\t} );\n\t}\n\n\treturn true;\n};\n\nexport const getAllPatternsDependants = ( select ) => ( state ) => {\n\treturn [\n\t\tstate.settings.__experimentalBlockPatterns,\n\t\tstate.settings.__experimentalUserPatternCategories,\n\t\tstate.settings.__experimentalReusableBlocks,\n\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\tstate.blockPatterns,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KC,MAAM,IAAQC,KAAK,IAAM;EAClE,OAAO,CACNA,KAAK,CAACC,QAAQ,CAACC,2BAA2B,EAC1CF,KAAK,CAACC,QAAQ,CAACE,mCAAmC,EAClDH,KAAK,CAACC,QAAQ,CAACG,4BAA4B,EAC3CJ,KAAK,CAACC,QAAQ,CAAEI,mCAAsB,CAAE,GAAIN,MAAO,CAAC,EACpDC,KAAK,CAACM,aAAa,CACnB;AACF,CAAC;AAACvB,OAAA,CAAAe,wBAAA,GAAAA,wBAAA"}
|
|
@@ -75,9 +75,12 @@ function InbetweenInsertionPointPopover({
|
|
|
75
75
|
isInserterShown: insertionPoint?.__unstableWithInserter
|
|
76
76
|
};
|
|
77
77
|
}, []);
|
|
78
|
+
const {
|
|
79
|
+
getBlockEditingMode
|
|
80
|
+
} = useSelect(blockEditorStore);
|
|
78
81
|
const disableMotion = useReducedMotion();
|
|
79
82
|
function onClick(event) {
|
|
80
|
-
if (event.target === ref.current && nextClientId) {
|
|
83
|
+
if (event.target === ref.current && nextClientId && getBlockEditingMode(nextClientId) !== 'disabled') {
|
|
81
84
|
selectBlock(nextClientId, -1);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useDispatch","useRef","createContext","useContext","__unstableMotion","motion","useReducedMotion","Inserter","store","blockEditorStore","BlockPopoverInbetween","BlockDropZonePopover","InsertionPointOpenRef","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isNavigationMode","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","_isNavigationMode","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","disableMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","createElement","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint","key"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisNavigationMode: _isNavigationMode(),\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif ( event.target === ref.current && nextClientId ) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree && ! isNavigationMode ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AACtE,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,oBAAoB,MAAM,4BAA4B;AAE7D,OAAO,MAAMC,qBAAqB,GAAGV,aAAa,CAAC,CAAC;AAEpD,SAASW,8BAA8BA,CAAE;EACxCC,qBAAqB;EACrBC,oBAAoB;EACpBC,SAAS,GAAG,QAAQ;EACpBC,WAAW,GAAG;AACf,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC;EAAmB,CAAC,GAAGnB,WAAW,CAAES,gBAAiB,CAAC;EAC3E,MAAMW,OAAO,GAAGjB,UAAU,CAAES,qBAAsB,CAAC;EACnD,MAAMS,GAAG,GAAGpB,MAAM,CAAC,CAAC;EACpB,MAAM;IACLqB,WAAW;IACXC,gBAAgB;IAChBC,YAAY;IACZC,YAAY;IACZC,eAAe;IACfC,iBAAiB;IACjBC;EACD,CAAC,GAAG7B,SAAS,CAAI8B,MA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,YAAc;IAC7BqD,qBAAqB;IACrBC,QAAQ,EAAKC,MAAM,IAAM;MACxB5D,OAAO,CAAC8B,OAAO,GAAG8B,MAAM;IACzB,CAAG;IACHC,eAAe,EAAGA,CAAA,KAAM;MACvB7D,OAAO,CAAC8B,OAAO,GAAG,KAAK;IACxB;EAAG,CACH,CACU,CAEF,CACU,CAAC;AAE1B;AAEA,eAAe,SAASgC,cAAcA,CAAEC,KAAK,EAAG;EAC/C,MAAM;IAAE7C,cAAc;IAAE8C,SAAS;IAAEC;EAAiB,CAAC,GAAGtF,SAAS,CAC9D8B,MAAM,IAAM;IACb,MAAM;MACLG,sBAAsB;MACtBsD,4BAA4B;MAC5BC;IACD,CAAC,GAAG1D,MAAM,CAAEpB,gBAAiB,CAAC;IAC9B,MAAM+E,mBAAmB,GAAGxD,sBAAsB,CAAC,CAAC;IACpD,OAAO;MACNM,cAAc,EAAEkD,mBAAmB;MACnCJ,SAAS,EAAEE,4BAA4B,CAAC,CAAC;MACzCD,gBAAgB,EACfE,aAAa,CAAEC,mBAAmB,EAAE/D,YAAa,CAAC,KAAK;IACzD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,IACC,CAAE2D,SAAS;EACX;EACA;EACAC,gBAAgB,EACf;IACD,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;EACC,OAAO/C,cAAc,CAACtB,SAAS,KAAK,SAAS,GAC5CiD,aAAA,CAACtD;EACA;EAAA;IACA8E,GAAG,EAAI,GAAGnD,cAAc,CAACb,YAAc,IAAIa,cAAc,CAACI,KAAO,EAAG;IAAA,GAC/DyC;EAAK,CACV,CAAC,GAEFlB,aAAA,CAACpD,8BAA8B;IAC9BG,SAAS,EAAGsB,cAAc,CAACtB,SAAW;IACtCC,WAAW,EAAGqB,cAAc,CAACrB,WAAa;IAAA,GACrCkE;EAAK,CACV,CACD;AACF"}
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","useDispatch","useRef","createContext","useContext","__unstableMotion","motion","useReducedMotion","Inserter","store","blockEditorStore","BlockPopoverInbetween","BlockDropZonePopover","InsertionPointOpenRef","InbetweenInsertionPointPopover","__unstablePopoverSlot","__unstableContentRef","operation","nearestSide","selectBlock","hideInsertionPoint","openRef","ref","orientation","previousClientId","nextClientId","rootClientId","isInserterShown","isDistractionFree","isNavigationMode","select","getBlockOrder","getBlockListSettings","getBlockInsertionPoint","isBlockBeingDragged","getPreviousBlockClientId","getNextBlockClientId","getSettings","_isNavigationMode","insertionPoint","order","length","_previousClientId","index","_nextClientId","settings","__unstableWithInserter","getBlockEditingMode","disableMotion","onClick","event","target","current","maybeHideInserterPoint","onFocus","lineVariants","start","opacity","scale","rest","transition","delay","type","hover","inserterVariants","orientationClassname","className","createElement","div","layout","initial","animate","whileHover","whileTap","exit","tabIndex","onHoverEnd","variants","position","clientId","__experimentalIsQuick","onToggle","isOpen","onSelectOrClose","InsertionPoint","props","isVisible","isBlockListEmpty","isBlockInsertionPointVisible","getBlockCount","blockInsertionPoint","key"],"sources":["@wordpress/block-editor/src/components/block-tools/insertion-point.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, createContext, useContext } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport { store as blockEditorStore } from '../../store';\nimport BlockPopoverInbetween from '../block-popover/inbetween';\nimport BlockDropZonePopover from '../block-popover/drop-zone';\n\nexport const InsertionPointOpenRef = createContext();\n\nfunction InbetweenInsertionPointPopover( {\n\t__unstablePopoverSlot,\n\t__unstableContentRef,\n\toperation = 'insert',\n\tnearestSide = 'right',\n} ) {\n\tconst { selectBlock, hideInsertionPoint } = useDispatch( blockEditorStore );\n\tconst openRef = useContext( InsertionPointOpenRef );\n\tconst ref = useRef();\n\tconst {\n\t\torientation,\n\t\tpreviousClientId,\n\t\tnextClientId,\n\t\trootClientId,\n\t\tisInserterShown,\n\t\tisDistractionFree,\n\t\tisNavigationMode,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockOrder,\n\t\t\tgetBlockListSettings,\n\t\t\tgetBlockInsertionPoint,\n\t\t\tisBlockBeingDragged,\n\t\t\tgetPreviousBlockClientId,\n\t\t\tgetNextBlockClientId,\n\t\t\tgetSettings,\n\t\t\tisNavigationMode: _isNavigationMode,\n\t\t} = select( blockEditorStore );\n\t\tconst insertionPoint = getBlockInsertionPoint();\n\t\tconst order = getBlockOrder( insertionPoint.rootClientId );\n\n\t\tif ( ! order.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet _previousClientId = order[ insertionPoint.index - 1 ];\n\t\tlet _nextClientId = order[ insertionPoint.index ];\n\n\t\twhile ( isBlockBeingDragged( _previousClientId ) ) {\n\t\t\t_previousClientId = getPreviousBlockClientId( _previousClientId );\n\t\t}\n\n\t\twhile ( isBlockBeingDragged( _nextClientId ) ) {\n\t\t\t_nextClientId = getNextBlockClientId( _nextClientId );\n\t\t}\n\n\t\tconst settings = getSettings();\n\n\t\treturn {\n\t\t\tpreviousClientId: _previousClientId,\n\t\t\tnextClientId: _nextClientId,\n\t\t\torientation:\n\t\t\t\tgetBlockListSettings( insertionPoint.rootClientId )\n\t\t\t\t\t?.orientation || 'vertical',\n\t\t\trootClientId: insertionPoint.rootClientId,\n\t\t\tisNavigationMode: _isNavigationMode(),\n\t\t\tisDistractionFree: settings.isDistractionFree,\n\t\t\tisInserterShown: insertionPoint?.__unstableWithInserter,\n\t\t};\n\t}, [] );\n\tconst { getBlockEditingMode } = useSelect( blockEditorStore );\n\n\tconst disableMotion = useReducedMotion();\n\n\tfunction onClick( event ) {\n\t\tif (\n\t\t\tevent.target === ref.current &&\n\t\t\tnextClientId &&\n\t\t\tgetBlockEditingMode( nextClientId ) !== 'disabled'\n\t\t) {\n\t\t\tselectBlock( nextClientId, -1 );\n\t\t}\n\t}\n\n\tfunction maybeHideInserterPoint( event ) {\n\t\t// Only hide the inserter if it's triggered on the wrapper,\n\t\t// and the inserter is not open.\n\t\tif ( event.target === ref.current && ! openRef.current ) {\n\t\t\thideInsertionPoint();\n\t\t}\n\t}\n\n\tfunction onFocus( event ) {\n\t\t// Only handle click on the wrapper specifically, and not an event\n\t\t// bubbled from the inserter itself.\n\t\tif ( event.target !== ref.current ) {\n\t\t\topenRef.current = true;\n\t\t}\n\t}\n\n\tconst lineVariants = {\n\t\t// Initial position starts from the center and invisible.\n\t\tstart: {\n\t\t\topacity: 0,\n\t\t\tscale: 0,\n\t\t},\n\t\t// The line expands to fill the container. If the inserter is visible it\n\t\t// is delayed so it appears orchestrated.\n\t\trest: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: isInserterShown ? 0.5 : 0, type: 'tween' },\n\t\t},\n\t\thover: {\n\t\t\topacity: 1,\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.5, type: 'tween' },\n\t\t},\n\t};\n\n\tconst inserterVariants = {\n\t\tstart: {\n\t\t\tscale: disableMotion ? 1 : 0,\n\t\t},\n\t\trest: {\n\t\t\tscale: 1,\n\t\t\ttransition: { delay: 0.4, type: 'tween' },\n\t\t},\n\t};\n\n\tif ( isDistractionFree && ! isNavigationMode ) {\n\t\treturn null;\n\t}\n\n\tconst orientationClassname =\n\t\torientation === 'horizontal' || operation === 'group'\n\t\t\t? 'is-horizontal'\n\t\t\t: 'is-vertical';\n\n\tconst className = classnames(\n\t\t'block-editor-block-list__insertion-point',\n\t\torientationClassname\n\t);\n\n\treturn (\n\t\t<BlockPopoverInbetween\n\t\t\tpreviousClientId={ previousClientId }\n\t\t\tnextClientId={ nextClientId }\n\t\t\t__unstablePopoverSlot={ __unstablePopoverSlot }\n\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\toperation={ operation }\n\t\t\tnearestSide={ nearestSide }\n\t\t>\n\t\t\t<motion.div\n\t\t\t\tlayout={ ! disableMotion }\n\t\t\t\tinitial={ disableMotion ? 'rest' : 'start' }\n\t\t\t\tanimate=\"rest\"\n\t\t\t\twhileHover=\"hover\"\n\t\t\t\twhileTap=\"pressed\"\n\t\t\t\texit=\"start\"\n\t\t\t\tref={ ref }\n\t\t\t\ttabIndex={ -1 }\n\t\t\t\tonClick={ onClick }\n\t\t\t\tonFocus={ onFocus }\n\t\t\t\tclassName={ classnames( className, {\n\t\t\t\t\t'is-with-inserter': isInserterShown,\n\t\t\t\t} ) }\n\t\t\t\tonHoverEnd={ maybeHideInserterPoint }\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tvariants={ lineVariants }\n\t\t\t\t\tclassName=\"block-editor-block-list__insertion-point-indicator\"\n\t\t\t\t\tdata-testid=\"block-list-insertion-point-indicator\"\n\t\t\t\t/>\n\t\t\t\t{ isInserterShown && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tvariants={ inserterVariants }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'block-editor-block-list__insertion-point-inserter'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Inserter\n\t\t\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\t\t\tclientId={ nextClientId }\n\t\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t\t\t__experimentalIsQuick\n\t\t\t\t\t\t\tonToggle={ ( isOpen ) => {\n\t\t\t\t\t\t\t\topenRef.current = isOpen;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonSelectOrClose={ () => {\n\t\t\t\t\t\t\t\topenRef.current = false;\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</motion.div>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t</BlockPopoverInbetween>\n\t);\n}\n\nexport default function InsertionPoint( props ) {\n\tconst { insertionPoint, isVisible, isBlockListEmpty } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\tisBlockInsertionPointVisible,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockInsertionPoint = getBlockInsertionPoint();\n\t\t\treturn {\n\t\t\t\tinsertionPoint: blockInsertionPoint,\n\t\t\t\tisVisible: isBlockInsertionPointVisible(),\n\t\t\t\tisBlockListEmpty:\n\t\t\t\t\tgetBlockCount( blockInsertionPoint?.rootClientId ) === 0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t! isVisible ||\n\t\t// Don't render the insertion point if the block list is empty.\n\t\t// The insertion point will be represented by the appender instead.\n\t\tisBlockListEmpty\n\t) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Render a popover that overlays the block when the desired operation is to replace it.\n\t * Otherwise, render a popover in between blocks for the indication of inserting between them.\n\t */\n\treturn insertionPoint.operation === 'replace' ? (\n\t\t<BlockDropZonePopover\n\t\t\t// Force remount to trigger the animation.\n\t\t\tkey={ `${ insertionPoint.rootClientId }-${ insertionPoint.index }` }\n\t\t\t{ ...props }\n\t\t/>\n\t) : (\n\t\t<InbetweenInsertionPointPopover\n\t\t\toperation={ insertionPoint.operation }\n\t\t\tnearestSide={ insertionPoint.nearestSide }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,aAAa,EAAEC,UAAU,QAAQ,oBAAoB;AACtE,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,gBAAgB,QAAQ,oBAAoB;;AAErD;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAClC,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,qBAAqB,MAAM,4BAA4B;AA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E,4BAA4B,CAAC,CAAC;MACzCD,gBAAgB,EACfE,aAAa,CAAEC,mBAAmB,EAAEhE,YAAa,CAAC,KAAK;IACzD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,IACC,CAAE4D,SAAS;EACX;EACA;EACAC,gBAAgB,EACf;IACD,OAAO,IAAI;EACZ;;EAEA;AACD;AACA;AACA;EACC,OAAOhD,cAAc,CAACtB,SAAS,KAAK,SAAS,GAC5CkD,aAAA,CAACvD;EACA;EAAA;IACA+E,GAAG,EAAI,GAAGpD,cAAc,CAACb,YAAc,IAAIa,cAAc,CAACI,KAAO,EAAG;IAAA,GAC/D0C;EAAK,CACV,CAAC,GAEFlB,aAAA,CAACrD,8BAA8B;IAC9BG,SAAS,EAAGsB,cAAc,CAACtB,SAAW;IACtCC,WAAW,EAAGqB,cAAc,CAACrB,WAAa;IAAA,GACrCmE;EAAK,CACV,CACD;AACF"}
|
|
@@ -2,10 +2,9 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { TextareaControl,
|
|
5
|
+
import { TextareaControl, Notice, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
6
|
import { useState } from '@wordpress/element';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { Icon, info } from '@wordpress/icons';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Internal dependencies
|
|
@@ -45,7 +44,10 @@ export default function AdvancedPanel({
|
|
|
45
44
|
}
|
|
46
45
|
return createElement(VStack, {
|
|
47
46
|
spacing: 3
|
|
48
|
-
}, createElement(
|
|
47
|
+
}, cssError && createElement(Notice, {
|
|
48
|
+
status: "error",
|
|
49
|
+
onRemove: () => setCSSError(null)
|
|
50
|
+
}, cssError), createElement(TextareaControl, {
|
|
49
51
|
label: __('Additional CSS'),
|
|
50
52
|
__nextHasNoMarginBottom: true,
|
|
51
53
|
value: customCSS,
|
|
@@ -53,13 +55,6 @@ export default function AdvancedPanel({
|
|
|
53
55
|
onBlur: handleOnBlur,
|
|
54
56
|
className: "block-editor-global-styles-advanced-panel__custom-css-input",
|
|
55
57
|
spellCheck: false
|
|
56
|
-
})
|
|
57
|
-
text: cssError
|
|
58
|
-
}, createElement("div", {
|
|
59
|
-
className: "block-editor-global-styles-advanced-panel__custom-css-validation-wrapper"
|
|
60
|
-
}, createElement(Icon, {
|
|
61
|
-
icon: info,
|
|
62
|
-
className: "block-editor-global-styles-advanced-panel__custom-css-validation-icon"
|
|
63
|
-
}))));
|
|
58
|
+
}));
|
|
64
59
|
}
|
|
65
60
|
//# sourceMappingURL=advanced-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TextareaControl","
|
|
1
|
+
{"version":3,"names":["TextareaControl","Notice","__experimentalVStack","VStack","useState","__","default","transformStyles","AdvancedPanel","value","onChange","inheritedValue","cssError","setCSSError","customCSS","css","handleOnChange","newValue","transformed","handleOnBlur","event","target","createElement","spacing","status","onRemove","label","__nextHasNoMarginBottom","onBlur","className","spellCheck"],"sources":["@wordpress/block-editor/src/components/global-styles/advanced-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tTextareaControl,\n\tNotice,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { default as transformStyles } from '../../utils/transform-styles';\n\nexport default function AdvancedPanel( {\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n} ) {\n\t// Custom CSS\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst customCSS = inheritedValue?.css;\n\tfunction handleOnChange( newValue ) {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tcss: newValue,\n\t\t} );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css: newValue } ],\n\t\t\t\t'.editor-styles-wrapper'\n\t\t\t);\n\t\t\tif ( transformed ) {\n\t\t\t\tsetCSSError( null );\n\t\t\t}\n\t\t}\n\t}\n\tfunction handleOnBlur( event ) {\n\t\tif ( ! event?.target?.value ) {\n\t\t\tsetCSSError( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ transformed ] = transformStyles(\n\t\t\t[ { css: event.target.value } ],\n\t\t\t'.editor-styles-wrapper'\n\t\t);\n\n\t\tsetCSSError(\n\t\t\ttransformed === null\n\t\t\t\t? __( 'There is an error with your CSS structure.' )\n\t\t\t\t: null\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 }>\n\t\t\t{ cssError && (\n\t\t\t\t<Notice status=\"error\" onRemove={ () => setCSSError( null ) }>\n\t\t\t\t\t{ cssError }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t<TextareaControl\n\t\t\t\tlabel={ __( 'Additional CSS' ) }\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tvalue={ customCSS }\n\t\t\t\tonChange={ ( newValue ) => handleOnChange( newValue ) }\n\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\tclassName=\"block-editor-global-styles-advanced-panel__custom-css-input\"\n\t\t\t\tspellCheck={ false }\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,eAAe,EACfC,MAAM,EACNC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,OAAO,IAAIC,eAAe,QAAQ,8BAA8B;AAEzE,eAAe,SAASC,aAAaA,CAAE;EACtCC,KAAK;EACLC,QAAQ;EACRC,cAAc,GAAGF;AAClB,CAAC,EAAG;EACH;EACA,MAAM,CAAEG,QAAQ,EAAEC,WAAW,CAAE,GAAGT,QAAQ,CAAE,IAAK,CAAC;EAClD,MAAMU,SAAS,GAAGH,cAAc,EAAEI,G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';
|
|
|
12
12
|
import BorderRadiusControl from '../border-radius-control';
|
|
13
13
|
import { useColorsPerOrigin } from './hooks';
|
|
14
14
|
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
15
|
-
import {
|
|
15
|
+
import { overrideOrigins } from '../../store/get-block-settings';
|
|
16
16
|
import { setImmutably } from '../../utils/object';
|
|
17
17
|
import { getBorderPanelLabel } from '../../hooks/border';
|
|
18
18
|
import { ShadowPopover } from './shadow-panel-components';
|
|
@@ -70,6 +70,7 @@ export default function BorderPanel({
|
|
|
70
70
|
name,
|
|
71
71
|
defaultControls = DEFAULT_CONTROLS
|
|
72
72
|
}) {
|
|
73
|
+
var _settings$shadow$pres, _overrideOrigins;
|
|
73
74
|
const colors = useColorsPerOrigin(settings);
|
|
74
75
|
const decodeValue = useCallback(rawValue => getValueFromVariable({
|
|
75
76
|
settings
|
|
@@ -127,10 +128,10 @@ export default function BorderPanel({
|
|
|
127
128
|
|
|
128
129
|
// Shadow
|
|
129
130
|
const shadow = decodeValue(inheritedValue?.shadow);
|
|
130
|
-
const shadowPresets = settings?.shadow?.presets;
|
|
131
|
-
const
|
|
131
|
+
const shadowPresets = (_settings$shadow$pres = settings?.shadow?.presets) !== null && _settings$shadow$pres !== void 0 ? _settings$shadow$pres : {};
|
|
132
|
+
const overriddenShadowPresets = (_overrideOrigins = overrideOrigins(shadowPresets)) !== null && _overrideOrigins !== void 0 ? _overrideOrigins : [];
|
|
132
133
|
const setShadow = newValue => {
|
|
133
|
-
const slug =
|
|
134
|
+
const slug = overriddenShadowPresets?.find(({
|
|
134
135
|
shadow: shadowName
|
|
135
136
|
}) => shadowName === newValue)?.slug;
|
|
136
137
|
onChange(setImmutably(value, ['shadow'], slug ? `var:preset|shadow|${slug}` : newValue || undefined));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalItemGroup","ItemGroup","BaseControl","useCallback","useMemo","__","BorderRadiusControl","useColorsPerOrigin","getValueFromVariable","TOOLSPANEL_DROPDOWNMENU_PROPS","mergeOrigins","setImmutably","getBorderPanelLabel","ShadowPopover","useHasShadowControl","settings","shadow","useHasBorderPanel","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","border","color","radius","style","width","BorderToolsPanel","resetAllFilter","onChange","value","panelId","children","label","resetAll","updatedValue","createElement","dropdownMenuProps","DEFAULT_CONTROLS","BorderPanel","as","Wrapper","inheritedValue","name","defaultControls","colors","decodeValue","rawValue","encodeColorValue","colorValue","allColors","flatMap","originColors","colorObject","find","slug","borderValue","forEach","side","undefined","setBorder","newBorder","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","newBorderRadius","hasBorderRadius","borderValues","Object","entries","hasShadowControl","shadowPresets","presets","mergedShadowPresets","setShadow","newValue","shadowName","hasShadow","resetShadow","resetBorder","onBorderChange","updatedBorder","previousValue","showBorderByDefault","blockName","hasBorderControl","hasValue","onDeselect","isShownByDefault","enableAlpha","enableStyle","popoverOffset","popoverPlacement","__experimentalIsRenderedInSidebar","size","hideLabelFromVision","values","VisualLabel","isBordered","isSeparated","onShadowChange"],"sources":["@wordpress/block-editor/src/components/global-styles/border-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\nimport { mergeOrigins } from '../../store/get-block-settings';\nimport { setImmutably } from '../../utils/object';\nimport { getBorderPanelLabel } from '../../hooks/border';\nimport { ShadowPopover } from './shadow-panel-components';\n\nfunction useHasShadowControl( settings ) {\n\treturn !! settings?.shadow;\n}\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( settings ),\n\t\tuseHasBorderRadiusControl( settings ),\n\t\tuseHasBorderStyleControl( settings ),\n\t\tuseHasBorderWidthControl( settings ),\n\t\tuseHasShadowControl( settings ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n\tshadow: false,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tname,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst border = useMemo( () => {\n\t\tif ( hasSplitBorders( inheritedValue?.border ) ) {\n\t\t\tconst borderValue = { ...inheritedValue?.border };\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tborderValue[ side ] = {\n\t\t\t\t\t...borderValue[ side ],\n\t\t\t\t\tcolor: decodeValue( borderValue[ side ]?.color ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn borderValue;\n\t\t}\n\t\treturn {\n\t\t\t...inheritedValue?.border,\n\t\t\tcolor: inheritedValue?.border?.color\n\t\t\t\t? decodeValue( inheritedValue?.border?.color )\n\t\t\t\t: undefined,\n\t\t};\n\t}, [ inheritedValue?.border, decodeValue ] );\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst borderRadiusValues = decodeValue( border?.radius );\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow\n\tconst shadow = decodeValue( inheritedValue?.shadow );\n\tconst shadowPresets = settings?.shadow?.presets;\n\tconst mergedShadowPresets = shadowPresets\n\t\t? mergeOrigins( shadowPresets )\n\t\t: [];\n\tconst setShadow = ( newValue ) => {\n\t\tconst slug = mergedShadowPresets?.find(\n\t\t\t( { shadow: shadowName } ) => shadowName === newValue\n\t\t)?.slug;\n\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'shadow' ],\n\t\t\t\tslug ? `var:preset|shadow|${ slug }` : newValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\tconst label = getBorderPanelLabel( {\n\t\tblockName: name,\n\t\thasShadowControl,\n\t\thasBorderControl:\n\t\t\tshowBorderColor ||\n\t\t\tshowBorderStyle ||\n\t\t\tshowBorderWidth ||\n\t\t\tshowBorderRadius,\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\thideLabelFromVision={ ! hasShadowControl }\n\t\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,8BAA8B,IAAIC,gBAAgB,EAClDC,6BAA6B,IAAIC,eAAe,EAChDC,6BAA6B,IAAIC,eAAe,EAChDC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,uBAAuB,IAAIC,SAAS,EACpCC,WAAW,QACL,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,EAAE,QAAQ,iBAAiB;;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xC,cAAc;IACdqC,KAAK,EAAG/B,EAAE,CAAE,QAAS,CAAG;IACxBuF,QAAQ,EAAGT,SAAW;IACtBU,UAAU,EAAGT,WAAa;IAC1BU,gBAAgB,EAAG/C,eAAe,CAAC/B,MAAQ;IAC3CkB,OAAO,EAAGA;EAAS,GAEnBK,aAAA,CAACrC,WAAW,CAACqG,WAAW;IAAC5D,EAAE,EAAC;EAAQ,GACjCtC,EAAE,CAAE,QAAS,CACS,CAAC,EAC1BkC,aAAA,CAACtC,SAAS;IAACuG,UAAU;IAACC,WAAW;EAAA,GAChClE,aAAA,CAAC1B,aAAa;IACbG,MAAM,EAAGA,MAAQ;IACjB0F,cAAc,EAAG1B,SAAW;IAC5BjE,QAAQ,EAAGA;EAAU,CACrB,CACS,CACI,CAET,CAAC;AAEZ"}
|
|
1
|
+
{"version":3,"names":["__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalItemGroup","ItemGroup","BaseControl","useCallback","useMemo","__","BorderRadiusControl","useColorsPerOrigin","getValueFromVariable","TOOLSPANEL_DROPDOWNMENU_PROPS","overrideOrigins","setImmutably","getBorderPanelLabel","ShadowPopover","useHasShadowControl","settings","shadow","useHasBorderPanel","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","border","color","radius","style","width","BorderToolsPanel","resetAllFilter","onChange","value","panelId","children","label","resetAll","updatedValue","createElement","dropdownMenuProps","DEFAULT_CONTROLS","BorderPanel","as","Wrapper","inheritedValue","name","defaultControls","_settings$shadow$pres","_overrideOrigins","colors","decodeValue","rawValue","encodeColorValue","colorValue","allColors","flatMap","originColors","colorObject","find","slug","borderValue","forEach","side","undefined","setBorder","newBorder","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","newBorderRadius","hasBorderRadius","borderValues","Object","entries","hasShadowControl","shadowPresets","presets","overriddenShadowPresets","setShadow","newValue","shadowName","hasShadow","resetShadow","resetBorder","onBorderChange","updatedBorder","previousValue","showBorderByDefault","blockName","hasBorderControl","hasValue","onDeselect","isShownByDefault","enableAlpha","enableStyle","popoverOffset","popoverPlacement","__experimentalIsRenderedInSidebar","size","hideLabelFromVision","values","VisualLabel","isBordered","isSeparated","onShadowChange"],"sources":["@wordpress/block-editor/src/components/global-styles/border-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalItemGroup as ItemGroup,\n\tBaseControl,\n} from '@wordpress/components';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BorderRadiusControl from '../border-radius-control';\nimport { useColorsPerOrigin } from './hooks';\nimport { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';\nimport { overrideOrigins } from '../../store/get-block-settings';\nimport { setImmutably } from '../../utils/object';\nimport { getBorderPanelLabel } from '../../hooks/border';\nimport { ShadowPopover } from './shadow-panel-components';\n\nfunction useHasShadowControl( settings ) {\n\treturn !! settings?.shadow;\n}\n\nexport function useHasBorderPanel( settings ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( settings ),\n\t\tuseHasBorderRadiusControl( settings ),\n\t\tuseHasBorderStyleControl( settings ),\n\t\tuseHasBorderWidthControl( settings ),\n\t\tuseHasShadowControl( settings ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( settings ) {\n\treturn settings?.border?.color;\n}\n\nfunction useHasBorderRadiusControl( settings ) {\n\treturn settings?.border?.radius;\n}\n\nfunction useHasBorderStyleControl( settings ) {\n\treturn settings?.border?.style;\n}\n\nfunction useHasBorderWidthControl( settings ) {\n\treturn settings?.border?.width;\n}\n\nfunction BorderToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n\tlabel,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ label }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t\tdropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tradius: true,\n\tcolor: true,\n\twidth: true,\n\tshadow: false,\n};\n\nexport default function BorderPanel( {\n\tas: Wrapper = BorderToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tname,\n\tdefaultControls = DEFAULT_CONTROLS,\n} ) {\n\tconst colors = useColorsPerOrigin( settings );\n\tconst decodeValue = useCallback(\n\t\t( rawValue ) => getValueFromVariable( { settings }, '', rawValue ),\n\t\t[ settings ]\n\t);\n\tconst encodeColorValue = ( colorValue ) => {\n\t\tconst allColors = colors.flatMap(\n\t\t\t( { colors: originColors } ) => originColors\n\t\t);\n\t\tconst colorObject = allColors.find(\n\t\t\t( { color } ) => color === colorValue\n\t\t);\n\t\treturn colorObject\n\t\t\t? 'var:preset|color|' + colorObject.slug\n\t\t\t: colorValue;\n\t};\n\tconst border = useMemo( () => {\n\t\tif ( hasSplitBorders( inheritedValue?.border ) ) {\n\t\t\tconst borderValue = { ...inheritedValue?.border };\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tborderValue[ side ] = {\n\t\t\t\t\t...borderValue[ side ],\n\t\t\t\t\tcolor: decodeValue( borderValue[ side ]?.color ),\n\t\t\t\t};\n\t\t\t} );\n\t\t\treturn borderValue;\n\t\t}\n\t\treturn {\n\t\t\t...inheritedValue?.border,\n\t\t\tcolor: inheritedValue?.border?.color\n\t\t\t\t? decodeValue( inheritedValue?.border?.color )\n\t\t\t\t: undefined,\n\t\t};\n\t}, [ inheritedValue?.border, decodeValue ] );\n\tconst setBorder = ( newBorder ) =>\n\t\tonChange( { ...value, border: newBorder } );\n\tconst showBorderColor = useHasBorderColorControl( settings );\n\tconst showBorderStyle = useHasBorderStyleControl( settings );\n\tconst showBorderWidth = useHasBorderWidthControl( settings );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( settings );\n\tconst borderRadiusValues = decodeValue( border?.radius );\n\tconst setBorderRadius = ( newBorderRadius ) =>\n\t\tsetBorder( { ...border, radius: newBorderRadius } );\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = value?.border?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\tconst hasShadowControl = useHasShadowControl( settings );\n\n\t// Shadow\n\tconst shadow = decodeValue( inheritedValue?.shadow );\n\tconst shadowPresets = settings?.shadow?.presets ?? {};\n\tconst overriddenShadowPresets = overrideOrigins( shadowPresets ) ?? [];\n\tconst setShadow = ( newValue ) => {\n\t\tconst slug = overriddenShadowPresets?.find(\n\t\t\t( { shadow: shadowName } ) => shadowName === newValue\n\t\t)?.slug;\n\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'shadow' ],\n\t\t\t\tslug ? `var:preset|shadow|${ slug }` : newValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasShadow = () => !! value?.shadow;\n\tconst resetShadow = () => setShadow( undefined );\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: value?.border?.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst onBorderChange = ( newBorder ) => {\n\t\t// Ensure we have a visible border style when a border width or\n\t\t// color is being selected.\n\t\tconst updatedBorder = { ...newBorder };\n\n\t\tif ( hasSplitBorders( updatedBorder ) ) {\n\t\t\t[ 'top', 'right', 'bottom', 'left' ].forEach( ( side ) => {\n\t\t\t\tif ( updatedBorder[ side ] ) {\n\t\t\t\t\tupdatedBorder[ side ] = {\n\t\t\t\t\t\t...updatedBorder[ side ],\n\t\t\t\t\t\tcolor: encodeColorValue( updatedBorder[ side ]?.color ),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} );\n\t\t} else if ( updatedBorder ) {\n\t\t\tupdatedBorder.color = encodeColorValue( updatedBorder.color );\n\t\t}\n\n\t\t// As radius is maintained separately to color, style, and width\n\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t// global styles are saved.\n\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tborder: undefined,\n\t\t\tshadow: undefined,\n\t\t};\n\t}, [] );\n\n\tconst showBorderByDefault =\n\t\tdefaultControls?.color || defaultControls?.width;\n\n\tconst label = getBorderPanelLabel( {\n\t\tblockName: name,\n\t\thasShadowControl,\n\t\thasBorderControl:\n\t\t\tshowBorderColor ||\n\t\t\tshowBorderStyle ||\n\t\t\tshowBorderWidth ||\n\t\t\tshowBorderRadius,\n\t} );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t\tlabel={ label }\n\t\t>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( value?.border ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ showBorderByDefault }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\thideLabelFromVision={ ! hasShadowControl }\n\t\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ defaultControls.radius }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetBorderRadius( newValue || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ hasShadowControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tlabel={ __( 'Shadow' ) }\n\t\t\t\t\thasValue={ hasShadow }\n\t\t\t\t\tonDeselect={ resetShadow }\n\t\t\t\t\tisShownByDefault={ defaultControls.shadow }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t<ShadowPopover\n\t\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\t\tonShadowChange={ setShadow }\n\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ItemGroup>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,8BAA8B,IAAIC,gBAAgB,EAClDC,6BAA6B,IAAIC,eAAe,EAChDC,6BAA6B,IAAIC,eAAe,EAChDC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,EAC9CC,uBAAuB,IAAIC,SAAS,EACpCC,WAAW,QACL,uBAAuB;AAC9B,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;AACzD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,oBAAoB,EAAEC,6BAA6B,QAAQ,SAAS;AAC7E,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,SAASC,aAAa,QAAQ,2BAA2B;AAEzD,SAASC,mBAAmBA,CAAEC,QAAQ,EAAG;EACxC,OAAO,CAAC,CAAEA,QAAQ,EAAEC,MAAM;AAC3B;AAEA,OAAO,SAASC,iBAAiBA,CAAEF,QAAQ,EAAG;EAC7C,MAAMG,QAAQ,GAAG,CAChBC,wBAAwB,CAAEJ,QAAS,CAAC,EACpCK,yBAAyB,CAAEL,QAAS,CAAC,EACrCM,wBAAwB,CAAEN,QAAS,CAAC,EACpCO,wBAAwB,CAAEP,QAAS,CAAC,EACpCD,mBAAmB,CAAEC,QAAS,CAA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AC;AAEZ"}
|
|
@@ -21,8 +21,8 @@ const translationMap = {
|
|
|
21
21
|
h4: __('H4'),
|
|
22
22
|
h5: __('H5'),
|
|
23
23
|
h6: __('H6'),
|
|
24
|
-
'settings.color': __('Color
|
|
25
|
-
'settings.typography': __('Typography
|
|
24
|
+
'settings.color': __('Color'),
|
|
25
|
+
'settings.typography': __('Typography'),
|
|
26
26
|
'styles.color': __('Colors'),
|
|
27
27
|
'styles.spacing': __('Spacing'),
|
|
28
28
|
'styles.typography': __('Typography')
|
|
@@ -51,10 +51,7 @@ function getTranslation(key) {
|
|
|
51
51
|
return blockName || keyArray[1];
|
|
52
52
|
}
|
|
53
53
|
if (keyArray?.[0] === 'elements') {
|
|
54
|
-
|
|
55
|
-
return sprintf(
|
|
56
|
-
// translators: %s: element name, e.g., heading button, link, caption.
|
|
57
|
-
__('%s element'), elementName);
|
|
54
|
+
return translationMap[keyArray[1]] || keyArray[1];
|
|
58
55
|
}
|
|
59
56
|
return undefined;
|
|
60
57
|
}
|
|
@@ -97,9 +94,9 @@ function deepCompare(changedObject, originalObject, parentPath = '') {
|
|
|
97
94
|
*
|
|
98
95
|
* @param {Object} next The changed object to compare.
|
|
99
96
|
* @param {Object} previous The original object to compare against.
|
|
100
|
-
* @return {
|
|
97
|
+
* @return {Array[]} A 2-dimensional array of tuples: [ "group", "translated change" ].
|
|
101
98
|
*/
|
|
102
|
-
function getGlobalStylesChangelist(next, previous) {
|
|
99
|
+
export function getGlobalStylesChangelist(next, previous) {
|
|
103
100
|
const cacheKey = JSON.stringify({
|
|
104
101
|
next,
|
|
105
102
|
previous
|
|
@@ -141,11 +138,11 @@ function getGlobalStylesChangelist(next, previous) {
|
|
|
141
138
|
const result = [...new Set(changedValueTree)]
|
|
142
139
|
/*
|
|
143
140
|
* Translate the keys.
|
|
144
|
-
* Remove
|
|
141
|
+
* Remove empty translations.
|
|
145
142
|
*/.reduce((acc, curr) => {
|
|
146
143
|
const translation = getTranslation(curr);
|
|
147
|
-
if (translation
|
|
148
|
-
acc.push(translation);
|
|
144
|
+
if (translation) {
|
|
145
|
+
acc.push([curr.split('.')[0], translation]);
|
|
149
146
|
}
|
|
150
147
|
return acc;
|
|
151
148
|
}, []);
|
|
@@ -154,29 +151,68 @@ function getGlobalStylesChangelist(next, previous) {
|
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
/**
|
|
157
|
-
* From a getGlobalStylesChangelist() result, returns
|
|
158
|
-
*
|
|
154
|
+
* From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type.
|
|
155
|
+
* The types are 'blocks', 'elements', 'settings', and 'styles'.
|
|
159
156
|
*
|
|
160
157
|
* @param {Object} next The changed object to compare.
|
|
161
158
|
* @param {Object} previous The original object to compare against.
|
|
162
159
|
* @param {{maxResults:number}} options Options. maxResults: results to return before truncating.
|
|
163
|
-
* @return {string[]}
|
|
160
|
+
* @return {string[]} An array of translated changes.
|
|
164
161
|
*/
|
|
165
162
|
export default function getGlobalStylesChanges(next, previous, options = {}) {
|
|
166
|
-
|
|
167
|
-
const changesLength =
|
|
163
|
+
let changeList = getGlobalStylesChangelist(next, previous);
|
|
164
|
+
const changesLength = changeList.length;
|
|
168
165
|
const {
|
|
169
166
|
maxResults
|
|
170
167
|
} = options;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
if (changesLength) {
|
|
169
|
+
// Truncate to `n` results if necessary.
|
|
170
|
+
if (!!maxResults && changesLength > maxResults) {
|
|
171
|
+
changeList = changeList.slice(0, maxResults);
|
|
172
|
+
}
|
|
173
|
+
return Object.entries(changeList.reduce((acc, curr) => {
|
|
174
|
+
const group = acc[curr[0]] || [];
|
|
175
|
+
if (!group.includes(curr[1])) {
|
|
176
|
+
acc[curr[0]] = [...group, curr[1]];
|
|
177
|
+
}
|
|
178
|
+
return acc;
|
|
179
|
+
}, {})).map(([key, changeValues]) => {
|
|
180
|
+
const changeValuesLength = changeValues.length;
|
|
181
|
+
const joinedChangesValue = changeValues.join(__(', '));
|
|
182
|
+
switch (key) {
|
|
183
|
+
case 'blocks':
|
|
184
|
+
{
|
|
185
|
+
return sprintf(
|
|
186
|
+
// translators: %s: a list of block names separated by a comma.
|
|
187
|
+
_n('%s block.', '%s blocks.', changeValuesLength), joinedChangesValue);
|
|
188
|
+
}
|
|
189
|
+
case 'elements':
|
|
190
|
+
{
|
|
191
|
+
return sprintf(
|
|
192
|
+
// translators: %s: a list of element names separated by a comma.
|
|
193
|
+
_n('%s element.', '%s elements.', changeValuesLength), joinedChangesValue);
|
|
194
|
+
}
|
|
195
|
+
case 'settings':
|
|
196
|
+
{
|
|
197
|
+
return sprintf(
|
|
198
|
+
// translators: %s: a list of theme.json setting labels separated by a comma.
|
|
199
|
+
__('%s settings.'), joinedChangesValue);
|
|
200
|
+
}
|
|
201
|
+
case 'styles':
|
|
202
|
+
{
|
|
203
|
+
return sprintf(
|
|
204
|
+
// translators: %s: a list of theme.json top-level styles labels separated by a comma.
|
|
205
|
+
__('%s styles.'), joinedChangesValue);
|
|
206
|
+
}
|
|
207
|
+
default:
|
|
208
|
+
{
|
|
209
|
+
return sprintf(
|
|
210
|
+
// translators: %s: a list of global styles changes separated by a comma.
|
|
211
|
+
__('%s.'), joinedChangesValue);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
});
|
|
179
215
|
}
|
|
180
|
-
return
|
|
216
|
+
return EMPTY_ARRAY;
|
|
181
217
|
}
|
|
182
218
|
//# sourceMappingURL=get-global-styles-changes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memoize","__","_n","sprintf","getBlockTypes","globalStylesChangesCache","Map","EMPTY_ARRAY","translationMap","caption","link","button","heading","h1","h2","h3","h4","h5","h6","getBlockNames","reduce","accumulator","name","title","isObject","obj","getTranslation","key","keyArray","split","blockName","elementName","undefined","deepCompare","changedObject","originalObject","parentPath","slice","join","allKeys","Set","Object","keys","diffs","path","changedPath","concat","getGlobalStylesChangelist","next","previous","cacheKey","JSON","stringify","has","get","changedValueTree","styles","color","typography","spacing","blocks","elements","settings","length","set","result","acc","curr","translation","includes","push","getGlobalStylesChanges","options","changes","changesLength","maxResults","deleteCount","andMoreText","splice"],"sources":["@wordpress/block-editor/src/components/global-styles/get-global-styles-changes.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { getBlockTypes } from '@wordpress/blocks';\n\nconst globalStylesChangesCache = new Map();\nconst EMPTY_ARRAY = [];\nconst translationMap = {\n\tcaption: __( 'Caption' ),\n\tlink: __( 'Link' ),\n\tbutton: __( 'Button' ),\n\theading: __( 'Heading' ),\n\th1: __( 'H1' ),\n\th2: __( 'H2' ),\n\th3: __( 'H3' ),\n\th4: __( 'H4' ),\n\th5: __( 'H5' ),\n\th6: __( 'H6' ),\n\t'settings.color': __( 'Color settings' ),\n\t'settings.typography': __( 'Typography settings' ),\n\t'styles.color': __( 'Colors' ),\n\t'styles.spacing': __( 'Spacing' ),\n\t'styles.typography': __( 'Typography' ),\n};\nconst getBlockNames = memoize( () =>\n\tgetBlockTypes().reduce( ( accumulator, { name, title } ) => {\n\t\taccumulator[ name ] = title;\n\t\treturn accumulator;\n\t}, {} )\n);\nconst isObject = ( obj ) => obj !== null && typeof obj === 'object';\n\n/**\n * Get the translation for a given global styles key.\n * @param {string} key A key representing a path to a global style property or setting.\n * @return {string|undefined} A translated key or undefined if no translation exists.\n */\nfunction getTranslation( key ) {\n\tif ( translationMap[ key ] ) {\n\t\treturn translationMap[ key ];\n\t}\n\n\tconst keyArray = key.split( '.' );\n\n\tif ( keyArray?.[ 0 ] === 'blocks' ) {\n\t\tconst blockName = getBlockNames()?.[ keyArray[ 1 ] ];\n\t\treturn blockName || keyArray[ 1 ];\n\t}\n\n\tif ( keyArray?.[ 0 ] === 'elements' ) {\n\t\tconst elementName = translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];\n\t\treturn sprintf(\n\t\t\t// translators: %s: element name, e.g., heading button, link, caption.\n\t\t\t__( '%s element' ),\n\t\t\telementName\n\t\t);\n\t}\n\n\treturn undefined;\n}\n\n/**\n * A deep comparison of two objects, optimized for comparing global styles.\n * @param {Object} changedObject The changed object to compare.\n * @param {Object} originalObject The original object to compare against.\n * @param {string} parentPath A key/value pair object of block names and their rendered titles.\n * @return {string[]} An array of paths whose values have changed.\n */\nfunction deepCompare( changedObject, originalObject, parentPath = '' ) {\n\t// We have two non-object values to compare.\n\tif ( ! isObject( changedObject ) && ! isObject( originalObject ) ) {\n\t\t/*\n\t\t * Only return a path if the value has changed.\n\t\t * And then only the path name up to 2 levels deep.\n\t\t */\n\t\treturn changedObject !== originalObject\n\t\t\t? parentPath.split( '.' ).slice( 0, 2 ).join( '.' )\n\t\t\t: undefined;\n\t}\n\n\t// Enable comparison when an object doesn't have a corresponding property to compare.\n\tchangedObject = isObject( changedObject ) ? changedObject : {};\n\toriginalObject = isObject( originalObject ) ? originalObject : {};\n\n\tconst allKeys = new Set( [\n\t\t...Object.keys( changedObject ),\n\t\t...Object.keys( originalObject ),\n\t] );\n\n\tlet diffs = [];\n\tfor ( const key of allKeys ) {\n\t\tconst path = parentPath ? parentPath + '.' + key : key;\n\t\tconst changedPath = deepCompare(\n\t\t\tchangedObject[ key ],\n\t\t\toriginalObject[ key ],\n\t\t\tpath\n\t\t);\n\t\tif ( changedPath ) {\n\t\t\tdiffs = diffs.concat( changedPath );\n\t\t}\n\t}\n\treturn diffs;\n}\n\n/**\n * Returns an array of translated summarized global styles changes.\n * Results are cached using a Map() key of `JSON.stringify( { next, previous } )`.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @return {string[]} An array of translated changes.\n */\nfunction getGlobalStylesChangelist( next, previous ) {\n\tconst cacheKey = JSON.stringify( { next, previous } );\n\n\tif ( globalStylesChangesCache.has( cacheKey ) ) {\n\t\treturn globalStylesChangesCache.get( cacheKey );\n\t}\n\n\t/*\n\t * Compare the two changesets with normalized keys.\n\t * The order of these keys determines the order in which\n\t * they'll appear in the results.\n\t */\n\tconst changedValueTree = deepCompare(\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tcolor: next?.styles?.color,\n\t\t\t\ttypography: next?.styles?.typography,\n\t\t\t\tspacing: next?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: next?.styles?.blocks,\n\t\t\telements: next?.styles?.elements,\n\t\t\tsettings: next?.settings,\n\t\t},\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tcolor: previous?.styles?.color,\n\t\t\t\ttypography: previous?.styles?.typography,\n\t\t\t\tspacing: previous?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: previous?.styles?.blocks,\n\t\t\telements: previous?.styles?.elements,\n\t\t\tsettings: previous?.settings,\n\t\t}\n\t);\n\n\tif ( ! changedValueTree.length ) {\n\t\tglobalStylesChangesCache.set( cacheKey, EMPTY_ARRAY );\n\t\treturn EMPTY_ARRAY;\n\t}\n\n\t// Remove duplicate results.\n\tconst result = [ ...new Set( changedValueTree ) ]\n\t\t/*\n\t\t * Translate the keys.\n\t\t * Remove duplicate or empty translations.\n\t\t */\n\t\t.reduce( ( acc, curr ) => {\n\t\t\tconst translation = getTranslation( curr );\n\t\t\tif ( translation && ! acc.includes( translation ) ) {\n\t\t\t\tacc.push( translation );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\tglobalStylesChangesCache.set( cacheKey, result );\n\n\treturn result;\n}\n\n/**\n * From a getGlobalStylesChangelist() result, returns a truncated array of translated changes.\n * Appends a translated string indicating the number of changes that were truncated.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @param {{maxResults:number}} options Options. maxResults: results to return before truncating.\n * @return {string[]} An array of translated changes.\n */\nexport default function getGlobalStylesChanges( next, previous, options = {} ) {\n\tconst changes = getGlobalStylesChangelist( next, previous );\n\tconst changesLength = changes.length;\n\tconst { maxResults } = options;\n\n\t// Truncate to `n` results if necessary.\n\tif ( !! maxResults && changesLength && changesLength > maxResults ) {\n\t\tconst deleteCount = changesLength - maxResults;\n\t\tconst andMoreText = sprintf(\n\t\t\t// translators: %d: number of global styles changes that are not displayed in the UI.\n\t\t\t_n( '…and %d more change', '…and %d more changes', deleteCount ),\n\t\t\tdeleteCount\n\t\t);\n\t\tchanges.splice( maxResults, deleteCount, andMoreText );\n\t}\n\n\treturn changes;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,OAAO,MAAM,QAAQ;;AAE5B;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,aAAa,QAAQ,mBAAmB;AAEjD,MAAMC,wBAAwB,GAAG,IAAIC,GAAG,CAAC,CAAC;AAC1C,MAAMC,WAAW,GAAG,EAAE;AACtB,MAAMC,cAAc,GAAG;EACtBC,OAAO,EAAER,EAAE,CAAE,SAAU,CAAC;EACxBS,IAAI,EAAET,EAAE,CAAE,MAAO,CAAC;EAClBU,MAAM,EAAEV,EAAE,CAAE,QAAS,CAAC;EACtBW,OAAO,EAAEX,EAAE,CAAE,SAAU,CAAC;EACxBY,EAAE,EAAEZ,EAAE,CAAE,IAAK,CAAC;EACda,EAAE,EAAEb,EAAE,CAAE,IAAK,CAAC;EACdc,EAAE,EAAEd,EAAE,CAAE,IAAK,CAAC;EACde,EAAE,EAAEf,EAAE,CAAE,IAAK,CAAC;EACdgB,EAAE,EAAEhB,EAAE,CAAE,IAAK,CAAC;EACdiB,EAAE,EAAEjB,EAAE,CAAE,IAAK,CAAC;EACd,gBAAgB,EAAEA,EAAE,CAAE,gBAAiB,CAAC;EACxC,qBAAqB,EAAEA,EAAE,CAAE,qBAAsB,CAAC;EAClD,cAAc,EAAEA,EAAE,CAAE,QAAS,CAAC;EAC9B,gBAAgB,EAAEA,EAAE,CAAE,SAAU,CAAC;EACjC,mB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AAG;MACnDF,GAAG,CAACI,IAAI,CAAEF,WAAY,CAAC;IACxB;IACA,OAAOF,GAAG;EACX,CAAC,EAAE,EAAG,CAAC;EAER7D,wBAAwB,CAAC2D,GAAG,CAAEd,QAAQ,EAAEe,MAAO,CAAC;EAEhD,OAAOA,MAAM;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASM,sBAAsBA,CAAEvB,IAAI,EAAEC,QAAQ,EAAEuB,OAAO,GAAG,CAAC,CAAC,EAAG;EAC9E,MAAMC,OAAO,GAAG1B,yBAAyB,CAAEC,IAAI,EAAEC,QAAS,CAAC;EAC3D,MAAMyB,aAAa,GAAGD,OAAO,CAACV,MAAM;EACpC,MAAM;IAAEY;EAAW,CAAC,GAAGH,OAAO;;EAE9B;EACA,IAAK,CAAC,CAAEG,UAAU,IAAID,aAAa,IAAIA,aAAa,GAAGC,UAAU,EAAG;IACnE,MAAMC,WAAW,GAAGF,aAAa,GAAGC,UAAU;IAC9C,MAAME,WAAW,GAAG1E,OAAO;IAC1B;IACAD,EAAE,CAAE,qBAAqB,EAAE,sBAAsB,EAAE0E,WAAY,CAAC,EAChEA,WACD,CAAC;IACDH,OAAO,CAACK,MAAM,CAAEH,UAAU,EAAEC,WAAW,EAAEC,WAAY,CAAC;EACvD;EAEA,OAAOJ,OAAO;AACf"}
|
|
1
|
+
{"version":3,"names":["memoize","__","_n","sprintf","getBlockTypes","globalStylesChangesCache","Map","EMPTY_ARRAY","translationMap","caption","link","button","heading","h1","h2","h3","h4","h5","h6","getBlockNames","reduce","accumulator","name","title","isObject","obj","getTranslation","key","keyArray","split","blockName","undefined","deepCompare","changedObject","originalObject","parentPath","slice","join","allKeys","Set","Object","keys","diffs","path","changedPath","concat","getGlobalStylesChangelist","next","previous","cacheKey","JSON","stringify","has","get","changedValueTree","styles","color","typography","spacing","blocks","elements","settings","length","set","result","acc","curr","translation","push","getGlobalStylesChanges","options","changeList","changesLength","maxResults","entries","group","includes","map","changeValues","changeValuesLength","joinedChangesValue"],"sources":["@wordpress/block-editor/src/components/global-styles/get-global-styles-changes.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { getBlockTypes } from '@wordpress/blocks';\n\nconst globalStylesChangesCache = new Map();\nconst EMPTY_ARRAY = [];\nconst translationMap = {\n\tcaption: __( 'Caption' ),\n\tlink: __( 'Link' ),\n\tbutton: __( 'Button' ),\n\theading: __( 'Heading' ),\n\th1: __( 'H1' ),\n\th2: __( 'H2' ),\n\th3: __( 'H3' ),\n\th4: __( 'H4' ),\n\th5: __( 'H5' ),\n\th6: __( 'H6' ),\n\t'settings.color': __( 'Color' ),\n\t'settings.typography': __( 'Typography' ),\n\t'styles.color': __( 'Colors' ),\n\t'styles.spacing': __( 'Spacing' ),\n\t'styles.typography': __( 'Typography' ),\n};\nconst getBlockNames = memoize( () =>\n\tgetBlockTypes().reduce( ( accumulator, { name, title } ) => {\n\t\taccumulator[ name ] = title;\n\t\treturn accumulator;\n\t}, {} )\n);\nconst isObject = ( obj ) => obj !== null && typeof obj === 'object';\n\n/**\n * Get the translation for a given global styles key.\n * @param {string} key A key representing a path to a global style property or setting.\n * @return {string|undefined} A translated key or undefined if no translation exists.\n */\nfunction getTranslation( key ) {\n\tif ( translationMap[ key ] ) {\n\t\treturn translationMap[ key ];\n\t}\n\n\tconst keyArray = key.split( '.' );\n\n\tif ( keyArray?.[ 0 ] === 'blocks' ) {\n\t\tconst blockName = getBlockNames()?.[ keyArray[ 1 ] ];\n\t\treturn blockName || keyArray[ 1 ];\n\t}\n\n\tif ( keyArray?.[ 0 ] === 'elements' ) {\n\t\treturn translationMap[ keyArray[ 1 ] ] || keyArray[ 1 ];\n\t}\n\n\treturn undefined;\n}\n\n/**\n * A deep comparison of two objects, optimized for comparing global styles.\n * @param {Object} changedObject The changed object to compare.\n * @param {Object} originalObject The original object to compare against.\n * @param {string} parentPath A key/value pair object of block names and their rendered titles.\n * @return {string[]} An array of paths whose values have changed.\n */\nfunction deepCompare( changedObject, originalObject, parentPath = '' ) {\n\t// We have two non-object values to compare.\n\tif ( ! isObject( changedObject ) && ! isObject( originalObject ) ) {\n\t\t/*\n\t\t * Only return a path if the value has changed.\n\t\t * And then only the path name up to 2 levels deep.\n\t\t */\n\t\treturn changedObject !== originalObject\n\t\t\t? parentPath.split( '.' ).slice( 0, 2 ).join( '.' )\n\t\t\t: undefined;\n\t}\n\n\t// Enable comparison when an object doesn't have a corresponding property to compare.\n\tchangedObject = isObject( changedObject ) ? changedObject : {};\n\toriginalObject = isObject( originalObject ) ? originalObject : {};\n\n\tconst allKeys = new Set( [\n\t\t...Object.keys( changedObject ),\n\t\t...Object.keys( originalObject ),\n\t] );\n\n\tlet diffs = [];\n\tfor ( const key of allKeys ) {\n\t\tconst path = parentPath ? parentPath + '.' + key : key;\n\t\tconst changedPath = deepCompare(\n\t\t\tchangedObject[ key ],\n\t\t\toriginalObject[ key ],\n\t\t\tpath\n\t\t);\n\t\tif ( changedPath ) {\n\t\t\tdiffs = diffs.concat( changedPath );\n\t\t}\n\t}\n\treturn diffs;\n}\n\n/**\n * Returns an array of translated summarized global styles changes.\n * Results are cached using a Map() key of `JSON.stringify( { next, previous } )`.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @return {Array[]} A 2-dimensional array of tuples: [ \"group\", \"translated change\" ].\n */\nexport function getGlobalStylesChangelist( next, previous ) {\n\tconst cacheKey = JSON.stringify( { next, previous } );\n\n\tif ( globalStylesChangesCache.has( cacheKey ) ) {\n\t\treturn globalStylesChangesCache.get( cacheKey );\n\t}\n\n\t/*\n\t * Compare the two changesets with normalized keys.\n\t * The order of these keys determines the order in which\n\t * they'll appear in the results.\n\t */\n\tconst changedValueTree = deepCompare(\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tcolor: next?.styles?.color,\n\t\t\t\ttypography: next?.styles?.typography,\n\t\t\t\tspacing: next?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: next?.styles?.blocks,\n\t\t\telements: next?.styles?.elements,\n\t\t\tsettings: next?.settings,\n\t\t},\n\t\t{\n\t\t\tstyles: {\n\t\t\t\tcolor: previous?.styles?.color,\n\t\t\t\ttypography: previous?.styles?.typography,\n\t\t\t\tspacing: previous?.styles?.spacing,\n\t\t\t},\n\t\t\tblocks: previous?.styles?.blocks,\n\t\t\telements: previous?.styles?.elements,\n\t\t\tsettings: previous?.settings,\n\t\t}\n\t);\n\n\tif ( ! changedValueTree.length ) {\n\t\tglobalStylesChangesCache.set( cacheKey, EMPTY_ARRAY );\n\t\treturn EMPTY_ARRAY;\n\t}\n\n\t// Remove duplicate results.\n\tconst result = [ ...new Set( changedValueTree ) ]\n\t\t/*\n\t\t * Translate the keys.\n\t\t * Remove empty translations.\n\t\t */\n\t\t.reduce( ( acc, curr ) => {\n\t\t\tconst translation = getTranslation( curr );\n\t\t\tif ( translation ) {\n\t\t\t\tacc.push( [ curr.split( '.' )[ 0 ], translation ] );\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] );\n\n\tglobalStylesChangesCache.set( cacheKey, result );\n\n\treturn result;\n}\n\n/**\n * From a getGlobalStylesChangelist() result, returns an array of translated global styles changes, grouped by type.\n * The types are 'blocks', 'elements', 'settings', and 'styles'.\n *\n * @param {Object} next The changed object to compare.\n * @param {Object} previous The original object to compare against.\n * @param {{maxResults:number}} options Options. maxResults: results to return before truncating.\n * @return {string[]} An array of translated changes.\n */\nexport default function getGlobalStylesChanges( next, previous, options = {} ) {\n\tlet changeList = getGlobalStylesChangelist( next, previous );\n\tconst changesLength = changeList.length;\n\tconst { maxResults } = options;\n\n\tif ( changesLength ) {\n\t\t// Truncate to `n` results if necessary.\n\t\tif ( !! maxResults && changesLength > maxResults ) {\n\t\t\tchangeList = changeList.slice( 0, maxResults );\n\t\t}\n\t\treturn Object.entries(\n\t\t\tchangeList.reduce( ( acc, curr ) => {\n\t\t\t\tconst group = acc[ curr[ 0 ] ] || [];\n\t\t\t\tif ( ! group.includes( curr[ 1 ] ) ) {\n\t\t\t\t\tacc[ curr[ 0 ] ] = [ ...group, curr[ 1 ] ];\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t}, {} )\n\t\t).map( ( [ key, changeValues ] ) => {\n\t\t\tconst changeValuesLength = changeValues.length;\n\t\t\tconst joinedChangesValue = changeValues.join( __( ', ' ) );\n\t\t\tswitch ( key ) {\n\t\t\t\tcase 'blocks': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of block names separated by a comma.\n\t\t\t\t\t\t_n( '%s block.', '%s blocks.', changeValuesLength ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'elements': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of element names separated by a comma.\n\t\t\t\t\t\t_n( '%s element.', '%s elements.', changeValuesLength ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'settings': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of theme.json setting labels separated by a comma.\n\t\t\t\t\t\t__( '%s settings.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tcase 'styles': {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of theme.json top-level styles labels separated by a comma.\n\t\t\t\t\t\t__( '%s styles.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\treturn sprintf(\n\t\t\t\t\t\t// translators: %s: a list of global styles changes separated by a comma.\n\t\t\t\t\t\t__( '%s.' ),\n\t\t\t\t\t\tjoinedChangesValue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n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AC;UACF;QACA,KAAK,UAAU;UAAE;YAChB,OAAO7E,OAAO;YACb;YACAF,EAAE,CAAE,cAAe,CAAC,EACpB+E,kBACD,CAAC;UACF;QACA,KAAK,QAAQ;UAAE;YACd,OAAO7E,OAAO;YACb;YACAF,EAAE,CAAE,YAAa,CAAC,EAClB+E,kBACD,CAAC;UACF;QACA;UAAS;YACR,OAAO7E,OAAO;YACb;YACAF,EAAE,CAAE,KAAM,CAAC,EACX+E,kBACD,CAAC;UACF;MACD;IACD,CAAE,CAAC;EACJ;EAEA,OAAOzE,WAAW;AACnB"}
|
|
@@ -14,10 +14,10 @@ export function ShadowPopoverContainer({
|
|
|
14
14
|
onShadowChange,
|
|
15
15
|
settings
|
|
16
16
|
}) {
|
|
17
|
-
const defaultShadows = settings?.shadow?.presets?.default;
|
|
18
|
-
const themeShadows = settings?.shadow?.presets?.theme;
|
|
17
|
+
const defaultShadows = settings?.shadow?.presets?.default || [];
|
|
18
|
+
const themeShadows = settings?.shadow?.presets?.theme || [];
|
|
19
19
|
const defaultPresetsEnabled = settings?.shadow?.defaultPresets;
|
|
20
|
-
const shadows = [...(defaultPresetsEnabled ? defaultShadows : []), ...
|
|
20
|
+
const shadows = [...(defaultPresetsEnabled ? defaultShadows : []), ...themeShadows];
|
|
21
21
|
return createElement("div", {
|
|
22
22
|
className: "block-editor-global-styles__shadow-popover-container"
|
|
23
23
|
}, createElement(VStack, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalVStack","VStack","__experimentalHeading","Heading","__experimentalGrid","Grid","__experimentalHStack","HStack","__experimentalDropdownContentWrapper","DropdownContentWrapper","Button","FlexItem","Dropdown","shadow","shadowIcon","Icon","check","classNames","ShadowPopoverContainer","onShadowChange","settings","defaultShadows","presets","default","themeShadows","theme","defaultPresetsEnabled","defaultPresets","shadows","createElement","className","spacing","level","ShadowPresets","activeShadow","onSelect","columns","gap","align","justify","map","name","slug","ShadowIndicator","key","label","isActive","undefined","onClick","style","boxShadow","showTooltip","icon","ShadowPopover","popoverProps","placement","offset","shift","renderToggle","renderShadowToggle","renderContent","paddingSize","onToggle","isOpen","toggleProps","size"],"sources":["@wordpress/block-editor/src/components/global-styles/shadow-panel-components.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHeading as Heading,\n\t__experimentalGrid as Grid,\n\t__experimentalHStack as HStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n\tFlexItem,\n\tDropdown,\n} from '@wordpress/components';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\n/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\nexport function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {\n\tconst defaultShadows = settings?.shadow?.presets?.default;\n\tconst themeShadows = settings?.shadow?.presets?.theme;\n\tconst defaultPresetsEnabled = settings?.shadow?.defaultPresets;\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...
|
|
1
|
+
{"version":3,"names":["__","__experimentalVStack","VStack","__experimentalHeading","Heading","__experimentalGrid","Grid","__experimentalHStack","HStack","__experimentalDropdownContentWrapper","DropdownContentWrapper","Button","FlexItem","Dropdown","shadow","shadowIcon","Icon","check","classNames","ShadowPopoverContainer","onShadowChange","settings","defaultShadows","presets","default","themeShadows","theme","defaultPresetsEnabled","defaultPresets","shadows","createElement","className","spacing","level","ShadowPresets","activeShadow","onSelect","columns","gap","align","justify","map","name","slug","ShadowIndicator","key","label","isActive","undefined","onClick","style","boxShadow","showTooltip","icon","ShadowPopover","popoverProps","placement","offset","shift","renderToggle","renderShadowToggle","renderContent","paddingSize","onToggle","isOpen","toggleProps","size"],"sources":["@wordpress/block-editor/src/components/global-styles/shadow-panel-components.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalHeading as Heading,\n\t__experimentalGrid as Grid,\n\t__experimentalHStack as HStack,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n\tButton,\n\tFlexItem,\n\tDropdown,\n} from '@wordpress/components';\nimport { shadow as shadowIcon, Icon, check } from '@wordpress/icons';\n/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\nexport function ShadowPopoverContainer( { shadow, onShadowChange, settings } ) {\n\tconst defaultShadows = settings?.shadow?.presets?.default || [];\n\tconst themeShadows = settings?.shadow?.presets?.theme || [];\n\tconst defaultPresetsEnabled = settings?.shadow?.defaultPresets;\n\n\tconst shadows = [\n\t\t...( defaultPresetsEnabled ? defaultShadows : [] ),\n\t\t...themeShadows,\n\t];\n\n\treturn (\n\t\t<div className=\"block-editor-global-styles__shadow-popover-container\">\n\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t<Heading level={ 5 }>{ __( 'Drop shadow' ) }</Heading>\n\t\t\t\t<ShadowPresets\n\t\t\t\t\tpresets={ shadows }\n\t\t\t\t\tactiveShadow={ shadow }\n\t\t\t\t\tonSelect={ onShadowChange }\n\t\t\t\t/>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport function ShadowPresets( { presets, activeShadow, onSelect } ) {\n\treturn ! presets ? null : (\n\t\t<Grid columns={ 6 } gap={ 0 } align=\"center\" justify=\"center\">\n\t\t\t{ presets.map( ( { name, slug, shadow } ) => (\n\t\t\t\t<ShadowIndicator\n\t\t\t\t\tkey={ slug }\n\t\t\t\t\tlabel={ name }\n\t\t\t\t\tisActive={ shadow === activeShadow }\n\t\t\t\t\tonSelect={ () =>\n\t\t\t\t\t\tonSelect( shadow === activeShadow ? undefined : shadow )\n\t\t\t\t\t}\n\t\t\t\t\tshadow={ shadow }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</Grid>\n\t);\n}\n\nexport function ShadowIndicator( { label, isActive, onSelect, shadow } ) {\n\treturn (\n\t\t<div className=\"block-editor-global-styles__shadow-indicator-wrapper\">\n\t\t\t<Button\n\t\t\t\tclassName=\"block-editor-global-styles__shadow-indicator\"\n\t\t\t\tonClick={ onSelect }\n\t\t\t\tlabel={ label }\n\t\t\t\tstyle={ { boxShadow: shadow } }\n\t\t\t\tshowTooltip\n\t\t\t>\n\t\t\t\t{ isActive && <Icon icon={ check } /> }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n\nexport function ShadowPopover( { shadow, onShadowChange, settings } ) {\n\tconst popoverProps = {\n\t\tplacement: 'left-start',\n\t\toffset: 36,\n\t\tshift: true,\n\t};\n\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ popoverProps }\n\t\t\tclassName=\"block-editor-global-styles__shadow-dropdown\"\n\t\t\trenderToggle={ renderShadowToggle() }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"medium\">\n\t\t\t\t\t<ShadowPopoverContainer\n\t\t\t\t\t\tshadow={ shadow }\n\t\t\t\t\t\tonShadowChange={ onShadowChange }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction renderShadowToggle() {\n\treturn ( { onToggle, isOpen } ) => {\n\t\tconst toggleProps = {\n\t\t\tonClick: onToggle,\n\t\t\tclassName: classNames( { 'is-open': isOpen } ),\n\t\t\t'aria-expanded': isOpen,\n\t\t};\n\n\t\treturn (\n\t\t\t<Button { ...toggleProps }>\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName=\"block-editor-global-styles__toggle-icon\"\n\t\t\t\t\t\ticon={ shadowIcon }\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t\t<FlexItem>{ __( 'Drop shadow' ) }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t</Button>\n\t\t);\n\t};\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,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