@wordpress/edit-site 3.0.2 → 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 +18 -4
- 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 +1 -1
- package/build/components/editor/global-styles-provider.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 +1 -1
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +0 -0
- 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 +7 -11
- 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 +6 -7
- 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/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/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/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 +54 -1
- 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 +15 -4
- 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 +1 -1
- package/build-module/components/editor/global-styles-provider.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 +1 -1
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +0 -0
- 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 +8 -12
- 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 +6 -7
- 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/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/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/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 +45 -1
- 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 +122 -17
- package/build-style/style.css +122 -17
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +16 -1
- 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 +1 -1
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/utils.js +1 -0
- package/src/components/{sidebar → global-styles}/border-panel.js +0 -0
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +12 -17
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +6 -10
- 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/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/style.scss +1 -0
- 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/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 +53 -1
- 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
|
@@ -66,7 +66,9 @@ function ColorPalettePanel({
|
|
|
66
66
|
slug
|
|
67
67
|
}) => slug);
|
|
68
68
|
}, [contextName]);
|
|
69
|
-
return (0, _element.createElement)(
|
|
69
|
+
return (0, _element.createElement)("div", {
|
|
70
|
+
className: "edit-site-global-styles-color-palette-panel"
|
|
71
|
+
}, (0, _element.createElement)(_components.__experimentalColorEdit, {
|
|
70
72
|
immutableColorSlugs: immutableColorSlugs,
|
|
71
73
|
colors: colors,
|
|
72
74
|
onChange: newColors => {
|
|
@@ -74,6 +76,6 @@ function ColorPalettePanel({
|
|
|
74
76
|
},
|
|
75
77
|
emptyUI: (0, _i18n.__)('Colors are empty! Add some colors to create your own color palette.'),
|
|
76
78
|
canReset: colors === userColors
|
|
77
|
-
});
|
|
79
|
+
}));
|
|
78
80
|
}
|
|
79
81
|
//# sourceMappingURL=color-palette-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-palette-panel.js"],"names":["EMPTY_ARRAY","ColorPalettePanel","contextName","getSetting","setSetting","colors","userColors","immutableColorSlugs","select","baseStyles","editSiteStore","getSettings","__experimentalGlobalStylesBaseStyles","contextualBasePalette","globalPalette","basePalette","theme","core","map","slug","newColors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,WAAW,GAAG,EAApB;;AAEe,SAASC,iBAAT,CAA4B;AAC1CC,EAAAA,WAD0C;AAE1CC,EAAAA,UAF0C;AAG1CC,EAAAA;AAH0C,CAA5B,EAIX;AACH,QAAMC,MAAM,GAAG,uBAAY,eAAZ,EAA6BH,WAA7B,CAAf;AACA,QAAMI,UAAU,GAAGH,UAAU,CAAED,WAAF,EAAe,eAAf,CAA7B;AACA,QAAMK,mBAAmB,GAAG,qBACzBC,MAAF,IAAc;AAAA;;AACb,UAAMC,UAAU,GAAGD,MAAM,CAAEE,YAAF,CAAN,CAAwBC,WAAxB,GACjBC,oCADF;;AAEA,UAAMC,qBAAqB,GAAG,iBAAKJ,UAAL,EAAiB,CAC9C,UAD8C,EAE9C,QAF8C,EAG9CP,WAH8C,EAI9C,OAJ8C,EAK9C,SAL8C,CAAjB,CAA9B;AAOA,UAAMY,aAAa,GAAG,iBAAKL,UAAL,EAAiB,CACtC,UADsC,EAEtC,OAFsC,EAGtC,SAHsC,CAAjB,CAAtB;AAKA,UAAMM,WAAW,6CAChBF,qBADgB,aAChBA,qBADgB,uBAChBA,qBAAqB,CAAEG,KADP,yEAEhBH,qBAFgB,aAEhBA,qBAFgB,uBAEhBA,qBAAqB,CAAEI,IAFP,yCAGhBH,aAHgB,aAGhBA,aAHgB,uBAGhBA,aAAa,CAAEE,KAHC,uCAIhBF,aAJgB,aAIhBA,aAJgB,uBAIhBA,aAAa,CAAEG,IAJhB;;AAKA,QAAK,CAAEF,WAAP,EAAqB;AACpB,aAAOf,WAAP;AACA;;AACD,WAAOe,WAAW,CAACG,GAAZ,CAAiB,CAAE;AAAEC,MAAAA;AAAF,KAAF,KAAgBA,IAAjC,CAAP;AACA,GAzB0B,EA0B3B,CAAEjB,WAAF,CA1B2B,CAA5B;AA4BA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mCAAD;AACC,IAAA,mBAAmB,EAAGK,mBADvB;AAEC,IAAA,MAAM,EAAGF,MAFV;AAGC,IAAA,QAAQ,EAAKe,SAAF,IAAiB;AAC3BhB,MAAAA,UAAU,CAAEF,WAAF,EAAe,eAAf,EAAgCkB,SAAhC,CAAV;AACA,KALF;AAMC,IAAA,OAAO,EAAG,cACT,qEADS,CANX;AASC,IAAA,QAAQ,EAAGf,MAAM,KAAKC;AATvB,IADD,CADD;AAeA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalColorEdit as ColorEdit } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useSetting } from '../editor/utils';\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Shared reference to an empty array for cases where it is important to avoid\n * returning a new array reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n *\n * @type {Array}\n */\nconst EMPTY_ARRAY = [];\n\nexport default function ColorPalettePanel( {\n\tcontextName,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst colors = useSetting( 'color.palette', contextName );\n\tconst userColors = getSetting( contextName, 'color.palette' );\n\tconst immutableColorSlugs = useSelect(\n\t\t( select ) => {\n\t\t\tconst baseStyles = select( editSiteStore ).getSettings()\n\t\t\t\t.__experimentalGlobalStylesBaseStyles;\n\t\t\tconst contextualBasePalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'blocks',\n\t\t\t\tcontextName,\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst globalPalette = get( baseStyles, [\n\t\t\t\t'settings',\n\t\t\t\t'color',\n\t\t\t\t'palette',\n\t\t\t] );\n\t\t\tconst basePalette =\n\t\t\t\tcontextualBasePalette?.theme ??\n\t\t\t\tcontextualBasePalette?.core ??\n\t\t\t\tglobalPalette?.theme ??\n\t\t\t\tglobalPalette?.core;\n\t\t\tif ( ! basePalette ) {\n\t\t\t\treturn EMPTY_ARRAY;\n\t\t\t}\n\t\t\treturn basePalette.map( ( { slug } ) => slug );\n\t\t},\n\t\t[ contextName ]\n\t);\n\treturn (\n\t\t<div className=\"edit-site-global-styles-color-palette-panel\">\n\t\t\t<ColorEdit\n\t\t\t\timmutableColorSlugs={ immutableColorSlugs }\n\t\t\t\tcolors={ colors }\n\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\tsetSetting( contextName, 'color.palette', newColors );\n\t\t\t\t} }\n\t\t\t\temptyUI={ __(\n\t\t\t\t\t'Colors are empty! Add some colors to create your own color palette.'\n\t\t\t\t) }\n\t\t\t\tcanReset={ colors === userColors }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -16,7 +16,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
|
|
17
17
|
var _utils = require("../editor/utils");
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _palette = _interopRequireDefault(require("./palette"));
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* WordPress dependencies
|
|
@@ -37,9 +37,7 @@ function ColorPanel({
|
|
|
37
37
|
name
|
|
38
38
|
},
|
|
39
39
|
getStyle,
|
|
40
|
-
setStyle
|
|
41
|
-
getSetting,
|
|
42
|
-
setSetting
|
|
40
|
+
setStyle
|
|
43
41
|
}) {
|
|
44
42
|
const solids = (0, _utils.useSetting)('color.palette', name);
|
|
45
43
|
const gradients = (0, _utils.useSetting)('color.gradients', name);
|
|
@@ -113,18 +111,16 @@ function ColorPanel({
|
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
|
|
116
|
-
return (0, _element.createElement)(
|
|
114
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_palette.default, {
|
|
115
|
+
contextName: name
|
|
116
|
+
}), (0, _element.createElement)(_blockEditor.__experimentalPanelColorGradientSettings, {
|
|
117
117
|
title: (0, _i18n.__)('Color'),
|
|
118
118
|
settings: settings,
|
|
119
119
|
colors: solids,
|
|
120
120
|
gradients: gradients,
|
|
121
121
|
disableCustomColors: !areCustomSolidsEnabled,
|
|
122
|
-
disableCustomGradients: !areCustomGradientsEnabled
|
|
123
|
-
|
|
124
|
-
key: 'color-palette-panel-' + name,
|
|
125
|
-
contextName: name,
|
|
126
|
-
getSetting: getSetting,
|
|
127
|
-
setSetting: setSetting
|
|
122
|
+
disableCustomGradients: !areCustomGradientsEnabled,
|
|
123
|
+
showTitle: false
|
|
128
124
|
}));
|
|
129
125
|
}
|
|
130
126
|
//# sourceMappingURL=color-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-panel.js"],"names":["useHasColorPanel","supports","includes","ColorPanel","context","name","getStyle","setStyle","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","isLinkEnabled","isTextEnabled","isBackgroundEnabled","hasLinkColor","length","hasTextColor","hasBackgroundColor","hasGradientColor","settings","color","userColor","push","colorValue","onColorChange","value","label","clearable","backgroundSettings","backgroundColor","userBackgroundColor","gradientSettings","gradient","userGradient","gradientValue","onGradientChange"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAMA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKO,SAASA,gBAAT,CAA2B;AAAEC,EAAAA;AAAF,CAA3B,EAA0C;AAChD,SACCA,QAAQ,CAACC,QAAT,CAAmB,OAAnB,KACAD,QAAQ,CAACC,QAAT,CAAmB,iBAAnB,CADA,IAEAD,QAAQ,CAACC,QAAT,CAAmB,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ettings as PanelColorGradientSettings } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\n\nimport { useSetting } from '../editor/utils';\nimport Palette from './palette';\n\nexport function useHasColorPanel( { supports } ) {\n\treturn (\n\t\tsupports.includes( 'color' ) ||\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' ) ||\n\t\tsupports.includes( 'linkColor' )\n\t);\n}\n\nexport default function ColorPanel( {\n\tcontext: { supports, name },\n\tgetStyle,\n\tsetStyle,\n} ) {\n\tconst solids = useSetting( 'color.palette', name );\n\tconst gradients = useSetting( 'color.gradients', name );\n\tconst areCustomSolidsEnabled = useSetting( 'color.custom', name );\n\tconst areCustomGradientsEnabled = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\tconst isLinkEnabled = useSetting( 'color.link', name );\n\tconst isTextEnabled = useSetting( 'color.text', name );\n\tconst isBackgroundEnabled = useSetting( 'color.background', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\n\tconst settings = [];\n\n\tif ( hasTextColor ) {\n\t\tconst color = getStyle( name, 'color' );\n\t\tconst userColor = getStyle( name, 'color', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'color', value ),\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tconst backgroundColor = getStyle( name, 'backgroundColor' );\n\t\tconst userBackgroundColor = getStyle( name, 'backgroundColor', 'user' );\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'backgroundColor', value ),\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tconst gradient = getStyle( name, 'background' );\n\t\tconst userGradient = getStyle( name, 'background', 'user' );\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: ( value ) =>\n\t\t\t\tsetStyle( name, 'background', value ),\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tif ( hasBackgroundColor || hasGradientColor ) {\n\t\tsettings.push( {\n\t\t\t...backgroundSettings,\n\t\t\t...gradientSettings,\n\t\t\tlabel: __( 'Background color' ),\n\t\t} );\n\t}\n\n\tif ( hasLinkColor ) {\n\t\tconst color = getStyle( name, 'linkColor' );\n\t\tconst userColor = getStyle( name, 'linkColor', 'user' );\n\t\tsettings.push( {\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: ( value ) => setStyle( name, 'linkColor', value ),\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: color === userColor,\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Palette contextName={ name } />\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ solids }\n\t\t\t\tgradients={ gradients }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\tshowTitle={ false }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _icons = require("@wordpress/icons");
|
|
15
|
+
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
18
|
+
var _borderPanel = require("./border-panel");
|
|
19
|
+
|
|
20
|
+
var _colorPanel = require("./color-panel");
|
|
21
|
+
|
|
22
|
+
var _dimensionsPanel = require("./dimensions-panel");
|
|
23
|
+
|
|
24
|
+
var _typographyPanel = require("./typography-panel");
|
|
25
|
+
|
|
26
|
+
var _navigationButton = _interopRequireDefault(require("./navigation-button"));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* WordPress dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Internal dependencies
|
|
34
|
+
*/
|
|
35
|
+
function ContextMenu({
|
|
36
|
+
context,
|
|
37
|
+
parentMenu = ''
|
|
38
|
+
}) {
|
|
39
|
+
const hasTypographyPanel = (0, _typographyPanel.useHasTypographyPanel)(context);
|
|
40
|
+
const hasColorPanel = (0, _colorPanel.useHasColorPanel)(context);
|
|
41
|
+
const hasBorderPanel = (0, _borderPanel.useHasBorderPanel)(context);
|
|
42
|
+
const hasDimensionsPanel = (0, _dimensionsPanel.useHasDimensionsPanel)(context);
|
|
43
|
+
const hasLayoutPanel = hasBorderPanel || hasDimensionsPanel;
|
|
44
|
+
return (0, _element.createElement)(_components.__experimentalItemGroup, null, hasTypographyPanel && (0, _element.createElement)(_navigationButton.default, {
|
|
45
|
+
icon: _icons.typography,
|
|
46
|
+
path: parentMenu + '/typography'
|
|
47
|
+
}, (0, _i18n.__)('Typography')), hasColorPanel && (0, _element.createElement)(_navigationButton.default, {
|
|
48
|
+
icon: _icons.color,
|
|
49
|
+
path: parentMenu + '/colors'
|
|
50
|
+
}, (0, _i18n.__)('Colors')), hasLayoutPanel && (0, _element.createElement)(_navigationButton.default, {
|
|
51
|
+
icon: _icons.layout,
|
|
52
|
+
path: parentMenu + '/layout'
|
|
53
|
+
}, (0, _i18n.__)('Layout')));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var _default = ContextMenu;
|
|
57
|
+
exports.default = _default;
|
|
58
|
+
//# sourceMappingURL=context-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["ContextMenu","context","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasLayoutPanel","typography","color","layout"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA,SAASA,WAAT,CAAsB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA,UAAU,GAAG;AAAxB,CAAtB,EAAqD;AACpD,QAAMC,kBAAkB,GAAG,4CAAuBF,OAAvB,CAA3B;AACA,QAAMG,aAAa,GAAG,kCAAkBH,OAAlB,CAAtB;AACA,QAAMI,cAAc,GAAG,oCAAmBJ,OAAnB,CAAvB;AACA,QAAMK,kBAAkB,GAAG,4CAAuBL,OAAvB,CAA3B;AACA,QAAMM,cAAc,GAAGF,cAAc,IAAIC,kBAAzC;AAEA,SACC,4BAAC,mCAAD,QACGH,kBAAkB,IACnB,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGK,iBADR;AAEC,IAAA,IAAI,EAAGN,UAAU,GAAG;AAFrB,KAIG,cAAI,YAAJ,CAJH,CAFF,EASGE,aAAa,IACd,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGK,YADR;AAEC,IAAA,IAAI,EAAGP,UAAU,GAAG;AAFrB,KAIG,cAAI,QAAJ,CAJH,CAVF,EAiBGK,cAAc,IACf,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGG,aADR;AAEC,IAAA,IAAI,EAAGR,UAAU,GAAG;AAFrB,KAIG,cAAI,QAAJ,CAJH,CAlBF,CADD;AA4BA;;eAEcF,W","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"]}
|
|
@@ -120,7 +120,7 @@ function DimensionsPanel({
|
|
|
120
120
|
|
|
121
121
|
const resetPaddingValue = () => setPaddingValues({});
|
|
122
122
|
|
|
123
|
-
const hasPaddingValue = () => paddingValues && Object.keys(paddingValues).length;
|
|
123
|
+
const hasPaddingValue = () => !!paddingValues && Object.keys(paddingValues).length;
|
|
124
124
|
|
|
125
125
|
const marginValues = splitStyleValue(getStyle(name, 'margin'));
|
|
126
126
|
const marginSides = (0, _blockEditor.__experimentalUseCustomSides)(name, 'margin');
|
|
@@ -133,7 +133,7 @@ function DimensionsPanel({
|
|
|
133
133
|
|
|
134
134
|
const resetMarginValue = () => setMarginValues({});
|
|
135
135
|
|
|
136
|
-
const hasMarginValue = () => marginValues && Object.keys(marginValues).length;
|
|
136
|
+
const hasMarginValue = () => !!marginValues && Object.keys(marginValues).length;
|
|
137
137
|
|
|
138
138
|
const gapValue = getStyle(name, '--wp--style--block-gap');
|
|
139
139
|
|
|
@@ -152,8 +152,7 @@ function DimensionsPanel({
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
return (0, _element.createElement)(_components.__experimentalToolsPanel, {
|
|
155
|
-
label: (0, _i18n.__)('Dimensions
|
|
156
|
-
header: (0, _i18n.__)('Dimensions'),
|
|
155
|
+
label: (0, _i18n.__)('Dimensions'),
|
|
157
156
|
resetAll: resetAll
|
|
158
157
|
}, showPaddingControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
159
158
|
hasValue: hasPaddingValue,
|
|
@@ -182,13 +181,13 @@ function DimensionsPanel({
|
|
|
182
181
|
allowReset: false,
|
|
183
182
|
splitOnAxis: isAxialMargin
|
|
184
183
|
})), showGapControl && (0, _element.createElement)(_components.__experimentalToolsPanelItem, {
|
|
185
|
-
className: "single-column",
|
|
186
184
|
hasValue: hasGapValue,
|
|
187
|
-
label: (0, _i18n.__)('Block
|
|
185
|
+
label: (0, _i18n.__)('Block spacing'),
|
|
188
186
|
onDeselect: resetGapValue,
|
|
189
187
|
isShownByDefault: true
|
|
190
188
|
}, (0, _element.createElement)(_components.__experimentalUnitControl, {
|
|
191
|
-
label: (0, _i18n.__)('Block
|
|
189
|
+
label: (0, _i18n.__)('Block spacing'),
|
|
190
|
+
__unstableInputWidth: "80px",
|
|
192
191
|
min: 0,
|
|
193
192
|
onChange: setGapValue,
|
|
194
193
|
units: units,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/dimensions-panel.js"],"names":["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":";;;;;;;;;;AAGA;;AACA;;AAOA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,MAAMA,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;;AAEO,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,CAAx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ADZ;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ,CAFT;AAGC,IAAA,UAAU,EAAGF,aAHd;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,4BAAC,qCAAD;AACC,IAAA,KAAK,EAAG,cAAI,eAAJ,CADT;AAEC,IAAA,oBAAoB,EAAC,MAFtB;AAGC,IAAA,GAAG,EAAG,CAHP;AAIC,IAAA,QAAQ,EAAGF,WAJZ;AAKC,IAAA,KAAK,EAAGvB,KALT;AAMC,IAAA,KAAK,EAAGsB;AANT,IAND,CAtCF,CADD;AAyDA","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,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
|
|
18
|
+
var _navigationButton = _interopRequireDefault(require("./navigation-button"));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
function ScreenHeader({
|
|
28
|
+
back,
|
|
29
|
+
title,
|
|
30
|
+
description
|
|
31
|
+
}) {
|
|
32
|
+
return (0, _element.createElement)(_components.__experimentalVStack, {
|
|
33
|
+
spacing: 2
|
|
34
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
35
|
+
spacing: 2
|
|
36
|
+
}, (0, _element.createElement)(_components.__experimentalView, null, (0, _element.createElement)(_navigationButton.default, {
|
|
37
|
+
path: back,
|
|
38
|
+
icon: (0, _element.createElement)(_icons.Icon, {
|
|
39
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
40
|
+
variant: "muted"
|
|
41
|
+
}),
|
|
42
|
+
size: "small",
|
|
43
|
+
isBack: true,
|
|
44
|
+
"aria-label": (0, _i18n.__)('Navigate to the previous view')
|
|
45
|
+
})), (0, _element.createElement)(_components.__experimentalSpacer, null, (0, _element.createElement)(_components.__experimentalHeading, {
|
|
46
|
+
level: 5
|
|
47
|
+
}, title))), description && (0, _element.createElement)("p", {
|
|
48
|
+
className: "edit-site-global-styles-header__description"
|
|
49
|
+
}, description));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var _default = ScreenHeader;
|
|
53
|
+
exports.default = _default;
|
|
54
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/header.js"],"names":["ScreenHeader","back","title","description","chevronRight","chevronLeft"],"mappings":";;;;;;;;;;;AAGA;;AAOA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAWA;AACA;AACA;AAGA,SAASA,YAAT,CAAuB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,KAAR;AAAeC,EAAAA;AAAf,CAAvB,EAAsD;AACrD,SACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,8BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGF,IADR;AAEC,IAAA,IAAI,EACH,4BAAC,WAAD;AACC,MAAA,IAAI,EAAG,qBAAUG,mBAAV,GAAyBC,kBADjC;AAEC,MAAA,OAAO,EAAC;AAFT,MAHF;AAQC,IAAA,IAAI,EAAC,OARN;AASC,IAAA,MAAM,MATP;AAUC,kBAAa,cAAI,+BAAJ;AAVd,IADD,CADD,EAeC,4BAAC,gCAAD,QACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG;AAAjB,KAAuBH,KAAvB,CADD,CAfD,CADD,EAoBGC,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CArBF,CADD;AA4BA;;eAEcH,Y","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,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _lodash = require("lodash");
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _globalStylesProvider = require("../editor/global-styles-provider");
|
|
17
|
+
|
|
18
|
+
var _screenRoot = _interopRequireDefault(require("./screen-root"));
|
|
19
|
+
|
|
20
|
+
var _screenBlockList = _interopRequireDefault(require("./screen-block-list"));
|
|
21
|
+
|
|
22
|
+
var _screenBlock = _interopRequireDefault(require("./screen-block"));
|
|
23
|
+
|
|
24
|
+
var _screenTypography = _interopRequireDefault(require("./screen-typography"));
|
|
25
|
+
|
|
26
|
+
var _screenColors = _interopRequireDefault(require("./screen-colors"));
|
|
27
|
+
|
|
28
|
+
var _screenColorPalette = _interopRequireDefault(require("./screen-color-palette"));
|
|
29
|
+
|
|
30
|
+
var _screenLayout = _interopRequireDefault(require("./screen-layout"));
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* External dependencies
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* WordPress dependencies
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Internal dependencies
|
|
42
|
+
*/
|
|
43
|
+
function ContextScreens({
|
|
44
|
+
name
|
|
45
|
+
}) {
|
|
46
|
+
const parentMenu = name === undefined ? '' : '/blocks/' + name;
|
|
47
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
48
|
+
path: parentMenu + '/typography'
|
|
49
|
+
}, (0, _element.createElement)(_screenTypography.default, {
|
|
50
|
+
name: name
|
|
51
|
+
})), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
52
|
+
path: parentMenu + '/colors'
|
|
53
|
+
}, (0, _element.createElement)(_screenColors.default, {
|
|
54
|
+
name: name
|
|
55
|
+
})), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
56
|
+
path: parentMenu + '/colors/palette'
|
|
57
|
+
}, (0, _element.createElement)(_screenColorPalette.default, {
|
|
58
|
+
name: name
|
|
59
|
+
})), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
60
|
+
path: parentMenu + '/layout'
|
|
61
|
+
}, (0, _element.createElement)(_screenLayout.default, {
|
|
62
|
+
name: name
|
|
63
|
+
})));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function GlobalStyles() {
|
|
67
|
+
const {
|
|
68
|
+
blocks
|
|
69
|
+
} = (0, _globalStylesProvider.useGlobalStylesContext)();
|
|
70
|
+
return (0, _element.createElement)(_components.__experimentalNavigatorProvider, {
|
|
71
|
+
initialPath: "/"
|
|
72
|
+
}, (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
73
|
+
path: "/"
|
|
74
|
+
}, (0, _element.createElement)(_screenRoot.default, null)), (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
75
|
+
path: "/blocks"
|
|
76
|
+
}, (0, _element.createElement)(_screenBlockList.default, null)), (0, _lodash.map)(blocks, (block, name) => (0, _element.createElement)(_components.__experimentalNavigatorScreen, {
|
|
77
|
+
key: 'menu-block-' + name,
|
|
78
|
+
path: '/blocks/' + name
|
|
79
|
+
}, (0, _element.createElement)(_screenBlock.default, {
|
|
80
|
+
name: name
|
|
81
|
+
}))), (0, _element.createElement)(ContextScreens, null), (0, _lodash.map)(blocks, (_, name) => (0, _element.createElement)(ContextScreens, {
|
|
82
|
+
key: 'screens-block-' + name,
|
|
83
|
+
name: name
|
|
84
|
+
})));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var _default = GlobalStyles;
|
|
88
|
+
exports.default = _default;
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/index.js"],"names":["ContextScreens","name","parentMenu","undefined","GlobalStyles","blocks","block","_"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAUA,SAASA,cAAT,CAAyB;AAAEC,EAAAA;AAAF,CAAzB,EAAoC;AACnC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AAEA,SACC,qDACC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,4BAAC,yBAAD;AAAkB,IAAA,IAAI,EAAGD;AAAzB,IADD,CADD,EAKC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGD;AAArB,IADD,CALD,EASC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,4BAAC,2BAAD;AAAoB,IAAA,IAAI,EAAGD;AAA3B,IADD,CATD,EAaC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAGC,UAAU,GAAG;AAArC,KACC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGD;AAArB,IADD,CAbD,CADD;AAmBA;;AAED,SAASG,YAAT,GAAwB;AACvB,QAAM;AAAEC,IAAAA;AAAF,MAAa,mDAAnB;AAEA,SACC,4BAAC,2CAAD;AAAmB,IAAA,WAAW,EAAC;AAA/B,KACC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,mBAAD,OADD,CADD,EAKC,4BAAC,yCAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KACC,4BAAC,wBAAD,OADD,CALD,EASG,iBAAKA,MAAL,EAAa,CAAEC,KAAF,EAASL,IAAT,KACd,4BAAC,yCAAD;AACC,IAAA,GAAG,EAAG,gBAAgBA,IADvB;AAEC,IAAA,IAAI,EAAG,aAAaA;AAFrB,KAIC,4BAAC,oBAAD;AAAa,IAAA,IAAI,EAAGA;AAApB,IAJD,CADC,CATH,EAkBC,4BAAC,cAAD,OAlBD,EAoBG,iBAAKI,MAAL,EAAa,CAAEE,CAAF,EAAKN,IAAL,KACd,4BAAC,cAAD;AAAgB,IAAA,GAAG,EAAG,mBAAmBA,IAAzC;AAAgD,IAAA,IAAI,EAAGA;AAAvD,IADC,CApBH,CADD;AA0BA;;eAEcG,Y","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,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
function NavigationButton({
|
|
22
|
+
path,
|
|
23
|
+
icon,
|
|
24
|
+
children,
|
|
25
|
+
isBack = false,
|
|
26
|
+
...props
|
|
27
|
+
}) {
|
|
28
|
+
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
29
|
+
return (0, _element.createElement)(_components.__experimentalItem, (0, _extends2.default)({
|
|
30
|
+
onClick: () => navigator.push(path, {
|
|
31
|
+
isBack
|
|
32
|
+
})
|
|
33
|
+
}, props), icon && (0, _element.createElement)(_components.__experimentalHStack, {
|
|
34
|
+
justify: "flex-start"
|
|
35
|
+
}, (0, _element.createElement)(_components.FlexItem, null, (0, _element.createElement)(_icons.Icon, {
|
|
36
|
+
icon: icon,
|
|
37
|
+
size: 24
|
|
38
|
+
})), (0, _element.createElement)(_components.FlexItem, null, children)), !icon && children);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var _default = NavigationButton;
|
|
42
|
+
exports.default = _default;
|
|
43
|
+
//# sourceMappingURL=navigation-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/navigation-button.js"],"names":["NavigationButton","path","icon","children","isBack","props","navigator","push"],"mappings":";;;;;;;;;;;;;AAGA;;AAMA;;AATA;AACA;AACA;AASA,SAASA,gBAAT,CAA2B;AAC1BC,EAAAA,IAD0B;AAE1BC,EAAAA,IAF0B;AAG1BC,EAAAA,QAH0B;AAI1BC,EAAAA,MAAM,GAAG,KAJiB;AAK1B,KAAGC;AALuB,CAA3B,EAMI;AACH,QAAMC,SAAS,GAAG,6CAAlB;AACA,SACC,4BAAC,8BAAD;AAAM,IAAA,OAAO,EAAG,MAAMA,SAAS,CAACC,IAAV,CAAgBN,IAAhB,EAAsB;AAAEG,MAAAA;AAAF,KAAtB;AAAtB,KAAgEC,KAAhE,GACGH,IAAI,IACL,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,oBAAD,QACC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGA,IAAb;AAAoB,IAAA,IAAI,EAAG;AAA3B,IADD,CADD,EAIC,4BAAC,oBAAD,QAAYC,QAAZ,CAJD,CAFF,EASG,CAAED,IAAF,IAAUC,QATb,CADD;AAaA;;eAEcH,gB","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,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _i18n = require("@wordpress/i18n");
|
|
15
|
+
|
|
16
|
+
var _subtitle = _interopRequireDefault(require("./subtitle"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("../editor/utils");
|
|
19
|
+
|
|
20
|
+
var _navigationButton = _interopRequireDefault(require("./navigation-button"));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* WordPress dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Internal dependencies
|
|
28
|
+
*/
|
|
29
|
+
function Palette({
|
|
30
|
+
contextName
|
|
31
|
+
}) {
|
|
32
|
+
const colors = (0, _utils.useSetting)('color.palette', contextName);
|
|
33
|
+
const screenPath = contextName === 'root' ? '/colors/palette' : '/blocks/' + contextName + '/colors/palette';
|
|
34
|
+
return (0, _element.createElement)("div", {
|
|
35
|
+
className: "edit-site-global-style-palette"
|
|
36
|
+
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
37
|
+
spacing: 1
|
|
38
|
+
}, (0, _element.createElement)(_subtitle.default, null, (0, _i18n.__)('Palette')), (0, _element.createElement)(_components.__experimentalItemGroup, {
|
|
39
|
+
isBordered: true,
|
|
40
|
+
isSeparated: true
|
|
41
|
+
}, (0, _element.createElement)(_navigationButton.default, {
|
|
42
|
+
path: screenPath
|
|
43
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, null, (0, _element.createElement)(_components.FlexBlock, null, (0, _element.createElement)(_components.__experimentalZStack, {
|
|
44
|
+
isLayered: false,
|
|
45
|
+
offset: -8
|
|
46
|
+
}, colors.slice(0, 5).map(({
|
|
47
|
+
color
|
|
48
|
+
}) => (0, _element.createElement)(_components.ColorIndicator, {
|
|
49
|
+
key: color,
|
|
50
|
+
colorValue: color
|
|
51
|
+
})))), (0, _element.createElement)(_components.FlexItem, null, (0, _i18n.sprintf)( // Translators: %d: Number of palette colors.
|
|
52
|
+
(0, _i18n._n)('%d color', '%d colors', colors.length), colors.length)))))));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var _default = Palette;
|
|
56
|
+
exports.default = _default;
|
|
57
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/palette.js"],"names":["Palette","contextName","colors","screenPath","slice","map","color","length"],"mappings":";;;;;;;;;;;AAGA;;AASA;;AAKA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAYA;AACA;AACA;AAKA,SAASA,OAAT,CAAkB;AAAEC,EAAAA;AAAF,CAAlB,EAAoC;AACnC,QAAMC,MAAM,GAAG,uBAAY,eAAZ,EAA6BD,WAA7B,CAAf;AACA,QAAME,UAAU,GACfF,WAAW,KAAK,MAAhB,GACG,iBADH,GAEG,aAAaA,WAAb,GAA2B,iBAH/B;AAKA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,iBAAD,QAAY,cAAI,SAAJ,CAAZ,CADD,EAEC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACC,4BAAC,yBAAD;AAAkB,IAAA,IAAI,EAAGE;AAAzB,KACC,4BAAC,gCAAD,QACC,4BAAC,qBAAD,QACC,4BAAC,gCAAD;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,4BAAC,0BAAD;AACC,IAAA,GAAG,EAAGA,KADP;AAEC,IAAA,UAAU,EAAGA;AAFd,IAHA,CADH,CADD,CADD,EAaC,4BAAC,oBAAD,QACG,oBACD;AACA,gBACC,UADD,EAEC,WAFD,EAGCJ,MAAM,CAACK,MAHR,CAFC,EAODL,MAAM,CAACK,MAPN,CADH,CAbD,CADD,CADD,CAFD,CADD,CADD;AAoCA;;eAEcP,O","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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
|
|
12
|
+
var _globalStylesProvider = require("../editor/global-styles-provider");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
const StylesPreview = () => {
|
|
22
|
+
var _getStyle, _getStyle2, _getStyle3, _getStyle4;
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
getStyle
|
|
26
|
+
} = (0, _globalStylesProvider.useGlobalStylesContext)();
|
|
27
|
+
const fontFamily = (_getStyle = getStyle('root', 'fontFamily')) !== null && _getStyle !== void 0 ? _getStyle : 'serif';
|
|
28
|
+
const textColor = (_getStyle2 = getStyle('root', 'color')) !== null && _getStyle2 !== void 0 ? _getStyle2 : 'black';
|
|
29
|
+
const linkColor = (_getStyle3 = getStyle('root', 'linkColor')) !== null && _getStyle3 !== void 0 ? _getStyle3 : 'blue';
|
|
30
|
+
const backgroundColor = (_getStyle4 = getStyle('root', 'backgroundColor')) !== null && _getStyle4 !== void 0 ? _getStyle4 : 'white';
|
|
31
|
+
return (0, _element.createElement)(_components.Card, {
|
|
32
|
+
className: "edit-site-global-styles-preview",
|
|
33
|
+
style: {
|
|
34
|
+
background: backgroundColor
|
|
35
|
+
}
|
|
36
|
+
}, (0, _element.createElement)(_components.__experimentalHStack, {
|
|
37
|
+
spacing: 5
|
|
38
|
+
}, (0, _element.createElement)("div", null, (0, _element.createElement)("span", {
|
|
39
|
+
style: {
|
|
40
|
+
fontFamily,
|
|
41
|
+
fontSize: '80px'
|
|
42
|
+
}
|
|
43
|
+
}, "A"), (0, _element.createElement)("span", {
|
|
44
|
+
style: {
|
|
45
|
+
fontFamily,
|
|
46
|
+
fontSize: '80px'
|
|
47
|
+
}
|
|
48
|
+
}, "a")), (0, _element.createElement)(_components.__experimentalVStack, {
|
|
49
|
+
spacing: 2
|
|
50
|
+
}, (0, _element.createElement)(_components.ColorIndicator, {
|
|
51
|
+
colorValue: textColor
|
|
52
|
+
}), (0, _element.createElement)(_components.ColorIndicator, {
|
|
53
|
+
colorValue: linkColor
|
|
54
|
+
}))));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var _default = StylesPreview;
|
|
58
|
+
exports.default = _default;
|
|
59
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/preview.js"],"names":["StylesPreview","getStyle","fontFamily","textColor","linkColor","backgroundColor","background","fontSize"],"mappings":";;;;;;;;;AAGA;;AASI;;AAZJ;AACA;AACA;;AAQA;AACA;AACA;AAEA,MAAMA,aAAa,GAAG,MAAM;AAAA;;AAC3B,QAAM;AAAEC,IAAAA;AAAF,MAAe,mDAArB;AACA,QAAMC,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,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,KAAK,EAAG;AAAEK,MAAAA,UAAU,EAAED;AAAd;AAFT,KAIC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,yCACC;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,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,0BAAD;AAAgB,IAAA,UAAU,EAAGJ;AAA7B,IADD,EAEC,4BAAC,0BAAD;AAAgB,IAAA,UAAU,EAAGC;AAA7B,IAFD,CALD,CAJD,CADD;AAiBA,CAxBD;;eA0BeJ,a","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"]}
|