@wordpress/edit-site 3.0.1-next.253d9b6e21.0 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/components/block-editor/back-button.js +60 -0
- package/build/components/block-editor/back-button.js.map +1 -0
- package/build/components/block-editor/index.js +20 -5
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +63 -0
- package/build/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build/components/editor/global-styles-provider.js +15 -2
- package/build/components/editor/global-styles-provider.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +8 -8
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +7 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/utils.js +4 -9
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/context-menu.js +58 -0
- package/build/components/global-styles/context-menu.js.map +1 -0
- package/build/components/{sidebar → global-styles}/dimensions-panel.js +58 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +1 -0
- package/build/components/global-styles/index.js +89 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +43 -0
- package/build/components/global-styles/navigation-button.js.map +1 -0
- package/build/components/global-styles/palette.js +57 -0
- package/build/components/global-styles/palette.js.map +1 -0
- package/build/components/global-styles/preview.js +59 -0
- package/build/components/global-styles/preview.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +76 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -0
- package/build/components/global-styles/screen-block.js +45 -0
- package/build/components/global-styles/screen-block.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +48 -0
- package/build/components/global-styles/screen-color-palette.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +51 -0
- package/build/components/global-styles/screen-colors.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +60 -0
- package/build/components/global-styles/screen-layout.js.map +1 -0
- package/build/components/global-styles/screen-root.js +44 -0
- package/build/components/global-styles/screen-root.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +50 -0
- package/build/components/global-styles/screen-typography.js.map +1 -0
- package/build/components/global-styles/subtitle.js +25 -0
- package/build/components/global-styles/subtitle.js.map +1 -0
- package/build/components/{sidebar → global-styles}/typography-panel.js +1 -3
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/header/document-actions/index.js +1 -1
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +82 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +75 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/header/undo-redo/redo.js +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -10
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +10 -10
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build/components/save-button/index.js +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -161
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +95 -0
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build/components/template-details/index.js +12 -6
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +73 -0
- package/build/components/template-details/template-areas.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +3 -3
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/index.js +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +60 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +19 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +16 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +91 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +48 -0
- package/build-module/components/block-editor/back-button.js.map +1 -0
- package/build-module/components/block-editor/index.js +17 -5
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +49 -0
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build-module/components/editor/global-styles-provider.js +16 -3
- package/build-module/components/editor/global-styles-provider.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +8 -8
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +4 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/utils.js +2 -7
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-panel.js +25 -22
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/context-menu.js +41 -0
- package/build-module/components/global-styles/context-menu.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/dimensions-panel.js +58 -9
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +1 -0
- package/build-module/components/global-styles/index.js +70 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +31 -0
- package/build-module/components/global-styles/navigation-button.js.map +1 -0
- package/build-module/components/global-styles/palette.js +43 -0
- package/build-module/components/global-styles/palette.js.map +1 -0
- package/build-module/components/global-styles/preview.js +50 -0
- package/build-module/components/global-styles/preview.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +58 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +32 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +35 -0
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +38 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +44 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +29 -0
- package/build-module/components/global-styles/screen-root.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +37 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -0
- package/build-module/components/global-styles/subtitle.js +17 -0
- package/build-module/components/global-styles/subtitle.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/header/document-actions/index.js +1 -1
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +70 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +3 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +5 -3
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +13 -159
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +84 -0
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/template-details/index.js +13 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +60 -0
- package/build-module/components/template-details/template-areas.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +3 -3
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +51 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +13 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +16 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +85 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +158 -19
- package/build-style/style.css +158 -19
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +18 -2
- package/src/components/block-editor/style.scss +26 -0
- package/src/components/edit-template-part-menu-button/index.js +57 -0
- package/src/components/editor/global-styles-provider.js +19 -3
- package/src/components/editor/global-styles-renderer.js +8 -5
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/test/global-styles-provider.js +131 -0
- package/src/components/editor/test/global-styles-renderer.js +1 -1
- package/src/components/editor/test/utils.js +146 -0
- package/src/components/editor/utils.js +2 -7
- package/src/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +43 -28
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +60 -9
- package/src/components/global-styles/header.js +50 -0
- package/src/components/global-styles/index.js +81 -0
- package/src/components/global-styles/navigation-button.js +35 -0
- package/src/components/global-styles/palette.js +67 -0
- package/src/components/global-styles/preview.js +41 -0
- package/src/components/global-styles/screen-block-list.js +59 -0
- package/src/components/global-styles/screen-block.js +28 -0
- package/src/components/global-styles/screen-color-palette.js +33 -0
- package/src/components/global-styles/screen-colors.js +36 -0
- package/src/components/global-styles/screen-layout.js +45 -0
- package/src/components/global-styles/screen-root.js +43 -0
- package/src/components/global-styles/screen-typography.js +33 -0
- package/src/components/global-styles/style.scss +35 -0
- package/src/components/global-styles/subtitle.js +10 -0
- package/src/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/src/components/header/document-actions/index.js +1 -1
- package/src/components/header/plugin-more-menu-item/index.js +71 -0
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/header/undo-redo/redo.js +4 -1
- package/src/components/header/undo-redo/undo.js +4 -1
- package/src/components/keyboard-shortcuts/index.js +25 -40
- package/src/components/navigation-sidebar/index.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +9 -4
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/style.scss +1 -0
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +3 -2
- package/src/components/save-button/index.js +1 -1
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/sidebar/global-styles-sidebar.js +14 -187
- package/src/components/sidebar/index.js +2 -7
- package/src/components/sidebar/plugin-sidebar/index.js +80 -0
- package/src/components/sidebar/style.scss +40 -0
- package/src/components/template-details/index.js +17 -7
- package/src/components/template-details/style.scss +36 -27
- package/src/components/template-details/template-areas.js +66 -0
- package/src/components/template-part-converter/convert-to-regular.js +2 -8
- package/src/components/template-part-converter/index.js +1 -1
- package/src/components/url-query-controller/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/actions.js +59 -7
- package/src/store/constants.js +15 -0
- package/src/store/reducer.js +26 -12
- package/src/store/selectors.js +96 -9
- package/src/store/test/reducer.js +40 -23
- package/src/store/test/selectors.js +34 -3
- package/src/style.scss +1 -0
- package/build/components/sidebar/border-panel.js.map +0 -1
- package/build/components/sidebar/color-palette-panel.js.map +0 -1
- package/build/components/sidebar/color-panel.js.map +0 -1
- package/build/components/sidebar/dimensions-panel.js.map +0 -1
- package/build/components/sidebar/typography-panel.js.map +0 -1
- package/build-module/components/sidebar/border-panel.js.map +0 -1
- package/build-module/components/sidebar/color-palette-panel.js.map +0 -1
- package/build-module/components/sidebar/color-panel.js.map +0 -1
- package/build-module/components/sidebar/dimensions-panel.js.map +0 -1
- package/build-module/components/sidebar/typography-panel.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
7
|
+
import { typography, color, layout } from '@wordpress/icons';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useHasBorderPanel } from './border-panel';
|
|
14
|
+
import { useHasColorPanel } from './color-panel';
|
|
15
|
+
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
16
|
+
import { useHasTypographyPanel } from './typography-panel';
|
|
17
|
+
import NavigationButton from './navigation-button';
|
|
18
|
+
|
|
19
|
+
function ContextMenu({
|
|
20
|
+
context,
|
|
21
|
+
parentMenu = ''
|
|
22
|
+
}) {
|
|
23
|
+
const hasTypographyPanel = useHasTypographyPanel(context);
|
|
24
|
+
const hasColorPanel = useHasColorPanel(context);
|
|
25
|
+
const hasBorderPanel = useHasBorderPanel(context);
|
|
26
|
+
const hasDimensionsPanel = useHasDimensionsPanel(context);
|
|
27
|
+
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
28
|
+
return createElement(ItemGroup, null, hasTypographyPanel && createElement(NavigationButton, {
|
|
29
|
+
icon: typography,
|
|
30
|
+
path: parentMenu + '/typography'
|
|
31
|
+
}, __('Typography')), hasColorPanel && createElement(NavigationButton, {
|
|
32
|
+
icon: color,
|
|
33
|
+
path: parentMenu + '/colors'
|
|
34
|
+
}, __('Colors')), hasLayoutPanel && createElement(NavigationButton, {
|
|
35
|
+
icon: layout,
|
|
36
|
+
path: parentMenu + '/layout'
|
|
37
|
+
}, __('Layout')));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default ContextMenu;
|
|
41
|
+
//# sourceMappingURL=context-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["__experimentalItemGroup","ItemGroup","typography","color","layout","__","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","NavigationButton","ContextMenu","context","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAApC,QAAqD,uBAArD;AACA,SAASC,UAAT,EAAqBC,KAArB,EAA4BC,MAA5B,QAA0C,kBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;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,gBAAP,MAA6B,qBAA7B;;AAEA,SAASC,WAAT,CAAsB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,UAAU,GAAG;AAAxB,CAAtB,EAAqD;AACpD,QAAMC,kBAAkB,GAAGL,qBAAqB,CAAEG,OAAF,CAAhD;AACA,QAAMG,aAAa,GAAGR,gBAAgB,CAAEK,OAAF,CAAtC;AACA,QAAMI,cAAc,GAAGV,iBAAiB,CAAEM,OAAF,CAAxC;AACA,QAAMK,kBAAkB,GAAGT,qBAAqB,CAAEI,OAAF,CAAhD;AACA,QAAMM,cAAc,GAAGF,cAAc,IAAIC,kBAAzC;AAEA,SACC,cAAC,SAAD,QACGH,kBAAkB,IACnB,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGZ,UADR;AAEC,IAAA,IAAI,EAAGW,UAAU,GAAG;AAFrB,KAIGR,EAAE,CAAE,YAAF,CAJL,CAFF,EASGU,aAAa,IACd,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGZ,KADR;AAEC,IAAA,IAAI,EAAGU,UAAU,GAAG;AAFrB,KAIGR,EAAE,CAAE,QAAF,CAJL,CAVF,EAiBGa,cAAc,IACf,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGd,MADR;AAEC,IAAA,IAAI,EAAGS,UAAU,GAAG;AAFrB,KAIGR,EAAE,CAAE,QAAF,CAJL,CAlBF,CADD;AA4BA;;AAED,eAAeM,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { typography, color, layout } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-panel';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport NavigationButton from './navigation-button';\n\nfunction ContextMenu( { context, parentMenu = '' } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( context );\n\tconst hasColorPanel = useHasColorPanel( context );\n\tconst hasBorderPanel = useHasBorderPanel( context );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( context );\n\tconst hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<NavigationButton\n\t\t\t\t\ticon={ typography }\n\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t</NavigationButton>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<NavigationButton\n\t\t\t\t\ticon={ color }\n\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t</NavigationButton>\n\t\t\t) }\n\t\t\t{ hasLayoutPanel && (\n\t\t\t\t<NavigationButton\n\t\t\t\t\ticon={ layout }\n\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t</NavigationButton>\n\t\t\t) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default ContextMenu;\n"]}
|
|
@@ -4,17 +4,19 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalBoxControl as BoxControl, __experimentalUseCustomUnits as useCustomUnits } from '@wordpress/components';
|
|
7
|
+
import { __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem, __experimentalBoxControl as BoxControl, __experimentalUnitControl as UnitControl, __experimentalUseCustomUnits as useCustomUnits } from '@wordpress/components';
|
|
8
8
|
import { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { useSetting } from '../editor/utils';
|
|
14
|
+
const AXIAL_SIDES = ['horizontal', 'vertical'];
|
|
14
15
|
export function useHasDimensionsPanel(context) {
|
|
15
16
|
const hasPadding = useHasPadding(context);
|
|
16
17
|
const hasMargin = useHasMargin(context);
|
|
17
|
-
|
|
18
|
+
const hasGap = useHasGap(context);
|
|
19
|
+
return hasPadding || hasMargin || hasGap;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
function useHasPadding({
|
|
@@ -33,6 +35,14 @@ function useHasMargin({
|
|
|
33
35
|
return settings && supports.includes('margin');
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
function useHasGap({
|
|
39
|
+
name,
|
|
40
|
+
supports
|
|
41
|
+
}) {
|
|
42
|
+
const settings = useSetting('spacing.blockGap', name);
|
|
43
|
+
return settings && supports.includes('--wp--style--block-gap');
|
|
44
|
+
}
|
|
45
|
+
|
|
36
46
|
function filterValuesBySides(values, sides) {
|
|
37
47
|
if (!sides) {
|
|
38
48
|
// If no custom side configuration all sides are opted into by default.
|
|
@@ -41,7 +51,19 @@ function filterValuesBySides(values, sides) {
|
|
|
41
51
|
|
|
42
52
|
|
|
43
53
|
const filteredValues = {};
|
|
44
|
-
sides.forEach(side =>
|
|
54
|
+
sides.forEach(side => {
|
|
55
|
+
if (side === 'vertical') {
|
|
56
|
+
filteredValues.top = values.top;
|
|
57
|
+
filteredValues.bottom = values.bottom;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (side === 'horizontal') {
|
|
61
|
+
filteredValues.left = values.left;
|
|
62
|
+
filteredValues.right = values.right;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
filteredValues[side] = values[side];
|
|
66
|
+
});
|
|
45
67
|
return filteredValues;
|
|
46
68
|
}
|
|
47
69
|
|
|
@@ -70,11 +92,13 @@ export default function DimensionsPanel({
|
|
|
70
92
|
} = context;
|
|
71
93
|
const showPaddingControl = useHasPadding(context);
|
|
72
94
|
const showMarginControl = useHasMargin(context);
|
|
95
|
+
const showGapControl = useHasGap(context);
|
|
73
96
|
const units = useCustomUnits({
|
|
74
97
|
availableUnits: useSetting('spacing.units', name) || ['%', 'px', 'em', 'rem', 'vw']
|
|
75
98
|
});
|
|
76
99
|
const paddingValues = splitStyleValue(getStyle(name, 'padding'));
|
|
77
100
|
const paddingSides = useCustomSides(name, 'padding');
|
|
101
|
+
const isAxialPadding = paddingSides && paddingSides.some(side => AXIAL_SIDES.includes(side));
|
|
78
102
|
|
|
79
103
|
const setPaddingValues = newPaddingValues => {
|
|
80
104
|
const padding = filterValuesBySides(newPaddingValues, paddingSides);
|
|
@@ -83,10 +107,11 @@ export default function DimensionsPanel({
|
|
|
83
107
|
|
|
84
108
|
const resetPaddingValue = () => setPaddingValues({});
|
|
85
109
|
|
|
86
|
-
const hasPaddingValue = () => paddingValues && Object.keys(paddingValues).length;
|
|
110
|
+
const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length;
|
|
87
111
|
|
|
88
112
|
const marginValues = splitStyleValue(getStyle(name, 'margin'));
|
|
89
113
|
const marginSides = useCustomSides(name, 'margin');
|
|
114
|
+
const isAxialMargin = marginSides && marginSides.some(side => AXIAL_SIDES.includes(side));
|
|
90
115
|
|
|
91
116
|
const setMarginValues = newMarginValues => {
|
|
92
117
|
const margin = filterValuesBySides(newMarginValues, marginSides);
|
|
@@ -95,16 +120,26 @@ export default function DimensionsPanel({
|
|
|
95
120
|
|
|
96
121
|
const resetMarginValue = () => setMarginValues({});
|
|
97
122
|
|
|
98
|
-
const hasMarginValue = () => marginValues && Object.keys(marginValues).length;
|
|
123
|
+
const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length;
|
|
124
|
+
|
|
125
|
+
const gapValue = getStyle(name, '--wp--style--block-gap');
|
|
126
|
+
|
|
127
|
+
const setGapValue = newGapValue => {
|
|
128
|
+
setStyle(name, '--wp--style--block-gap', newGapValue);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const resetGapValue = () => setGapValue(undefined);
|
|
132
|
+
|
|
133
|
+
const hasGapValue = () => !!gapValue;
|
|
99
134
|
|
|
100
135
|
const resetAll = () => {
|
|
101
136
|
resetPaddingValue();
|
|
102
137
|
resetMarginValue();
|
|
138
|
+
resetGapValue();
|
|
103
139
|
};
|
|
104
140
|
|
|
105
141
|
return createElement(ToolsPanel, {
|
|
106
|
-
label: __('Dimensions
|
|
107
|
-
header: __('Dimensions'),
|
|
142
|
+
label: __('Dimensions'),
|
|
108
143
|
resetAll: resetAll
|
|
109
144
|
}, showPaddingControl && createElement(ToolsPanelItem, {
|
|
110
145
|
hasValue: hasPaddingValue,
|
|
@@ -117,7 +152,8 @@ export default function DimensionsPanel({
|
|
|
117
152
|
label: __('Padding'),
|
|
118
153
|
sides: paddingSides,
|
|
119
154
|
units: units,
|
|
120
|
-
allowReset: false
|
|
155
|
+
allowReset: false,
|
|
156
|
+
splitOnAxis: isAxialPadding
|
|
121
157
|
})), showMarginControl && createElement(ToolsPanelItem, {
|
|
122
158
|
hasValue: hasMarginValue,
|
|
123
159
|
label: __('Margin'),
|
|
@@ -129,7 +165,20 @@ export default function DimensionsPanel({
|
|
|
129
165
|
label: __('Margin'),
|
|
130
166
|
sides: marginSides,
|
|
131
167
|
units: units,
|
|
132
|
-
allowReset: false
|
|
168
|
+
allowReset: false,
|
|
169
|
+
splitOnAxis: isAxialMargin
|
|
170
|
+
})), showGapControl && createElement(ToolsPanelItem, {
|
|
171
|
+
hasValue: hasGapValue,
|
|
172
|
+
label: __('Block spacing'),
|
|
173
|
+
onDeselect: resetGapValue,
|
|
174
|
+
isShownByDefault: true
|
|
175
|
+
}, createElement(UnitControl, {
|
|
176
|
+
label: __('Block spacing'),
|
|
177
|
+
__unstableInputWidth: "80px",
|
|
178
|
+
min: 0,
|
|
179
|
+
onChange: setGapValue,
|
|
180
|
+
units: units,
|
|
181
|
+
value: gapValue
|
|
133
182
|
})));
|
|
134
183
|
}
|
|
135
184
|
//# sourceMappingURL=dimensions-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/dimensions-panel.js"],"names":["__","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalBoxControl","BoxControl","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUseCustomSides","useCustomSides","useSetting","AXIAL_SIDES","useHasDimensionsPanel","context","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","name","supports","settings","includes","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","DimensionsPanel","getStyle","setStyle","showPaddingControl","showMarginControl","showGapControl","units","availableUnits","paddingValues","paddingSides","isAxialPadding","some","setPaddingValues","newPaddingValues","padding","resetPaddingValue","hasPaddingValue","Object","keys","length","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","margin","resetMarginValue","hasMarginValue","gapValue","setGapValue","newGapValue","resetGapValue","undefined","hasGapValue","resetAll"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,wBAAwB,IAAIC,UAH7B,EAICC,yBAAyB,IAAIC,WAJ9B,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,4BAA4B,IAAIC,cAAzC,QAA+D,yBAA/D;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA,MAAMC,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;AAEA,OAAO,SAASC,qBAAT,CAAgCC,OAAhC,EAA0C;AAChD,QAAMC,UAAU,GAAGC,aAAa,CAAEF,OAAF,CAAhC;AACA,QAAMG,SAAS,GAAGC,YAAY,CAAEJ,OAAF,CAA9B;AACA,QAAMK,MAAM,GAAGC,SAAS,CAAEN,OAAF,CAAxB;AAEA,SAAOC,UAAU,IAAIE,SAAd,IAA2BE,MAAlC;AACA;;AAED,SAASH,aAAT,CAAwB;AAAEK,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAAxB,EAA6C;AAC5C,QAAMC,QAAQ,GAAGZ,UAAU,CAAE,uBAAF,EAA2BU,IAA3B,CAA3B;AAEA,SAAOE,QAAQ,IAAID,QAAQ,CAACE,QAAT,CAAmB,SAAnB,CAAnB;AACA;;AAED,SAASN,YAAT,CAAuB;AAAEG,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAAvB,EAA4C;AAC3C,QAAMC,QAAQ,GAAGZ,UAAU,CAAE,sBAAF,EAA0BU,IAA1B,CAA3B;AAEA,SAAOE,QAA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A","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n} from '@wordpress/components';\nimport { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( context ) {\n\tconst hasPadding = useHasPadding( context );\n\tconst hasMargin = useHasMargin( context );\n\tconst hasGap = useHasGap( context );\n\n\treturn hasPadding || hasMargin || hasGap;\n}\n\nfunction useHasPadding( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customPadding', name );\n\n\treturn settings && supports.includes( 'padding' );\n}\n\nfunction useHasMargin( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.customMargin', name );\n\n\treturn settings && supports.includes( 'margin' );\n}\n\nfunction useHasGap( { name, supports } ) {\n\tconst settings = useSetting( 'spacing.blockGap', name );\n\n\treturn settings && supports.includes( '--wp--style--block-gap' );\n}\n\nfunction filterValuesBySides( values, sides ) {\n\tif ( ! sides ) {\n\t\t// If no custom side configuration all sides are opted into by default.\n\t\treturn values;\n\t}\n\n\t// Only include sides opted into within filtered values.\n\tconst filteredValues = {};\n\tsides.forEach( ( side ) => {\n\t\tif ( side === 'vertical' ) {\n\t\t\tfilteredValues.top = values.top;\n\t\t\tfilteredValues.bottom = values.bottom;\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tfilteredValues.left = values.left;\n\t\t\tfilteredValues.right = values.right;\n\t\t}\n\t\tfilteredValues[ side ] = values[ side ];\n\t} );\n\n\treturn filteredValues;\n}\n\nfunction splitStyleValue( value ) {\n\t// Check for shorthand value ( a string value ).\n\tif ( value && typeof value === 'string' ) {\n\t\t// Convert to value for individual sides for BoxControl.\n\t\treturn {\n\t\t\ttop: value,\n\t\t\tright: value,\n\t\t\tbottom: value,\n\t\t\tleft: value,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nexport default function DimensionsPanel( { context, getStyle, setStyle } ) {\n\tconst { name } = context;\n\tconst showPaddingControl = useHasPadding( context );\n\tconst showMarginControl = useHasMargin( context );\n\tconst showGapControl = useHasGap( context );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units', name ) || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\tconst paddingValues = splitStyleValue( getStyle( name, 'padding' ) );\n\tconst paddingSides = useCustomSides( name, 'padding' );\n\tconst isAxialPadding =\n\t\tpaddingSides &&\n\t\tpaddingSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setPaddingValues = ( newPaddingValues ) => {\n\t\tconst padding = filterValuesBySides( newPaddingValues, paddingSides );\n\t\tsetStyle( name, 'padding', padding );\n\t};\n\tconst resetPaddingValue = () => setPaddingValues( {} );\n\tconst hasPaddingValue = () =>\n\t\t!! paddingValues && Object.keys( paddingValues ).length;\n\n\tconst marginValues = splitStyleValue( getStyle( name, 'margin' ) );\n\tconst marginSides = useCustomSides( name, 'margin' );\n\tconst isAxialMargin =\n\t\tmarginSides &&\n\t\tmarginSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\n\tconst setMarginValues = ( newMarginValues ) => {\n\t\tconst margin = filterValuesBySides( newMarginValues, marginSides );\n\t\tsetStyle( name, 'margin', margin );\n\t};\n\tconst resetMarginValue = () => setMarginValues( {} );\n\tconst hasMarginValue = () =>\n\t\t!! marginValues && Object.keys( marginValues ).length;\n\n\tconst gapValue = getStyle( name, '--wp--style--block-gap' );\n\n\tconst setGapValue = ( newGapValue ) => {\n\t\tsetStyle( name, '--wp--style--block-gap', newGapValue );\n\t};\n\tconst resetGapValue = () => setGapValue( undefined );\n\tconst hasGapValue = () => !! gapValue;\n\n\tconst resetAll = () => {\n\t\tresetPaddingValue();\n\t\tresetMarginValue();\n\t\tresetGapValue();\n\t};\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n\t\t\t{ showPaddingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasPaddingValue }\n\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\tonDeselect={ resetPaddingValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMarginControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMarginValue }\n\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\tonDeselect={ resetMarginValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BoxControl\n\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showGapControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\tonDeselect={ resetGapValue }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tonChange={ setGapValue }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tvalue={ gapValue }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalSpacer as Spacer, __experimentalHeading as Heading, __experimentalView as View } from '@wordpress/components';
|
|
7
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
8
|
+
import { chevronRight, chevronLeft, Icon } from '@wordpress/icons';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import NavigationButton from './navigation-button';
|
|
14
|
+
|
|
15
|
+
function ScreenHeader({
|
|
16
|
+
back,
|
|
17
|
+
title,
|
|
18
|
+
description
|
|
19
|
+
}) {
|
|
20
|
+
return createElement(VStack, {
|
|
21
|
+
spacing: 2
|
|
22
|
+
}, createElement(HStack, {
|
|
23
|
+
spacing: 2
|
|
24
|
+
}, createElement(View, null, createElement(NavigationButton, {
|
|
25
|
+
path: back,
|
|
26
|
+
icon: createElement(Icon, {
|
|
27
|
+
icon: isRTL() ? chevronRight : chevronLeft,
|
|
28
|
+
variant: "muted"
|
|
29
|
+
}),
|
|
30
|
+
size: "small",
|
|
31
|
+
isBack: true,
|
|
32
|
+
"aria-label": __('Navigate to the previous view')
|
|
33
|
+
})), createElement(Spacer, null, createElement(Heading, {
|
|
34
|
+
level: 5
|
|
35
|
+
}, title))), description && createElement("p", {
|
|
36
|
+
className: "edit-site-global-styles-header__description"
|
|
37
|
+
}, description));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default ScreenHeader;
|
|
41
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalSpacer","Spacer","__experimentalHeading","Heading","__experimentalView","View","isRTL","__","chevronRight","chevronLeft","Icon","NavigationButton","ScreenHeader","back","title","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,qBAAqB,IAAIC,OAJ1B,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,EAAoCC,IAApC,QAAgD,kBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;;AAEA,SAASC,YAAT,CAAuB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA;AAAf,CAAvB,EAAsD;AACrD,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,IAAD,QACC,cAAC,gBAAD;AACC,IAAA,IAAI,EAAGF,IADR;AAEC,IAAA,IAAI,EACH,cAAC,IAAD;AACC,MAAA,IAAI,EAAGP,KAAK,KAAKE,YAAL,GAAoBC,WADjC;AAEC,MAAA,OAAO,EAAC;AAFT,MAHF;AAQC,IAAA,IAAI,EAAC,OARN;AASC,IAAA,MAAM,MATP;AAUC,kBAAaF,EAAE,CAAE,+BAAF;AAVhB,IADD,CADD,EAeC,cAAC,MAAD,QACC,cAAC,OAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuBO,KAAvB,CADD,CAfD,CADD,EAoBGC,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CArBF,CADD;AA4BA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n\t__experimentalHeading as Heading,\n\t__experimentalView as View,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport NavigationButton from './navigation-button';\n\nfunction ScreenHeader( { back, title, description } ) {\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack spacing={ 2 }>\n\t\t\t\t<View>\n\t\t\t\t\t<NavigationButton\n\t\t\t\t\t\tpath={ back }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tisBack\n\t\t\t\t\t\taria-label={ __( 'Navigate to the previous view' ) }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t\t<Spacer>\n\t\t\t\t\t<Heading level={ 5 }>{ title }</Heading>\n\t\t\t\t</Spacer>\n\t\t\t</HStack>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"edit-site-global-styles-header__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default ScreenHeader;\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { map } from 'lodash';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen } from '@wordpress/components';
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
17
|
+
import ScreenRoot from './screen-root';
|
|
18
|
+
import ScreenBlockList from './screen-block-list';
|
|
19
|
+
import ScreenBlock from './screen-block';
|
|
20
|
+
import ScreenTypography from './screen-typography';
|
|
21
|
+
import ScreenColors from './screen-colors';
|
|
22
|
+
import ScreenColorPalette from './screen-color-palette';
|
|
23
|
+
import ScreenLayout from './screen-layout';
|
|
24
|
+
|
|
25
|
+
function ContextScreens({
|
|
26
|
+
name
|
|
27
|
+
}) {
|
|
28
|
+
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
29
|
+
return createElement(Fragment, null, createElement(NavigatorScreen, {
|
|
30
|
+
path: parentMenu + '/typography'
|
|
31
|
+
}, createElement(ScreenTypography, {
|
|
32
|
+
name: name
|
|
33
|
+
})), createElement(NavigatorScreen, {
|
|
34
|
+
path: parentMenu + '/colors'
|
|
35
|
+
}, createElement(ScreenColors, {
|
|
36
|
+
name: name
|
|
37
|
+
})), createElement(NavigatorScreen, {
|
|
38
|
+
path: parentMenu + '/colors/palette'
|
|
39
|
+
}, createElement(ScreenColorPalette, {
|
|
40
|
+
name: name
|
|
41
|
+
})), createElement(NavigatorScreen, {
|
|
42
|
+
path: parentMenu + '/layout'
|
|
43
|
+
}, createElement(ScreenLayout, {
|
|
44
|
+
name: name
|
|
45
|
+
})));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function GlobalStyles() {
|
|
49
|
+
const {
|
|
50
|
+
blocks
|
|
51
|
+
} = useGlobalStylesContext();
|
|
52
|
+
return createElement(NavigatorProvider, {
|
|
53
|
+
initialPath: "/"
|
|
54
|
+
}, createElement(NavigatorScreen, {
|
|
55
|
+
path: "/"
|
|
56
|
+
}, createElement(ScreenRoot, null)), createElement(NavigatorScreen, {
|
|
57
|
+
path: "/blocks"
|
|
58
|
+
}, createElement(ScreenBlockList, null)), map(blocks, (block, name) => createElement(NavigatorScreen, {
|
|
59
|
+
key: 'menu-block-' + name,
|
|
60
|
+
path: '/blocks/' + name
|
|
61
|
+
}, createElement(ScreenBlock, {
|
|
62
|
+
name: name
|
|
63
|
+
}))), createElement(ContextScreens, null), map(blocks, (_, name) => createElement(ContextScreens, {
|
|
64
|
+
key: 'screens-block-' + name,
|
|
65
|
+
name: name
|
|
66
|
+
})));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default GlobalStyles;
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/index.js"],"names":["map","__experimentalNavigatorProvider","NavigatorProvider","__experimentalNavigatorScreen","NavigatorScreen","useGlobalStylesContext","ScreenRoot","ScreenBlockList","ScreenBlock","ScreenTypography","ScreenColors","ScreenColorPalette","ScreenLayout","ContextScreens","name","parentMenu","undefined","GlobalStyles","blocks","block","_"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SACCC,+BAA+B,IAAIC,iBADpC,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,kCAAvC;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,OAAO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ApB,IAJD,CADI,CATN,EAkBC,cAAC,cAAD,OAlBD,EAoBGd,GAAG,CAAEkB,MAAF,EAAU,CAAEE,CAAF,EAAKN,IAAL,KACd,cAAC,cAAD;AAAgB,IAAA,GAAG,EAAG,mBAAmBA,IAAzC;AAAgD,IAAA,IAAI,EAAGA;AAAvD,IADI,CApBN,CADD;AA0BA;;AAED,eAAeG,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesContext } from '../editor/global-styles-provider';\nimport ScreenRoot from './screen-root';\nimport ScreenBlockList from './screen-block-list';\nimport ScreenBlock from './screen-block';\nimport ScreenTypography from './screen-typography';\nimport ScreenColors from './screen-colors';\nimport ScreenColorPalette from './screen-color-palette';\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 + '/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 + '/layout' }>\n\t\t\t\t<ScreenLayout name={ name } />\n\t\t\t</NavigatorScreen>\n\t\t</>\n\t);\n}\n\nfunction GlobalStyles() {\n\tconst { blocks } = useGlobalStylesContext();\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{ map( blocks, ( block, name ) => (\n\t\t\t\t<NavigatorScreen\n\t\t\t\t\tkey={ 'menu-block-' + name }\n\t\t\t\t\tpath={ '/blocks/' + name }\n\t\t\t\t>\n\t\t\t\t\t<ScreenBlock name={ name } />\n\t\t\t\t</NavigatorScreen>\n\t\t\t) ) }\n\n\t\t\t<ContextScreens />\n\n\t\t\t{ map( blocks, ( _, name ) => (\n\t\t\t\t<ContextScreens key={ 'screens-block-' + name } name={ name } />\n\t\t\t) ) }\n\t\t</NavigatorProvider>\n\t);\n}\n\nexport default GlobalStyles;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { __experimentalUseNavigator as useNavigator, __experimentalItem as Item, FlexItem, __experimentalHStack as HStack } from '@wordpress/components';
|
|
8
|
+
import { Icon } from '@wordpress/icons';
|
|
9
|
+
|
|
10
|
+
function NavigationButton({
|
|
11
|
+
path,
|
|
12
|
+
icon,
|
|
13
|
+
children,
|
|
14
|
+
isBack = false,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const navigator = useNavigator();
|
|
18
|
+
return createElement(Item, _extends({
|
|
19
|
+
onClick: () => navigator.push(path, {
|
|
20
|
+
isBack
|
|
21
|
+
})
|
|
22
|
+
}, props), icon && createElement(HStack, {
|
|
23
|
+
justify: "flex-start"
|
|
24
|
+
}, createElement(FlexItem, null, createElement(Icon, {
|
|
25
|
+
icon: icon,
|
|
26
|
+
size: 24
|
|
27
|
+
})), createElement(FlexItem, null, children)), !icon && children);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default NavigationButton;
|
|
31
|
+
//# sourceMappingURL=navigation-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["__experimentalUseNavigator","useNavigator","__experimentalItem","Item","FlexItem","__experimentalHStack","HStack","Icon","NavigationButton","path","icon","children","isBack","props","navigator","push"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,0BAA0B,IAAIC,YAD/B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,QAHD,EAICC,oBAAoB,IAAIC,MAJzB,QAKO,uBALP;AAMA,SAASC,IAAT,QAAqB,kBAArB;;AAEA,SAASC,gBAAT,CAA2B;AAC1BC,EAAAA,IAD0B;AAE1BC,EAAAA,IAF0B;AAG1BC,EAAAA,QAH0B;AAI1BC,EAAAA,MAAM,GAAG,KAJiB;AAK1B,KAAGC;AALuB,CAA3B,EAMI;AACH,QAAMC,SAAS,GAAGb,YAAY,EAA9B;AACA,SACC,cAAC,IAAD;AAAM,IAAA,OAAO,EAAG,MAAMa,SAAS,CAACC,IAAV,CAAgBN,IAAhB,EAAsB;AAAEG,MAAAA;AAAF,KAAtB;AAAtB,KAAgEC,KAAhE,GACGH,IAAI,IACL,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,QAAD,QACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGA,IAAb;AAAoB,IAAA,IAAI,EAAG;AAA3B,IADD,CADD,EAIC,cAAC,QAAD,QAAYC,QAAZ,CAJD,CAFF,EASG,CAAED,IAAF,IAAUC,QATb,CADD;AAaA;;AAED,eAAeH,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalItem as Item,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { Icon } from '@wordpress/icons';\n\nfunction NavigationButton( {\n\tpath,\n\ticon,\n\tchildren,\n\tisBack = false,\n\t...props\n} ) {\n\tconst navigator = useNavigator();\n\treturn (\n\t\t<Item onClick={ () => navigator.push( path, { isBack } ) } { ...props }>\n\t\t\t{ icon && (\n\t\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Icon icon={ icon } size={ 24 } />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>{ children }</FlexItem>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t\t{ ! icon && children }\n\t\t</Item>\n\t);\n}\n\nexport default NavigationButton;\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup, FlexItem, __experimentalHStack as HStack, __experimentalZStack as ZStack, __experimentalVStack as VStack, FlexBlock, ColorIndicator } from '@wordpress/components';
|
|
7
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import Subtitle from './subtitle';
|
|
13
|
+
import { useSetting } from '../editor/utils';
|
|
14
|
+
import NavigationButton from './navigation-button';
|
|
15
|
+
|
|
16
|
+
function Palette({
|
|
17
|
+
contextName
|
|
18
|
+
}) {
|
|
19
|
+
const colors = useSetting('color.palette', contextName);
|
|
20
|
+
const screenPath = contextName === 'root' ? '/colors/palette' : '/blocks/' + contextName + '/colors/palette';
|
|
21
|
+
return createElement("div", {
|
|
22
|
+
className: "edit-site-global-style-palette"
|
|
23
|
+
}, createElement(VStack, {
|
|
24
|
+
spacing: 1
|
|
25
|
+
}, createElement(Subtitle, null, __('Palette')), createElement(ItemGroup, {
|
|
26
|
+
isBordered: true,
|
|
27
|
+
isSeparated: true
|
|
28
|
+
}, createElement(NavigationButton, {
|
|
29
|
+
path: screenPath
|
|
30
|
+
}, createElement(HStack, null, createElement(FlexBlock, null, createElement(ZStack, {
|
|
31
|
+
isLayered: false,
|
|
32
|
+
offset: -8
|
|
33
|
+
}, colors.slice(0, 5).map(({
|
|
34
|
+
color
|
|
35
|
+
}) => createElement(ColorIndicator, {
|
|
36
|
+
key: color,
|
|
37
|
+
colorValue: color
|
|
38
|
+
})))), createElement(FlexItem, null, sprintf( // Translators: %d: Number of palette colors.
|
|
39
|
+
_n('%d color', '%d colors', colors.length), colors.length)))))));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default Palette;
|
|
43
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["__experimentalItemGroup","ItemGroup","FlexItem","__experimentalHStack","HStack","__experimentalZStack","ZStack","__experimentalVStack","VStack","FlexBlock","ColorIndicator","__","_n","sprintf","Subtitle","useSetting","NavigationButton","Palette","contextName","colors","screenPath","slice","map","color","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,QAFD,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,SAND,EAOCC,cAPD,QAQO,uBARP;AASA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;;AAEA,SAASC,OAAT,CAAkB;AAAEC,EAAAA;AAAF,CAAlB,EAAoC;AACnC,QAAMC,MAAM,GAAGJ,UAAU,CAAE,eAAF,EAAmBG,WAAnB,CAAzB;AACA,QAAME,UAAU,GACfF,WAAW,KAAK,MAAhB,GACG,iBADH,GAEG,aAAaA,WAAb,GAA2B,iBAH/B;AAKA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,QAAD,QAAYP,EAAE,CAAE,SAAF,CAAd,CADD,EAEC,cAAC,SAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACC,cAAC,gBAAD;AAAkB,IAAA,IAAI,EAAGS;AAAzB,KACC,cAAC,MAAD,QACC,cAAC,SAAD,QACC,cAAC,MAAD;AAAQ,IAAA,SAAS,EAAG,KAApB;AAA4B,IAAA,MAAM,EAAG,CAAC;AAAtC,KACGD,MAAM,CACNE,KADA,CACO,CADP,EACU,CADV,EAEAC,GAFA,CAEK,CAAE;AAAEC,IAAAA;AAAF,GAAF,KACL,cAAC,cAAD;AACC,IAAA,GAAG,EAAGA,KADP;AAEC,IAAA,UAAU,EAAGA;AAFd,IAHA,CADH,CADD,CADD,EAaC,cAAC,QAAD,QACGV,OAAO,EACR;AACAD,EAAAA,EAAE,CACD,UADC,EAED,WAFC,EAGDO,MAAM,CAACK,MAHN,CAFM,EAORL,MAAM,CAACK,MAPC,CADV,CAbD,CADD,CADD,CAFD,CADD,CADD;AAoCA;;AAED,eAAeP,OAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\tFlexItem,\n\t__experimentalHStack as HStack,\n\t__experimentalZStack as ZStack,\n\t__experimentalVStack as VStack,\n\tFlexBlock,\n\tColorIndicator,\n} from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Subtitle from './subtitle';\nimport { useSetting } from '../editor/utils';\nimport NavigationButton from './navigation-button';\n\nfunction Palette( { contextName } ) {\n\tconst colors = useSetting( 'color.palette', contextName );\n\tconst screenPath =\n\t\tcontextName === 'root'\n\t\t\t? '/colors/palette'\n\t\t\t: '/blocks/' + contextName + '/colors/palette';\n\n\treturn (\n\t\t<div className=\"edit-site-global-style-palette\">\n\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t<Subtitle>{ __( 'Palette' ) }</Subtitle>\n\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t<NavigationButton path={ screenPath }>\n\t\t\t\t\t\t<HStack>\n\t\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t\t<ZStack isLayered={ false } offset={ -8 }>\n\t\t\t\t\t\t\t\t\t{ colors\n\t\t\t\t\t\t\t\t\t\t.slice( 0, 5 )\n\t\t\t\t\t\t\t\t\t\t.map( ( { color } ) => (\n\t\t\t\t\t\t\t\t\t\t\t<ColorIndicator\n\t\t\t\t\t\t\t\t\t\t\t\tkey={ color }\n\t\t\t\t\t\t\t\t\t\t\t\tcolorValue={ color }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t\t</ZStack>\n\t\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t// Translators: %d: Number of palette colors.\n\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t'%d color',\n\t\t\t\t\t\t\t\t\t\t'%d colors',\n\t\t\t\t\t\t\t\t\t\tcolors.length\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tcolors.length\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</NavigationButton>\n\t\t\t\t</ItemGroup>\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default Palette;\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __experimentalHStack as HStack, __experimentalVStack as VStack, Card, ColorIndicator } from '@wordpress/components';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
12
|
+
|
|
13
|
+
const StylesPreview = () => {
|
|
14
|
+
var _getStyle, _getStyle2, _getStyle3, _getStyle4;
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
getStyle
|
|
18
|
+
} = useGlobalStylesContext();
|
|
19
|
+
const fontFamily = (_getStyle = getStyle('root', 'fontFamily')) !== null && _getStyle !== void 0 ? _getStyle : 'serif';
|
|
20
|
+
const textColor = (_getStyle2 = getStyle('root', 'color')) !== null && _getStyle2 !== void 0 ? _getStyle2 : 'black';
|
|
21
|
+
const linkColor = (_getStyle3 = getStyle('root', 'linkColor')) !== null && _getStyle3 !== void 0 ? _getStyle3 : 'blue';
|
|
22
|
+
const backgroundColor = (_getStyle4 = getStyle('root', 'backgroundColor')) !== null && _getStyle4 !== void 0 ? _getStyle4 : 'white';
|
|
23
|
+
return createElement(Card, {
|
|
24
|
+
className: "edit-site-global-styles-preview",
|
|
25
|
+
style: {
|
|
26
|
+
background: backgroundColor
|
|
27
|
+
}
|
|
28
|
+
}, createElement(HStack, {
|
|
29
|
+
spacing: 5
|
|
30
|
+
}, createElement("div", null, createElement("span", {
|
|
31
|
+
style: {
|
|
32
|
+
fontFamily,
|
|
33
|
+
fontSize: '80px'
|
|
34
|
+
}
|
|
35
|
+
}, "A"), createElement("span", {
|
|
36
|
+
style: {
|
|
37
|
+
fontFamily,
|
|
38
|
+
fontSize: '80px'
|
|
39
|
+
}
|
|
40
|
+
}, "a")), createElement(VStack, {
|
|
41
|
+
spacing: 2
|
|
42
|
+
}, createElement(ColorIndicator, {
|
|
43
|
+
colorValue: textColor
|
|
44
|
+
}), createElement(ColorIndicator, {
|
|
45
|
+
colorValue: linkColor
|
|
46
|
+
}))));
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default StylesPreview;
|
|
50
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","Card","ColorIndicator","useGlobalStylesContext","StylesPreview","getStyle","fontFamily","textColor","linkColor","backgroundColor","background","fontSize"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,IAHD,EAICC,cAJD,QAKO,uBALP;AAOA;AACA;AACA;;AAAI,SAASC,sBAAT,QAAuC,kCAAvC;;AAEJ,MAAMC,aAAa,GAAG,MAAM;AAAA;;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAeF,sBAAsB,EAA3C;AACA,QAAMG,UAAU,gBAAGD,QAAQ,CAAE,MAAF,EAAU,YAAV,CAAX,iDAAuC,OAAvD;AACA,QAAME,SAAS,iBAAGF,QAAQ,CAAE,MAAF,EAAU,OAAV,CAAX,mDAAkC,OAAjD;AACA,QAAMG,SAAS,iBAAGH,QAAQ,CAAE,MAAF,EAAU,WAAV,CAAX,mDAAsC,MAArD;AACA,QAAMI,eAAe,iBAAGJ,QAAQ,CAAE,MAAF,EAAU,iBAAV,CAAX,mDAA4C,OAAjE;AAEA,SACC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,KAAK,EAAG;AAAEK,MAAAA,UAAU,EAAED;AAAd;AAFT,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,2BACC;AAAM,IAAA,KAAK,EAAG;AAAEH,MAAAA,UAAF;AAAcK,MAAAA,QAAQ,EAAE;AAAxB;AAAd,SADD,EAEC;AAAM,IAAA,KAAK,EAAG;AAAEL,MAAAA,UAAF;AAAcK,MAAAA,QAAQ,EAAE;AAAxB;AAAd,SAFD,CADD,EAKC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,cAAD;AAAgB,IAAA,UAAU,EAAGJ;AAA7B,IADD,EAEC,cAAC,cAAD;AAAgB,IAAA,UAAU,EAAGC;AAA7B,IAFD,CALD,CAJD,CADD;AAiBA,CAxBD;;AA0BA,eAAeJ,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tCard,\n\tColorIndicator,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */ import { useGlobalStylesContext } from '../editor/global-styles-provider';\n\nconst StylesPreview = () => {\n\tconst { getStyle } = useGlobalStylesContext();\n\tconst fontFamily = getStyle( 'root', 'fontFamily' ) ?? 'serif';\n\tconst textColor = getStyle( 'root', 'color' ) ?? 'black';\n\tconst linkColor = getStyle( 'root', 'linkColor' ) ?? 'blue';\n\tconst backgroundColor = getStyle( 'root', 'backgroundColor' ) ?? 'white';\n\n\treturn (\n\t\t<Card\n\t\t\tclassName=\"edit-site-global-styles-preview\"\n\t\t\tstyle={ { background: backgroundColor } }\n\t\t>\n\t\t\t<HStack spacing={ 5 }>\n\t\t\t\t<div>\n\t\t\t\t\t<span style={ { fontFamily, fontSize: '80px' } }>A</span>\n\t\t\t\t\t<span style={ { fontFamily, fontSize: '80px' } }>a</span>\n\t\t\t\t</div>\n\t\t\t\t<VStack spacing={ 2 }>\n\t\t\t\t\t<ColorIndicator colorValue={ textColor } />\n\t\t\t\t\t<ColorIndicator colorValue={ linkColor } />\n\t\t\t\t</VStack>\n\t\t\t</HStack>\n\t\t</Card>\n\t);\n};\n\nexport default StylesPreview;\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { getBlockType } from '@wordpress/blocks';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
13
|
+
import { useHasBorderPanel } from './border-panel';
|
|
14
|
+
import { useHasColorPanel } from './color-panel';
|
|
15
|
+
import { useHasDimensionsPanel } from './dimensions-panel';
|
|
16
|
+
import { useHasTypographyPanel } from './typography-panel';
|
|
17
|
+
import ScreenHeader from './header';
|
|
18
|
+
import NavigationButton from './navigation-button';
|
|
19
|
+
|
|
20
|
+
function BlockMenuItem({
|
|
21
|
+
block
|
|
22
|
+
}) {
|
|
23
|
+
const {
|
|
24
|
+
blocks
|
|
25
|
+
} = useGlobalStylesContext();
|
|
26
|
+
const context = blocks[block.name];
|
|
27
|
+
const hasTypographyPanel = useHasTypographyPanel(context);
|
|
28
|
+
const hasColorPanel = useHasColorPanel(context);
|
|
29
|
+
const hasBorderPanel = useHasBorderPanel(context);
|
|
30
|
+
const hasDimensionsPanel = useHasDimensionsPanel(context);
|
|
31
|
+
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
32
|
+
const hasBlockMenuItem = hasTypographyPanel || hasColorPanel || hasLayoutPanel;
|
|
33
|
+
|
|
34
|
+
if (!hasBlockMenuItem) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return createElement(NavigationButton, {
|
|
39
|
+
path: '/blocks/' + block.name
|
|
40
|
+
}, block.title);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function ScreenBlockList() {
|
|
44
|
+
const {
|
|
45
|
+
blocks
|
|
46
|
+
} = useGlobalStylesContext();
|
|
47
|
+
const visibleBlocks = Object.keys(blocks).map(name => getBlockType(name)).filter(blockType => !!blockType);
|
|
48
|
+
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
49
|
+
back: "/",
|
|
50
|
+
title: __('Blocks')
|
|
51
|
+
}), visibleBlocks.map(block => createElement(BlockMenuItem, {
|
|
52
|
+
block: block,
|
|
53
|
+
key: 'menu-itemblock-' + block.name
|
|
54
|
+
})));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default ScreenBlockList;
|
|
58
|
+
//# sourceMappingURL=screen-block-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block-list.js"],"names":["getBlockType","__","useGlobalStylesContext","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","ScreenHeader","NavigationButton","BlockMenuItem","block","blocks","context","name","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","hasBlockMenuItem","title","ScreenBlockList","visibleBlocks","Object","keys","map","filter","blockType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,mBAA7B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,kCAAvC;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,OAAOC,gBAAP,MAA6B,qBAA7B;;AAEA,SAASC,aAAT,CAAwB;AAAEC,EAAAA;AAAF,CAAxB,EAAoC;AACnC,QAAM;AAAEC,IAAAA;AAAF,MAAaT,sBAAsB,EAAzC;AACA,QAAMU,OAAO,GAAGD,MAAM,CAAED,KAAK,CAACG,IAAR,CAAtB;AACA,QAAMC,kBAAkB,GAAGR,qBAAqB,CAAEM,OAAF,CAAhD;AACA,QAAMG,aAAa,GAAGX,gBAAgB,CAAEQ,OAAF,CAAtC;AACA,QAAMI,cAAc,GAAGb,iBAAiB,CAAES,OAAF,CAAxC;AACA,QAAMK,kBAAkB,GAAGZ,qBAAqB,CAAEO,OAAF,CAAhD;AACA,QAAMM,cAAc,GAAGF,cAAc,IAAIC,kBAAzC;AACA,QAAME,gBAAgB,GACrBL,kBAAkB,IAAIC,aAAtB,IAAuCG,cADxC;;AAGA,MAAK,CAAEC,gBAAP,EAA0B;AACzB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,gBAAD;AAAkB,IAAA,IAAI,EAAG,aAAaT,KAAK,CAACG;AAA5C,KACGH,KAAK,CAACU,KADT,CADD;AAKA;;AAED,SAASC,eAAT,GAA2B;AAC1B,QAAM;AAAEV,IAAAA;AAAF,MAAaT,sBAAsB,EAAzC;AACA,QAAMoB,aAAa,GAAGC,MAAM,CAACC,IAAP,CAAab,MAAb,EACpBc,GADoB,CACbZ,IAAF,IAAYb,YAAY,CAAEa,IAAF,CADT,EAEpBa,MAFoB,CAEVC,SAAF,IAAiB,CAAC,CAAEA,SAFR,CAAtB;AAIA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAC,GAAnB;AAAuB,IAAA,KAAK,EAAG1B,EAAE,CAAE,QAAF;AAAjC,IADD,EAEGqB,aAAa,CAACG,GAAd,CAAqBf,KAAF,IACpB,cAAC,aAAD;AACC,IAAA,KAAK,EAAGA,KADT;AAEC,IAAA,GAAG,EAAG,oBAAoBA,KAAK,CAACG;AAFjC,IADC,CAFH,CADD;AAWA;;AAED,eAAeQ,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesContext } from '../editor/global-styles-provider';\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-panel';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport ScreenHeader from './header';\nimport NavigationButton from './navigation-button';\n\nfunction BlockMenuItem( { block } ) {\n\tconst { blocks } = useGlobalStylesContext();\n\tconst context = blocks[ block.name ];\n\tconst hasTypographyPanel = useHasTypographyPanel( context );\n\tconst hasColorPanel = useHasColorPanel( context );\n\tconst hasBorderPanel = useHasBorderPanel( context );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( context );\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\treturn (\n\t\t<NavigationButton path={ '/blocks/' + block.name }>\n\t\t\t{ block.title }\n\t\t</NavigationButton>\n\t);\n}\n\nfunction ScreenBlockList() {\n\tconst { blocks } = useGlobalStylesContext();\n\tconst visibleBlocks = Object.keys( blocks )\n\t\t.map( ( name ) => getBlockType( name ) )\n\t\t.filter( ( blockType ) => !! blockType );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader back=\"/\" title={ __( 'Blocks' ) } />\n\t\t\t{ visibleBlocks.map( ( block ) => (\n\t\t\t\t<BlockMenuItem\n\t\t\t\t\tblock={ block }\n\t\t\t\t\tkey={ 'menu-itemblock-' + block.name }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlockList;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { getBlockType } from '@wordpress/blocks';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { useGlobalStylesContext } from '../editor/global-styles-provider';
|
|
12
|
+
import ContextMenu from './context-menu';
|
|
13
|
+
import ScreenHeader from './header';
|
|
14
|
+
|
|
15
|
+
function ScreenBlock({
|
|
16
|
+
name
|
|
17
|
+
}) {
|
|
18
|
+
const blockType = getBlockType(name);
|
|
19
|
+
const {
|
|
20
|
+
blocks
|
|
21
|
+
} = useGlobalStylesContext();
|
|
22
|
+
return createElement(Fragment, null, createElement(ScreenHeader, {
|
|
23
|
+
back: "/blocks",
|
|
24
|
+
title: blockType.title
|
|
25
|
+
}), createElement(ContextMenu, {
|
|
26
|
+
parentMenu: '/blocks/' + name,
|
|
27
|
+
context: blocks[name]
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default ScreenBlock;
|
|
32
|
+
//# sourceMappingURL=screen-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"names":["getBlockType","useGlobalStylesContext","ContextMenu","ScreenHeader","ScreenBlock","name","blockType","blocks","title"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,YAAT,QAA6B,mBAA7B;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,kCAAvC;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,OAAOC,YAAP,MAAyB,UAAzB;;AAEA,SAASC,WAAT,CAAsB;AAAEC,EAAAA;AAAF,CAAtB,EAAiC;AAChC,QAAMC,SAAS,GAAGN,YAAY,CAAEK,IAAF,CAA9B;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAaN,sBAAsB,EAAzC;AAEA,SACC,8BACC,cAAC,YAAD;AAAc,IAAA,IAAI,EAAC,SAAnB;AAA6B,IAAA,KAAK,EAAGK,SAAS,CAACE;AAA/C,IADD,EAEC,cAAC,WAAD;AACC,IAAA,UAAU,EAAG,aAAaH,IAD3B;AAEC,IAAA,OAAO,EAAGE,MAAM,CAAEF,IAAF;AAFjB,IAFD,CADD;AASA;;AAED,eAAeD,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesContext } from '../editor/global-styles-provider';\nimport ContextMenu from './context-menu';\nimport ScreenHeader from './header';\n\nfunction ScreenBlock( { name } ) {\n\tconst blockType = getBlockType( name );\n\tconst { blocks } = useGlobalStylesContext();\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader back=\"/blocks\" title={ blockType.title } />\n\t\t\t<ContextMenu\n\t\t\t\tparentMenu={ '/blocks/' + name }\n\t\t\t\tcontext={ blocks[ name ] }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"]}
|