@wordpress/edit-site 3.0.11 → 3.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template-part.js +34 -17
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +41 -22
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +3 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +4 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +71 -0
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +5 -5
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +23 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +54 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +74 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +28 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +12 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/list/actions/index.js +104 -0
- package/build/components/list/actions/index.js.map +1 -0
- package/build/components/list/actions/rename-menu-item.js +112 -0
- package/build/components/list/actions/rename-menu-item.js.map +1 -0
- package/build/components/list/added-by.js +180 -0
- package/build/components/list/added-by.js.map +1 -0
- package/build/components/list/index.js +18 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +58 -67
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -11
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +28 -11
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +14 -5
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/template-details/edit-template-title.js +33 -0
- package/build/components/template-details/edit-template-title.js.map +1 -0
- package/build/components/template-details/index.js +6 -2
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +47 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +30 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +40 -23
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +5 -5
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +60 -0
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +5 -5
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +12 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +22 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +41 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +70 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +28 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +11 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/list/actions/index.js +85 -0
- package/build-module/components/list/actions/index.js.map +1 -0
- package/build-module/components/list/actions/rename-menu-item.js +101 -0
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
- package/build-module/components/list/added-by.js +166 -0
- package/build-module/components/list/added-by.js.map +1 -0
- package/build-module/components/list/index.js +15 -3
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +60 -69
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +11 -12
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +26 -12
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +14 -6
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/template-details/edit-template-title.js +23 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -0
- package/build-module/components/template-details/index.js +5 -2
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/index.js +8 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +48 -19
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +146 -21
- package/build-style/style.css +146 -21
- package/package.json +10 -8
- package/src/components/add-new-template/new-template-part.js +32 -17
- package/src/components/add-new-template/new-template.js +39 -19
- package/src/components/block-editor/index.js +2 -0
- package/src/components/global-styles/color-palette-panel.js +5 -5
- package/src/components/global-styles/gradients-palette-panel.js +99 -0
- package/src/components/global-styles/hooks.js +4 -4
- package/src/components/global-styles/palette.js +30 -10
- package/src/components/global-styles/screen-background-color.js +2 -0
- package/src/components/global-styles/screen-color-palette.js +30 -3
- package/src/components/global-styles/screen-link-color.js +2 -0
- package/src/components/global-styles/screen-text-color.js +2 -0
- package/src/components/global-styles/screen-typography-element.js +39 -0
- package/src/components/global-styles/screen-typography.js +84 -3
- package/src/components/global-styles/style.scss +45 -6
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/test/utils.js +1 -1
- package/src/components/global-styles/typography-panel.js +37 -7
- package/src/components/global-styles/ui.js +9 -0
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/list/actions/index.js +95 -0
- package/src/components/list/actions/rename-menu-item.js +134 -0
- package/src/components/list/added-by.js +179 -0
- package/src/components/list/index.js +27 -11
- package/src/components/list/style.scss +106 -11
- package/src/components/list/table.js +65 -75
- package/src/components/navigation-sidebar/index.js +9 -16
- package/src/components/navigation-sidebar/navigation-panel/index.js +25 -9
- package/src/components/navigation-sidebar/navigation-toggle/index.js +29 -17
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/template-details/edit-template-title.js +28 -0
- package/src/components/template-details/index.js +13 -8
- package/src/components/template-details/template-areas.js +1 -1
- package/src/index.js +10 -2
- package/src/store/actions.js +82 -34
- package/src/store/selectors.js +22 -4
- package/src/store/test/actions.js +0 -24
- package/src/store/test/selectors.js +24 -0
|
@@ -4,23 +4,42 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption } from '@wordpress/components';
|
|
8
|
+
import { useState } from '@wordpress/element';
|
|
7
9
|
/**
|
|
8
10
|
* Internal dependencies
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
import ColorPalettePanel from './color-palette-panel';
|
|
14
|
+
import GradientPalettePanel from './gradients-palette-panel';
|
|
12
15
|
import ScreenHeader from './header';
|
|
13
16
|
|
|
14
17
|
function ScreenColorPalette(_ref) {
|
|
15
18
|
let {
|
|
16
19
|
name
|
|
17
20
|
} = _ref;
|
|
21
|
+
const [currentTab, setCurrentTab] = useState('solid');
|
|
18
22
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
19
23
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
20
24
|
back: parentMenu + '/colors',
|
|
21
|
-
title: __('
|
|
22
|
-
description: __('
|
|
23
|
-
}), createElement(
|
|
25
|
+
title: __('Palette'),
|
|
26
|
+
description: __('Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.')
|
|
27
|
+
}), createElement(ToggleGroupControl, {
|
|
28
|
+
className: "edit-site-screen-color-palette-toggle",
|
|
29
|
+
value: currentTab,
|
|
30
|
+
onChange: setCurrentTab,
|
|
31
|
+
label: __('Select palette type'),
|
|
32
|
+
hideLabelFromVision: true,
|
|
33
|
+
isBlock: true
|
|
34
|
+
}, createElement(ToggleGroupControlOption, {
|
|
35
|
+
value: "solid",
|
|
36
|
+
label: __('Solid')
|
|
37
|
+
}), createElement(ToggleGroupControlOption, {
|
|
38
|
+
value: "gradient",
|
|
39
|
+
label: __('Gradient')
|
|
40
|
+
})), currentTab === 'solid' && createElement(ColorPalettePanel, {
|
|
41
|
+
name: name
|
|
42
|
+
}), currentTab === 'gradient' && createElement(GradientPalettePanel, {
|
|
24
43
|
name: name
|
|
25
44
|
}));
|
|
26
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-color-palette.js"],"names":["__","ColorPalettePanel","ScreenHeader","ScreenColorPalette","name","parentMenu","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,YAAP,MAAyB,UAAzB;;AAEA,SAASC,kBAAT,OAAwC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACvC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-color-palette.js"],"names":["__","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","useState","ColorPalettePanel","GradientPalettePanel","ScreenHeader","ScreenColorPalette","name","currentTab","setCurrentTab","parentMenu","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,gCAAgC,IAAIC,kBADrC,EAECC,sCAAsC,IAAIC,wBAF3C,QAGO,uBAHP;AAIA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,oBAAP,MAAiC,2BAAjC;AACA,OAAOC,YAAP,MAAyB,UAAzB;;AAEA,SAASC,kBAAT,OAAwC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACvC,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgCP,QAAQ,CAAE,OAAF,CAA9C;AACA,QAAMQ,UAAU,GAAGH,IAAI,KAAKI,SAAT,GAAqB,EAArB,GAA0B,aAAaJ,IAA1D;AAEA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGG,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGb,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,yIADe;AAHjB,IADD,EAQC,cAAC,kBAAD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,KAAK,EAAGW,UAFT;AAGC,IAAA,QAAQ,EAAGC,aAHZ;AAIC,IAAA,KAAK,EAAGZ,EAAE,CAAE,qBAAF,CAJX;AAKC,IAAA,mBAAmB,MALpB;AAMC,IAAA,OAAO;AANR,KAQC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,OADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF;AAFX,IARD,EAYC,cAAC,wBAAD;AACC,IAAA,KAAK,EAAC,UADP;AAEC,IAAA,KAAK,EAAGA,EAAE,CAAE,UAAF;AAFX,IAZD,CARD,EAyBGW,UAAU,KAAK,OAAf,IAA0B,cAAC,iBAAD;AAAmB,IAAA,IAAI,EAAGD;AAA1B,IAzB7B,EA0BGC,UAAU,KAAK,UAAf,IACD,cAAC,oBAAD;AAAsB,IAAA,IAAI,EAAGD;AAA7B,IA3BF,CADD;AAgCA;;AAED,eAAeD,kBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ColorPalettePanel from './color-palette-panel';\nimport GradientPalettePanel from './gradients-palette-panel';\nimport ScreenHeader from './header';\n\nfunction ScreenColorPalette( { name } ) {\n\tconst [ currentTab, setCurrentTab ] = useState( 'solid' );\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Palette' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Palettes are used to provide default color options for blocks and various design tools. Here you can edit the colors with their labels.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tclassName=\"edit-site-screen-color-palette-toggle\"\n\t\t\t\tvalue={ currentTab }\n\t\t\t\tonChange={ setCurrentTab }\n\t\t\t\tlabel={ __( 'Select palette type' ) }\n\t\t\t\thideLabelFromVision\n\t\t\t\tisBlock\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"solid\"\n\t\t\t\t\tlabel={ __( 'Solid' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tvalue=\"gradient\"\n\t\t\t\t\tlabel={ __( 'Gradient' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ currentTab === 'solid' && <ColorPalettePanel name={ name } /> }\n\t\t\t{ currentTab === 'gradient' && (\n\t\t\t\t<GradientPalettePanel name={ name } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenColorPalette;\n"]}
|
|
@@ -46,7 +46,9 @@ function ScreenLinkColor(_ref) {
|
|
|
46
46
|
colors: colorsPerOrigin,
|
|
47
47
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
48
48
|
__experimentalHasMultipleOrigins: true,
|
|
49
|
-
showTitle: false
|
|
49
|
+
showTitle: false,
|
|
50
|
+
enableAlpha: true,
|
|
51
|
+
__experimentalIsRenderedInSidebar: true
|
|
50
52
|
}));
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AAEA,QAAMM,eAAe,GAAGR,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAM,CAAEO,aAAF,IAAoBX,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,WAAnB,KACAF,aADA,KAEEH,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,SAAF,EAAaC,YAAb,IAA8Bf,QAAQ,CAC3C,0BAD2C,EAE3CG,IAF2C,CAA5C;AAIA,QAAM,CAAEa,aAAF,IAAoBhB,QAAQ,CACjC,0BADiC,EAEjCG,IAFiC,EAGjC,MAHiC,CAAlC;;AAMA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,SADb;AAECK,IAAAA,aAAa,EAAEJ,YAFhB;AAGCK,IAAAA,KAAK,EAAE1B,EAAE,CAAE,YAAF,CAHV;AAIC2B,IAAAA,SAAS,EAAEP,SAAS,KAAKE;AAJ1B,GADgB,CAAjB;AASA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,OAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,uDADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGR,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAED,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SAL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ADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGR,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAED,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,IATD,CADD;AAsBA;;AAED,eAAeN,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } 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 ScreenLinkColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\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 [ isLinkEnabled ] = useSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ linkColor, setLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ userLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [\n\t\t{\n\t\t\tcolorValue: linkColor,\n\t\t\tonColorChange: setLinkColor,\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: linkColor === userLinkColor,\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
|
|
@@ -46,7 +46,9 @@ function ScreenTextColor(_ref) {
|
|
|
46
46
|
colors: colorsPerOrigin,
|
|
47
47
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
48
48
|
__experimentalHasMultipleOrigins: true,
|
|
49
|
-
showTitle: false
|
|
49
|
+
showTitle: false,
|
|
50
|
+
enableAlpha: true,
|
|
51
|
+
__experimentalIsRenderedInSidebar: true
|
|
50
52
|
}));
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAO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AAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGP,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAEF,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AACA,QAAM,CAAEM,aAAF,IAAoBV,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMO,eAAe,GAAGT,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEF,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,CAApC;AACA,QAAM,CAAEa,SAAF,IAAgBhB,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,EAAsB,MAAtB,CAA9B;;AAEA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,KADb;AAECK,IAAAA,aAAa,EAAEJ,QAFhB;AAGCK,IAAAA,KAAK,EAAE1B,EAAE,CAAE,YAAF,CAHV;AAIC2B,IAAAA,SAAS,EAAEP,KAAK,KAAKE;AAJtB,GADgB,CAAjB;AASA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGP,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAEF,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,IATD,CADD;AAsBA;;AAED,eAAeN,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } 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 ScreenTextColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( 'color.text', name );\n\tconst [ userColor ] = useStyle( 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [\n\t\t{\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: setColor,\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import TypographyPanel from './typography-panel';
|
|
12
|
+
import ScreenHeader from './header';
|
|
13
|
+
const elements = {
|
|
14
|
+
text: {
|
|
15
|
+
description: __('Manage the fonts used on the site.'),
|
|
16
|
+
title: __('Text')
|
|
17
|
+
},
|
|
18
|
+
link: {
|
|
19
|
+
description: __('Manage the fonts and typography used on the links.'),
|
|
20
|
+
title: __('Links')
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function ScreenTypographyElement(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
name,
|
|
27
|
+
element
|
|
28
|
+
} = _ref;
|
|
29
|
+
const parentMenu = name === undefined ? '/typography' : '/blocks/' + name + '/typography';
|
|
30
|
+
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
31
|
+
back: parentMenu,
|
|
32
|
+
title: elements[element].title,
|
|
33
|
+
description: elements[element].description
|
|
34
|
+
}), createElement(TypographyPanel, {
|
|
35
|
+
name: name,
|
|
36
|
+
element: element
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default ScreenTypographyElement;
|
|
41
|
+
//# sourceMappingURL=screen-typography-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography-element.js"],"names":["__","TypographyPanel","ScreenHeader","elements","text","description","title","link","ScreenTypographyElement","name","element","parentMenu","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,YAAP,MAAyB,UAAzB;AAEA,MAAMC,QAAQ,GAAG;AAChBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,WAAW,EAAEL,EAAE,CAAE,oCAAF,CADV;AAELM,IAAAA,KAAK,EAAEN,EAAE,CAAE,MAAF;AAFJ,GADU;AAKhBO,EAAAA,IAAI,EAAE;AACLF,IAAAA,WAAW,EAAEL,EAAE,CAAE,oDAAF,CADV;AAELM,IAAAA,KAAK,EAAEN,EAAE,CAAE,OAAF;AAFJ;AALU,CAAjB;;AAWA,SAASQ,uBAAT,OAAsD;AAAA,MAApB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAoB;AACrD,QAAMC,UAAU,GACfF,IAAI,KAAKG,SAAT,GAAqB,aAArB,GAAqC,aAAaH,IAAb,GAAoB,aAD1D;AAGA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGE,UADR;AAEC,IAAA,KAAK,EAAGR,QAAQ,CAAEO,OAAF,CAAR,CAAoBJ,KAF7B;AAGC,IAAA,WAAW,EAAGH,QAAQ,CAAEO,OAAF,CAAR,CAAoBL;AAHnC,IADD,EAMC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAGI,IAAxB;AAA+B,IAAA,OAAO,EAAGC;AAAzC,IAND,CADD;AAUA;;AAED,eAAeF,uBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport ScreenHeader from './header';\n\nconst elements = {\n\ttext: {\n\t\tdescription: __( 'Manage the fonts used on the site.' ),\n\t\ttitle: __( 'Text' ),\n\t},\n\tlink: {\n\t\tdescription: __( 'Manage the fonts and typography used on the links.' ),\n\t\ttitle: __( 'Links' ),\n\t},\n};\n\nfunction ScreenTypographyElement( { name, element } ) {\n\tconst parentMenu =\n\t\tname === undefined ? '/typography' : '/blocks/' + name + '/typography';\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu }\n\t\t\t\ttitle={ elements[ element ].title }\n\t\t\t\tdescription={ elements[ element ].description }\n\t\t\t/>\n\t\t\t<TypographyPanel name={ name } element={ element } />\n\t\t</>\n\t);\n}\n\nexport default ScreenTypographyElement;\n"]}
|
|
@@ -4,24 +4,88 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalVStack as VStack, __experimentalHStack as HStack, FlexItem } from '@wordpress/components';
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
|
-
import TypographyPanel from './typography-panel';
|
|
12
12
|
import ScreenHeader from './header';
|
|
13
|
+
import NavigationButton from './navigation-button';
|
|
14
|
+
import { useStyle } from './hooks';
|
|
15
|
+
import Subtitle from './subtitle';
|
|
16
|
+
import TypographyPanel from './typography-panel';
|
|
13
17
|
|
|
14
|
-
function
|
|
18
|
+
function Item(_ref) {
|
|
15
19
|
let {
|
|
16
|
-
name
|
|
20
|
+
name,
|
|
21
|
+
parentMenu,
|
|
22
|
+
element,
|
|
23
|
+
label
|
|
17
24
|
} = _ref;
|
|
25
|
+
const hasSupport = !name;
|
|
26
|
+
const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
|
|
27
|
+
const extraStyles = element === 'link' ? {
|
|
28
|
+
textDecoration: 'underline'
|
|
29
|
+
} : {};
|
|
30
|
+
const [fontFamily] = useStyle(prefix + 'typography.fontFamily', name);
|
|
31
|
+
const [fontStyle] = useStyle(prefix + 'typography.fontStyle', name);
|
|
32
|
+
const [fontWeight] = useStyle(prefix + 'typography.fontWeight', name);
|
|
33
|
+
const [letterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
|
|
34
|
+
const [backgroundColor] = useStyle(prefix + 'color.background', name);
|
|
35
|
+
const [gradientValue] = useStyle(prefix + 'color.gradient', name);
|
|
36
|
+
const [color] = useStyle(prefix + 'color.text', name);
|
|
37
|
+
|
|
38
|
+
if (!hasSupport) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return createElement(NavigationButton, {
|
|
43
|
+
path: parentMenu + '/typography/' + element
|
|
44
|
+
}, createElement(HStack, {
|
|
45
|
+
justify: "flex-start"
|
|
46
|
+
}, createElement(FlexItem, {
|
|
47
|
+
className: "edit-site-global-styles-screen-typography__indicator",
|
|
48
|
+
style: {
|
|
49
|
+
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
|
|
50
|
+
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
|
|
51
|
+
color,
|
|
52
|
+
fontStyle,
|
|
53
|
+
fontWeight,
|
|
54
|
+
letterSpacing,
|
|
55
|
+
...extraStyles
|
|
56
|
+
}
|
|
57
|
+
}, __('Aa')), createElement(FlexItem, null, label)));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ScreenTypography(_ref2) {
|
|
61
|
+
let {
|
|
62
|
+
name
|
|
63
|
+
} = _ref2;
|
|
18
64
|
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
19
65
|
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
20
66
|
back: parentMenu ? parentMenu : '/',
|
|
21
67
|
title: __('Typography'),
|
|
22
|
-
description: __('Manage the
|
|
23
|
-
}), createElement(
|
|
24
|
-
|
|
68
|
+
description: __('Manage the typography settings for different elements.')
|
|
69
|
+
}), !name && createElement("div", {
|
|
70
|
+
className: "edit-site-global-styles-screen-typography"
|
|
71
|
+
}, createElement(VStack, {
|
|
72
|
+
spacing: 3
|
|
73
|
+
}, createElement(Subtitle, null, __('Elements')), createElement(ItemGroup, {
|
|
74
|
+
isBordered: true,
|
|
75
|
+
isSeparated: true
|
|
76
|
+
}, createElement(Item, {
|
|
77
|
+
name: name,
|
|
78
|
+
parentMenu: parentMenu,
|
|
79
|
+
element: "text",
|
|
80
|
+
label: __('Text')
|
|
81
|
+
}), createElement(Item, {
|
|
82
|
+
name: name,
|
|
83
|
+
parentMenu: parentMenu,
|
|
84
|
+
element: "link",
|
|
85
|
+
label: __('Links')
|
|
86
|
+
})))), !!name && createElement(TypographyPanel, {
|
|
87
|
+
name: name,
|
|
88
|
+
element: "text"
|
|
25
89
|
}));
|
|
26
90
|
}
|
|
27
91
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["__","__experimentalItemGroup","ItemGroup","__experimentalVStack","VStack","__experimentalHStack","HStack","FlexItem","ScreenHeader","NavigationButton","useStyle","Subtitle","TypographyPanel","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","background","ScreenTypography","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,QAJD,QAKO,uBALP;AAOA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAASC,QAAT,QAAyB,SAAzB;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;;AAEA,SAASC,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC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\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport NavigationButton from './navigation-button';\nimport { useStyle } from './hooks';\nimport Subtitle from './subtitle';\nimport TypographyPanel from './typography-panel';\n\nfunction Item( { name, parentMenu, element, label } ) {\n\tconst hasSupport = ! name;\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );\n\tconst [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );\n\tconst [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );\n\tconst [ letterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<NavigationButton path={ parentMenu + '/typography/' + element }>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButton>\n\t);\n}\n\nfunction ScreenTypography( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu ? parentMenu : '/' }\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t{ ! name && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\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<Item\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\telement=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\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\telement=\"link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Links' ) }\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</div>\n\t\t\t) }\n\n\t\t\t{ /* no typogrpahy elements support yet for blocks */ }\n\t\t\t{ !! name && <TypographyPanel name={ name } element=\"text\" /> }\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
|
|
@@ -37,9 +37,11 @@ function useHasLetterSpacingControl(name) {
|
|
|
37
37
|
|
|
38
38
|
export default function TypographyPanel(_ref) {
|
|
39
39
|
let {
|
|
40
|
-
name
|
|
40
|
+
name,
|
|
41
|
+
element
|
|
41
42
|
} = _ref;
|
|
42
43
|
const supports = getSupportedGlobalStylesPanels(name);
|
|
44
|
+
const prefix = element === 'text' || !element ? '' : `elements.${element}.`;
|
|
43
45
|
const [fontSizes] = useSetting('typography.fontSizes', name);
|
|
44
46
|
const disableCustomFontSizes = !useSetting('typography.customFontSize', name)[0];
|
|
45
47
|
const [fontFamilies] = useSetting('typography.fontFamilies', name);
|
|
@@ -48,16 +50,34 @@ export default function TypographyPanel(_ref) {
|
|
|
48
50
|
const hasLineHeightEnabled = useHasLineHeightControl(name);
|
|
49
51
|
const hasAppearanceControl = useHasAppearanceControl(name);
|
|
50
52
|
const hasLetterSpacingControl = useHasLetterSpacingControl(name);
|
|
51
|
-
const [fontFamily, setFontFamily] = useStyle('typography.fontFamily', name);
|
|
52
|
-
const [fontSize, setFontSize] = useStyle('typography.fontSize', name);
|
|
53
|
-
const [fontStyle, setFontStyle] = useStyle('typography.fontStyle', name);
|
|
54
|
-
const [fontWeight, setFontWeight] = useStyle('typography.fontWeight', name);
|
|
55
|
-
const [lineHeight, setLineHeight] = useStyle('typography.lineHeight', name);
|
|
56
|
-
const [letterSpacing, setLetterSpacing] = useStyle('typography.letterSpacing', name);
|
|
53
|
+
const [fontFamily, setFontFamily] = useStyle(prefix + 'typography.fontFamily', name);
|
|
54
|
+
const [fontSize, setFontSize] = useStyle(prefix + 'typography.fontSize', name);
|
|
55
|
+
const [fontStyle, setFontStyle] = useStyle(prefix + 'typography.fontStyle', name);
|
|
56
|
+
const [fontWeight, setFontWeight] = useStyle(prefix + 'typography.fontWeight', name);
|
|
57
|
+
const [lineHeight, setLineHeight] = useStyle(prefix + 'typography.lineHeight', name);
|
|
58
|
+
const [letterSpacing, setLetterSpacing] = useStyle(prefix + 'typography.letterSpacing', name);
|
|
59
|
+
const [backgroundColor] = useStyle(prefix + 'color.background', name);
|
|
60
|
+
const [gradientValue] = useStyle(prefix + 'color.gradient', name);
|
|
61
|
+
const [color] = useStyle(prefix + 'color.text', name);
|
|
62
|
+
const extraStyles = element === 'link' ? {
|
|
63
|
+
textDecoration: 'underline'
|
|
64
|
+
} : {};
|
|
57
65
|
return createElement(PanelBody, {
|
|
58
66
|
className: "edit-site-typography-panel",
|
|
59
67
|
initialOpen: true
|
|
60
|
-
},
|
|
68
|
+
}, createElement("div", {
|
|
69
|
+
className: "edit-site-typography-panel__preview",
|
|
70
|
+
style: {
|
|
71
|
+
fontFamily: fontFamily !== null && fontFamily !== void 0 ? fontFamily : 'serif',
|
|
72
|
+
background: gradientValue !== null && gradientValue !== void 0 ? gradientValue : backgroundColor,
|
|
73
|
+
color,
|
|
74
|
+
fontSize,
|
|
75
|
+
fontStyle,
|
|
76
|
+
fontWeight,
|
|
77
|
+
letterSpacing,
|
|
78
|
+
...extraStyles
|
|
79
|
+
}
|
|
80
|
+
}, "Aa"), supports.includes('fontFamily') && createElement(FontFamilyControl, {
|
|
61
81
|
fontFamilies: fontFamilies,
|
|
62
82
|
value: fontFamily,
|
|
63
83
|
onChange: setFontFamily
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["LineHeightControl","__experimentalFontFamilyControl","FontFamilyControl","__experimentalFontAppearanceControl","FontAppearanceControl","__experimentalLetterSpacingControl","LetterSpacingControl","PanelBody","FontSizePicker","getSupportedGlobalStylesPanels","useSetting","useStyle","useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","TypographyPanel","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","newFontStyle","newFontWeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,+BAA+B,IAAIC,iBAFpC,EAGCC,mCA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BAAuB,IACxB,cAAC,oBAAD;AACC,IAAA,KAAK,EAAGW,aADT;AAEC,IAAA,QAAQ,EAAGC;AAFZ,IAxCF,CADD;AAgDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport { PanelBody, FontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.letterSpacing', name )[ 0 ] &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( { name } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name );\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\t'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle( 'typography.fontSize', name );\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\t'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\t'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\t'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\t'typography.letterSpacing',\n\t\tname\n\t);\n\n\treturn (\n\t\t<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t<FontFamilyControl\n\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ supports.includes( 'fontSize' ) && (\n\t\t\t\t<FontSizePicker\n\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<LineHeightControl\n\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<FontAppearanceControl\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t} }\n\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t} }\n\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<LetterSpacingControl\n\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/typography-panel.js"],"names":["LineHeightControl","__experimentalFontFamilyControl","FontFamilyControl","__experimentalFontAppearanceControl","FontAppearanceControl","__experimentalLetterSpacingControl","LetterSpacingControl","PanelBody","FontSizePicker","getSupportedGlobalStylesPanels","useSetting","useStyle","useHasTypographyPanel","name","hasLineHeight","useHasLineHeightControl","hasFontAppearance","useHasAppearanceControl","hasLetterSpacing","useHasLetterSpacingControl","supports","includes","hasFontStyles","hasFontWeights","TypographyPanel","element","prefix","fontSizes","disableCustomFontSizes","fontFamilies","hasLineHeightEnabled","hasAppearanceControl","hasLetterSpacingControl","fontFamily","setFontFamily","fontSize","setFontSize","fontStyle","setFontStyle","fontWeight","setFontWeight","lineHeight","setLineHeight","letterSpacing","setLetterSpacing","backgroundColor","gradientValue","color","extraStyles","textDecoration","background","newFontStyle","newFontWeight"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,+BAA+B,IAAIC,iBAFpC,EAGCC,mCAAmC,IAAIC,qBAHxC,EAICC,kCAAkC,IAAIC,oBAJvC,QAKO,yBALP;AAMA,SAASC,SAAT,EAAoBC,cAApB,QAA0C,uBAA1C;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,EAAyCC,UAAzC,EAAqDC,QAArD,QAAqE,SAArE;AAEA,OAAO,SAASC,qBAAT,CAAgCC,IAAhC,EAAuC;AAC7C,QAAMC,aAAa,GAAGC,uBAAuB,CAAEF,IAAF,CAA7C;AACA,QAAMG,iBAAiB,GAAGC,uBAAuB,CAAEJ,IAAF,CAAjD;AACA,QAAMK,gBAAgB,GAAGC,0BAA0B,CAAEN,IAAF,CAAnD;AACA,QAAMO,QAAQ,GAAGX,8BAA8B,CAAEI,IAAF,CAA/C;AACA,SACCC,aAAa,IACbE,iBADA,IAEAE,gBAFA,IAGAE,QAAQ,CAACC,QAAT,CAAmB,UAAnB,CAJD;AAMA;;AAED,SAASN,uBAAT,CAAkCF,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAGX,8BAA8B,CAAEI,IAAF,CAA/C;AACA,SACCH,UAAU,CAAE,uBAAF,EAA2BG,IAA3B,CAAV,CAA6C,CAA7C,KACAO,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFD;AAIA;;AAED,SAASJ,uBAAT,CAAkCJ,IAAlC,EAAyC;AACxC,QAAMO,QAAQ,GAAGX,8BAA8B,CAAEI,IAAF,CAA/C;AACA,QAAMS,aAAa,GAClBZ,UAAU,CAAE,sBAAF,EAA0BG,IAA1B,CAAV,CAA4C,CAA5C,KACAO,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAFD;AAGA,QAAME,cAAc,GACnBb,UAAU,CAA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AAgEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tLineHeightControl,\n\t__experimentalFontFamilyControl as FontFamilyControl,\n\t__experimentalFontAppearanceControl as FontAppearanceControl,\n\t__experimentalLetterSpacingControl as LetterSpacingControl,\n} from '@wordpress/block-editor';\nimport { PanelBody, FontSizePicker } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';\n\nexport function useHasTypographyPanel( name ) {\n\tconst hasLineHeight = useHasLineHeightControl( name );\n\tconst hasFontAppearance = useHasAppearanceControl( name );\n\tconst hasLetterSpacing = useHasLetterSpacingControl( name );\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\thasLineHeight ||\n\t\thasFontAppearance ||\n\t\thasLetterSpacing ||\n\t\tsupports.includes( 'fontSize' )\n\t);\n}\n\nfunction useHasLineHeightControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.lineHeight', name )[ 0 ] &&\n\t\tsupports.includes( 'lineHeight' )\n\t);\n}\n\nfunction useHasAppearanceControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\treturn hasFontStyles || hasFontWeights;\n}\n\nfunction useHasLetterSpacingControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseSetting( 'typography.letterSpacing', name )[ 0 ] &&\n\t\tsupports.includes( 'letterSpacing' )\n\t);\n}\n\nexport default function TypographyPanel( { name, element } ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst [ fontSizes ] = useSetting( 'typography.fontSizes', name );\n\tconst disableCustomFontSizes = ! useSetting(\n\t\t'typography.customFontSize',\n\t\tname\n\t)[ 0 ];\n\tconst [ fontFamilies ] = useSetting( 'typography.fontFamilies', name );\n\tconst hasFontStyles =\n\t\tuseSetting( 'typography.fontStyle', name )[ 0 ] &&\n\t\tsupports.includes( 'fontStyle' );\n\tconst hasFontWeights =\n\t\tuseSetting( 'typography.fontWeight', name )[ 0 ] &&\n\t\tsupports.includes( 'fontWeight' );\n\tconst hasLineHeightEnabled = useHasLineHeightControl( name );\n\tconst hasAppearanceControl = useHasAppearanceControl( name );\n\tconst hasLetterSpacingControl = useHasLetterSpacingControl( name );\n\n\tconst [ fontFamily, setFontFamily ] = useStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontSize, setFontSize ] = useStyle(\n\t\tprefix + 'typography.fontSize',\n\t\tname\n\t);\n\n\tconst [ fontStyle, setFontStyle ] = useStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight, setFontWeight ] = useStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ lineHeight, setLineHeight ] = useStyle(\n\t\tprefix + 'typography.lineHeight',\n\t\tname\n\t);\n\tconst [ letterSpacing, setLetterSpacing ] = useStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useStyle( prefix + 'color.background', name );\n\tconst [ gradientValue ] = useStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useStyle( prefix + 'color.text', name );\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\n\treturn (\n\t\t<PanelBody className=\"edit-site-typography-panel\" initialOpen={ true }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-typography-panel__preview\"\n\t\t\t\tstyle={ {\n\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\tcolor,\n\t\t\t\t\tfontSize,\n\t\t\t\t\tfontStyle,\n\t\t\t\t\tfontWeight,\n\t\t\t\t\tletterSpacing,\n\t\t\t\t\t...extraStyles,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\tAa\n\t\t\t</div>\n\n\t\t\t{ supports.includes( 'fontFamily' ) && (\n\t\t\t\t<FontFamilyControl\n\t\t\t\t\tfontFamilies={ fontFamilies }\n\t\t\t\t\tvalue={ fontFamily }\n\t\t\t\t\tonChange={ setFontFamily }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ supports.includes( 'fontSize' ) && (\n\t\t\t\t<FontSizePicker\n\t\t\t\t\tvalue={ fontSize }\n\t\t\t\t\tonChange={ setFontSize }\n\t\t\t\t\tfontSizes={ fontSizes }\n\t\t\t\t\tdisableCustomFontSizes={ disableCustomFontSizes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLineHeightEnabled && (\n\t\t\t\t<LineHeightControl\n\t\t\t\t\tvalue={ lineHeight }\n\t\t\t\t\tonChange={ setLineHeight }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasAppearanceControl && (\n\t\t\t\t<FontAppearanceControl\n\t\t\t\t\tvalue={ {\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t} }\n\t\t\t\t\tonChange={ ( {\n\t\t\t\t\t\tfontStyle: newFontStyle,\n\t\t\t\t\t\tfontWeight: newFontWeight,\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tsetFontStyle( newFontStyle );\n\t\t\t\t\t\tsetFontWeight( newFontWeight );\n\t\t\t\t\t} }\n\t\t\t\t\thasFontStyles={ hasFontStyles }\n\t\t\t\t\thasFontWeights={ hasFontWeights }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasLetterSpacingControl && (\n\t\t\t\t<LetterSpacingControl\n\t\t\t\t\tvalue={ letterSpacing }\n\t\t\t\t\tonChange={ setLetterSpacing }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -13,6 +13,7 @@ import ScreenRoot from './screen-root';
|
|
|
13
13
|
import ScreenBlockList from './screen-block-list';
|
|
14
14
|
import ScreenBlock from './screen-block';
|
|
15
15
|
import ScreenTypography from './screen-typography';
|
|
16
|
+
import ScreenTypographyElement from './screen-typography-element';
|
|
16
17
|
import ScreenColors from './screen-colors';
|
|
17
18
|
import ScreenColorPalette from './screen-color-palette';
|
|
18
19
|
import ScreenBackgroundColor from './screen-background-color';
|
|
@@ -29,6 +30,16 @@ function ContextScreens(_ref) {
|
|
|
29
30
|
path: parentMenu + '/typography'
|
|
30
31
|
}, createElement(ScreenTypography, {
|
|
31
32
|
name: name
|
|
33
|
+
})), createElement(NavigatorScreen, {
|
|
34
|
+
path: parentMenu + '/typography/text'
|
|
35
|
+
}, createElement(ScreenTypographyElement, {
|
|
36
|
+
name: name,
|
|
37
|
+
element: "text"
|
|
38
|
+
})), createElement(NavigatorScreen, {
|
|
39
|
+
path: parentMenu + '/typography/link'
|
|
40
|
+
}, createElement(ScreenTypographyElement, {
|
|
41
|
+
name: name,
|
|
42
|
+
element: "link"
|
|
32
43
|
})), createElement(NavigatorScreen, {
|
|
33
44
|
path: parentMenu + '/colors'
|
|
34
45
|
}, createElement(ScreenColors, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","getBlockTypes","ScreenRoot","ScreenBlockList","ScreenBlock","ScreenTypography","ScreenColors","ScreenColorPalette","ScreenBackgroundColor","ScreenTextColor","ScreenLinkColor","ScreenLayout","ContextScreens","name","parentMenu","undefined","GlobalStylesUI","blocks","map","block"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,aAAT,QAA8B,mBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,qBAAP,MAAkC,2BAAlC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;;AAEA,SAASC,cAAT,OAAoC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AAEA,SACC,8BACC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,cAAC,gBAAD;AAAkB,IAAA,IAAI,EAAGD;AAAzB,IADD,CADD,EAKC,cAAC,eAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAGD;AAArB,IADD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/ui.js"],"names":["__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","getBlockTypes","ScreenRoot","ScreenBlockList","ScreenBlock","ScreenTypography","ScreenTypographyElement","ScreenColors","ScreenColorPalette","ScreenBackgroundColor","ScreenTextColor","ScreenLinkColor","ScreenLayout","ContextScreens","name","parentMenu","undefined","GlobalStylesUI","blocks","map","block"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,aAAT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D;AA6BA;;AAED,eAAeG,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\nimport { getBlockTypes } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenTypographyElement from './screen-typography-element';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\nimport ScreenBackgroundColor from './screen-background-color';\nimport ScreenTextColor from './screen-text-color';\nimport ScreenLinkColor from './screen-link-color';\nimport ScreenLayout from './screen-layout';\n\nfunction ContextScreens( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\n\treturn (\n\t\t<>\n\t\t\t<NavigatorScreen path={ parentMenu + '/typography' }>\n\t\t\t\t<ScreenTypography name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/typography/text' }>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"text\" />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/typography/link' }>\n\t\t\t\t<ScreenTypographyElement name={ name } element=\"link\" />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors' }>\n\t\t\t\t<ScreenColors name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/palette' }>\n\t\t\t\t<ScreenColorPalette name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/background' }>\n\t\t\t\t<ScreenBackgroundColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/text' }>\n\t\t\t\t<ScreenTextColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/colors/link' }>\n\t\t\t\t<ScreenLinkColor name={ name } />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path={ parentMenu + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStylesUI() {\n\tconst blocks = getBlockTypes();\n\n\treturn (\n\t\t<NavigatorProvider initialPath=\"/\">\n\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t<ScreenRoot />\n\t\t\t</NavigatorScreen>\n\n\t\t\t<NavigatorScreen path=\"/blocks\">\n\t\t\t\t<ScreenBlockList />\n\t\t\t</NavigatorScreen>\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<NavigatorScreen\n\t\t\t\t\tkey={ 'menu-block-' + block.name }\n\t\t\t\t\tpath={ '/blocks/' + block.name }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ block.name } />\n\t\t\t\t</NavigatorScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ blocks.map( ( block ) => (\n\t\t\t\t<ContextScreens\n\t\t\t\t\tkey={ 'screens-block-' + block.name }\n\t\t\t\t\tname={ block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStylesUI;\n"]}
|
|
@@ -49,7 +49,7 @@ function getPresetsDeclarations() {
|
|
|
49
49
|
cssVarInfix
|
|
50
50
|
} = _ref;
|
|
51
51
|
const presetByOrigin = get(blockPresets, path, []);
|
|
52
|
-
['default', 'theme', '
|
|
52
|
+
['default', 'theme', 'custom'].forEach(origin => {
|
|
53
53
|
if (presetByOrigin[origin]) {
|
|
54
54
|
presetByOrigin[origin].forEach(value => {
|
|
55
55
|
declarations.push(`--wp--preset--${cssVarInfix}--${kebabCase(value.slug)}: ${value[valueKey]}`);
|
|
@@ -82,7 +82,7 @@ function getPresetsClasses(blockSelector) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const presetByOrigin = get(blockPresets, path, []);
|
|
85
|
-
['default', 'theme', '
|
|
85
|
+
['default', 'theme', 'custom'].forEach(origin => {
|
|
86
86
|
if (presetByOrigin[origin]) {
|
|
87
87
|
presetByOrigin[origin].forEach(_ref3 => {
|
|
88
88
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["first","forEach","get","isEmpty","isString","kebabCase","pickBy","reduce","set","startsWith","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockTypes","useEffect","useState","useContext","PRESET_METADATA","ROOT_BLOCK_SELECTOR","GlobalStylesContext","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","declarations","path","valueKey","cssVarInfix","presetByOrigin","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","properties","pathToValue","styleValue","entries","entry","name","prop","cssProperty","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","elements","blocks","node","blockName","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","nodesWithStyles","nodesWithSettings","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","merged","mergedConfig","customProperties","globalStyles","css","isGlobalStyles","__experimentalNoWrapper"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KADD,EAECC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f,IAAkC1F,QAAQ,CAAE,EAAF,CAAhD;AACA,QAAM,CAAEwE,QAAF,EAAYmB,WAAZ,IAA4B3F,QAAQ,CAAE,EAAF,CAA1C;AACA,QAAM;AAAE4F,IAAAA,MAAM,EAAEC;AAAV,MAA2B5F,UAAU,CAAEG,mBAAF,CAA3C;AAEAL,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,EAAE8F,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAEhC,MAAhB,KAA0B,EAAEgC,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAErB,QAAhB,CAA/B,EAA0D;AACzD;AACA;;AAED,UAAMb,cAAc,GAAGwB,iBAAiB,CAAErF,aAAa,EAAf,CAAxC;AACA,UAAMgG,gBAAgB,GAAGjB,kBAAkB,CAC1CgB,YAD0C,EAE1ClC,cAF0C,CAA3C;AAIA,UAAMoC,YAAY,GAAGf,QAAQ,CAAEa,YAAF,EAAgBlC,cAAhB,CAA7B;AACA+B,IAAAA,cAAc,CAAE,CACf;AACCM,MAAAA,GAAG,EAAEF,gBADN;AAECG,MAAAA,cAAc,EAAE,IAFjB;AAGCC,MAAAA,uBAAuB,EAAE;AAH1B,KADe,EAMf;AACCF,MAAAA,GAAG,EAAED,YADN;AAECE,MAAAA,cAAc,EAAE;AAFjB,KANe,CAAF,CAAd;AAWAN,IAAAA,WAAW,CAAEE,YAAY,CAACrB,QAAf,CAAX;AACA,GAvBQ,EAuBN,CAAEqB,YAAF,CAvBM,CAAT;AAyBA,SAAO,CAAEJ,WAAF,EAAejB,QAAf,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'user' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'user' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\treturn reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography' ].includes( key )\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset =\n\t\t'.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';\n\tnodesWithStyles.forEach( ( { selector, styles } ) => {\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t\t__experimentalNoWrapper: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings ];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/use-global-styles-output.js"],"names":["first","forEach","get","isEmpty","isString","kebabCase","pickBy","reduce","set","startsWith","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","__EXPERIMENTAL_ELEMENTS","ELEMENTS","getBlockTypes","useEffect","useState","useContext","PRESET_METADATA","ROOT_BLOCK_SELECTOR","GlobalStylesContext","compileStyleValue","uncompiledValue","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","variable","slice","length","split","join","getPresetsDeclarations","blockPresets","declarations","path","valueKey","cssVarInfix","presetByOrigin","origin","value","push","slug","getPresetsClasses","blockSelector","classes","classSuffix","propertyName","classSelectorToUse","selectorToUse","map","selector","flattenTree","input","prefix","token","result","Object","keys","key","newKey","replace","newLeaf","newPrefix","getStylesDeclarations","blockStyles","properties","pathToValue","styleValue","entries","entry","name","prop","cssProperty","getNodesWithStyles","tree","blockSelectors","nodes","styles","pickStyleKeys","treeToPickFrom","includes","elements","blocks","node","blockName","elementName","sel","getNodesWithSettings","settings","pickPresets","presets","custom","blockCustom","toCustomProperties","ruleset","customProps","toStyles","nodesWithStyles","nodesWithSettings","getBlockSelectors","blockTypes","blockType","supports","__experimentalSelector","useGlobalStylesOutput","stylesheets","setStylesheets","setSettings","merged","mergedConfig","customProperties","globalStyles","css","isGlobalStyles","__experimentalNoWrapper"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KADD,EAECC,OAFD,EAGCC,GAHD,EAICC,OAJD,EAKCC,QALD,EAMCC,SAND,EAOCC,MAPD,EAQCC,MARD,EASCC,GATD,EAUCC,UAVD,QAWO,QAXP;AAaA;AACA;AAC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4F,IAAAA,MAAM,EAAEC;AAAV,MAA2B5F,UAAU,CAAEG,mBAAF,CAA3C;AAEAL,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,EAAE8F,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAEhC,MAAhB,KAA0B,EAAEgC,YAAF,aAAEA,YAAF,eAAEA,YAAY,CAAErB,QAAhB,CAA/B,EAA0D;AACzD;AACA;;AAED,UAAMb,cAAc,GAAGwB,iBAAiB,CAAErF,aAAa,EAAf,CAAxC;AACA,UAAMgG,gBAAgB,GAAGjB,kBAAkB,CAC1CgB,YAD0C,EAE1ClC,cAF0C,CAA3C;AAIA,UAAMoC,YAAY,GAAGf,QAAQ,CAAEa,YAAF,EAAgBlC,cAAhB,CAA7B;AACA+B,IAAAA,cAAc,CAAE,CACf;AACCM,MAAAA,GAAG,EAAEF,gBADN;AAECG,MAAAA,cAAc,EAAE,IAFjB;AAGCC,MAAAA,uBAAuB,EAAE;AAH1B,KADe,EAMf;AACCF,MAAAA,GAAG,EAAED,YADN;AAECE,MAAAA,cAAc,EAAE;AAFjB,KANe,CAAF,CAAd;AAWAN,IAAAA,WAAW,CAAEE,YAAY,CAACrB,QAAf,CAAX;AACA,GAvBQ,EAuBN,CAAEqB,YAAF,CAvBM,CAAT;AAyBA,SAAO,CAAEJ,WAAF,EAAejB,QAAf,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tpickBy,\n\treduce,\n\tset,\n\tstartsWith,\n} from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n\tgetBlockTypes,\n} from '@wordpress/blocks';\nimport { useEffect, useState, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\n/**\n * Internal dependencies\n */\nimport { PRESET_METADATA, ROOT_BLOCK_SELECTOR } from './utils';\nimport { GlobalStylesContext } from './context';\n\nfunction compileStyleValue( uncompiledValue ) {\n\tconst VARIABLE_REFERENCE_PREFIX = 'var:';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\n\tconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Transform given preset tree into a set of style declarations.\n *\n * @param {Object} blockPresets\n *\n * @return {Array} An array of style declarations.\n */\nfunction getPresetsDeclarations( blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, valueKey, cssVarInfix } ) => {\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( value ) => {\n\t\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t\t`--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tvalue.slug\n\t\t\t\t\t\t\t) }: ${ value[ valueKey ] }`\n\t\t\t\t\t\t);\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\n/**\n * Transform given preset tree into a set of preset class declarations.\n *\n * @param {string} blockSelector\n * @param {Object} blockPresets\n * @return {string} CSS declarations for the preset classes.\n */\nfunction getPresetsClasses( blockSelector, blockPresets = {} ) {\n\treturn reduce(\n\t\tPRESET_METADATA,\n\t\t( declarations, { path, cssVarInfix, classes } ) => {\n\t\t\tif ( ! classes ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst presetByOrigin = get( blockPresets, path, [] );\n\t\t\t[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {\n\t\t\t\tif ( presetByOrigin[ origin ] ) {\n\t\t\t\t\tpresetByOrigin[ origin ].forEach( ( { slug } ) => {\n\t\t\t\t\t\tclasses.forEach( ( { classSuffix, propertyName } ) => {\n\t\t\t\t\t\t\tconst classSelectorToUse = `.has-${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) }-${ classSuffix }`;\n\t\t\t\t\t\t\tconst selectorToUse = blockSelector\n\t\t\t\t\t\t\t\t.split( ',' ) // Selector can be \"h1, h2, h3\"\n\t\t\t\t\t\t\t\t.map(\n\t\t\t\t\t\t\t\t\t( selector ) =>\n\t\t\t\t\t\t\t\t\t\t`${ selector }${ classSelectorToUse }`\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t.join( ',' );\n\t\t\t\t\t\t\tconst value = `var(--wp--preset--${ cssVarInfix }--${ kebabCase(\n\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t) })`;\n\t\t\t\t\t\t\tdeclarations += `${ selectorToUse }{${ propertyName }: ${ value } !important;}`;\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn declarations;\n\t\t},\n\t\t''\n\t);\n}\n\nfunction flattenTree( input = {}, prefix, token ) {\n\tlet result = [];\n\tObject.keys( input ).forEach( ( key ) => {\n\t\tconst newKey = prefix + kebabCase( key.replace( '/', '-' ) );\n\t\tconst newLeaf = input[ key ];\n\n\t\tif ( newLeaf instanceof Object ) {\n\t\t\tconst newPrefix = newKey + token;\n\t\t\tresult = [ ...result, ...flattenTree( newLeaf, newPrefix, token ) ];\n\t\t} else {\n\t\t\tresult.push( `${ newKey }: ${ newLeaf }` );\n\t\t}\n\t} );\n\treturn result;\n}\n\n/**\n * Transform given style tree into a set of style declarations.\n *\n * @param {Object} blockStyles Block styles.\n *\n * @return {Array} An array of style declarations.\n */\nfunction getStylesDeclarations( blockStyles = {} ) {\n\treturn reduce(\n\t\tSTYLE_PROPERTY,\n\t\t( declarations, { value, properties }, key ) => {\n\t\t\tconst pathToValue = value;\n\t\t\tif ( first( pathToValue ) === 'elements' ) {\n\t\t\t\treturn declarations;\n\t\t\t}\n\n\t\t\tconst styleValue = get( blockStyles, pathToValue );\n\n\t\t\tif ( !! properties && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( properties ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, prop ] = entry;\n\n\t\t\t\t\tif ( ! get( styleValue, [ prop ], false ) ) {\n\t\t\t\t\t\t// Do not create a declaration\n\t\t\t\t\t\t// for sub-properties that don't have any value.\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst cssProperty = kebabCase( name );\n\t\t\t\t\tdeclarations.push(\n\t\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\t\tget( styleValue, [ prop ] )\n\t\t\t\t\t\t) }`\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t} else if ( get( blockStyles, pathToValue, false ) ) {\n\t\t\t\tconst cssProperty = key.startsWith( '--' )\n\t\t\t\t\t? key\n\t\t\t\t\t: kebabCase( key );\n\t\t\t\tdeclarations.push(\n\t\t\t\t\t`${ cssProperty }: ${ compileStyleValue(\n\t\t\t\t\t\tget( blockStyles, pathToValue )\n\t\t\t\t\t) }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn declarations;\n\t\t},\n\t\t[]\n\t);\n}\n\nexport const getNodesWithStyles = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.styles ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickStyleKeys = ( treeToPickFrom ) =>\n\t\tpickBy( treeToPickFrom, ( value, key ) =>\n\t\t\t[ 'border', 'color', 'spacing', 'typography' ].includes( key )\n\t\t);\n\n\t// Top-level.\n\tconst styles = pickStyleKeys( tree.styles );\n\tif ( !! styles ) {\n\t\tnodes.push( {\n\t\t\tstyles,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\tforEach( tree.styles?.elements, ( value, key ) => {\n\t\tif ( !! value && !! ELEMENTS[ key ] ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: value,\n\t\t\t\tselector: ELEMENTS[ key ],\n\t\t\t} );\n\t\t}\n\t} );\n\n\t// Iterate over blocks: they can have styles & elements.\n\tforEach( tree.styles?.blocks, ( node, blockName ) => {\n\t\tconst blockStyles = pickStyleKeys( node );\n\t\tif ( !! blockStyles && !! blockSelectors?.[ blockName ]?.selector ) {\n\t\t\tnodes.push( {\n\t\t\t\tstyles: blockStyles,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\n\t\tforEach( node?.elements, ( value, elementName ) => {\n\t\t\tif (\n\t\t\t\t!! value &&\n\t\t\t\t!! blockSelectors?.[ blockName ] &&\n\t\t\t\t!! ELEMENTS?.[ elementName ]\n\t\t\t) {\n\t\t\t\tnodes.push( {\n\t\t\t\t\tstyles: value,\n\t\t\t\t\tselector: blockSelectors[ blockName ].selector\n\t\t\t\t\t\t.split( ',' )\n\t\t\t\t\t\t.map( ( sel ) => sel + ' ' + ELEMENTS[ elementName ] )\n\t\t\t\t\t\t.join( ',' ),\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn nodes;\n};\n\nexport const getNodesWithSettings = ( tree, blockSelectors ) => {\n\tconst nodes = [];\n\n\tif ( ! tree?.settings ) {\n\t\treturn nodes;\n\t}\n\n\tconst pickPresets = ( treeToPickFrom ) => {\n\t\tconst presets = {};\n\t\tPRESET_METADATA.forEach( ( { path } ) => {\n\t\t\tconst value = get( treeToPickFrom, path, false );\n\t\t\tif ( value !== false ) {\n\t\t\t\tset( presets, path, value );\n\t\t\t}\n\t\t} );\n\t\treturn presets;\n\t};\n\n\t// Top-level.\n\tconst presets = pickPresets( tree.settings );\n\tconst custom = tree.settings?.custom;\n\tif ( ! isEmpty( presets ) || !! custom ) {\n\t\tnodes.push( {\n\t\t\tpresets,\n\t\t\tcustom,\n\t\t\tselector: ROOT_BLOCK_SELECTOR,\n\t\t} );\n\t}\n\n\t// Blocks.\n\tforEach( tree.settings?.blocks, ( node, blockName ) => {\n\t\tconst blockPresets = pickPresets( node );\n\t\tconst blockCustom = node.custom;\n\t\tif ( ! isEmpty( blockPresets ) || !! blockCustom ) {\n\t\t\tnodes.push( {\n\t\t\t\tpresets: blockPresets,\n\t\t\t\tcustom: blockCustom,\n\t\t\t\tselector: blockSelectors[ blockName ].selector,\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn nodes;\n};\n\nexport const toCustomProperties = ( tree, blockSelectors ) => {\n\tconst settings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset = '';\n\tsettings.forEach( ( { presets, custom, selector } ) => {\n\t\tconst declarations = getPresetsDeclarations( presets );\n\t\tconst customProps = flattenTree( custom, '--wp--custom--', '--' );\n\t\tif ( customProps.length > 0 ) {\n\t\t\tdeclarations.push( ...customProps );\n\t\t}\n\n\t\tif ( declarations.length > 0 ) {\n\t\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nexport const toStyles = ( tree, blockSelectors ) => {\n\tconst nodesWithStyles = getNodesWithStyles( tree, blockSelectors );\n\tconst nodesWithSettings = getNodesWithSettings( tree, blockSelectors );\n\n\tlet ruleset =\n\t\t'.wp-site-blocks > * { margin-top: 0; margin-bottom: 0; }.wp-site-blocks > * + * { margin-top: var( --wp--style--block-gap ); }';\n\tnodesWithStyles.forEach( ( { selector, styles } ) => {\n\t\tconst declarations = getStylesDeclarations( styles );\n\t\tif ( declarations.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\truleset = ruleset + `${ selector }{${ declarations.join( ';' ) };}`;\n\t} );\n\n\tnodesWithSettings.forEach( ( { selector, presets } ) => {\n\t\tif ( ROOT_BLOCK_SELECTOR === selector ) {\n\t\t\t// Do not add extra specificity for top-level classes.\n\t\t\tselector = '';\n\t\t}\n\n\t\tconst classes = getPresetsClasses( selector, presets );\n\t\tif ( ! isEmpty( classes ) ) {\n\t\t\truleset = ruleset + classes;\n\t\t}\n\t} );\n\n\treturn ruleset;\n};\n\nconst getBlockSelectors = ( blockTypes ) => {\n\tconst result = {};\n\tblockTypes.forEach( ( blockType ) => {\n\t\tconst name = blockType.name;\n\t\tconst selector =\n\t\t\tblockType?.supports?.__experimentalSelector ??\n\t\t\t'.wp-block-' + name.replace( 'core/', '' ).replace( '/', '-' );\n\t\tresult[ name ] = {\n\t\t\tname,\n\t\t\tselector,\n\t\t};\n\t} );\n\n\treturn result;\n};\n\nexport function useGlobalStylesOutput() {\n\tconst [ stylesheets, setStylesheets ] = useState( [] );\n\tconst [ settings, setSettings ] = useState( {} );\n\tconst { merged: mergedConfig } = useContext( GlobalStylesContext );\n\n\tuseEffect( () => {\n\t\tif ( ! mergedConfig?.styles || ! mergedConfig?.settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst blockSelectors = getBlockSelectors( getBlockTypes() );\n\t\tconst customProperties = toCustomProperties(\n\t\t\tmergedConfig,\n\t\t\tblockSelectors\n\t\t);\n\t\tconst globalStyles = toStyles( mergedConfig, blockSelectors );\n\t\tsetStylesheets( [\n\t\t\t{\n\t\t\t\tcss: customProperties,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t\t__experimentalNoWrapper: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcss: globalStyles,\n\t\t\t\tisGlobalStyles: true,\n\t\t\t},\n\t\t] );\n\t\tsetSettings( mergedConfig.settings );\n\t}, [ mergedConfig ] );\n\n\treturn [ stylesheets, settings ];\n}\n"]}
|