@wordpress/block-editor 8.0.3 → 8.0.4

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.
@@ -139,64 +139,66 @@ const PanelColorGradientSettingsSingleSelect = props => {
139
139
 
140
140
  const PanelColorGradientSettingsMultipleSelect = props => {
141
141
  const colorGradientSettings = useCommonSingleMultipleSelects();
142
- const userColors = (0, _useSetting.default)('color.palette.user');
142
+ const customColors = (0, _useSetting.default)('color.palette.user');
143
143
  const themeColors = (0, _useSetting.default)('color.palette.theme');
144
- const coreColors = (0, _useSetting.default)('color.palette.core');
144
+ const defaultColors = (0, _useSetting.default)('color.palette.default');
145
+ const shouldDisplayDefaultColors = (0, _useSetting.default)('color.defaultPalette');
145
146
  colorGradientSettings.colors = (0, _element.useMemo)(() => {
146
147
  const result = [];
147
148
 
148
- if (coreColors && coreColors.length) {
149
+ if (themeColors && themeColors.length) {
149
150
  result.push({
150
- name: (0, _i18n.__)('Core'),
151
- colors: coreColors
151
+ name: (0, _i18n._x)('Theme', 'Indicates this palette comes from the theme.'),
152
+ colors: themeColors
152
153
  });
153
154
  }
154
155
 
155
- if (themeColors && themeColors.length) {
156
+ if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
156
157
  result.push({
157
- name: (0, _i18n.__)('Theme'),
158
- colors: themeColors
158
+ name: (0, _i18n._x)('Default', 'Indicates this palette comes from WordPress.'),
159
+ colors: defaultColors
159
160
  });
160
161
  }
161
162
 
162
- if (userColors && userColors.length) {
163
+ if (customColors && customColors.length) {
163
164
  result.push({
164
- name: (0, _i18n.__)('User'),
165
- colors: userColors
165
+ name: (0, _i18n._x)('Custom', 'Indicates this palette comes from the theme.'),
166
+ colors: customColors
166
167
  });
167
168
  }
168
169
 
169
170
  return result;
170
- }, [coreColors, themeColors, userColors]);
171
- const userGradients = (0, _useSetting.default)('color.gradients.user');
171
+ }, [defaultColors, themeColors, customColors]);
172
+ const customGradients = (0, _useSetting.default)('color.gradients.user');
172
173
  const themeGradients = (0, _useSetting.default)('color.gradients.theme');
173
- const coreGradients = (0, _useSetting.default)('color.gradients.core');
174
+ const defaultGradients = (0, _useSetting.default)('color.gradients.default');
175
+ const shouldDisplayDefaultGradients = (0, _useSetting.default)('color.defaultGradients');
174
176
  colorGradientSettings.gradients = (0, _element.useMemo)(() => {
175
177
  const result = [];
176
178
 
177
- if (coreGradients && coreGradients.length) {
179
+ if (themeGradients && themeGradients.length) {
178
180
  result.push({
179
- name: (0, _i18n.__)('Core'),
180
- gradients: coreGradients
181
+ name: (0, _i18n._x)('Theme', 'Indicates this palette comes from the theme.'),
182
+ gradients: themeGradients
181
183
  });
182
184
  }
183
185
 
184
- if (themeGradients && themeGradients.length) {
186
+ if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
185
187
  result.push({
186
- name: (0, _i18n.__)('Theme'),
187
- gradients: themeGradients
188
+ name: (0, _i18n._x)('Default', 'Indicates this palette comes from WordPress.'),
189
+ gradients: defaultGradients
188
190
  });
189
191
  }
190
192
 
191
- if (userGradients && userGradients.length) {
193
+ if (customGradients && customGradients.length) {
192
194
  result.push({
193
- name: (0, _i18n.__)('User'),
194
- gradients: userGradients
195
+ name: (0, _i18n._x)('Custom', 'Indicates this palette is created by the user.'),
196
+ gradients: customGradients
195
197
  });
196
198
  }
197
199
 
198
200
  return result;
199
- }, [userGradients, themeGradients, coreGradients]);
201
+ }, [customGradients, themeGradients, defaultGradients]);
200
202
  return (0, _element.createElement)(PanelColorGradientSettingsInner, (0, _extends2.default)({}, colorGradientSettings, props));
201
203
  };
202
204
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","props","setting","undefined","titleElement","useCommonSingleMultipleSelects","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","userColors","themeColors","coreColors","result","length","push","userGradients","themeGradients","coreGradients","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAMA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,QAAuC;AAAA,MAArC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBC,IAAAA;AAArB,GAAqC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,QAQCC,KARD,KASK;AAAA,QARJ;AACCC,MAAAA,UADD;AAECC,MAAAA,aAFD;AAGCC,MAAAA,KAHD;AAICP,MAAAA,MAAM,EAAEQ,eAJT;AAKCP,MAAAA,SAAS,EAAEQ;AALZ,KAQI;;AACJ,QAAK,CAAEJ,UAAF,IAAgB,CAAEC,aAAvB,EAAuC;AACtC,aAAO,IAAP;AACA;;AACD,QAAII,SAAJ;;AACA,QAAKL,UAAL,EAAkB;AACjB,YAAMM,WAAW,GAAG,wCACnBH,eAAe,IAAIR,MADA,EAEnBK,UAFmB,CAApB;AAIAK,MAAAA,SAAS,GAAG,mBACXd,uBADW,EAEXW,KAAK,CAACK,WAAN,EAFW,EAGTD,WAAW,IAAIA,WAAW,CAACE,IAA7B,IAAuCR,UAH5B,CAAZ;AAKA,KAVD,MAUO;AACN,YAAMS,cAAc,GAAG,+DAC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D,QAAKD,aAAa,IAAIA,aAAa,CAACF,MAApC,EAA6C;AAC5CD,MAAAA,MAAM,CAACE,IAAP,CAAa;AACZvB,QAAAA,IAAI,EAAE,cAAI,MAAJ,CADM;AAEZZ,QAAAA,SAAS,EAAEoC;AAFC,OAAb;AAIA;;AACD,WAAOH,MAAP;AACA,GArBiC,EAqB/B,CAAEG,aAAF,EAAiBC,cAAjB,EAAiCC,aAAjC,CArB+B,CAAlC;AAsBA,SACC,4BAAC,+BAAD,6BACWV,qBADX,EACqCN,KADrC,EADD;AAKA,CA1DD;;AA4DA,MAAMiB,0BAA0B,GAAKjB,KAAF,IAAa;AAC/C,MACC,mBAAOzB,qBAAP,EAAgC2C,GAAF,IAAWlB,KAAK,CAACmB,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,+BAAD,EAAsClB,KAAtC,CAAP;AACA;;AACD,MAAKA,KAAK,CAACD,gCAAX,EAA8C;AAC7C,WAAO,4BAAC,wCAAD,EAA+CC,KAA/C,CAAP;AACA;;AACD,SAAO,4BAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;eAYeiB,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nfunction useCommonSingleMultipleSelects() {\n\treturn {\n\t\tdisableCustomColors: ! useSetting( 'color.custom' ),\n\t\tdisableCustomGradients: ! useSetting( 'color.customGradient' ),\n\t};\n}\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tconst userColors = useSetting( 'color.palette.user' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst coreColors = useSetting( 'color.palette.core' );\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( coreColors && coreColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Core' ),\n\t\t\t\tcolors: coreColors,\n\t\t\t} );\n\t\t}\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Theme' ),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif ( userColors && userColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'User' ),\n\t\t\t\tcolors: userColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ coreColors, themeColors, userColors ] );\n\n\tconst userGradients = useSetting( 'color.gradients.user' );\n\tconst themeGradients = useSetting( 'color.gradients.theme' );\n\tconst coreGradients = useSetting( 'color.gradients.core' );\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( coreGradients && coreGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Core' ),\n\t\t\t\tgradients: coreGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Theme' ),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( userGradients && userGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'User' ),\n\t\t\t\tgradients: userGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ userGradients, themeGradients, coreGradients ] );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","props","setting","undefined","titleElement","useCommonSingleMultipleSelects","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","result","length","push","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;AAMA;AACA,MAAMA,uBAAuB,GAAG,cAAI,gBAAJ,CAAhC,C,CAEA;;AACA,MAAMC,0BAA0B,GAAG,cAAI,mBAAJ,CAAnC;AAEA,MAAMC,qBAAqB,GAAG,CAC7B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C,4BAAC,+BAAD,6BACWX,qBADX,EACqCN,KADrC,EADD;AAKA,CAzFD;;AA2FA,MAAMmB,0BAA0B,GAAKnB,KAAF,IAAa;AAC/C,MACC,mBAAOzB,qBAAP,EAAgC6C,GAAF,IAAWpB,KAAK,CAACqB,cAAN,CAAsBD,GAAtB,CAAzC,CADD,EAEE;AACD,WAAO,4BAAC,+BAAD,EAAsCpB,KAAtC,CAAP;AACA;;AACD,MAAKA,KAAK,CAACD,gCAAX,EAA8C;AAC7C,WAAO,4BAAC,wCAAD,EAA+CC,KAA/C,CAAP;AACA;;AACD,SAAO,4BAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;eAYemB,0B","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __, _x } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nfunction useCommonSingleMultipleSelects() {\n\treturn {\n\t\tdisableCustomColors: ! useSetting( 'color.custom' ),\n\t\tdisableCustomGradients: ! useSetting( 'color.customGradient' ),\n\t};\n}\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tconst customColors = useSetting( 'color.palette.user' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' );\n\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ defaultColors, themeColors, customColors ] );\n\n\tconst customGradients = useSetting( 'color.gradients.user' );\n\tconst themeGradients = useSetting( 'color.gradients.theme' );\n\tconst defaultGradients = useSetting( 'color.gradients.default' );\n\tconst shouldDisplayDefaultGradients = useSetting(\n\t\t'color.defaultGradients'\n\t);\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customGradients, themeGradients, defaultGradients ] );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
@@ -118,7 +118,7 @@ function useSetting(path) {
118
118
  if (_blocks.__EXPERIMENTAL_PATHS_WITH_MERGE[normalizedPath]) {
119
119
  var _ref, _experimentalFeatures;
120
120
 
121
- return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core;
121
+ return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.default;
122
122
  }
123
123
 
124
124
  return experimentalFeaturesResult;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["deprecatedFlags","settings","colors","undefined","gradients","disableCustomColors","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","setting","select","blockEditorStore","getSettings","normalizedPath","defaultsPath","blockPath","experimentalFeaturesResult","PATHS_WITH_MERGE","user","theme","core","deprecatedSettingsValue"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG;AACvB,mBAAmBC,QAAF,IAChBA,QAAQ,CAACC,MAAT,KAAoBC,SAApB,GAAgCA,SAAhC,GAA4CF,QAAQ,CAACC,MAF/B;AAGvB,qBAAqBD,QAAF,IAClBA,QAAQ,CAACG,SAAT,KAAuBD,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACG,SAJlC;AAKvB,kBAAkBH,QAAF,IACfA,QAAQ,CAACI,mBAAT,KAAiCF,SAAjC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACI,mBARQ;AASvB,0BAA0BJ,QAAF,IACvBA,QAAQ,CAACK,sBAAT,KAAoCH,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACK,sBAZQ;AAavB,0BAA0BL,QAAF,IACvBA,QAAQ,CAACM,SAAT,KAAuBJ,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACM,SAdlC;AAevB,+BAA+BN,QAAF,IAC5BA,QAAQ,CAACO,sBAAT,KAAoCL,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACO,sBAlBQ;AAmBvB,2BAA2BP,QAAF,IAAgBA,QAAQ,CAACQ,sBAnB3B;AAoBvB,mBAAmBR,QAAF,IAAgB;AAChC,QAAKA,QAAQ,CAACS,iBAAT,KAA+BP,SAApC,EAAgD;AAC/C;AACA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gB,EAAnF;AACA,UAAMG,0BAA0B,WAC/B,iBAAKxB,QAAL,EAAeuB,SAAf,CAD+B,uCACD,iBAAKvB,QAAL,EAAesB,YAAf,CAD/B;;AAGA,QAAKE,0BAA0B,KAAKtB,SAApC,EAAgD;AAC/C,UAAKuB,wCAAkBJ,cAAlB,CAAL,EAA0C;AAAA;;AACzC,gDACCG,0BAA0B,CAACE,IAD5B,yEAECF,0BAA0B,CAACG,KAF5B,uCAGCH,0BAA0B,CAACI,IAH5B;AAKA;;AACD,aAAOJ,0BAAP;AACA,KApBY,CAsBb;;;AACA,UAAMK,uBAAuB,GAAG9B,eAAe,CAAEsB,cAAF,CAAf,GAC7BtB,eAAe,CAAEsB,cAAF,CAAf,CAAmCrB,QAAnC,CAD6B,GAE7BE,SAFH;;AAGA,QAAK2B,uBAAuB,KAAK3B,SAAjC,EAA6C;AAC5C,aAAO2B,uBAAP;AACA,KA5BY,CA8Bb;AACA;AACA;AACA;;;AACA,WAAOR,cAAc,KAAK,oBAAnB,GAA0C,IAA1C,GAAiDnB,SAAxD;AACA,GApCc,EAqCf,CAAEc,SAAF,EAAaH,IAAb,CArCe,CAAhB;AAwCA,SAAOI,OAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) =>\n\t\tsettings.colors === undefined ? undefined : settings.colors,\n\t'color.gradients': ( settings ) =>\n\t\tsettings.gradients === undefined ? undefined : settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) =>\n\t\tsettings.fontSizes === undefined ? undefined : settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the editor setting.\n * It works with nested objects using by finding the value at path.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName } = useBlockEditContext();\n\n\tconst setting = useSelect(\n\t\t( select ) => {\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\t// 1 - Use __experimental features, if available.\n\t\t\t// We cascade to the all value if the block one is not available.\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\tconst experimentalFeaturesResult =\n\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\n\t\t\tif ( experimentalFeaturesResult !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\texperimentalFeaturesResult.user ??\n\t\t\t\t\t\texperimentalFeaturesResult.theme ??\n\t\t\t\t\t\texperimentalFeaturesResult.core\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn experimentalFeaturesResult;\n\t\t\t}\n\n\t\t\t// 2 - Use deprecated settings, otherwise.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 3 - Fall back for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, path ]\n\t);\n\n\treturn setting;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["deprecatedFlags","settings","colors","undefined","gradients","disableCustomColors","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","setting","select","blockEditorStore","getSettings","normalizedPath","defaultsPath","blockPath","experimentalFeaturesResult","PATHS_WITH_MERGE","user","theme","default","deprecatedSettingsValue"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAMA,eAAe,GAAG;AACvB,mBAAmBC,QAAF,IAChBA,QAAQ,CAACC,MAAT,KAAoBC,SAApB,GAAgCA,SAAhC,GAA4CF,QAAQ,CAACC,MAF/B;AAGvB,qBAAqBD,QAAF,IAClBA,QAAQ,CAACG,SAAT,KAAuBD,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACG,SAJlC;AAKvB,kBAAkBH,QAAF,IACfA,QAAQ,CAACI,mBAAT,KAAiCF,SAAjC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACI,mBARQ;AASvB,0BAA0BJ,QAAF,IACvBA,QAAQ,CAACK,sBAAT,KAAoCH,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACK,sBAZQ;AAavB,0BAA0BL,QAAF,IACvBA,QAAQ,CAACM,SAAT,KAAuBJ,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACM,SAdlC;AAevB,+BAA+BN,QAAF,IAC5BA,QAAQ,CAACO,sBAAT,KAAoCL,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACO,sBAlBQ;AAmBvB,2BAA2BP,QAAF,IAAgBA,QAAQ,CAACQ,sBAnB3B;AAoBvB,mBAAmBR,QAAF,IAAgB;AAChC,QAAKA,QAAQ,CAACS,iBAAT,KAA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I,iCAAiCP,SAAW,IAAIK,cAAgB,EAAnF;AACA,UAAMG,0BAA0B,WAC/B,iBAAKxB,QAAL,EAAeuB,SAAf,CAD+B,uCACD,iBAAKvB,QAAL,EAAesB,YAAf,CAD/B;;AAGA,QAAKE,0BAA0B,KAAKtB,SAApC,EAAgD;AAC/C,UAAKuB,wCAAkBJ,cAAlB,CAAL,EAA0C;AAAA;;AACzC,gDACCG,0BAA0B,CAACE,IAD5B,yEAECF,0BAA0B,CAACG,KAF5B,uCAGCH,0BAA0B,CAACI,OAH5B;AAKA;;AACD,aAAOJ,0BAAP;AACA,KApBY,CAsBb;;;AACA,UAAMK,uBAAuB,GAAG9B,eAAe,CAAEsB,cAAF,CAAf,GAC7BtB,eAAe,CAAEsB,cAAF,CAAf,CAAmCrB,QAAnC,CAD6B,GAE7BE,SAFH;;AAGA,QAAK2B,uBAAuB,KAAK3B,SAAjC,EAA6C;AAC5C,aAAO2B,uBAAP;AACA,KA5BY,CA8Bb;AACA;AACA;AACA;;;AACA,WAAOR,cAAc,KAAK,oBAAnB,GAA0C,IAA1C,GAAiDnB,SAAxD;AACA,GApCc,EAqCf,CAAEc,SAAF,EAAaH,IAAb,CArCe,CAAhB;AAwCA,SAAOI,OAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) =>\n\t\tsettings.colors === undefined ? undefined : settings.colors,\n\t'color.gradients': ( settings ) =>\n\t\tsettings.gradients === undefined ? undefined : settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) =>\n\t\tsettings.fontSizes === undefined ? undefined : settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the editor setting.\n * It works with nested objects using by finding the value at path.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName } = useBlockEditContext();\n\n\tconst setting = useSelect(\n\t\t( select ) => {\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\t// 1 - Use __experimental features, if available.\n\t\t\t// We cascade to the all value if the block one is not available.\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\tconst experimentalFeaturesResult =\n\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\n\t\t\tif ( experimentalFeaturesResult !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\texperimentalFeaturesResult.user ??\n\t\t\t\t\t\texperimentalFeaturesResult.theme ??\n\t\t\t\t\t\texperimentalFeaturesResult.default\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn experimentalFeaturesResult;\n\t\t\t}\n\n\t\t\t// 2 - Use deprecated settings, otherwise.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 3 - Fall back for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, path ]\n\t);\n\n\treturn setting;\n}\n"]}
@@ -11,7 +11,7 @@ import { every, isEmpty } from 'lodash';
11
11
  */
12
12
 
13
13
  import { PanelBody, ColorIndicator } from '@wordpress/components';
14
- import { sprintf, __ } from '@wordpress/i18n';
14
+ import { sprintf, __, _x } from '@wordpress/i18n';
15
15
  import { useMemo } from '@wordpress/element';
16
16
  /**
17
17
  * Internal dependencies
@@ -123,64 +123,66 @@ const PanelColorGradientSettingsSingleSelect = props => {
123
123
 
124
124
  const PanelColorGradientSettingsMultipleSelect = props => {
125
125
  const colorGradientSettings = useCommonSingleMultipleSelects();
126
- const userColors = useSetting('color.palette.user');
126
+ const customColors = useSetting('color.palette.user');
127
127
  const themeColors = useSetting('color.palette.theme');
128
- const coreColors = useSetting('color.palette.core');
128
+ const defaultColors = useSetting('color.palette.default');
129
+ const shouldDisplayDefaultColors = useSetting('color.defaultPalette');
129
130
  colorGradientSettings.colors = useMemo(() => {
130
131
  const result = [];
131
132
 
132
- if (coreColors && coreColors.length) {
133
+ if (themeColors && themeColors.length) {
133
134
  result.push({
134
- name: __('Core'),
135
- colors: coreColors
135
+ name: _x('Theme', 'Indicates this palette comes from the theme.'),
136
+ colors: themeColors
136
137
  });
137
138
  }
138
139
 
139
- if (themeColors && themeColors.length) {
140
+ if (shouldDisplayDefaultColors && defaultColors && defaultColors.length) {
140
141
  result.push({
141
- name: __('Theme'),
142
- colors: themeColors
142
+ name: _x('Default', 'Indicates this palette comes from WordPress.'),
143
+ colors: defaultColors
143
144
  });
144
145
  }
145
146
 
146
- if (userColors && userColors.length) {
147
+ if (customColors && customColors.length) {
147
148
  result.push({
148
- name: __('User'),
149
- colors: userColors
149
+ name: _x('Custom', 'Indicates this palette comes from the theme.'),
150
+ colors: customColors
150
151
  });
151
152
  }
152
153
 
153
154
  return result;
154
- }, [coreColors, themeColors, userColors]);
155
- const userGradients = useSetting('color.gradients.user');
155
+ }, [defaultColors, themeColors, customColors]);
156
+ const customGradients = useSetting('color.gradients.user');
156
157
  const themeGradients = useSetting('color.gradients.theme');
157
- const coreGradients = useSetting('color.gradients.core');
158
+ const defaultGradients = useSetting('color.gradients.default');
159
+ const shouldDisplayDefaultGradients = useSetting('color.defaultGradients');
158
160
  colorGradientSettings.gradients = useMemo(() => {
159
161
  const result = [];
160
162
 
161
- if (coreGradients && coreGradients.length) {
163
+ if (themeGradients && themeGradients.length) {
162
164
  result.push({
163
- name: __('Core'),
164
- gradients: coreGradients
165
+ name: _x('Theme', 'Indicates this palette comes from the theme.'),
166
+ gradients: themeGradients
165
167
  });
166
168
  }
167
169
 
168
- if (themeGradients && themeGradients.length) {
170
+ if (shouldDisplayDefaultGradients && defaultGradients && defaultGradients.length) {
169
171
  result.push({
170
- name: __('Theme'),
171
- gradients: themeGradients
172
+ name: _x('Default', 'Indicates this palette comes from WordPress.'),
173
+ gradients: defaultGradients
172
174
  });
173
175
  }
174
176
 
175
- if (userGradients && userGradients.length) {
177
+ if (customGradients && customGradients.length) {
176
178
  result.push({
177
- name: __('User'),
178
- gradients: userGradients
179
+ name: _x('Custom', 'Indicates this palette is created by the user.'),
180
+ gradients: customGradients
179
181
  });
180
182
  }
181
183
 
182
184
  return result;
183
- }, [userGradients, themeGradients, coreGradients]);
185
+ }, [customGradients, themeGradients, defaultGradients]);
184
186
  return createElement(PanelColorGradientSettingsInner, _extends({}, colorGradientSettings, props));
185
187
  };
186
188
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["classnames","every","isEmpty","PanelBody","ColorIndicator","sprintf","__","useMemo","ColorGradientControl","getColorObjectByColorValue","__experimentalGetGradientObjectByGradientValue","useSetting","colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","props","setting","undefined","titleElement","useCommonSingleMultipleSelects","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","userColors","themeColors","coreColors","result","length","push","userGradients","themeGradients","coreGradients","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,KAAT,EAAgBC,OAAhB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,cAApB,QAA0C,uBAA1C;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC;AACA,SAASC,0BAAT,QAA2C,WAA3C;AACA,SAASC,8CAAT,QAA+D,cAA/D;AACA,OAAOC,UAAP,MAAuB,gBAAvB,C,CAEA;;AACA,MAAMC,uBAAuB,GAAGN,EAAE,CAAE,gBAAF,CAAlC,C,CAEA;;;AACA,MAAMO,0BAA0B,GAAGP,EAAE,CAAE,mBAAF,CAArC;;AAEA,MAAMQ,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,QAAuC;AAAA,MAArC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBC,IAAAA;AAArB,GAAqC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,QAQCC,KARD,KASK;AAAA,QARJ;AACCC,MAAAA,UADD;AAECC,MAAAA,aAFD;AAGCC,MAAAA,KAHD;AAICP,MAAAA,MAAM,EAAEQ,eAJT;AAKCP,MAAAA,SAAS,EAAEQ;AALZ,KAQI;;AACJ,QAAK,CAAEJ,UAAF,IAAgB,CAAEC,aAAvB,EAAuC;AACtC,aAAO,IAAP;AACA;;AACD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YA,eAAeiB,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nfunction useCommonSingleMultipleSelects() {\n\treturn {\n\t\tdisableCustomColors: ! useSetting( 'color.custom' ),\n\t\tdisableCustomGradients: ! useSetting( 'color.customGradient' ),\n\t};\n}\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tconst userColors = useSetting( 'color.palette.user' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst coreColors = useSetting( 'color.palette.core' );\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( coreColors && coreColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Core' ),\n\t\t\t\tcolors: coreColors,\n\t\t\t} );\n\t\t}\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Theme' ),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif ( userColors && userColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'User' ),\n\t\t\t\tcolors: userColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ coreColors, themeColors, userColors ] );\n\n\tconst userGradients = useSetting( 'color.gradients.user' );\n\tconst themeGradients = useSetting( 'color.gradients.theme' );\n\tconst coreGradients = useSetting( 'color.gradients.core' );\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( coreGradients && coreGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Core' ),\n\t\t\t\tgradients: coreGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'Theme' ),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( userGradients && userGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: __( 'User' ),\n\t\t\t\tgradients: userGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ userGradients, themeGradients, coreGradients ] );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/colors-gradients/panel-color-gradient-settings.js"],"names":["classnames","every","isEmpty","PanelBody","ColorIndicator","sprintf","__","_x","useMemo","ColorGradientControl","getColorObjectByColorValue","__experimentalGetGradientObjectByGradientValue","useSetting","colorIndicatorAriaLabel","gradientIndicatorAriaLabel","colorsAndGradientKeys","Indicators","colors","gradients","settings","map","index","colorValue","gradientValue","label","availableColors","availableGradients","ariaLabel","colorObject","toLowerCase","name","gradientObject","PanelColorGradientSettingsInner","className","disableCustomColors","disableCustomGradients","children","title","showTitle","__experimentalHasMultipleOrigins","props","setting","undefined","titleElement","useCommonSingleMultipleSelects","PanelColorGradientSettingsSingleSelect","colorGradientSettings","PanelColorGradientSettingsMultipleSelect","customColors","themeColors","defaultColors","shouldDisplayDefaultColors","result","length","push","customGradients","themeGradients","defaultGradients","shouldDisplayDefaultGradients","PanelColorGradientSettings","key","hasOwnProperty"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,KAAT,EAAgBC,OAAhB,QAA+B,QAA/B;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,cAApB,QAA0C,uBAA1C;AACA,SAASC,OAAT,EAAkBC,EAAlB,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC;AACA,SAASC,0BAAT,QAA2C,WAA3C;AACA,SAASC,8CAAT,QAA+D,cAA/D;AACA,OAAOC,UAAP,MAAuB,gBAAvB,C,CAEA;;AACA,MAAMC,uBAAuB,GAAGP,EAAE,CAAE,gBAAF,CAAlC,C,CAEA;;;AACA,MAAMQ,0BAA0B,GAAGR,EAAE,CAAE,mBAAF,CAArC;;AAEA,MAAMS,qBAAqB,GAAG,CAC7B,QAD6B,EAE7B,qBAF6B,EAG7B,WAH6B,EAI7B,wBAJ6B,CAA9B;;AAOA,MAAMC,UAAU,GAAG,QAAuC;AAAA,MAArC;AAAEC,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBC,IAAAA;AAArB,GAAqC;AACzD,SAAOA,QAAQ,CAACC,GAAT,CACN,QAQCC,KARD,KASK;AAAA,QARJ;AACCC,MAAAA,UADD;AAECC,MAAAA,aAFD;AAGCC,MA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,KADrC,EADD;AAKA,CAzFD;;AA2FA,MAAMmB,0BAA0B,GAAKnB,KAAF,IAAa;AAC/C,MACCvC,KAAK,CAAEc,qBAAF,EAA2B6C,GAAF,IAAWpB,KAAK,CAACqB,cAAN,CAAsBD,GAAtB,CAApC,CADN,EAEE;AACD,WAAO,cAAC,+BAAD,EAAsCpB,KAAtC,CAAP;AACA;;AACD,MAAKA,KAAK,CAACD,gCAAX,EAA8C;AAC7C,WAAO,cAAC,wCAAD,EAA+CC,KAA/C,CAAP;AACA;;AACD,SAAO,cAAC,sCAAD,EAA6CA,KAA7C,CAAP;AACA,CAVD;;AAYA,eAAemB,0BAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { every, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { PanelBody, ColorIndicator } from '@wordpress/components';\nimport { sprintf, __, _x } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorGradientControl from './control';\nimport { getColorObjectByColorValue } from '../colors';\nimport { __experimentalGetGradientObjectByGradientValue } from '../gradients';\nimport useSetting from '../use-setting';\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst colorIndicatorAriaLabel = __( '(%s: color %s)' );\n\n// translators: first %s: The type of color or gradient (e.g. background, overlay...), second %s: the color name or value (e.g. red or #ff0000)\nconst gradientIndicatorAriaLabel = __( '(%s: gradient %s)' );\n\nconst colorsAndGradientKeys = [\n\t'colors',\n\t'disableCustomColors',\n\t'gradients',\n\t'disableCustomGradients',\n];\n\nconst Indicators = ( { colors, gradients, settings } ) => {\n\treturn settings.map(\n\t\t(\n\t\t\t{\n\t\t\t\tcolorValue,\n\t\t\t\tgradientValue,\n\t\t\t\tlabel,\n\t\t\t\tcolors: availableColors,\n\t\t\t\tgradients: availableGradients,\n\t\t\t},\n\t\t\tindex\n\t\t) => {\n\t\t\tif ( ! colorValue && ! gradientValue ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tlet ariaLabel;\n\t\t\tif ( colorValue ) {\n\t\t\t\tconst colorObject = getColorObjectByColorValue(\n\t\t\t\t\tavailableColors || colors,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tcolorIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( colorObject && colorObject.name ) || colorValue\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst gradientObject = __experimentalGetGradientObjectByGradientValue(\n\t\t\t\t\tavailableGradients || gradients,\n\t\t\t\t\tcolorValue\n\t\t\t\t);\n\t\t\t\tariaLabel = sprintf(\n\t\t\t\t\tgradientIndicatorAriaLabel,\n\t\t\t\t\tlabel.toLowerCase(),\n\t\t\t\t\t( gradientObject && gradientObject.name ) || gradientValue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<ColorIndicator\n\t\t\t\t\tkey={ index }\n\t\t\t\t\tcolorValue={ colorValue || gradientValue }\n\t\t\t\t\taria-label={ ariaLabel }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t);\n};\n\nexport const PanelColorGradientSettingsInner = ( {\n\tclassName,\n\tcolors,\n\tgradients,\n\tdisableCustomColors,\n\tdisableCustomGradients,\n\tchildren,\n\tsettings,\n\ttitle,\n\tshowTitle = true,\n\t__experimentalHasMultipleOrigins,\n\t...props\n} ) => {\n\tif (\n\t\tisEmpty( colors ) &&\n\t\tisEmpty( gradients ) &&\n\t\tdisableCustomColors &&\n\t\tdisableCustomGradients &&\n\t\tevery(\n\t\t\tsettings,\n\t\t\t( setting ) =>\n\t\t\t\tisEmpty( setting.colors ) &&\n\t\t\t\tisEmpty( setting.gradients ) &&\n\t\t\t\t( setting.disableCustomColors === undefined ||\n\t\t\t\t\tsetting.disableCustomColors ) &&\n\t\t\t\t( setting.disableCustomGradients === undefined ||\n\t\t\t\t\tsetting.disableCustomGradients )\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\n\tconst titleElement = (\n\t\t<span className=\"block-editor-panel-color-gradient-settings__panel-title\">\n\t\t\t{ title }\n\t\t\t<Indicators\n\t\t\t\tcolors={ colors }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tsettings={ settings }\n\t\t\t/>\n\t\t</span>\n\t);\n\n\treturn (\n\t\t<PanelBody\n\t\t\tclassName={ classnames(\n\t\t\t\t'block-editor-panel-color-gradient-settings',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ttitle={ showTitle ? titleElement : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ settings.map( ( setting, index ) => (\n\t\t\t\t<ColorGradientControl\n\t\t\t\t\tshowTitle={ showTitle }\n\t\t\t\t\tkey={ index }\n\t\t\t\t\t{ ...{\n\t\t\t\t\t\tcolors,\n\t\t\t\t\t\tgradients,\n\t\t\t\t\t\tdisableCustomColors,\n\t\t\t\t\t\tdisableCustomGradients,\n\t\t\t\t\t\t__experimentalHasMultipleOrigins,\n\t\t\t\t\t\t...setting,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n};\n\nfunction useCommonSingleMultipleSelects() {\n\treturn {\n\t\tdisableCustomColors: ! useSetting( 'color.custom' ),\n\t\tdisableCustomGradients: ! useSetting( 'color.customGradient' ),\n\t};\n}\n\nconst PanelColorGradientSettingsSingleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tcolorGradientSettings.colors = useSetting( 'color.palette' );\n\tcolorGradientSettings.gradients = useSetting( 'color.gradients' );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettingsMultipleSelect = ( props ) => {\n\tconst colorGradientSettings = useCommonSingleMultipleSelects();\n\tconst customColors = useSetting( 'color.palette.user' );\n\tconst themeColors = useSetting( 'color.palette.theme' );\n\tconst defaultColors = useSetting( 'color.palette.default' );\n\tconst shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' );\n\n\tcolorGradientSettings.colors = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeColors && themeColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: themeColors,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultColors &&\n\t\t\tdefaultColors &&\n\t\t\tdefaultColors.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tcolors: defaultColors,\n\t\t\t} );\n\t\t}\n\t\tif ( customColors && customColors.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tcolors: customColors,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ defaultColors, themeColors, customColors ] );\n\n\tconst customGradients = useSetting( 'color.gradients.user' );\n\tconst themeGradients = useSetting( 'color.gradients.theme' );\n\tconst defaultGradients = useSetting( 'color.gradients.default' );\n\tconst shouldDisplayDefaultGradients = useSetting(\n\t\t'color.defaultGradients'\n\t);\n\tcolorGradientSettings.gradients = useMemo( () => {\n\t\tconst result = [];\n\t\tif ( themeGradients && themeGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Theme',\n\t\t\t\t\t'Indicates this palette comes from the theme.'\n\t\t\t\t),\n\t\t\t\tgradients: themeGradients,\n\t\t\t} );\n\t\t}\n\t\tif (\n\t\t\tshouldDisplayDefaultGradients &&\n\t\t\tdefaultGradients &&\n\t\t\tdefaultGradients.length\n\t\t) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Default',\n\t\t\t\t\t'Indicates this palette comes from WordPress.'\n\t\t\t\t),\n\t\t\t\tgradients: defaultGradients,\n\t\t\t} );\n\t\t}\n\t\tif ( customGradients && customGradients.length ) {\n\t\t\tresult.push( {\n\t\t\t\tname: _x(\n\t\t\t\t\t'Custom',\n\t\t\t\t\t'Indicates this palette is created by the user.'\n\t\t\t\t),\n\t\t\t\tgradients: customGradients,\n\t\t\t} );\n\t\t}\n\t\treturn result;\n\t}, [ customGradients, themeGradients, defaultGradients ] );\n\treturn (\n\t\t<PanelColorGradientSettingsInner\n\t\t\t{ ...{ ...colorGradientSettings, ...props } }\n\t\t/>\n\t);\n};\n\nconst PanelColorGradientSettings = ( props ) => {\n\tif (\n\t\tevery( colorsAndGradientKeys, ( key ) => props.hasOwnProperty( key ) )\n\t) {\n\t\treturn <PanelColorGradientSettingsInner { ...props } />;\n\t}\n\tif ( props.__experimentalHasMultipleOrigins ) {\n\t\treturn <PanelColorGradientSettingsMultipleSelect { ...props } />;\n\t}\n\treturn <PanelColorGradientSettingsSingleSelect { ...props } />;\n};\n\nexport default PanelColorGradientSettings;\n"]}
@@ -106,7 +106,7 @@ export default function useSetting(path) {
106
106
  if (PATHS_WITH_MERGE[normalizedPath]) {
107
107
  var _ref, _experimentalFeatures;
108
108
 
109
- return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.core;
109
+ return (_ref = (_experimentalFeatures = experimentalFeaturesResult.user) !== null && _experimentalFeatures !== void 0 ? _experimentalFeatures : experimentalFeaturesResult.theme) !== null && _ref !== void 0 ? _ref : experimentalFeaturesResult.default;
110
110
  }
111
111
 
112
112
  return experimentalFeaturesResult;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["get","useSelect","__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","useBlockEditContext","store","blockEditorStore","deprecatedFlags","settings","colors","undefined","gradients","disableCustomColors","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","setting","select","getSettings","normalizedPath","defaultsPath","blockPath","experimentalFeaturesResult","user","theme","core","deprecatedSettingsValue"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,+BAA+B,IAAIC,gBAA5C,QAAoE,mBAApE;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,eAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,eAAe,GAAG;AACvB,mBAAmBC,QAAF,IAChBA,QAAQ,CAACC,MAAT,KAAoBC,SAApB,GAAgCA,SAAhC,GAA4CF,QAAQ,CAACC,MAF/B;AAGvB,qBAAqBD,QAAF,IAClBA,QAAQ,CAACG,SAAT,KAAuBD,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACG,SAJlC;AAKvB,kBAAkBH,QAAF,IACfA,QAAQ,CAACI,mBAAT,KAAiCF,SAAjC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACI,mBARQ;AASvB,0BAA0BJ,QAAF,IACvBA,QAAQ,CAACK,sBAAT,KAAoCH,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACK,sBAZQ;AAavB,0BAA0BL,QAAF,IACvBA,QAAQ,CAACM,SAAT,KAAuBJ,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACM,SAdlC;AAevB,+BAA+BN,QAAF,IAC5BA,QAAQ,CAACO,sBAAT,KAAoCL,SAApC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACO,sBAl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BqB,WAA3B,EAAjB,CADa,CAGb;AACA;;AACA,UAAMC,cAAc,GAAGR,oBAAoB,CAAEC,IAAF,CAA3C;AACA,UAAMQ,YAAY,GAAI,0BAA0BD,cAAgB,EAAhE;AACA,UAAME,SAAS,GAAI,iCAAiCN,SAAW,IAAII,cAAgB,EAAnF;AACA,UAAMG,0BAA0B,WAC/B/B,GAAG,CAAEQ,QAAF,EAAYsB,SAAZ,CAD4B,uCACD9B,GAAG,CAAEQ,QAAF,EAAYqB,YAAZ,CADlC;;AAGA,QAAKE,0BAA0B,KAAKrB,SAApC,EAAgD;AAC/C,UAAKP,gBAAgB,CAAEyB,cAAF,CAArB,EAA0C;AAAA;;AACzC,gDACCG,0BAA0B,CAACC,IAD5B,yEAECD,0BAA0B,CAACE,KAF5B,uCAGCF,0BAA0B,CAACG,IAH5B;AAKA;;AACD,aAAOH,0BAAP;AACA,KApBY,CAsBb;;;AACA,UAAMI,uBAAuB,GAAG5B,eAAe,CAAEqB,cAAF,CAAf,GAC7BrB,eAAe,CAAEqB,cAAF,CAAf,CAAmCpB,QAAnC,CAD6B,GAE7BE,SAFH;;AAGA,QAAKyB,uBAAuB,KAAKzB,SAAjC,EAA6C;AAC5C,aAAOyB,uBAAP;AACA,KA5BY,CA8Bb;AACA;AACA;AACA;;;AACA,WAAOP,cAAc,KAAK,oBAAnB,GAA0C,IAA1C,GAAiDlB,SAAxD;AACA,GApCuB,EAqCxB,CAAEc,SAAF,EAAaH,IAAb,CArCwB,CAAzB;AAwCA,SAAOI,OAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) =>\n\t\tsettings.colors === undefined ? undefined : settings.colors,\n\t'color.gradients': ( settings ) =>\n\t\tsettings.gradients === undefined ? undefined : settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) =>\n\t\tsettings.fontSizes === undefined ? undefined : settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the editor setting.\n * It works with nested objects using by finding the value at path.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName } = useBlockEditContext();\n\n\tconst setting = useSelect(\n\t\t( select ) => {\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\t// 1 - Use __experimental features, if available.\n\t\t\t// We cascade to the all value if the block one is not available.\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\tconst experimentalFeaturesResult =\n\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\n\t\t\tif ( experimentalFeaturesResult !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\texperimentalFeaturesResult.user ??\n\t\t\t\t\t\texperimentalFeaturesResult.theme ??\n\t\t\t\t\t\texperimentalFeaturesResult.core\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn experimentalFeaturesResult;\n\t\t\t}\n\n\t\t\t// 2 - Use deprecated settings, otherwise.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 3 - Fall back for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, path ]\n\t);\n\n\treturn setting;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"names":["get","useSelect","__EXPERIMENTAL_PATHS_WITH_MERGE","PATHS_WITH_MERGE","useBlockEditContext","store","blockEditorStore","deprecatedFlags","settings","colors","undefined","gradients","disableCustomColors","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","setting","select","getSettings","normalizedPath","defaultsPath","blockPath","experimentalFeaturesResult","user","theme","default","deprecatedSettingsValue"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,+BAA+B,IAAIC,gBAA5C,QAAoE,mBAApE;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,eAApC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA,MAAMC,eAAe,GAAG;AACvB,mBAAmBC,QAAF,IAChBA,QAAQ,CAACC,MAAT,KAAoBC,SAApB,GAAgCA,SAAhC,GAA4CF,QAAQ,CAACC,MAF/B;AAGvB,qBAAqBD,QAAF,IAClBA,QAAQ,CAACG,SAAT,KAAuBD,SAAvB,GAAmCA,SAAnC,GAA+CF,QAAQ,CAACG,SAJlC;AAKvB,kBAAkBH,QAAF,IACfA,QAAQ,CAACI,mBAAT,KAAiCF,SAAjC,GACGA,SADH,GAEG,CAAEF,QAAQ,CAACI,mBARQ;AASvB,0BAA0BJ,QAAF,IACvBA,QAAQ,CAACK,s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ACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) =>\n\t\tsettings.colors === undefined ? undefined : settings.colors,\n\t'color.gradients': ( settings ) =>\n\t\tsettings.gradients === undefined ? undefined : settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) =>\n\t\tsettings.fontSizes === undefined ? undefined : settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the editor setting.\n * It works with nested objects using by finding the value at path.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName } = useBlockEditContext();\n\n\tconst setting = useSelect(\n\t\t( select ) => {\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\n\t\t\t// 1 - Use __experimental features, if available.\n\t\t\t// We cascade to the all value if the block one is not available.\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\tconst experimentalFeaturesResult =\n\t\t\t\tget( settings, blockPath ) ?? get( settings, defaultsPath );\n\n\t\t\tif ( experimentalFeaturesResult !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\texperimentalFeaturesResult.user ??\n\t\t\t\t\t\texperimentalFeaturesResult.theme ??\n\t\t\t\t\t\texperimentalFeaturesResult.default\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn experimentalFeaturesResult;\n\t\t\t}\n\n\t\t\t// 2 - Use deprecated settings, otherwise.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 3 - Fall back for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, path ]\n\t);\n\n\treturn setting;\n}\n"]}
@@ -728,35 +728,6 @@
728
728
  display: none;
729
729
  }
730
730
 
731
- .block-editor-block-list__block .block-list-appender {
732
- align-self: center;
733
- padding: 0;
734
- list-style: none;
735
- margin-bottom: revert;
736
- }
737
- .block-editor-block-list__block .block-list-appender.wp-block {
738
- max-width: none;
739
- }
740
- .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
741
- margin: 8px 0;
742
- }
743
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
744
- padding: 0;
745
- opacity: 1;
746
- transform: scale(1);
747
- transition: all 0.1s ease;
748
- margin-right: 8px;
749
- }
750
- @media (prefers-reduced-motion: reduce) {
751
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
752
- transition-duration: 0s;
753
- transition-delay: 0s;
754
- }
755
- }
756
- .block-editor-block-list__block .block-list-appender:first-of-type .block-list-appender__toggle {
757
- margin-right: 0;
758
- }
759
-
760
731
  .is-vertical .block-list-appender {
761
732
  width: 24px;
762
733
  margin-left: auto;
@@ -1762,20 +1733,6 @@
1762
1733
  .block-editor-button-block-appender:active {
1763
1734
  color: #000;
1764
1735
  }
1765
- .block-editor-button-block-appender.block-list-appender__toggle {
1766
- display: flex;
1767
- flex-direction: row;
1768
- box-shadow: none;
1769
- height: 24px;
1770
- width: 24px;
1771
- }
1772
- .block-editor-button-block-appender.block-list-appender__toggle > svg {
1773
- width: 24px;
1774
- background-color: #1e1e1e;
1775
- color: #fff;
1776
- border-radius: 2px;
1777
- flex: 1 0 auto;
1778
- }
1779
1736
 
1780
1737
  .block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator {
1781
1738
  margin-bottom: 12px;
@@ -1805,6 +1762,14 @@
1805
1762
  margin: 0;
1806
1763
  }
1807
1764
 
1765
+ /**
1766
+ * Default block appender.
1767
+ *
1768
+ * This component shows up in 3 places:
1769
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
1770
+ * - on the right, inside empty paragraphs
1771
+ * - absolute positioned and blue inside nesting containers
1772
+ */
1808
1773
  .block-editor-default-block-appender {
1809
1774
  clear: both;
1810
1775
  margin-right: auto;
@@ -1821,32 +1786,72 @@
1821
1786
  display: none;
1822
1787
  }
1823
1788
 
1824
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
1825
- .block-editor-default-block-appender .block-editor-inserter {
1789
+ .block-editor-default-block-appender .block-editor-inserter,
1790
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
1826
1791
  position: absolute;
1827
1792
  top: 0;
1828
- height: 32px;
1793
+ left: 0;
1794
+ line-height: 0;
1829
1795
  }
1830
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle,
1831
- .block-editor-default-block-appender .block-editor-inserter .block-editor-inserter__toggle {
1832
- margin-left: 0;
1796
+ .block-editor-default-block-appender .block-editor-inserter:disabled,
1797
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled {
1798
+ display: none;
1833
1799
  }
1834
1800
 
1835
- @media (min-width: 600px) {
1836
- .block-editor-block-list__empty-block-inserter,
1837
- .block-editor-default-block-appender .block-editor-inserter {
1838
- display: flex;
1839
- height: 100%;
1840
- }
1801
+ /**
1802
+ * Fixed position appender.
1803
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
1804
+ */
1805
+ .block-editor-block-list__block .block-list-appender {
1806
+ position: absolute;
1807
+ list-style: none;
1808
+ padding: 0;
1809
+ z-index: 2;
1810
+ bottom: 0;
1811
+ left: 0;
1812
+ }
1813
+ .block-editor-block-list__block .block-list-appender.block-list-appender {
1814
+ margin: 0;
1815
+ line-height: 0;
1816
+ }
1817
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
1818
+ height: 24px;
1819
+ }
1820
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1821
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
1822
+ flex-direction: row;
1823
+ box-shadow: none;
1824
+ height: 24px;
1825
+ width: 24px;
1826
+ display: none;
1827
+ padding: 0 !important;
1828
+ background: #1e1e1e;
1829
+ color: #fff;
1830
+ }
1831
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,
1832
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover {
1833
+ color: #fff;
1834
+ background: var(--wp-admin-theme-color);
1841
1835
  }
1842
- .block-editor-block-list__empty-block-inserter:disabled,
1843
- .block-editor-default-block-appender .block-editor-inserter:disabled {
1836
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content {
1844
1837
  display: none;
1845
1838
  }
1839
+ .block-editor-block-list__block .block-list-appender:only-child {
1840
+ position: relative;
1841
+ left: auto;
1842
+ align-self: center;
1843
+ list-style: none;
1844
+ line-height: inherit;
1845
+ }
1846
+ .block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content {
1847
+ display: block;
1848
+ }
1846
1849
 
1847
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
1848
- .block-editor-block-list__empty-block-inserter {
1849
- left: 0;
1850
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1851
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle,
1852
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1853
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle {
1854
+ display: flex;
1850
1855
  }
1851
1856
 
1852
1857
  .block-editor-duotone-control__popover > .components-popover__content > div {
@@ -2384,16 +2389,11 @@
2384
2389
  .block-editor-block-list__layout.has-overlay::after {
2385
2390
  content: "";
2386
2391
  position: absolute;
2387
- top: -14px;
2388
- left: -14px;
2389
- bottom: -14px;
2390
- right: -14px;
2391
- z-index: 60;
2392
- }
2393
-
2394
- [data-align=full] .has-overlay::after {
2392
+ top: 0;
2395
2393
  left: 0;
2394
+ bottom: 0;
2396
2395
  right: 0;
2396
+ z-index: 60;
2397
2397
  }
2398
2398
 
2399
2399
  .block-editor-block-types-list__list-item {
@@ -728,35 +728,6 @@
728
728
  display: none;
729
729
  }
730
730
 
731
- .block-editor-block-list__block .block-list-appender {
732
- align-self: center;
733
- padding: 0;
734
- list-style: none;
735
- margin-bottom: revert;
736
- }
737
- .block-editor-block-list__block .block-list-appender.wp-block {
738
- max-width: none;
739
- }
740
- .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
741
- margin: 8px 0;
742
- }
743
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
744
- padding: 0;
745
- opacity: 1;
746
- transform: scale(1);
747
- transition: all 0.1s ease;
748
- margin-left: 8px;
749
- }
750
- @media (prefers-reduced-motion: reduce) {
751
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
752
- transition-duration: 0s;
753
- transition-delay: 0s;
754
- }
755
- }
756
- .block-editor-block-list__block .block-list-appender:first-of-type .block-list-appender__toggle {
757
- margin-left: 0;
758
- }
759
-
760
731
  .is-vertical .block-list-appender {
761
732
  width: 24px;
762
733
  margin-right: auto;
@@ -1762,20 +1733,6 @@
1762
1733
  .block-editor-button-block-appender:active {
1763
1734
  color: #000;
1764
1735
  }
1765
- .block-editor-button-block-appender.block-list-appender__toggle {
1766
- display: flex;
1767
- flex-direction: row;
1768
- box-shadow: none;
1769
- height: 24px;
1770
- width: 24px;
1771
- }
1772
- .block-editor-button-block-appender.block-list-appender__toggle > svg {
1773
- width: 24px;
1774
- background-color: #1e1e1e;
1775
- color: #fff;
1776
- border-radius: 2px;
1777
- flex: 1 0 auto;
1778
- }
1779
1736
 
1780
1737
  .block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator {
1781
1738
  margin-bottom: 12px;
@@ -1805,6 +1762,14 @@
1805
1762
  margin: 0;
1806
1763
  }
1807
1764
 
1765
+ /**
1766
+ * Default block appender.
1767
+ *
1768
+ * This component shows up in 3 places:
1769
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
1770
+ * - on the right, inside empty paragraphs
1771
+ * - absolute positioned and blue inside nesting containers
1772
+ */
1808
1773
  .block-editor-default-block-appender {
1809
1774
  clear: both;
1810
1775
  margin-left: auto;
@@ -1821,32 +1786,72 @@
1821
1786
  display: none;
1822
1787
  }
1823
1788
 
1824
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
1825
- .block-editor-default-block-appender .block-editor-inserter {
1789
+ .block-editor-default-block-appender .block-editor-inserter,
1790
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
1826
1791
  position: absolute;
1827
1792
  top: 0;
1828
- height: 32px;
1793
+ right: 0;
1794
+ line-height: 0;
1829
1795
  }
1830
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle,
1831
- .block-editor-default-block-appender .block-editor-inserter .block-editor-inserter__toggle {
1832
- margin-right: 0;
1796
+ .block-editor-default-block-appender .block-editor-inserter:disabled,
1797
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled {
1798
+ display: none;
1833
1799
  }
1834
1800
 
1835
- @media (min-width: 600px) {
1836
- .block-editor-block-list__empty-block-inserter,
1837
- .block-editor-default-block-appender .block-editor-inserter {
1838
- display: flex;
1839
- height: 100%;
1840
- }
1801
+ /**
1802
+ * Fixed position appender.
1803
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
1804
+ */
1805
+ .block-editor-block-list__block .block-list-appender {
1806
+ position: absolute;
1807
+ list-style: none;
1808
+ padding: 0;
1809
+ z-index: 2;
1810
+ bottom: 0;
1811
+ right: 0;
1812
+ }
1813
+ .block-editor-block-list__block .block-list-appender.block-list-appender {
1814
+ margin: 0;
1815
+ line-height: 0;
1816
+ }
1817
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
1818
+ height: 24px;
1819
+ }
1820
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1821
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
1822
+ flex-direction: row;
1823
+ box-shadow: none;
1824
+ height: 24px;
1825
+ width: 24px;
1826
+ display: none;
1827
+ padding: 0 !important;
1828
+ background: #1e1e1e;
1829
+ color: #fff;
1830
+ }
1831
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,
1832
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover {
1833
+ color: #fff;
1834
+ background: var(--wp-admin-theme-color);
1841
1835
  }
1842
- .block-editor-block-list__empty-block-inserter:disabled,
1843
- .block-editor-default-block-appender .block-editor-inserter:disabled {
1836
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content {
1844
1837
  display: none;
1845
1838
  }
1839
+ .block-editor-block-list__block .block-list-appender:only-child {
1840
+ position: relative;
1841
+ right: auto;
1842
+ align-self: center;
1843
+ list-style: none;
1844
+ line-height: inherit;
1845
+ }
1846
+ .block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content {
1847
+ display: block;
1848
+ }
1846
1849
 
1847
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
1848
- .block-editor-block-list__empty-block-inserter {
1849
- right: 0;
1850
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1851
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle,
1852
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1853
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle {
1854
+ display: flex;
1850
1855
  }
1851
1856
 
1852
1857
  .block-editor-duotone-control__popover > .components-popover__content > div {
@@ -2384,16 +2389,11 @@
2384
2389
  .block-editor-block-list__layout.has-overlay::after {
2385
2390
  content: "";
2386
2391
  position: absolute;
2387
- top: -14px;
2388
- right: -14px;
2389
- bottom: -14px;
2390
- left: -14px;
2391
- z-index: 60;
2392
- }
2393
-
2394
- [data-align=full] .has-overlay::after {
2392
+ top: 0;
2395
2393
  right: 0;
2394
+ bottom: 0;
2396
2395
  left: 0;
2396
+ z-index: 60;
2397
2397
  }
2398
2398
 
2399
2399
  .block-editor-block-types-list__list-item {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "8.0.3",
3
+ "version": "8.0.4",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,7 +38,7 @@
38
38
  "@wordpress/blob": "^3.2.2",
39
39
  "@wordpress/block-serialization-default-parser": "^4.2.3",
40
40
  "@wordpress/blocks": "^11.1.4",
41
- "@wordpress/components": "^19.0.3",
41
+ "@wordpress/components": "^19.0.4",
42
42
  "@wordpress/compose": "^5.0.6",
43
43
  "@wordpress/data": "^6.1.4",
44
44
  "@wordpress/deprecated": "^3.2.3",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "c6594e767659bd3289e633a17c44fdf6a4933194"
78
+ "gitHead": "ca22e8852fcc91889510e417bdaa180ad60f8dac"
79
79
  }
@@ -1,45 +1,3 @@
1
- // These styles are only applied to the appender when it appears inside of a block.
2
- // Otherwise the default appender may be improperly positioned in some themes.
3
- .block-editor-block-list__block .block-list-appender {
4
- align-self: center;
5
- padding: 0;
6
- list-style: none;
7
-
8
- // Themes sometimes apply a max-width to all elements classed blocks.
9
- &.wp-block {
10
- max-width: none;
11
- }
12
-
13
- .block-editor-default-block-appender {
14
- margin: $grid-unit-10 0;
15
- }
16
-
17
- // Zero out the margin that's inherited from common.scss.
18
- margin-bottom: revert;
19
-
20
- // Black square plus appender.
21
- .block-list-appender__toggle {
22
- padding: 0;
23
-
24
- // Animate appearance.
25
- opacity: 1;
26
- transform: scale(1);
27
- transition: all 0.1s ease;
28
- @include reduce-motion("transition");
29
-
30
- // The black square button should have a little left margin in horizontal containers.
31
- margin-left: $grid-unit-10;
32
- }
33
-
34
- // Cancel any left margin if the black plus sits alone in the container.
35
- // `first-of-type` is used instead of `first-child` as the element is not always the only
36
- // element in the "empty" container. For example the empty navigation block state has a
37
- // zero-width placeholder state that is meant to help correctly size the dimensions.
38
- &:first-of-type .block-list-appender__toggle {
39
- margin-left: 0;
40
- }
41
- }
42
-
43
1
  // For vertical flex containers, a 100% width ensures correct alignment.
44
2
  .is-vertical .block-list-appender {
45
3
  width: $icon-size;
@@ -26,21 +26,4 @@
26
26
  &:active {
27
27
  color: $black;
28
28
  }
29
-
30
- // This variant is used in inline situations, like Buttons, Social Links, Navigation Menu.
31
- &.block-list-appender__toggle {
32
- display: flex;
33
- flex-direction: row;
34
- box-shadow: none;
35
- height: $icon-size;
36
- width: $icon-size;
37
-
38
- & > svg {
39
- width: $icon-size;
40
- background-color: $gray-900;
41
- color: $white;
42
- border-radius: $radius-block-ui;
43
- flex: 1 0 auto;
44
- }
45
- }
46
29
  }
@@ -8,7 +8,7 @@ import { every, isEmpty } from 'lodash';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { PanelBody, ColorIndicator } from '@wordpress/components';
11
- import { sprintf, __ } from '@wordpress/i18n';
11
+ import { sprintf, __, _x } from '@wordpress/i18n';
12
12
  import { useMemo } from '@wordpress/element';
13
13
 
14
14
  /**
@@ -172,57 +172,88 @@ const PanelColorGradientSettingsSingleSelect = ( props ) => {
172
172
 
173
173
  const PanelColorGradientSettingsMultipleSelect = ( props ) => {
174
174
  const colorGradientSettings = useCommonSingleMultipleSelects();
175
- const userColors = useSetting( 'color.palette.user' );
175
+ const customColors = useSetting( 'color.palette.user' );
176
176
  const themeColors = useSetting( 'color.palette.theme' );
177
- const coreColors = useSetting( 'color.palette.core' );
177
+ const defaultColors = useSetting( 'color.palette.default' );
178
+ const shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' );
179
+
178
180
  colorGradientSettings.colors = useMemo( () => {
179
181
  const result = [];
180
- if ( coreColors && coreColors.length ) {
182
+ if ( themeColors && themeColors.length ) {
181
183
  result.push( {
182
- name: __( 'Core' ),
183
- colors: coreColors,
184
+ name: _x(
185
+ 'Theme',
186
+ 'Indicates this palette comes from the theme.'
187
+ ),
188
+ colors: themeColors,
184
189
  } );
185
190
  }
186
- if ( themeColors && themeColors.length ) {
191
+ if (
192
+ shouldDisplayDefaultColors &&
193
+ defaultColors &&
194
+ defaultColors.length
195
+ ) {
187
196
  result.push( {
188
- name: __( 'Theme' ),
189
- colors: themeColors,
197
+ name: _x(
198
+ 'Default',
199
+ 'Indicates this palette comes from WordPress.'
200
+ ),
201
+ colors: defaultColors,
190
202
  } );
191
203
  }
192
- if ( userColors && userColors.length ) {
204
+ if ( customColors && customColors.length ) {
193
205
  result.push( {
194
- name: __( 'User' ),
195
- colors: userColors,
206
+ name: _x(
207
+ 'Custom',
208
+ 'Indicates this palette comes from the theme.'
209
+ ),
210
+ colors: customColors,
196
211
  } );
197
212
  }
198
213
  return result;
199
- }, [ coreColors, themeColors, userColors ] );
214
+ }, [ defaultColors, themeColors, customColors ] );
200
215
 
201
- const userGradients = useSetting( 'color.gradients.user' );
216
+ const customGradients = useSetting( 'color.gradients.user' );
202
217
  const themeGradients = useSetting( 'color.gradients.theme' );
203
- const coreGradients = useSetting( 'color.gradients.core' );
218
+ const defaultGradients = useSetting( 'color.gradients.default' );
219
+ const shouldDisplayDefaultGradients = useSetting(
220
+ 'color.defaultGradients'
221
+ );
204
222
  colorGradientSettings.gradients = useMemo( () => {
205
223
  const result = [];
206
- if ( coreGradients && coreGradients.length ) {
224
+ if ( themeGradients && themeGradients.length ) {
207
225
  result.push( {
208
- name: __( 'Core' ),
209
- gradients: coreGradients,
226
+ name: _x(
227
+ 'Theme',
228
+ 'Indicates this palette comes from the theme.'
229
+ ),
230
+ gradients: themeGradients,
210
231
  } );
211
232
  }
212
- if ( themeGradients && themeGradients.length ) {
233
+ if (
234
+ shouldDisplayDefaultGradients &&
235
+ defaultGradients &&
236
+ defaultGradients.length
237
+ ) {
213
238
  result.push( {
214
- name: __( 'Theme' ),
215
- gradients: themeGradients,
239
+ name: _x(
240
+ 'Default',
241
+ 'Indicates this palette comes from WordPress.'
242
+ ),
243
+ gradients: defaultGradients,
216
244
  } );
217
245
  }
218
- if ( userGradients && userGradients.length ) {
246
+ if ( customGradients && customGradients.length ) {
219
247
  result.push( {
220
- name: __( 'User' ),
221
- gradients: userGradients,
248
+ name: _x(
249
+ 'Custom',
250
+ 'Indicates this palette is created by the user.'
251
+ ),
252
+ gradients: customGradients,
222
253
  } );
223
254
  }
224
255
  return result;
225
- }, [ userGradients, themeGradients, coreGradients ] );
256
+ }, [ customGradients, themeGradients, defaultGradients ] );
226
257
  return (
227
258
  <PanelColorGradientSettingsInner
228
259
  { ...{ ...colorGradientSettings, ...props } }
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Default block appender.
3
+ *
4
+ * This component shows up in 3 places:
5
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
6
+ * - on the right, inside empty paragraphs
7
+ * - absolute positioned and blue inside nesting containers
8
+ */
9
+
1
10
  .block-editor-default-block-appender {
2
11
  clear: both; // The appender doesn't scale well to sit next to floats, so clear them.
3
12
 
@@ -23,32 +32,97 @@
23
32
  }
24
33
  }
25
34
 
26
- // Empty / default block side inserter.
27
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter, // Empty paragraph, needs specificity to override inherited popover styles.
28
- .block-editor-default-block-appender .block-editor-inserter { // Empty appender.
35
+ // The black plus that shows up on the right side of an empty paragraph block, or the initial appender
36
+ // that exists only on empty documents.
37
+ .block-editor-default-block-appender .block-editor-inserter,
38
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter { // This needs specificity to override inherited popover styles.
29
39
  position: absolute;
30
40
  top: 0;
31
- height: $button-size-small + $grid-unit-10;
41
+ right: 0;
42
+ line-height: 0;
32
43
 
33
- .block-editor-inserter__toggle {
34
- margin-right: 0;
44
+ &:disabled {
45
+ display: none;
35
46
  }
36
47
  }
37
48
 
38
- // Left side.
39
- .block-editor-block-list__empty-block-inserter,
40
- .block-editor-default-block-appender .block-editor-inserter {
41
- @include break-small {
42
- display: flex;
43
- height: 100%;
49
+
50
+ /**
51
+ * Fixed position appender.
52
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
53
+ */
54
+
55
+ .block-editor-block-list__block .block-list-appender {
56
+ position: absolute;
57
+ list-style: none;
58
+ padding: 0;
59
+ z-index: z-index(".block-editor-block-list__block .block-list-appender");
60
+ bottom: 0;
61
+ right: 0;
62
+
63
+ // These rules needs extra specificity as it's affected by DOM rules.
64
+ &.block-list-appender {
65
+ margin: 0;
66
+ line-height: 0;
44
67
  }
45
68
 
46
- &:disabled {
69
+ .block-editor-default-block-appender {
70
+ height: $button-size-small;
71
+ }
72
+
73
+ // @todo: these are currently two separate components. Since we're now
74
+ // treating them the same, one or both can be retired.
75
+ .block-editor-inserter__toggle.components-button.has-icon,
76
+ .block-list-appender__toggle {
77
+ flex-direction: row;
78
+ box-shadow: none;
79
+ height: $button-size-small;
80
+ width: $button-size-small;
81
+
82
+ // Hide by default, then we unhide it when the selected block is a direct ancestor.
83
+ display: none;
84
+
85
+ // Important to override styles form Button component.
86
+ padding: 0 !important;
87
+
88
+ // Basic look
89
+ background: $gray-900;
90
+ color: $white;
91
+
92
+ &:hover {
93
+ color: $white;
94
+ background: var(--wp-admin-theme-color);
95
+ }
96
+ }
97
+
98
+ // This content only shows up inside the empty appender.
99
+ .block-editor-default-block-appender__content {
47
100
  display: none;
48
101
  }
102
+
103
+ // These could be avoided by employing a :not(:only-child) on the parent,
104
+ // but this should be more performant.
105
+ // @todo: These styles can almost certainly be refactored away we refactor
106
+ // the markup and classes of the component itself. The rules provide some
107
+ // baseline styles for when the block is the only one inside.
108
+ &:only-child {
109
+ position: relative;
110
+ right: auto;
111
+ align-self: center;
112
+ list-style: none;
113
+ line-height: inherit;
114
+
115
+ .block-editor-default-block-appender__content {
116
+ display: block;
117
+ }
118
+ }
49
119
  }
50
120
 
51
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
52
- .block-editor-block-list__empty-block-inserter {
53
- right: 0;
121
+ // Unhide the inserter when you're in the exact container.
122
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender,
123
+ .block-editor-block-list__block.is-selected > .block-list-appender {
124
+ .block-editor-inserter__toggle.components-button.has-icon,
125
+ .block-list-appender__toggle {
126
+ display: flex;
127
+ }
54
128
  }
@@ -4,16 +4,10 @@
4
4
  &::after {
5
5
  content: "";
6
6
  position: absolute;
7
- top: -$block-padding;
8
- right: -$block-padding;
9
- bottom: -$block-padding;
10
- left: -$block-padding;
7
+ top: 0;
8
+ right: 0;
9
+ bottom: 0;
10
+ left: 0;
11
11
  z-index: z-index(".block-editor-block-list__layout.has-overlay::after");
12
12
  }
13
13
  }
14
-
15
- // On fullwide blocks, don't go beyond the canvas.
16
- [data-align="full"] .has-overlay::after {
17
- right: 0;
18
- left: 0;
19
- }
@@ -119,7 +119,7 @@ export default function useSetting( path ) {
119
119
  return (
120
120
  experimentalFeaturesResult.user ??
121
121
  experimentalFeaturesResult.theme ??
122
- experimentalFeaturesResult.core
122
+ experimentalFeaturesResult.default
123
123
  );
124
124
  }
125
125
  return experimentalFeaturesResult;