@wordpress/edit-site 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +9 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +15 -51
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -4
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -1
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -11
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +6 -5
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +9 -3
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +3 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +50 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +8 -7
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +9 -3
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +8 -7
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -3
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +8 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +9 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -18
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +119 -33
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +49 -2
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/layout/index.js +81 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/site-hub/index.js +9 -9
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +20 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +5 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +17 -49
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -4
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +16 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +6 -5
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +8 -3
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +49 -26
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +8 -7
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +8 -3
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +8 -7
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +7 -2
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +9 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +84 -19
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +121 -35
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +47 -2
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/layout/index.js +81 -10
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/site-hub/index.js +10 -9
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +93 -21
- package/build-style/style.css +93 -21
- package/package.json +30 -30
- package/src/components/add-new-template/new-template-part.js +23 -1
- package/src/components/add-new-template/utils.js +14 -0
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +11 -54
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +43 -7
- package/src/components/editor/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +14 -2
- package/src/components/global-styles/border-panel.js +8 -4
- package/src/components/global-styles/context-menu.js +6 -0
- package/src/components/global-styles/dimensions-panel.js +32 -15
- package/src/components/global-styles/screen-background-color.js +12 -5
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-border.js +7 -4
- package/src/components/global-styles/screen-button-color.js +2 -2
- package/src/components/global-styles/screen-colors.js +82 -21
- package/src/components/global-styles/screen-heading-color.js +7 -7
- package/src/components/global-styles/screen-layout.js +10 -4
- package/src/components/global-styles/screen-link-color.js +19 -7
- package/src/components/global-styles/screen-text-color.js +7 -3
- package/src/components/global-styles/screen-typography.js +11 -4
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +31 -8
- package/src/components/global-styles/ui.js +101 -13
- package/src/components/global-styles/use-global-styles-output.js +137 -14
- package/src/components/global-styles/utils.js +46 -2
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/layout/index.js +107 -19
- package/src/components/layout/style.scss +30 -5
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
- package/src/components/site-hub/index.js +120 -109
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/store/reducer.js +1 -1
|
@@ -15,7 +15,8 @@ import { getSupportedGlobalStylesPanels, useColorsPerOrigin, useGradientsPerOrig
|
|
|
15
15
|
|
|
16
16
|
function ScreenBackgroundColor(_ref) {
|
|
17
17
|
let {
|
|
18
|
-
name
|
|
18
|
+
name,
|
|
19
|
+
variationPath = ''
|
|
19
20
|
} = _ref;
|
|
20
21
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
21
22
|
const [solids] = useSetting('color.palette', name);
|
|
@@ -27,10 +28,10 @@ function ScreenBackgroundColor(_ref) {
|
|
|
27
28
|
const [isBackgroundEnabled] = useSetting('color.background', name);
|
|
28
29
|
const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
|
29
30
|
const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
|
|
30
|
-
const [backgroundColor, setBackgroundColor] = useStyle('color.background', name);
|
|
31
|
-
const [userBackgroundColor] = useStyle('color.background', name, 'user');
|
|
32
|
-
const [gradient, setGradient] = useStyle('color.gradient', name);
|
|
33
|
-
const [userGradient] = useStyle('color.gradient', name, 'user');
|
|
31
|
+
const [backgroundColor, setBackgroundColor] = useStyle(variationPath + 'color.background', name);
|
|
32
|
+
const [userBackgroundColor] = useStyle(variationPath + 'color.background', name, 'user');
|
|
33
|
+
const [gradient, setGradient] = useStyle(variationPath + 'color.gradient', name);
|
|
34
|
+
const [userGradient] = useStyle(variationPath + 'color.gradient', name, 'user');
|
|
34
35
|
|
|
35
36
|
if (!hasBackgroundColor && !hasGradientColor) {
|
|
36
37
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,kBAFD,EAGCC,qBAHD,EAICC,UAJD,EAKCC,QALD,QAMO,SANP;;AAQA,SAASC,qBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","variationPath","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,kBAFD,EAGCC,qBAHD,EAICC,UAJD,EAKCC,QALD,QAMO,SANP;;AAQA,SAASC,qBAAT,OAA+D;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AAC9D,QAAMC,QAAQ,GAAGR,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEG,MAAF,IAAaN,UAAU,CAAE,eAAF,EAAmBG,IAAnB,CAA7B;AACA,QAAM,CAAEI,SAAF,IAAgBP,UAAU,CAAE,iBAAF,EAAqBG,IAArB,CAAhC;AACA,QAAM,CAAEK,sBAAF,IAA6BR,UAAU,CAAE,cAAF,EAAkBG,IAAlB,CAA7C;AACA,QAAM,C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BM,MAAAA,kBAAkB,CAACG,SAAnB,GACCT,eAAe,KAAKE,mBADrB;AAEA;AACD;;AAED,MAAIQ,gBAAgB,GAAG,EAAvB;;AACA,MAAKX,gBAAL,EAAwB;AACvBW,IAAAA,gBAAgB,GAAG;AAClBC,MAAAA,aAAa,EAAER,QADG;AAElBS,MAAAA,gBAAgB,EAAER;AAFA,KAAnB;;AAIA,QAAKD,QAAL,EAAgB;AACfO,MAAAA,gBAAgB,CAACD,SAAjB,GAA6BN,QAAQ,KAAKE,YAA1C;AACA;AACD;;AAED,QAAMQ,YAAY,GAAG,EACpB,GAAGP,kBADiB;AAEpB,OAAGI;AAFiB,GAArB;AAKA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGlC,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,wDADe;AAFjB,IADD,EAOC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,MAAM,EAAGiB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEH,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,KASMqB,YATN,EAPD,CADD;AAqBA;;AAED,eAAe5B,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nfunction ScreenBackgroundColor( { name, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\tvariationPath + 'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\tvariationPath + 'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle(\n\t\tvariationPath + 'color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useStyle(\n\t\tvariationPath + 'color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-background-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...controlProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
|
|
@@ -19,6 +19,7 @@ import { useHasBorderPanel } from './border-panel';
|
|
|
19
19
|
import { useHasColorPanel } from './color-utils';
|
|
20
20
|
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
21
21
|
import { useHasTypographyPanel } from './typography-panel';
|
|
22
|
+
import { useHasVariationsPanel } from './variations-panel';
|
|
22
23
|
import ScreenHeader from './header';
|
|
23
24
|
import { NavigationButtonAsItem } from './navigation-button';
|
|
24
25
|
|
|
@@ -58,7 +59,8 @@ function BlockMenuItem(_ref) {
|
|
|
58
59
|
const hasBorderPanel = useHasBorderPanel(block.name);
|
|
59
60
|
const hasDimensionsPanel = useHasDimensionsPanel(block.name);
|
|
60
61
|
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
61
|
-
const
|
|
62
|
+
const hasVariationsPanel = useHasVariationsPanel(block.name);
|
|
63
|
+
const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel || hasVariationsPanel;
|
|
62
64
|
|
|
63
65
|
if (!hasBlockMenuItem) {
|
|
64
66
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["store","blocksStore","__","sprintf","_n","FlexItem","SearchControl","__experimentalHStack","HStack","useSelect","useState","useMemo","useEffect","useRef","BlockIcon","useDebounce","speak","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","ScreenHeader","NavigationButtonAsItem","useSortedBlockTypes","blockItems","select","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","BlockMenuItem","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SACCC,QADD,EAECC,aAFD,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,EAAmBC,OAAnB,EAA4BC,SAA5B,EAAuCC,MAAvC,QAAqD,oBAArD;AACA,SAASC,SAAT,QAA0B,yBAA1B;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,gBAAlC;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,SAASC,qBAAT,QAAsC,oBAAtC;AACA,SAASC,qBAAT,QAAsC,oBAAtC;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;;AAEA,SAASC,mBAAT,GAA+B;AAC9B,QAAMC,UAAU,GAAGf,SAAS,CACzB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iB,CAACE,OAAlB,CAA0BC,iBAAxC;AACA,UAAMC,mBAAmB,GAAG5D,OAAO;AAClC;AACAC,IAAAA,EAAE,CAAE,kBAAF,EAAsB,mBAAtB,EAA2CwD,KAA3C,CAFgC,EAGlCA,KAHkC,CAAnC;AAKAN,IAAAA,cAAc,CAAES,mBAAF,EAAuBH,KAAvB,CAAd;AACA,GAnBQ,EAmBN,CAAER,WAAF,EAAeE,cAAf,CAnBM,CAAT;AAqBA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,KAAK,EAAGpD,EAAE,CAAE,QAAF,CADX;AAEC,IAAA,WAAW,EAAGA,EAAE,CACf,qEADe;AAFjB,IADD,EAOC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,8BAFX;AAGC,IAAA,QAAQ,EAAGmD,cAHZ;AAIC,IAAA,KAAK,EAAGD,WAJT;AAKC,IAAA,KAAK,EAAGlD,EAAE,CAAE,mBAAF,CALX;AAMC,IAAA,WAAW,EAAGA,EAAE,CAAE,QAAF;AANjB,IAPD,EAeC;AACC,IAAA,GAAG,EAAGyD,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0BnC,KAAF,IACzB,cAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;AAED,eAAeiB,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( block.name );\n\tconst hasColorPanel = useHasColorPanel( block.name );\n\tconst hasBorderPanel = useHasBorderPanel( block.name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( block.name );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasBlockMenuItem =\n\t\thasTypographyPanel || hasColorPanel || hasLayoutPanel;\n\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["store","blocksStore","__","sprintf","_n","FlexItem","SearchControl","__experimentalHStack","HStack","useSelect","useState","useMemo","useEffect","useRef","BlockIcon","useDebounce","speak","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","useHasVariationsPanel","ScreenHeader","NavigationButtonAsItem","useSortedBlockTypes","blockItems","select","getBlockTypes","groupByType","blocks","block","core","noncore","type","name","startsWith","push","coreItems","nonCoreItems","reduce","BlockMenuItem","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","hasBlockMenuItem","navigationButtonLabel","title","encodeURIComponent","icon","ScreenBlockList","sortedBlockTypes","filterValue","setFilterValue","debouncedSpeak","isMatchingSearchTerm","filteredBlockTypes","filter","blockType","blockTypesListRef","count","current","childElementCount","resultsFoundMessage","map"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,EAAT,EAAaC,OAAb,EAAsBC,EAAtB,QAAgC,iBAAhC;AACA,SACCC,QADD,EAECC,aAFD,EAGCC,oBAAo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AE,mBAAF,CALX;AAMC,IAAA,WAAW,EAAGA,EAAE,CAAE,QAAF;AANjB,IAPD,EAeC;AACC,IAAA,GAAG,EAAG2D,iBADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGH,kBAAkB,CAACQ,GAAnB,CAA0BpC,KAAF,IACzB,cAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACI;AAFjC,IADC,CAJH,CAfD,CADD;AA6BA;;AAED,eAAekB,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport {\n\tFlexItem,\n\tSearchControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo, useEffect, useRef } from '@wordpress/element';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\n\nfunction useSortedBlockTypes() {\n\tconst blockItems = useSelect(\n\t\t( select ) => select( blocksStore ).getBlockTypes(),\n\t\t[]\n\t);\n\t// Ensure core blocks are prioritized in the returned results,\n\t// because third party blocks can be registered earlier than\n\t// the core blocks (usually by using the `init` action),\n\t// thus affecting the display order.\n\t// We don't sort reusable blocks as they are handled differently.\n\tconst groupByType = ( blocks, block ) => {\n\t\tconst { core, noncore } = blocks;\n\t\tconst type = block.name.startsWith( 'core/' ) ? core : noncore;\n\t\ttype.push( block );\n\t\treturn blocks;\n\t};\n\tconst { core: coreItems, noncore: nonCoreItems } = blockItems.reduce(\n\t\tgroupByType,\n\t\t{ core: [], noncore: [] }\n\t);\n\treturn [ ...coreItems, ...nonCoreItems ];\n}\n\nfunction BlockMenuItem( { block } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( block.name );\n\tconst hasColorPanel = useHasColorPanel( block.name );\n\tconst hasBorderPanel = useHasBorderPanel( block.name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( block.name );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( block.name );\n\tconst hasBlockMenuItem =\n\t\thasTypographyPanel ||\n\t\thasColorPanel ||\n\t\thasLayoutPanel ||\n\t\thasVariationsPanel;\n\n\tif ( ! hasBlockMenuItem ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t__( '%s block styles' ),\n\t\tblock.title\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ '/blocks/' + encodeURIComponent( block.name ) }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<BlockIcon icon={ block.icon } />\n\t\t\t\t<FlexItem>{ block.title }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst sortedBlockTypes = useSortedBlockTypes();\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst isMatchingSearchTerm = useSelect(\n\t\t( select ) => select( blocksStore ).isMatchingSearchTerm,\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn sortedBlockTypes;\n\t\t}\n\t\treturn sortedBlockTypes.filter( ( blockType ) =>\n\t\t\tisMatchingSearchTerm( blockType, filterValue )\n\t\t);\n\t}, [ filterValue, sortedBlockTypes, isMatchingSearchTerm ] );\n\n\tconst blockTypesListRef = useRef();\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! filterValue ) {\n\t\t\treturn;\n\t\t}\n\t\t// We extract the results from the wrapper div's `ref` because\n\t\t// filtered items can contain items that will eventually not\n\t\t// render and there is no reliable way to detect when a child\n\t\t// will return `null`.\n\t\t// TODO: We should find a better way of handling this as it's\n\t\t// fragile and depends on the number of rendered elements of `BlockMenuItem`,\n\t\t// which is now one.\n\t\t// @see https://github.com/WordPress/gutenberg/pull/39117#discussion_r816022116\n\t\tconst count = blockTypesListRef.current.childElementCount;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage, count );\n\t}, [ filterValue, debouncedSpeak ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Blocks' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of specific blocks and for the whole site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tclassName=\"edit-site-block-types-search\"\n\t\t\t\tonChange={ setFilterValue }\n\t\t\t\tvalue={ filterValue }\n\t\t\t\tlabel={ __( 'Search for blocks' ) }\n\t\t\t\tplaceholder={ __( 'Search' ) }\n\t\t\t/>\n\t\t\t<div\n\t\t\t\tref={ blockTypesListRef }\n\t\t\t\tclassName=\"edit-site-block-types-item-list\"\n\t\t\t>\n\t\t\t\t{ filteredBlockTypes.map( ( block ) => (\n\t\t\t\t\t<BlockMenuItem\n\t\t\t\t\t\tblock={ block }\n\t\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
|
|
@@ -11,18 +11,23 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
import ScreenHeader from './header';
|
|
12
12
|
import BorderPanel, { useHasBorderPanel } from './border-panel';
|
|
13
13
|
import BlockPreviewPanel from './block-preview-panel';
|
|
14
|
+
import { getVariationClassNameFromPath } from './utils';
|
|
14
15
|
|
|
15
16
|
function ScreenBorder(_ref) {
|
|
16
17
|
let {
|
|
17
|
-
name
|
|
18
|
+
name,
|
|
19
|
+
variationPath = ''
|
|
18
20
|
} = _ref;
|
|
19
21
|
const hasBorderPanel = useHasBorderPanel(name);
|
|
22
|
+
const variationClassName = getVariationClassNameFromPath(variationPath);
|
|
20
23
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
21
24
|
title: __('Border')
|
|
22
25
|
}), createElement(BlockPreviewPanel, {
|
|
23
|
-
name: name
|
|
26
|
+
name: name,
|
|
27
|
+
variation: variationClassName
|
|
24
28
|
}), hasBorderPanel && createElement(BorderPanel, {
|
|
25
|
-
name: name
|
|
29
|
+
name: name,
|
|
30
|
+
variationPath: variationPath
|
|
26
31
|
}));
|
|
27
32
|
}
|
|
28
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-border.js"],"names":["__","ScreenHeader","BorderPanel","useHasBorderPanel","BlockPreviewPanel","ScreenBorder","name","hasBorderPanel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,WAAP,IAAsBC,iBAAtB,QAA+C,gBAA/C;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;;AAEA,SAASC,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-border.js"],"names":["__","ScreenHeader","BorderPanel","useHasBorderPanel","BlockPreviewPanel","getVariationClassNameFromPath","ScreenBorder","name","variationPath","hasBorderPanel","variationClassName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,WAAP,IAAsBC,iBAAtB,QAA+C,gBAA/C;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,6BAAT,QAA8C,SAA9C;;AAEA,SAASC,YAAT,OAAsD;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AACrD,QAAMC,cAAc,GAAGN,iBAAiB,CAAEI,IAAF,CAAxC;AACA,QAAMG,kBAAkB,GAAGL,6BAA6B,CAAEG,aAAF,CAAxD;AACA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,KAAK,EAAGR,EAAE,CAAE,QAAF;AAAxB,IADD,EAEC,cAAC,iBAAD;AAAmB,IAAA,IAAI,EAAGO,IAA1B;AAAiC,IAAA,SAAS,EAAGG;AAA7C,IAFD,EAGGD,cAAc,IACf,cAAC,WAAD;AAAa,IAAA,IAAI,EAAGF,IAApB;AAA2B,IAAA,aAAa,EAAGC;AAA3C,IAJF,CADD;AASA;;AAED,eAAeF,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BorderPanel, { useHasBorderPanel } from './border-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassNameFromPath } from './utils';\n\nfunction ScreenBorder( { name, variationPath = '' } ) {\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst variationClassName = getVariationClassNameFromPath( variationPath );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Border' ) } />\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<BorderPanel name={ name } variationPath={ variationPath } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBorder;\n"]}
|
|
@@ -14,7 +14,8 @@ import { getSupportedGlobalStylesPanels, useSetting, useStyle, useColorsPerOrigi
|
|
|
14
14
|
|
|
15
15
|
function ScreenButtonColor(_ref) {
|
|
16
16
|
let {
|
|
17
|
-
name
|
|
17
|
+
name,
|
|
18
|
+
variationPath = ''
|
|
18
19
|
} = _ref;
|
|
19
20
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
20
21
|
const [solids] = useSetting('color.palette', name);
|
|
@@ -22,7 +23,7 @@ function ScreenButtonColor(_ref) {
|
|
|
22
23
|
const colorsPerOrigin = useColorsPerOrigin(name);
|
|
23
24
|
const [isBackgroundEnabled] = useSetting('color.background', name);
|
|
24
25
|
const hasButtonColor = supports.includes('buttonColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
|
25
|
-
const [buttonTextColor, setButtonTextColor] = useStyle('elements.button.color.text', name);
|
|
26
|
+
const [buttonTextColor, setButtonTextColor] = useStyle(variationPath + 'elements.button.color.text', name);
|
|
26
27
|
const [userButtonTextColor] = useStyle('elements.button.color.text', name, 'user');
|
|
27
28
|
const [buttonBgColor, setButtonBgColor] = useStyle('elements.button.color.background', name);
|
|
28
29
|
const [userButtonBgColor] = useStyle('elements.button.color.background', name, 'user');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-button-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenButtonColor","name","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isBackgroundEnabled","hasButtonColor","includes","length","buttonTextColor","setButtonTextColor","userButtonTextColor","buttonBgColor","setButtonBgColor","userButtonBgColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,iBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-button-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenButtonColor","name","variationPath","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isBackgroundEnabled","hasButtonColor","includes","length","buttonTextColor","setButtonTextColor","userButtonTextColor","buttonBgColor","setButtonBgColor","userButtonBgColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,iBAAT,OAA2D;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AAC1D,QAAMC,QAAQ,GAAGP,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEG,MAAF,IAAaP,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEI,sBAAF,IAA6BR,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AAEA,QAAMK,eAAe,GAAGP,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAM,CAAEM,mBAAF,IAA0BV,UAAU,CAAE,kBAAF,EAAsBI,IAAtB,CAA1C;AAEA,QAAMO,cAAc,GACnBL,QAAQ,CAACM,QAAT,CAAmB,aAAnB,KACAF,mBADA,KAEEH,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,eAAF,EAAmB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aAPd;AAQC,IAAA,aAAa,EAAGC,gBARjB;AASC,IAAA,SAAS,EAAGD,aAAa,KAAKE;AAT/B,IA5BD,CADD;AA0CA;;AAED,eAAehB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenButtonColor( { name, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasButtonColor =\n\t\tsupports.includes( 'buttonColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ buttonTextColor, setButtonTextColor ] = useStyle(\n\t\tvariationPath + 'elements.button.color.text',\n\t\tname\n\t);\n\tconst [ userButtonTextColor ] = useStyle(\n\t\t'elements.button.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ buttonBgColor, setButtonBgColor ] = useStyle(\n\t\t'elements.button.color.background',\n\t\tname\n\t);\n\tconst [ userButtonBgColor ] = useStyle(\n\t\t'elements.button.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasButtonColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Buttons' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default colors used for buttons across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Text color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ buttonTextColor }\n\t\t\t\tonColorChange={ setButtonTextColor }\n\t\t\t\tclearable={ buttonTextColor === userButtonTextColor }\n\t\t\t/>\n\n\t\t\t<h4 className=\"edit-site-global-styles-section-title\">\n\t\t\t\t{ __( 'Background color' ) }\n\t\t\t</h4>\n\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-button-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ buttonBgColor }\n\t\t\t\tonColorChange={ setButtonBgColor }\n\t\t\t\tclearable={ buttonBgColor === userButtonBgColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenButtonColor;\n"]}
|
|
@@ -16,23 +16,34 @@ import { getSupportedGlobalStylesPanels, useStyle } from './hooks';
|
|
|
16
16
|
import Subtitle from './subtitle';
|
|
17
17
|
import ColorIndicatorWrapper from './color-indicator-wrapper';
|
|
18
18
|
import BlockPreviewPanel from './block-preview-panel';
|
|
19
|
+
import { getVariationClassNameFromPath } from './utils';
|
|
20
|
+
|
|
21
|
+
function variationPathToURL(variationPath) {
|
|
22
|
+
if (!variationPath) {
|
|
23
|
+
return '';
|
|
24
|
+
} // Replace the dots with slashes, add slash at the beginning and remove the last slash.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return '/' + variationPath.replace(/\./g, '/').slice(0, -1);
|
|
28
|
+
}
|
|
19
29
|
|
|
20
30
|
function BackgroundColorItem(_ref) {
|
|
21
31
|
let {
|
|
22
32
|
name,
|
|
23
|
-
parentMenu
|
|
33
|
+
parentMenu,
|
|
34
|
+
variationPath = ''
|
|
24
35
|
} = _ref;
|
|
25
36
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
26
37
|
const hasSupport = supports.includes('backgroundColor') || supports.includes('background');
|
|
27
|
-
const [backgroundColor] = useStyle('color.background', name);
|
|
28
|
-
const [gradientValue] = useStyle('color.gradient', name);
|
|
38
|
+
const [backgroundColor] = useStyle(variationPath + 'color.background', name);
|
|
39
|
+
const [gradientValue] = useStyle(variationPath + 'color.gradient', name);
|
|
29
40
|
|
|
30
41
|
if (!hasSupport) {
|
|
31
42
|
return null;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
return createElement(NavigationButtonAsItem, {
|
|
35
|
-
path: parentMenu + '/colors/background',
|
|
46
|
+
path: parentMenu + variationPathToURL(variationPath) + '/colors/background',
|
|
36
47
|
"aria-label": __('Colors background styles')
|
|
37
48
|
}, createElement(HStack, {
|
|
38
49
|
justify: "flex-start"
|
|
@@ -49,18 +60,19 @@ function BackgroundColorItem(_ref) {
|
|
|
49
60
|
function TextColorItem(_ref2) {
|
|
50
61
|
let {
|
|
51
62
|
name,
|
|
52
|
-
parentMenu
|
|
63
|
+
parentMenu,
|
|
64
|
+
variationPath = ''
|
|
53
65
|
} = _ref2;
|
|
54
66
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
55
67
|
const hasSupport = supports.includes('color');
|
|
56
|
-
const [color] = useStyle('color.text', name);
|
|
68
|
+
const [color] = useStyle(variationPath + 'color.text', name);
|
|
57
69
|
|
|
58
70
|
if (!hasSupport) {
|
|
59
71
|
return null;
|
|
60
72
|
}
|
|
61
73
|
|
|
62
74
|
return createElement(NavigationButtonAsItem, {
|
|
63
|
-
path: parentMenu + '/colors/text',
|
|
75
|
+
path: parentMenu + variationPathToURL(variationPath) + '/colors/text',
|
|
64
76
|
"aria-label": __('Colors text styles')
|
|
65
77
|
}, createElement(HStack, {
|
|
66
78
|
justify: "flex-start"
|
|
@@ -77,19 +89,20 @@ function TextColorItem(_ref2) {
|
|
|
77
89
|
function LinkColorItem(_ref3) {
|
|
78
90
|
let {
|
|
79
91
|
name,
|
|
80
|
-
parentMenu
|
|
92
|
+
parentMenu,
|
|
93
|
+
variationPath = ''
|
|
81
94
|
} = _ref3;
|
|
82
95
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
83
96
|
const hasSupport = supports.includes('linkColor');
|
|
84
|
-
const [color] = useStyle('elements.link.color.text', name);
|
|
85
|
-
const [colorHover] = useStyle('elements.link.:hover.color.text', name);
|
|
97
|
+
const [color] = useStyle(variationPath + 'elements.link.color.text', name);
|
|
98
|
+
const [colorHover] = useStyle(variationPath + 'elements.link.:hover.color.text', name);
|
|
86
99
|
|
|
87
100
|
if (!hasSupport) {
|
|
88
101
|
return null;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
return createElement(NavigationButtonAsItem, {
|
|
92
|
-
path: parentMenu + '/colors/link',
|
|
105
|
+
path: parentMenu + variationPathToURL(variationPath) + '/colors/link',
|
|
93
106
|
"aria-label": __('Colors link styles')
|
|
94
107
|
}, createElement(HStack, {
|
|
95
108
|
justify: "flex-start"
|
|
@@ -112,19 +125,20 @@ function LinkColorItem(_ref3) {
|
|
|
112
125
|
function HeadingColorItem(_ref4) {
|
|
113
126
|
let {
|
|
114
127
|
name,
|
|
115
|
-
parentMenu
|
|
128
|
+
parentMenu,
|
|
129
|
+
variationPath = ''
|
|
116
130
|
} = _ref4;
|
|
117
131
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
118
132
|
const hasSupport = supports.includes('color');
|
|
119
|
-
const [color] = useStyle('elements.heading.color.text', name);
|
|
120
|
-
const [bgColor] = useStyle('elements.heading.color.background', name);
|
|
133
|
+
const [color] = useStyle(variationPath + 'elements.heading.color.text', name);
|
|
134
|
+
const [bgColor] = useStyle(variationPath + 'elements.heading.color.background', name);
|
|
121
135
|
|
|
122
136
|
if (!hasSupport) {
|
|
123
137
|
return null;
|
|
124
138
|
}
|
|
125
139
|
|
|
126
140
|
return createElement(NavigationButtonAsItem, {
|
|
127
|
-
path: parentMenu + '/colors/heading',
|
|
141
|
+
path: parentMenu + variationPathToURL(variationPath) + '/colors/heading',
|
|
128
142
|
"aria-label": __('Colors heading styles')
|
|
129
143
|
}, createElement(HStack, {
|
|
130
144
|
justify: "flex-start"
|
|
@@ -145,19 +159,20 @@ function HeadingColorItem(_ref4) {
|
|
|
145
159
|
function ButtonColorItem(_ref5) {
|
|
146
160
|
let {
|
|
147
161
|
name,
|
|
148
|
-
parentMenu
|
|
162
|
+
parentMenu,
|
|
163
|
+
variationPath = ''
|
|
149
164
|
} = _ref5;
|
|
150
165
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
151
166
|
const hasSupport = supports.includes('buttonColor');
|
|
152
|
-
const [color] = useStyle('elements.button.color.text', name);
|
|
153
|
-
const [bgColor] = useStyle('elements.button.color.background', name);
|
|
167
|
+
const [color] = useStyle(variationPath + 'elements.button.color.text', name);
|
|
168
|
+
const [bgColor] = useStyle(variationPath + 'elements.button.color.background', name);
|
|
154
169
|
|
|
155
170
|
if (!hasSupport) {
|
|
156
171
|
return null;
|
|
157
172
|
}
|
|
158
173
|
|
|
159
174
|
return createElement(NavigationButtonAsItem, {
|
|
160
|
-
path: parentMenu + '/colors/button'
|
|
175
|
+
path: parentMenu + variationPathToURL(variationPath) + '/colors/button'
|
|
161
176
|
}, createElement(HStack, {
|
|
162
177
|
justify: "flex-start"
|
|
163
178
|
}, createElement(ZStack, {
|
|
@@ -178,14 +193,17 @@ function ButtonColorItem(_ref5) {
|
|
|
178
193
|
|
|
179
194
|
function ScreenColors(_ref6) {
|
|
180
195
|
let {
|
|
181
|
-
name
|
|
196
|
+
name,
|
|
197
|
+
variationPath = ''
|
|
182
198
|
} = _ref6;
|
|
183
199
|
const parentMenu = name === undefined ? '' : '/blocks/' + encodeURIComponent(name);
|
|
200
|
+
const variationClassName = getVariationClassNameFromPath(variationPath);
|
|
184
201
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
185
202
|
title: __('Colors'),
|
|
186
203
|
description: __('Manage palettes and the default color of different global elements on the site.')
|
|
187
204
|
}), createElement(BlockPreviewPanel, {
|
|
188
|
-
name: name
|
|
205
|
+
name: name,
|
|
206
|
+
variation: variationClassName
|
|
189
207
|
}), createElement("div", {
|
|
190
208
|
className: "edit-site-global-styles-screen-colors"
|
|
191
209
|
}, createElement(VStack, {
|
|
@@ -199,19 +217,24 @@ function ScreenColors(_ref6) {
|
|
|
199
217
|
isSeparated: true
|
|
200
218
|
}, createElement(BackgroundColorItem, {
|
|
201
219
|
name: name,
|
|
202
|
-
parentMenu: parentMenu
|
|
220
|
+
parentMenu: parentMenu,
|
|
221
|
+
variationPath: variationPath
|
|
203
222
|
}), createElement(TextColorItem, {
|
|
204
223
|
name: name,
|
|
205
|
-
parentMenu: parentMenu
|
|
224
|
+
parentMenu: parentMenu,
|
|
225
|
+
variationPath: variationPath
|
|
206
226
|
}), createElement(LinkColorItem, {
|
|
207
227
|
name: name,
|
|
208
|
-
parentMenu: parentMenu
|
|
228
|
+
parentMenu: parentMenu,
|
|
229
|
+
variationPath: variationPath
|
|
209
230
|
}), createElement(HeadingColorItem, {
|
|
210
231
|
name: name,
|
|
211
|
-
parentMenu: parentMenu
|
|
232
|
+
parentMenu: parentMenu,
|
|
233
|
+
variationPath: variationPath
|
|
212
234
|
}), createElement(ButtonColorItem, {
|
|
213
235
|
name: name,
|
|
214
|
-
parentMenu: parentMenu
|
|
236
|
+
parentMenu: parentMenu,
|
|
237
|
+
variationPath: variationPath
|
|
215
238
|
}))))));
|
|
216
239
|
}
|
|
217
240
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"names":["__","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalZStack","ZStack","FlexItem","ColorIndicator","ScreenHeader","Palette","NavigationButtonAsItem","getSupportedGlobalStylesPanels","useStyle","Subtitle","ColorIndicatorWrapper","BlockPreviewPanel","BackgroundColorItem","name","parentMenu","supports","hasSupport","includes","backgroundColor","gradientValue","TextColorItem","color","LinkColorItem","colorHover","HeadingColorItem","bgColor","ButtonColorItem","ScreenColors","undefined","encodeURIComponent"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,QALD,EAMCC,cAND,QAOO,uBAPP;AASA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,8BAAT,EAAyCC,QAAzC,QAAyD,SAAzD;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;;AAEA,SAASC,mBAAT,OAAqD;AAAA,MAAvB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAuB;AACpD,QAAMC,QAAQ,GAAGR,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAMG,UAAU,GACfD,QAAQ,CAACE,QAAT,CAAmB,iBAAnB,KACAF,QAAQ,CAACE,QAAT,CAAmB,YAAnB,CAFD;AAGA,QAAM,CAAEC,eAAF,IAAsBV,QAAQ,CAAE,kBAAF,EAAsBK,IAAtB,CAApC;AACA,QAAM,CAAEM,aAAF,IAAoBX,QAAQ,CAAE,gBAAF,EAAoBK,IAApB,CAAlC;;AAEA,MAAK,CAAEG,UAAP,EAAoB;AACnB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,sBAAD;A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AAGD,IADR;AAEC,IAAA,UAAU,EAAGC;AAFd,IATD,EAaC,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC;AAFd,IAbD,EAiBC,cAAC,eAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC;AAFd,IAjBD,CAFD,CAHD,CADD,CAVD,CADD;AA4CA;;AAED,eAAea,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalZStack as ZStack,\n\tFlexItem,\n\tColorIndicator,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport Palette from './palette';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { getSupportedGlobalStylesPanels, useStyle } from './hooks';\nimport Subtitle from './subtitle';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\nimport BlockPreviewPanel from './block-preview-panel';\n\nfunction BackgroundColorItem( { name, parentMenu } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport =\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' );\n\tconst [ backgroundColor ] = useStyle( 'color.background', name );\n\tconst [ gradientValue ] = useStyle( 'color.gradient', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/colors/background' }\n\t\t\taria-label={ __( 'Colors background styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\tcolorValue={ gradientValue ?? backgroundColor }\n\t\t\t\t\t\tdata-testid=\"background-color-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Background' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction TextColorItem( { name, parentMenu } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'color' );\n\tconst [ color ] = useStyle( 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/colors/text' }\n\t\t\taria-label={ __( 'Colors text styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\tdata-testid=\"text-color-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Text' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction LinkColorItem( { name, parentMenu } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'linkColor' );\n\tconst [ color ] = useStyle( 'elements.link.color.text', name );\n\tconst [ colorHover ] = useStyle( 'elements.link.:hover.color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/colors/link' }\n\t\t\taria-label={ __( 'Colors link styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ colorHover } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Links' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction HeadingColorItem( { name, parentMenu } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'color' );\n\tconst [ color ] = useStyle( 'elements.heading.color.text', name );\n\tconst [ bgColor ] = useStyle( 'elements.heading.color.background', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/colors/heading' }\n\t\t\taria-label={ __( 'Colors heading styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ bgColor } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem>{ __( 'Headings' ) }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ButtonColorItem( { name, parentMenu } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'buttonColor' );\n\tconst [ color ] = useStyle( 'elements.button.color.text', name );\n\tconst [ bgColor ] = useStyle( 'elements.button.color.background', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem path={ parentMenu + '/colors/button' }>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ bgColor } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Buttons' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenColors( { name } ) {\n\tconst parentMenu =\n\t\tname === undefined ? '' : '/blocks/' + encodeURIComponent( name );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Colors' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage palettes and the default color of different global elements on the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } />\n\n\t\t\t<div className=\"edit-site-global-styles-screen-colors\">\n\t\t\t\t<VStack spacing={ 10 }>\n\t\t\t\t\t<Palette name={ name } />\n\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<BackgroundColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<LinkColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HeadingColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ButtonColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenColors;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-colors.js"],"names":["__","__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalZStack","ZStack","FlexItem","ColorIndicator","ScreenHeader","Palette","NavigationButtonAsItem","getSupportedGlobalStylesPanels","useStyle","Subtitle","ColorIndicatorWrapper","BlockPreviewPanel","getVariationClassNameFromPath","variationPathToURL","variationPath","replace","slice","BackgroundColorItem","name","parentMenu","supports","hasSupport","includes","backgroundColor","gradientValue","TextColorItem","color","LinkColorItem","colorHover","HeadingColorItem","bgColor","ButtonColorItem","ScreenColors","undefined","encodeURIComponent","variationClassName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,QALD,EAMCC,cAND,QAOO,uBAPP;AASA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,8BAAT,EAAyCC,QAAzC,QA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W;AAAjC,KACC,cAAC,mBAAD;AACC,IAAA,IAAI,EAAGyB,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,aAAa,EAAGL;AAHjB,IADD,EAMC,cAAC,aAAD;AACC,IAAA,IAAI,EAAGI,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,aAAa,EAAGL;AAHjB,IAND,EAWC,cAAC,aAAD;AACC,IAAA,IAAI,EAAGI,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,aAAa,EAAGL;AAHjB,IAXD,EAgBC,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGI,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,aAAa,EAAGL;AAHjB,IAhBD,EAqBC,cAAC,eAAD;AACC,IAAA,IAAI,EAAGI,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,aAAa,EAAGL;AAHjB,IArBD,CAFD,CAHD,CADD,CAVD,CADD;AAiDA;;AAED,eAAekB,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalZStack as ZStack,\n\tFlexItem,\n\tColorIndicator,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport Palette from './palette';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { getSupportedGlobalStylesPanels, useStyle } from './hooks';\nimport Subtitle from './subtitle';\nimport ColorIndicatorWrapper from './color-indicator-wrapper';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassNameFromPath } from './utils';\n\nfunction variationPathToURL( variationPath ) {\n\tif ( ! variationPath ) {\n\t\treturn '';\n\t}\n\t// Replace the dots with slashes, add slash at the beginning and remove the last slash.\n\treturn '/' + variationPath.replace( /\\./g, '/' ).slice( 0, -1 );\n}\n\nfunction BackgroundColorItem( { name, parentMenu, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport =\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' );\n\tconst [ backgroundColor ] = useStyle(\n\t\tvariationPath + 'color.background',\n\t\tname\n\t);\n\tconst [ gradientValue ] = useStyle(\n\t\tvariationPath + 'color.gradient',\n\t\tname\n\t);\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={\n\t\t\t\tparentMenu +\n\t\t\t\tvariationPathToURL( variationPath ) +\n\t\t\t\t'/colors/background'\n\t\t\t}\n\t\t\taria-label={ __( 'Colors background styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\tcolorValue={ gradientValue ?? backgroundColor }\n\t\t\t\t\t\tdata-testid=\"background-color-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Background' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction TextColorItem( { name, parentMenu, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'color' );\n\tconst [ color ] = useStyle( variationPath + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={\n\t\t\t\tparentMenu +\n\t\t\t\tvariationPathToURL( variationPath ) +\n\t\t\t\t'/colors/text'\n\t\t\t}\n\t\t\taria-label={ __( 'Colors text styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\tdata-testid=\"text-color-indicator\"\n\t\t\t\t\t/>\n\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Text' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction LinkColorItem( { name, parentMenu, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'linkColor' );\n\tconst [ color ] = useStyle(\n\t\tvariationPath + 'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ colorHover ] = useStyle(\n\t\tvariationPath + 'elements.link.:hover.color.text',\n\t\tname\n\t);\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={\n\t\t\t\tparentMenu +\n\t\t\t\tvariationPathToURL( variationPath ) +\n\t\t\t\t'/colors/link'\n\t\t\t}\n\t\t\taria-label={ __( 'Colors link styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ colorHover } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Links' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction HeadingColorItem( { name, parentMenu, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'color' );\n\tconst [ color ] = useStyle(\n\t\tvariationPath + 'elements.heading.color.text',\n\t\tname\n\t);\n\tconst [ bgColor ] = useStyle(\n\t\tvariationPath + 'elements.heading.color.background',\n\t\tname\n\t);\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={\n\t\t\t\tparentMenu +\n\t\t\t\tvariationPathToURL( variationPath ) +\n\t\t\t\t'/colors/heading'\n\t\t\t}\n\t\t\taria-label={ __( 'Colors heading styles' ) }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ bgColor } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem>{ __( 'Headings' ) }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ButtonColorItem( { name, parentMenu, variationPath = '' } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasSupport = supports.includes( 'buttonColor' );\n\tconst [ color ] = useStyle(\n\t\tvariationPath + 'elements.button.color.text',\n\t\tname\n\t);\n\tconst [ bgColor ] = useStyle(\n\t\tvariationPath + 'elements.button.color.background',\n\t\tname\n\t);\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={\n\t\t\t\tparentMenu +\n\t\t\t\tvariationPathToURL( variationPath ) +\n\t\t\t\t'/colors/button'\n\t\t\t}\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ bgColor } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t\t<ColorIndicatorWrapper expanded={ false }>\n\t\t\t\t\t\t<ColorIndicator colorValue={ color } />\n\t\t\t\t\t</ColorIndicatorWrapper>\n\t\t\t\t</ZStack>\n\t\t\t\t<FlexItem className=\"edit-site-global-styles__color-label\">\n\t\t\t\t\t{ __( 'Buttons' ) }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenColors( { name, variationPath = '' } ) {\n\tconst parentMenu =\n\t\tname === undefined ? '' : '/blocks/' + encodeURIComponent( name );\n\tconst variationClassName = getVariationClassNameFromPath( variationPath );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Colors' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage palettes and the default color of different global elements on the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t<div className=\"edit-site-global-styles-screen-colors\">\n\t\t\t\t<VStack spacing={ 10 }>\n\t\t\t\t\t<Palette name={ name } />\n\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<BackgroundColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<TextColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<LinkColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<HeadingColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ButtonColorItem\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\tvariationPath={ variationPath }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</VStack>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default ScreenColors;\n"]}
|
|
@@ -17,7 +17,8 @@ import { getSupportedGlobalStylesPanels, useSetting, useStyle, useColorsPerOrigi
|
|
|
17
17
|
|
|
18
18
|
function ScreenHeadingColor(_ref) {
|
|
19
19
|
let {
|
|
20
|
-
name
|
|
20
|
+
name,
|
|
21
|
+
variationPath = ''
|
|
21
22
|
} = _ref;
|
|
22
23
|
const [selectedLevel, setCurrentTab] = useState('heading');
|
|
23
24
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
@@ -32,12 +33,12 @@ function ScreenHeadingColor(_ref) {
|
|
|
32
33
|
const hasTextColor = supports.includes('color') && isTextEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
|
33
34
|
const hasBackgroundColor = supports.includes('backgroundColor') && isBackgroundEnabled && (solids.length > 0 || areCustomSolidsEnabled);
|
|
34
35
|
const hasGradientColor = supports.includes('background') && (gradients.length > 0 || areCustomGradientsEnabled);
|
|
35
|
-
const [color, setColor] = useStyle('elements.' + selectedLevel + '.color.text', name);
|
|
36
|
-
const [userColor] = useStyle('elements.' + selectedLevel + '.color.text', name, 'user');
|
|
37
|
-
const [backgroundColor, setBackgroundColor] = useStyle('elements.' + selectedLevel + '.color.background', name);
|
|
38
|
-
const [userBackgroundColor] = useStyle('elements.' + selectedLevel + '.color.background', name, 'user');
|
|
39
|
-
const [gradient, setGradient] = useStyle('elements.' + selectedLevel + '.color.gradient', name);
|
|
40
|
-
const [userGradient] = useStyle('elements.' + selectedLevel + '.color.gradient', name, 'user');
|
|
36
|
+
const [color, setColor] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.text', name);
|
|
37
|
+
const [userColor] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.text', name, 'user');
|
|
38
|
+
const [backgroundColor, setBackgroundColor] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.background', name);
|
|
39
|
+
const [userBackgroundColor] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.background', name, 'user');
|
|
40
|
+
const [gradient, setGradient] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.gradient', name);
|
|
41
|
+
const [userGradient] = useStyle(variationPath + 'elements.' + selectedLevel + '.color.gradient', name, 'user');
|
|
41
42
|
|
|
42
43
|
if (!hasTextColor && !hasBackgroundColor && !hasGradientColor) {
|
|
43
44
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-heading-color.js"],"names":["sprintf","__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalColorGradientControl","ColorGradientControl","useState","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","useGradientsPerOrigin","ScreenHeadingColor","name","selectedLevel","setCurrentTab","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isTextEnabled","isBackgroundEnabled","colorsPerOrigin","gradientsPerOrigin","hasTextColor","includes","length","hasBackgroundColor","hasGradientColor","color","setColor","userColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps","toUpperCase"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,gCAAgC,IAAIC,kBADrC,EAECC,sCAAsC,IAAIC,wBAF3C,QAGO,uBAHP;AAIA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,EAKCC,qBALD,QAMO,SANP;;AAQA,SAASC,kBAAT,OAAwC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACvC,QAAM,CAAEC,aAAF,EAAiBC,aAAjB,IAAmCV,QAAQ,CAAE,SAAF,CAAjD;AAEA,QAAMW,QAAQ,GAAGT,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaT,UAAU,CAAE,eAAF,EAAmBK,IAAnB,CAA7B;AACA,QAAM,CAAEK,SAAF,IAAgBV,UAAU,CAAE,iBAAF,EAAqBK,IAArB,CAAhC;AACA,QAAM,CAAEM,sBAAF,IAA6BX,UAAU,CAAE,cAAF,EAAkBK,IAAlB,CAA7C;AACA,QAAM,CAAEO,yBAAF,IAAgCZ,UAAU,CAC/C,sBAD+C,EAE/CK,IAF+C,CAAhD;AAIA,QAAM,CAAEQ,aAAF,IAAoBb,UAAU,CAAE,YAAF,EAAgBK,IAAhB,CAApC;AACA,QAAM,CAAES,mBAAF,IAA0Bd,UAAU,CAAE,kBAAF,EAAsBK,IAAtB,CAA1C;AAEA,QAAMU,eAAe,GAAGb,kBAAkB,CAAEG,IAAF,CAA1C;AACA,QAAMW,kBAAkB,GAAGb,qBAAqB,CAAEE,IAAF,CAAhD;AAEA,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,WAAd,EAHO,CAHX,CADD,EAUC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,MAAM,EAAGxB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEL,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,KASM0B,YATN,EAVD,CAxDF,CADD;AAkFA;;AAED,eAAelC,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n} from './hooks';\n\nfunction ScreenHeadingColor( { name } ) {\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tconst [ color, setColor ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.text',\n\t\tname\n\t);\n\tconst [ userColor ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useStyle(\n\t\t'elements.' + selectedLevel + '.color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasTextColor && ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Headings' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for headings across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t<h4>{ __( 'Select heading level' ) }</h4>\n\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\tisBlock\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels\n\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleGroupControlOption value=\"h1\" label={ __( 'H1' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h2\" label={ __( 'H2' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h3\" label={ __( 'H3' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h4\" label={ __( 'H4' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h5\" label={ __( 'H5' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h6\" label={ __( 'H6' ) } />\n\t\t\t\t</ToggleGroupControl>\n\t\t\t</div>\n\t\t\t{ hasTextColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Text color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Text color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h4>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-text-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\tonColorChange={ setColor }\n\t\t\t\t\t\tclearable={ color === userColor }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasBackgroundColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Background color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Background color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h4>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-background-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t{ ...controlProps }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenHeadingColor;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-heading-color.js"],"names":["sprintf","__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalColorGradientControl","ColorGradientControl","useState","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","useGradientsPerOrigin","ScreenHeadingColor","name","variationPath","selectedLevel","setCurrentTab","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isTextEnabled","isBackgroundEnabled","colorsPerOrigin","gradientsPerOrigin","hasTextColor","includes","length","hasBackgroundColor","hasGradientColor","color","setColor","userColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps","toUpperCase"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SACCC,gCAAgC,IAAIC,kBADrC,EAECC,sCAAsC,IAAIC,wBAF3C,QAGO,uBAHP;AAIA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,EAKCC,qBALD,QAMO,SANP;;AAQA,SAASC,kBAAT,OAA4D;AAAA,MAA/B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,aAAa,GAAG;AAAxB,GAA+B;AAC3D,QAAM,CAAEC,aAAF,EAAiBC,aAAjB,IAAmCX,QAAQ,CAAE,SAAF,CAAjD;AAEA,QAAMY,QAAQ,GAAGV,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEK,MAAF,IAAaV,UAAU,CAAE,eAAF,EAAmBK,IAAnB,CAA7B;AACA,QAAM,CAAEM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H,GAECD,OAAO;AACP;AACAC,EAAAA,EAAE,CAAE,mBAAF,CAFK,EAGPiB,aAAa,CAACiC,WAAd,EAHO,CAHX,CADD,EAUC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,8CADX;AAEC,IAAA,MAAM,EAAGxB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEJ,sBAHzB;AAIC,IAAA,SAAS,EAAG,KAJb;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,iCAAiC,MANlC;AAOC,IAAA,UAAU,EAAGW,KAPd;AAQC,IAAA,aAAa,EAAGC,QARjB;AASC,IAAA,SAAS,EAAGD,KAAK,KAAKE;AATvB,IAVD,CAhCF,EAuDGJ,kBAAkB,IACnB;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,0BACGd,aAAa,KAAK,SAAlB,GACCjB,EAAE,CAAE,yCAAF,CADH,GAECD,OAAO;AACP;AACAC,EAAAA,EAAE,CAAE,yBAAF,CAFK,EAGPiB,aAAa,CAACiC,WAAd,EAHO,CAHX,CADD,EAUC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,oDADX;AAEC,IAAA,MAAM,EAAGxB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEL,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,KASM0B,YATN,EAVD,CAxDF,CADD;AAkFA;;AAED,eAAenC,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n} from './hooks';\n\nfunction ScreenHeadingColor( { name, variationPath = '' } ) {\n\tconst [ selectedLevel, setCurrentTab ] = useState( 'heading' );\n\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tconst [ color, setColor ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.text',\n\t\tname\n\t);\n\tconst [ userColor ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.gradient',\n\t\tname\n\t);\n\tconst [ userGradient ] = useStyle(\n\t\tvariationPath + 'elements.' + selectedLevel + '.color.gradient',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasTextColor && ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Headings' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for headings across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t<h4>{ __( 'Select heading level' ) }</h4>\n\n\t\t\t\t<ToggleGroupControl\n\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\tvalue={ selectedLevel }\n\t\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\t\tisBlock\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels\n\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleGroupControlOption value=\"h1\" label={ __( 'H1' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h2\" label={ __( 'H2' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h3\" label={ __( 'H3' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h4\" label={ __( 'H4' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h5\" label={ __( 'H5' ) } />\n\t\t\t\t\t<ToggleGroupControlOption value=\"h6\" label={ __( 'H6' ) } />\n\t\t\t\t</ToggleGroupControl>\n\t\t\t</div>\n\t\t\t{ hasTextColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Text color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Text color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h4>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-text-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\tonColorChange={ setColor }\n\t\t\t\t\t\tclearable={ color === userColor }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasBackgroundColor && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-heading-color\">\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t{ selectedLevel === 'heading'\n\t\t\t\t\t\t\t? __( 'Background color for all heading levels' )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: heading level (h1-h6) */\n\t\t\t\t\t\t\t\t\t__( 'Background color for %s' ),\n\t\t\t\t\t\t\t\t\tselectedLevel.toUpperCase()\n\t\t\t\t\t\t\t ) }\n\t\t\t\t\t</h4>\n\t\t\t\t\t<ColorGradientControl\n\t\t\t\t\t\tclassName=\"edit-site-screen-heading-background-color__control\"\n\t\t\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t\t\tshowTitle={ false }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t{ ...controlProps }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenHeadingColor;\n"]}
|
|
@@ -11,18 +11,23 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
import DimensionsPanel, { useHasDimensionsPanel } from './dimensions-panel';
|
|
12
12
|
import ScreenHeader from './header';
|
|
13
13
|
import BlockPreviewPanel from './block-preview-panel';
|
|
14
|
+
import { getVariationClassNameFromPath } from './utils';
|
|
14
15
|
|
|
15
16
|
function ScreenLayout(_ref) {
|
|
16
17
|
let {
|
|
17
|
-
name
|
|
18
|
+
name,
|
|
19
|
+
variationPath = ''
|
|
18
20
|
} = _ref;
|
|
19
21
|
const hasDimensionsPanel = useHasDimensionsPanel(name);
|
|
22
|
+
const variationClassName = getVariationClassNameFromPath(variationPath);
|
|
20
23
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
21
24
|
title: __('Layout')
|
|
22
25
|
}), createElement(BlockPreviewPanel, {
|
|
23
|
-
name: name
|
|
26
|
+
name: name,
|
|
27
|
+
variation: variationClassName
|
|
24
28
|
}), hasDimensionsPanel && createElement(DimensionsPanel, {
|
|
25
|
-
name: name
|
|
29
|
+
name: name,
|
|
30
|
+
variationPath: variationPath
|
|
26
31
|
}));
|
|
27
32
|
}
|
|
28
33
|
|