@wordpress/edit-site 5.6.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-template/new-template-part.js +3 -11
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +7 -7
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +7 -10
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +6 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +35 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +8 -11
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +11 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +53 -0
- package/build/components/global-styles/effects-panel.js.map +1 -0
- package/build/components/global-styles/filters-panel.js +45 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/global-styles-provider.js +7 -4
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/hooks.js +1 -58
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +4 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +17 -12
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +22 -211
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-effects.js +15 -7
- package/build/components/global-styles/screen-effects.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +2 -2
- package/build/components/global-styles/screen-filters.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +8 -118
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +149 -0
- package/build/components/global-styles/style-variations-container.js.map +1 -0
- package/build/components/global-styles/ui.js +51 -37
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -137
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +8 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +4 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +4 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +8 -6
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js +5 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/site-hub/index.js +4 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +44 -9
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +6 -7
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/hooks/commands/index.js +19 -0
- package/build/hooks/commands/index.js.map +1 -0
- package/build/hooks/commands/use-navigation-commands.js +117 -0
- package/build/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build/hooks/commands/use-wp-admin-commands.js +94 -0
- package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +2 -1
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -9
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -7
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -11
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +6 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +34 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +8 -8
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +11 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +43 -0
- package/build-module/components/global-styles/effects-panel.js.map +1 -0
- package/build-module/components/global-styles/filters-panel.js +35 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/global-styles-provider.js +8 -5
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +1 -52
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +4 -5
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +16 -11
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +23 -208
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-effects.js +13 -4
- package/build-module/components/global-styles/screen-effects.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +2 -2
- package/build-module/components/global-styles/screen-filters.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -114
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +130 -0
- package/build-module/components/global-styles/style-variations-container.js.map +1 -0
- package/build-module/components/global-styles/ui.js +49 -33
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -2
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -135
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +6 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -2
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +9 -7
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +45 -10
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +7 -8
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/hooks/commands/index.js +10 -0
- package/build-module/hooks/commands/index.js.map +1 -0
- package/build-module/hooks/commands/use-navigation-commands.js +101 -0
- package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js +79 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +2 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +2 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +24 -63
- package/build-style/style.css +24 -63
- package/package.json +33 -31
- package/src/components/add-new-template/new-template-part.js +1 -6
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/block-editor/editor-canvas.js +13 -23
- package/src/components/editor/index.js +11 -3
- package/src/components/global-styles/border-panel.js +32 -1
- package/src/components/global-styles/context-menu.js +8 -8
- package/src/components/global-styles/dimensions-panel.js +11 -0
- package/src/components/global-styles/effects-panel.js +40 -0
- package/src/components/global-styles/filters-panel.js +33 -0
- package/src/components/global-styles/global-styles-provider.js +4 -4
- package/src/components/global-styles/hooks.js +1 -78
- package/src/components/global-styles/preview.js +2 -2
- package/src/components/global-styles/screen-block-list.js +11 -7
- package/src/components/global-styles/screen-colors.js +25 -229
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-effects.js +12 -5
- package/src/components/global-styles/screen-filters.js +2 -2
- package/src/components/global-styles/screen-style-variations.js +10 -129
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/stories/index.js +425 -0
- package/src/components/global-styles/style-variations-container.js +136 -0
- package/src/components/global-styles/style.scss +4 -57
- package/src/components/global-styles/ui.js +50 -33
- package/src/components/global-styles-renderer/index.js +1 -2
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -155
- package/src/components/layout/index.js +4 -0
- package/src/components/preferences-modal/index.js +7 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -3
- package/src/components/sidebar/index.js +4 -0
- package/src/components/sidebar-navigation-screen/index.js +10 -5
- package/src/components/sidebar-navigation-screen/style.scss +20 -5
- package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
- package/src/components/sidebar-navigation-screen-main/index.js +9 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
- package/src/components/site-hub/index.js +3 -3
- package/src/components/start-template-options/index.js +40 -8
- package/src/components/start-template-options/style.scss +7 -14
- package/src/components/style-book/index.js +10 -16
- package/src/components/style-book/style.scss +1 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/hooks/commands/index.js +10 -0
- package/src/hooks/commands/use-navigation-commands.js +103 -0
- package/src/hooks/commands/use-wp-admin-commands.js +77 -0
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/hooks/template-part-edit.js +1 -0
- package/src/index.js +1 -0
- package/src/store/selectors.js +2 -1
- package/build/components/global-styles/color-utils.js +0 -17
- package/build/components/global-styles/color-utils.js.map +0 -1
- package/build/components/global-styles/duotone-panel.js +0 -78
- package/build/components/global-styles/duotone-panel.js.map +0 -1
- package/build/components/global-styles/filter-utils.js +0 -17
- package/build/components/global-styles/filter-utils.js.map +0 -1
- package/build/components/global-styles/screen-background-color.js +0 -114
- package/build/components/global-styles/screen-background-color.js.map +0 -1
- package/build/components/global-styles/screen-button-color.js +0 -88
- package/build/components/global-styles/screen-button-color.js.map +0 -1
- package/build/components/global-styles/screen-heading-color.js +0 -165
- package/build/components/global-styles/screen-heading-color.js.map +0 -1
- package/build/components/global-styles/screen-link-color.js +0 -105
- package/build/components/global-styles/screen-link-color.js.map +0 -1
- package/build/components/global-styles/screen-text-color.js +0 -71
- package/build/components/global-styles/screen-text-color.js.map +0 -1
- package/build/components/global-styles/shadow-panel.js +0 -197
- package/build/components/global-styles/shadow-panel.js.map +0 -1
- package/build-module/components/global-styles/color-utils.js +0 -9
- package/build-module/components/global-styles/color-utils.js.map +0 -1
- package/build-module/components/global-styles/duotone-panel.js +0 -67
- package/build-module/components/global-styles/duotone-panel.js.map +0 -1
- package/build-module/components/global-styles/filter-utils.js +0 -9
- package/build-module/components/global-styles/filter-utils.js.map +0 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -97
- package/build-module/components/global-styles/screen-background-color.js.map +0 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -73
- package/build-module/components/global-styles/screen-button-color.js.map +0 -1
- package/build-module/components/global-styles/screen-heading-color.js +0 -149
- package/build-module/components/global-styles/screen-heading-color.js.map +0 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -89
- package/build-module/components/global-styles/screen-link-color.js.map +0 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -56
- package/build-module/components/global-styles/screen-text-color.js.map +0 -1
- package/build-module/components/global-styles/shadow-panel.js +0 -178
- package/build-module/components/global-styles/shadow-panel.js.map +0 -1
- package/src/components/global-styles/color-utils.js +0 -14
- package/src/components/global-styles/duotone-panel.js +0 -82
- package/src/components/global-styles/filter-utils.js +0 -9
- package/src/components/global-styles/screen-background-color.js +0 -132
- package/src/components/global-styles/screen-button-color.js +0 -104
- package/src/components/global-styles/screen-heading-color.js +0 -206
- package/src/components/global-styles/screen-link-color.js +0 -124
- package/src/components/global-styles/screen-text-color.js +0 -62
- package/src/components/global-styles/shadow-panel.js +0 -178
|
@@ -11,7 +11,7 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _filtersPanel = _interopRequireDefault(require("./filters-panel"));
|
|
15
15
|
|
|
16
16
|
var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel"));
|
|
17
17
|
|
|
@@ -36,7 +36,7 @@ function ScreenFilters(_ref) {
|
|
|
36
36
|
title: (0, _i18n.__)('Filters')
|
|
37
37
|
}), (0, _element.createElement)(_blockPreviewPanel.default, {
|
|
38
38
|
name: name
|
|
39
|
-
}), (0, _element.createElement)(
|
|
39
|
+
}), (0, _element.createElement)(_filtersPanel.default, {
|
|
40
40
|
name: name
|
|
41
41
|
}));
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-filters.js"],"names":["ScreenFilters","name"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,aAAT,OAAmC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAClC,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAtB,IADD,EAEC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGA;AAA1B,IAFD,EAGC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGA;AAArB,IAHD,CADD;AAOA;;eAEcD,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-filters.js"],"names":["ScreenFilters","name"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AAdA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,aAAT,OAAmC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAClC,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAtB,IADD,EAEC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGA;AAA1B,IAFD,EAGC,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGA;AAArB,IAHD,CADD;AAOA;;eAEcD,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport FiltersPanel from './filters-panel';\nimport BlockPreviewPanel from './block-preview-panel';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\n\nfunction ScreenFilters( { name } ) {\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Filters' ) } />\n\t\t\t<BlockPreviewPanel name={ name } />\n\t\t\t<FiltersPanel name={ name } />\n\t\t</>\n\t);\n}\n\nexport default ScreenFilters;\n"]}
|
|
@@ -9,33 +9,17 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
|
|
15
|
-
|
|
16
|
-
var _coreData = require("@wordpress/core-data");
|
|
17
|
-
|
|
18
|
-
var _data = require("@wordpress/data");
|
|
19
|
-
|
|
20
|
-
var _keycodes = require("@wordpress/keycodes");
|
|
21
|
-
|
|
22
12
|
var _components = require("@wordpress/components");
|
|
23
13
|
|
|
24
14
|
var _i18n = require("@wordpress/i18n");
|
|
25
15
|
|
|
26
16
|
var _blockEditor = require("@wordpress/block-editor");
|
|
27
17
|
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _preview = _interopRequireDefault(require("./preview"));
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
31
19
|
|
|
32
20
|
var _header = _interopRequireDefault(require("./header"));
|
|
33
21
|
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* External dependencies
|
|
38
|
-
*/
|
|
22
|
+
var _styleVariationsContainer = _interopRequireDefault(require("./style-variations-container"));
|
|
39
23
|
|
|
40
24
|
/**
|
|
41
25
|
* WordPress dependencies
|
|
@@ -44,107 +28,14 @@ var _privateApis = require("../../private-apis");
|
|
|
44
28
|
/**
|
|
45
29
|
* Internal dependencies
|
|
46
30
|
*/
|
|
47
|
-
const {
|
|
48
|
-
GlobalStylesContext
|
|
49
|
-
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
50
|
-
|
|
51
|
-
function compareVariations(a, b) {
|
|
52
|
-
return (0, _es.default)(a.styles, b.styles) && (0, _es.default)(a.settings, b.settings);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function Variation(_ref) {
|
|
56
|
-
let {
|
|
57
|
-
variation
|
|
58
|
-
} = _ref;
|
|
59
|
-
const [isFocused, setIsFocused] = (0, _element.useState)(false);
|
|
60
|
-
const {
|
|
61
|
-
base,
|
|
62
|
-
user,
|
|
63
|
-
setUserConfig
|
|
64
|
-
} = (0, _element.useContext)(GlobalStylesContext);
|
|
65
|
-
const context = (0, _element.useMemo)(() => {
|
|
66
|
-
var _variation$settings, _variation$styles;
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
user: {
|
|
70
|
-
settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
|
|
71
|
-
styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
|
|
72
|
-
},
|
|
73
|
-
base,
|
|
74
|
-
merged: (0, _globalStylesProvider.mergeBaseAndUserConfigs)(base, variation),
|
|
75
|
-
setUserConfig: () => {}
|
|
76
|
-
};
|
|
77
|
-
}, [variation, base]);
|
|
78
|
-
|
|
79
|
-
const selectVariation = () => {
|
|
80
|
-
setUserConfig(() => {
|
|
81
|
-
return {
|
|
82
|
-
settings: variation.settings,
|
|
83
|
-
styles: variation.styles
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const selectOnEnter = event => {
|
|
89
|
-
if (event.keyCode === _keycodes.ENTER) {
|
|
90
|
-
event.preventDefault();
|
|
91
|
-
selectVariation();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const isActive = (0, _element.useMemo)(() => {
|
|
96
|
-
return compareVariations(user, variation);
|
|
97
|
-
}, [user, variation]);
|
|
98
|
-
return (0, _element.createElement)(GlobalStylesContext.Provider, {
|
|
99
|
-
value: context
|
|
100
|
-
}, (0, _element.createElement)("div", {
|
|
101
|
-
className: (0, _classnames.default)('edit-site-global-styles-variations_item', {
|
|
102
|
-
'is-active': isActive
|
|
103
|
-
}),
|
|
104
|
-
role: "button",
|
|
105
|
-
onClick: selectVariation,
|
|
106
|
-
onKeyDown: selectOnEnter,
|
|
107
|
-
tabIndex: "0",
|
|
108
|
-
"aria-label": variation === null || variation === void 0 ? void 0 : variation.title,
|
|
109
|
-
"aria-current": isActive,
|
|
110
|
-
onFocus: () => setIsFocused(true),
|
|
111
|
-
onBlur: () => setIsFocused(false)
|
|
112
|
-
}, (0, _element.createElement)("div", {
|
|
113
|
-
className: "edit-site-global-styles-variations_item-preview"
|
|
114
|
-
}, (0, _element.createElement)(_preview.default, {
|
|
115
|
-
label: variation === null || variation === void 0 ? void 0 : variation.title,
|
|
116
|
-
isFocused: isFocused,
|
|
117
|
-
withHoverView: true
|
|
118
|
-
}))));
|
|
119
|
-
}
|
|
120
|
-
|
|
121
31
|
function ScreenStyleVariations() {
|
|
122
32
|
const {
|
|
123
|
-
variations,
|
|
124
33
|
mode
|
|
125
34
|
} = (0, _data.useSelect)(select => {
|
|
126
35
|
return {
|
|
127
|
-
variations: select(_coreData.store).__experimentalGetCurrentThemeGlobalStylesVariations(),
|
|
128
36
|
mode: select(_blockEditor.store).__unstableGetEditorMode()
|
|
129
37
|
};
|
|
130
38
|
}, []);
|
|
131
|
-
const withEmptyVariation = (0, _element.useMemo)(() => {
|
|
132
|
-
return [{
|
|
133
|
-
title: (0, _i18n.__)('Default'),
|
|
134
|
-
settings: {},
|
|
135
|
-
styles: {}
|
|
136
|
-
}, ...variations.map(variation => {
|
|
137
|
-
var _variation$settings2, _variation$styles2;
|
|
138
|
-
|
|
139
|
-
return { ...variation,
|
|
140
|
-
settings: (_variation$settings2 = variation.settings) !== null && _variation$settings2 !== void 0 ? _variation$settings2 : {},
|
|
141
|
-
styles: (_variation$styles2 = variation.styles) !== null && _variation$styles2 !== void 0 ? _variation$styles2 : {}
|
|
142
|
-
};
|
|
143
|
-
})];
|
|
144
|
-
}, [variations]);
|
|
145
|
-
const {
|
|
146
|
-
__unstableSetEditorMode
|
|
147
|
-
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
148
39
|
const shouldRevertInitialMode = (0, _element.useRef)(null);
|
|
149
40
|
(0, _element.useEffect)(() => {
|
|
150
41
|
// ignore changes to zoom-out mode as we explictily change to it on mount.
|
|
@@ -166,8 +57,12 @@ function ScreenStyleVariations() {
|
|
|
166
57
|
__unstableSetEditorMode(mode);
|
|
167
58
|
}
|
|
168
59
|
};
|
|
169
|
-
}
|
|
60
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
|
|
170
62
|
}, []);
|
|
63
|
+
const {
|
|
64
|
+
__unstableSetEditorMode
|
|
65
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
171
66
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
|
|
172
67
|
back: "/",
|
|
173
68
|
title: (0, _i18n.__)('Browse styles'),
|
|
@@ -176,12 +71,7 @@ function ScreenStyleVariations() {
|
|
|
176
71
|
size: "small",
|
|
177
72
|
isBorderless: true,
|
|
178
73
|
className: "edit-site-global-styles-screen-style-variations"
|
|
179
|
-
}, (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(
|
|
180
|
-
columns: 2
|
|
181
|
-
}, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0, _element.createElement)(Variation, {
|
|
182
|
-
key: index,
|
|
183
|
-
variation: variation
|
|
184
|
-
}))))));
|
|
74
|
+
}, (0, _element.createElement)(_components.CardBody, null, (0, _element.createElement)(_styleVariationsContainer.default, null))));
|
|
185
75
|
}
|
|
186
76
|
|
|
187
77
|
var _default = ScreenStyleVariations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-style-variations.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-style-variations.js"],"names":["ScreenStyleVariations","mode","select","blockEditorStore","__unstableGetEditorMode","shouldRevertInitialMode","current","__unstableSetEditorMode"],"mappings":";;;;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AACA;;AAbA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,qBAAT,GAAiC;AAChC,QAAM;AAAEC,IAAAA;AAAF,MAAW,qBAAaC,MAAF,IAAc;AACzC,WAAO;AACND,MAAAA,IAAI,EAAEC,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,uBAA3B;AADA,KAAP;AAGA,GAJgB,EAId,EAJc,CAAjB;AAMA,QAAMC,uBAAuB,GAAG,qBAAQ,IAAR,CAAhC;AACA,0BAAW,MAAM;AAChB;AACA,QAAKJ,IAAI,KAAK,UAAd,EAA2B;AAC1BI,MAAAA,uBAAuB,CAACC,OAAxB,GAAkC,KAAlC;AACA;AACD,GALD,EAKG,CAAEL,IAAF,CALH,EARgC,CAehC;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QAAKA,IAAI,KAAK,UAAd,EAA2B;AAC1BM,MAAAA,uBAAuB,CAAE,UAAF,CAAvB;;AACAF,MAAAA,uBAAuB,CAACC,OAAxB,GAAkC,IAAlC;AACA,aAAO,MAAM;AACZ;AACA,YAAKD,uBAAuB,CAACC,OAA7B,EAAuC;AACtCC,UAAAA,uBAAuB,CAAEN,IAAF,CAAvB;AACA;AACD,OALD;AAMA,KAVe,CAWhB;;AACA,GAZD,EAYG,EAZH;AAcA,QAAM;AAAEM,IAAAA;AAAF,MAA8B,uBAAaJ,kBAAb,CAApC;AAEA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,IAAI,EAAC,GADN;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,oDADa;AAHf,IADD,EASC,4BAAC,gBAAD;AACC,IAAA,IAAI,EAAC,OADN;AAEC,IAAA,YAAY,MAFb;AAGC,IAAA,SAAS,EAAC;AAHX,KAKC,4BAAC,oBAAD,QACC,4BAAC,iCAAD,OADD,CALD,CATD,CADD;AAqBA;;eAEcH,qB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Card, CardBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport StyleVariationsContainer from './style-variations-container';\n\nfunction ScreenStyleVariations() {\n\tconst { mode } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tmode: select( blockEditorStore ).__unstableGetEditorMode(),\n\t\t};\n\t}, [] );\n\n\tconst shouldRevertInitialMode = useRef( null );\n\tuseEffect( () => {\n\t\t// ignore changes to zoom-out mode as we explictily change to it on mount.\n\t\tif ( mode !== 'zoom-out' ) {\n\t\t\tshouldRevertInitialMode.current = false;\n\t\t}\n\t}, [ mode ] );\n\n\t// Intentionality left without any dependency.\n\t// This effect should only run the first time the component is rendered.\n\t// The effect opens the zoom-out view if it is not open before when applying a style variation.\n\tuseEffect( () => {\n\t\tif ( mode !== 'zoom-out' ) {\n\t\t\t__unstableSetEditorMode( 'zoom-out' );\n\t\t\tshouldRevertInitialMode.current = true;\n\t\t\treturn () => {\n\t\t\t\t// if there were not mode changes revert to the initial mode when unmounting.\n\t\t\t\tif ( shouldRevertInitialMode.current ) {\n\t\t\t\t\t__unstableSetEditorMode( mode );\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [] );\n\n\tconst { __unstableSetEditorMode } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback=\"/\"\n\t\t\t\ttitle={ __( 'Browse styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a variation to change the look of the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<Card\n\t\t\t\tsize=\"small\"\n\t\t\t\tisBorderless\n\t\t\t\tclassName=\"edit-site-global-styles-screen-style-variations\"\n\t\t\t>\n\t\t\t\t<CardBody>\n\t\t\t\t\t<StyleVariationsContainer />\n\t\t\t\t</CardBody>\n\t\t\t</Card>\n\t\t</>\n\t);\n}\n\nexport default ScreenStyleVariations;\n"]}
|
|
@@ -39,6 +39,10 @@ const elements = {
|
|
|
39
39
|
description: (0, _i18n.__)('Manage the fonts and typography used on headings.'),
|
|
40
40
|
title: (0, _i18n.__)('Headings')
|
|
41
41
|
},
|
|
42
|
+
caption: {
|
|
43
|
+
description: (0, _i18n.__)('Manage the fonts and typography used on captions.'),
|
|
44
|
+
title: (0, _i18n.__)('Captions')
|
|
45
|
+
},
|
|
42
46
|
button: {
|
|
43
47
|
description: (0, _i18n.__)('Manage the fonts and typography used on buttons.'),
|
|
44
48
|
title: (0, _i18n.__)('Buttons')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography-element.js"],"names":["elements","text","description","title","link","heading","button","ScreenTypographyElement","name","element","headingLevel","setHeadingLevel"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,QAAQ,GAAG;AAChBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,WAAW,EAAE,cAAI,oCAAJ,CADR;AAELC,IAAAA,KAAK,EAAE,cAAI,MAAJ;AAFF,GADU;AAKhBC,EAAAA,IAAI,EAAE;AACLF,IAAAA,WAAW,EAAE,cAAI,oDAAJ,CADR;AAELC,IAAAA,KAAK,EAAE,cAAI,OAAJ;AAFF,GALU;AAShBE,EAAAA,OAAO,EAAE;AACRH,IAAAA,WAAW,EAAE,cAAI,mDAAJ,CADL;AAERC,IAAAA,KAAK,EAAE,cAAI,UAAJ;AAFC,GATO;AAahBG,EAAAA,MAAM,EAAE;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography-element.js"],"names":["elements","text","description","title","link","heading","caption","button","ScreenTypographyElement","name","element","headingLevel","setHeadingLevel"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAUA;;AACA;;AACA;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAMA,QAAQ,GAAG;AAChBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,WAAW,EAAE,cAAI,oCAAJ,CADR;AAELC,IAAAA,KAAK,EAAE,cAAI,MAAJ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AAGC,YAHT;AAIC,IAAA,QAAQ,EAAGC,eAJZ;AAKC,IAAA,OAAO,MALR;AAMC,IAAA,IAAI,EAAC,kBANN;AAOC,IAAA,uBAAuB;AAPxB,KASC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC;AACN;AACP;AAHM;AAIC,IAAA,KAAK,EAAG,cAAI,KAAJ;AAJT,IATD,EAeC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IAfD,EAmBC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IAnBD,EAuBC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IAvBD,EA2BC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IA3BD,EA+BC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IA/BD,EAmCC,4BAAC,kDAAD;AACC,IAAA,KAAK,EAAC,IADP;AAEC,IAAA,KAAK,EAAG,cAAI,IAAJ;AAFT,IAnCD,CADD,CAbF,EAwDC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGH,IADR;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,YAAY,EAAGC;AAHhB,IAxDD,CADD;AAgEA;;eAEcH,uB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TypographyPanel from './typography-panel';\nimport ScreenHeader from './header';\nimport TypographyPreview from './typography-preview';\n\nconst elements = {\n\ttext: {\n\t\tdescription: __( 'Manage the fonts used on the site.' ),\n\t\ttitle: __( 'Text' ),\n\t},\n\tlink: {\n\t\tdescription: __( 'Manage the fonts and typography used on the links.' ),\n\t\ttitle: __( 'Links' ),\n\t},\n\theading: {\n\t\tdescription: __( 'Manage the fonts and typography used on headings.' ),\n\t\ttitle: __( 'Headings' ),\n\t},\n\tcaption: {\n\t\tdescription: __( 'Manage the fonts and typography used on captions.' ),\n\t\ttitle: __( 'Captions' ),\n\t},\n\tbutton: {\n\t\tdescription: __( 'Manage the fonts and typography used on buttons.' ),\n\t\ttitle: __( 'Buttons' ),\n\t},\n};\n\nfunction ScreenTypographyElement( { name, element } ) {\n\tconst [ headingLevel, setHeadingLevel ] = useState( 'heading' );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ elements[ element ].title }\n\t\t\t\tdescription={ elements[ element ].description }\n\t\t\t/>\n\t\t\t<Spacer marginX={ 4 }>\n\t\t\t\t<TypographyPreview\n\t\t\t\t\tname={ name }\n\t\t\t\t\telement={ element }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t</Spacer>\n\t\t\t{ element === 'heading' && (\n\t\t\t\t<Spacer marginX={ 4 } marginBottom=\"1em\">\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Select heading level' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ headingLevel }\n\t\t\t\t\t\tonChange={ setHeadingLevel }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"heading\"\n\t\t\t\t\t\t\t/* translators: 'All' refers to selecting all heading levels \n\t\t\t\t\t\t\tand applying the same style to h1-h6. */\n\t\t\t\t\t\t\tlabel={ __( 'All' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h1\"\n\t\t\t\t\t\t\tlabel={ __( 'H1' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h2\"\n\t\t\t\t\t\t\tlabel={ __( 'H2' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h3\"\n\t\t\t\t\t\t\tlabel={ __( 'H3' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h4\"\n\t\t\t\t\t\t\tlabel={ __( 'H4' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h5\"\n\t\t\t\t\t\t\tlabel={ __( 'H5' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tvalue=\"h6\"\n\t\t\t\t\t\t\tlabel={ __( 'H6' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</Spacer>\n\t\t\t) }\n\t\t\t<TypographyPanel\n\t\t\t\tname={ name }\n\t\t\t\telement={ element }\n\t\t\t\theadingLevel={ headingLevel }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTypographyElement;\n"]}
|
|
@@ -122,6 +122,11 @@ function ScreenTypography(_ref2) {
|
|
|
122
122
|
parentMenu: parentMenu,
|
|
123
123
|
element: "heading",
|
|
124
124
|
label: (0, _i18n.__)('Headings')
|
|
125
|
+
}), (0, _element.createElement)(Item, {
|
|
126
|
+
name: name,
|
|
127
|
+
parentMenu: parentMenu,
|
|
128
|
+
element: "caption",
|
|
129
|
+
label: (0, _i18n.__)('Captions')
|
|
125
130
|
}), (0, _element.createElement)(Item, {
|
|
126
131
|
name: name,
|
|
127
132
|
parentMenu: parentMenu,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["useGlobalStyle","blockEditorPrivateApis","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variation","undefined","variationClassName"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAUA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;;AAEA,SAASC,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC,EAAlC,GAAwC,YAAYA,OAAS,GAD9D;AAEA,QAAMI,WAAW,GAChBJ,OAAO,KAAK,MAAZ,GACG;AACAK,IAAAA,cAAc,EAAE;AADhB,GADH,GAIG,EALJ;AAMA,QAAM,CAAEC,UAAF,IAAiBX,cAAc,CACpCQ,MAAM,GAAG,uBAD2B,EAEpCL,IAFoC,CAArC;AAIA,QAAM,CAAES,SAAF,IAAgBZ,cAAc,CACnCQ,MAAM,GAAG,sBAD0B,EAEnCL,IAFmC,CAApC;AAIA,QAAM,CAAEU,UAAF,IAAiBb,cAAc,CACpCQ,MAAM,GAAG,uBAD2B,EAEpCL,IAFoC,CAArC;AAIA,QAAM,CAAEW,aAAF,IAAoBd,cAAc,CACvCQ,MAAM,GAAG,0BAD8B,EAEvCL,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3B;AACA,SACC,qDACC,4BAAC,eAAD;AACC,IAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,IAAA,WAAW,EAAG,cACb,wDADa;AAFf,IADD,EAQC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGlB,IAA1B;AAAiC,IAAA,SAAS,EAAGoB;AAA7C,IARD,EAUG,CAAEpB,IAAF,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,iBAAD;AAAU,IAAA,KAAK,EAAG;AAAlB,KAAwB,cAAI,UAAJ,CAAxB,CADD,EAEC,4BAAC,mCAAD;AAAW,IAAA,UAAU,MAArB;AAAsB,IAAA,WAAW;AAAjC,KACC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGA,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,MAHT;AAIC,IAAA,KAAK,EAAG,cAAI,MAAJ;AAJT,IADD,EAOC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,MAHT;AAIC,IAAA,KAAK,EAAG,cAAI,OAAJ;AAJT,IAPD,EAaC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,SAHT;AAIC,IAAA,KAAK,EAAG,cAAI,UAAJ;AAJT,IAbD,EAmBC,4BAAC,IAAD;AACC,IAAA,IAAI,EAAGD,IADR;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,OAAO,EAAC,QAHT;AAIC,IAAA,KAAK,EAAG,cAAI,SAAJ;AAJT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-typography.js"],"names":["useGlobalStyle","blockEditorPrivateApis","Item","name","parentMenu","element","label","hasSupport","prefix","extraStyles","textDecoration","fontFamily","fontStyle","fontWeight","letterSpacing","backgroundColor","gradientValue","color","navigationButtonLabel","background","ScreenTypography","variation","undefined","variationClassName"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAUA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqB,yBAAQC,wBAAR,CAA3B;;AAEA,SAASC,IAAT,OAAsD;AAAA,MAAvC;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,UAAR;AAAoBC,IAAAA,OAApB;AAA6BC,IAAAA;AAA7B,GAAuC;AACrD,QAAMC,UAAU,GAAG,CAAEJ,IAArB;AACA,QAAMK,MAAM,GACXH,OAAO,KAAK,MAAZ,IAAsB,CAAEA,OAAxB,GAAkC,EAAlC,GAAwC,YAAYA,OAAS,GAD9D;AAEA,QAAMI,WAAW,GAChBJ,OAAO,KAAK,MAAZ,GACG;AACAK,IAAAA,cAAc,EAAE;AADhB,GADH,GAIG,EALJ;AAMA,QAAM,CAAEC,UAAF,IAAiBX,cAAc,CACpCQ,MAAM,GAAG,uBAD2B,EAEpCL,IAFoC,CAArC;AAIA,QAAM,CAAES,SAAF,IAAgBZ,cAAc,CACnCQ,MAAM,GAAG,sBAD0B,EAEnCL,IAFmC,CAApC;AAIA,QAAM,CAAEU,UAAF,IAAiBb,cAAc,CACpCQ,MAAM,GAAG,uBAD2B,EAEpCL,IAFoC,CAArC;AAIA,QAAM,CAAEW,aAAF,IAAoBd,cAAc,CACvCQ,MAAM,GAAG,0BAD8B,EAEvCL,IAFuC,CAAxC;AAIA,QAAM,CAAEY,eAAF,IAAsBf,cAAc,CACzCQ,MAAM,GAAG,kBADgC,EAEzCL,IAFyC,CAA1C;AAIA,QAAM,CAAEa,aAAF,IAAoBhB,cAAc,CAAEQ,MAAM,GAAG,gBAAX,EAA6BL,IAA7B,CAAxC;AACA,QAAM,CAAEc,KAAF,IAAYjB,cAA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["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tFlexItem,\n} from '@wordpress/components';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport Subtitle from './subtitle';\nimport TypographyPanel from './typography-panel';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nfunction Item( { name, parentMenu, element, label } ) {\n\tconst hasSupport = ! name;\n\tconst prefix =\n\t\telement === 'text' || ! element ? '' : `elements.${ element }.`;\n\tconst extraStyles =\n\t\telement === 'link'\n\t\t\t? {\n\t\t\t\t\ttextDecoration: 'underline',\n\t\t\t }\n\t\t\t: {};\n\tconst [ fontFamily ] = useGlobalStyle(\n\t\tprefix + 'typography.fontFamily',\n\t\tname\n\t);\n\tconst [ fontStyle ] = useGlobalStyle(\n\t\tprefix + 'typography.fontStyle',\n\t\tname\n\t);\n\tconst [ fontWeight ] = useGlobalStyle(\n\t\tprefix + 'typography.fontWeight',\n\t\tname\n\t);\n\tconst [ letterSpacing ] = useGlobalStyle(\n\t\tprefix + 'typography.letterSpacing',\n\t\tname\n\t);\n\tconst [ backgroundColor ] = useGlobalStyle(\n\t\tprefix + 'color.background',\n\t\tname\n\t);\n\tconst [ gradientValue ] = useGlobalStyle( prefix + 'color.gradient', name );\n\tconst [ color ] = useGlobalStyle( prefix + 'color.text', name );\n\n\tif ( ! hasSupport ) {\n\t\treturn null;\n\t}\n\n\tconst navigationButtonLabel = sprintf(\n\t\t// translators: %s: is a subset of Typography, e.g., 'text' or 'links'.\n\t\t__( 'Typography %s styles' ),\n\t\tlabel\n\t);\n\n\treturn (\n\t\t<NavigationButtonAsItem\n\t\t\tpath={ parentMenu + '/typography/' + element }\n\t\t\taria-label={ navigationButtonLabel }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\">\n\t\t\t\t<FlexItem\n\t\t\t\t\tclassName=\"edit-site-global-styles-screen-typography__indicator\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tfontFamily: fontFamily ?? 'serif',\n\t\t\t\t\t\tbackground: gradientValue ?? backgroundColor,\n\t\t\t\t\t\tcolor,\n\t\t\t\t\t\tfontStyle,\n\t\t\t\t\t\tfontWeight,\n\t\t\t\t\t\tletterSpacing,\n\t\t\t\t\t\t...extraStyles,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Aa' ) }\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem>{ label }</FlexItem>\n\t\t\t</HStack>\n\t\t</NavigationButtonAsItem>\n\t);\n}\n\nfunction ScreenTypography( { name, variation = '' } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst variationClassName = getVariationClassName( variation );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Typography' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage the typography settings for different elements.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\n\t\t\t{ ! name && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-typography\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle level={ 3 }>{ __( 'Elements' ) }</Subtitle>\n\t\t\t\t\t\t<ItemGroup isBordered isSeparated>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"text\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Text' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"link\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Links' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"heading\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Headings' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"caption\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Captions' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Item\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\tparentMenu={ parentMenu }\n\t\t\t\t\t\t\t\telement=\"button\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Buttons' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ /* No typography elements support yet for blocks. */ }\n\t\t\t{ !! name && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tname={ name }\n\t\t\t\t\tvariation={ variation }\n\t\t\t\t\telement=\"text\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenTypography;\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
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 = StyleVariationsContainer;
|
|
9
|
+
|
|
10
|
+
var _element = require("@wordpress/element");
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
|
|
15
|
+
|
|
16
|
+
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
|
|
18
|
+
var _data = require("@wordpress/data");
|
|
19
|
+
|
|
20
|
+
var _keycodes = require("@wordpress/keycodes");
|
|
21
|
+
|
|
22
|
+
var _components = require("@wordpress/components");
|
|
23
|
+
|
|
24
|
+
var _i18n = require("@wordpress/i18n");
|
|
25
|
+
|
|
26
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
27
|
+
|
|
28
|
+
var _globalStylesProvider = require("./global-styles-provider");
|
|
29
|
+
|
|
30
|
+
var _preview = _interopRequireDefault(require("./preview"));
|
|
31
|
+
|
|
32
|
+
var _privateApis = require("../../private-apis");
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* External dependencies
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* WordPress dependencies
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Internal dependencies
|
|
44
|
+
*/
|
|
45
|
+
const {
|
|
46
|
+
GlobalStylesContext
|
|
47
|
+
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
48
|
+
|
|
49
|
+
function compareVariations(a, b) {
|
|
50
|
+
return (0, _es.default)(a.styles, b.styles) && (0, _es.default)(a.settings, b.settings);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function Variation(_ref) {
|
|
54
|
+
let {
|
|
55
|
+
variation
|
|
56
|
+
} = _ref;
|
|
57
|
+
const [isFocused, setIsFocused] = (0, _element.useState)(false);
|
|
58
|
+
const {
|
|
59
|
+
base,
|
|
60
|
+
user,
|
|
61
|
+
setUserConfig
|
|
62
|
+
} = (0, _element.useContext)(GlobalStylesContext);
|
|
63
|
+
const context = (0, _element.useMemo)(() => {
|
|
64
|
+
var _variation$settings, _variation$styles;
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
user: {
|
|
68
|
+
settings: (_variation$settings = variation.settings) !== null && _variation$settings !== void 0 ? _variation$settings : {},
|
|
69
|
+
styles: (_variation$styles = variation.styles) !== null && _variation$styles !== void 0 ? _variation$styles : {}
|
|
70
|
+
},
|
|
71
|
+
base,
|
|
72
|
+
merged: (0, _globalStylesProvider.mergeBaseAndUserConfigs)(base, variation),
|
|
73
|
+
setUserConfig: () => {}
|
|
74
|
+
};
|
|
75
|
+
}, [variation, base]);
|
|
76
|
+
|
|
77
|
+
const selectVariation = () => {
|
|
78
|
+
setUserConfig(() => {
|
|
79
|
+
return {
|
|
80
|
+
settings: variation.settings,
|
|
81
|
+
styles: variation.styles
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const selectOnEnter = event => {
|
|
87
|
+
if (event.keyCode === _keycodes.ENTER) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
selectVariation();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const isActive = (0, _element.useMemo)(() => {
|
|
94
|
+
return compareVariations(user, variation);
|
|
95
|
+
}, [user, variation]);
|
|
96
|
+
return (0, _element.createElement)(GlobalStylesContext.Provider, {
|
|
97
|
+
value: context
|
|
98
|
+
}, (0, _element.createElement)("div", {
|
|
99
|
+
className: (0, _classnames.default)('edit-site-global-styles-variations_item', {
|
|
100
|
+
'is-active': isActive
|
|
101
|
+
}),
|
|
102
|
+
role: "button",
|
|
103
|
+
onClick: selectVariation,
|
|
104
|
+
onKeyDown: selectOnEnter,
|
|
105
|
+
tabIndex: "0",
|
|
106
|
+
"aria-label": variation === null || variation === void 0 ? void 0 : variation.title,
|
|
107
|
+
"aria-current": isActive,
|
|
108
|
+
onFocus: () => setIsFocused(true),
|
|
109
|
+
onBlur: () => setIsFocused(false)
|
|
110
|
+
}, (0, _element.createElement)("div", {
|
|
111
|
+
className: "edit-site-global-styles-variations_item-preview"
|
|
112
|
+
}, (0, _element.createElement)(_preview.default, {
|
|
113
|
+
label: variation === null || variation === void 0 ? void 0 : variation.title,
|
|
114
|
+
isFocused: isFocused,
|
|
115
|
+
withHoverView: true
|
|
116
|
+
}))));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function StyleVariationsContainer() {
|
|
120
|
+
const {
|
|
121
|
+
variations
|
|
122
|
+
} = (0, _data.useSelect)(select => {
|
|
123
|
+
return {
|
|
124
|
+
variations: select(_coreData.store).__experimentalGetCurrentThemeGlobalStylesVariations() || []
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
127
|
+
const withEmptyVariation = (0, _element.useMemo)(() => {
|
|
128
|
+
return [{
|
|
129
|
+
title: (0, _i18n.__)('Default'),
|
|
130
|
+
settings: {},
|
|
131
|
+
styles: {}
|
|
132
|
+
}, ...variations.map(variation => {
|
|
133
|
+
var _variation$settings2, _variation$styles2;
|
|
134
|
+
|
|
135
|
+
return { ...variation,
|
|
136
|
+
settings: (_variation$settings2 = variation.settings) !== null && _variation$settings2 !== void 0 ? _variation$settings2 : {},
|
|
137
|
+
styles: (_variation$styles2 = variation.styles) !== null && _variation$styles2 !== void 0 ? _variation$styles2 : {}
|
|
138
|
+
};
|
|
139
|
+
})];
|
|
140
|
+
}, [variations]);
|
|
141
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalGrid, {
|
|
142
|
+
columns: 2,
|
|
143
|
+
className: "edit-site-global-styles-style-variations-container"
|
|
144
|
+
}, withEmptyVariation === null || withEmptyVariation === void 0 ? void 0 : withEmptyVariation.map((variation, index) => (0, _element.createElement)(Variation, {
|
|
145
|
+
key: index,
|
|
146
|
+
variation: variation
|
|
147
|
+
}))));
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=style-variations-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/style-variations-container.js"],"names":["GlobalStylesContext","blockEditorPrivateApis","compareVariations","a","b","styles","settings","Variation","variation","isFocused","setIsFocused","base","user","setUserConfig","context","merged","selectVariation","selectOnEnter","event","keyCode","ENTER","preventDefault","isActive","title","StyleVariationsContainer","variations","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","withEmptyVariation","map","index"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAIA;AACA;AACA;;AASA;AACA;AACA;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAA0B,yBAAQC,wBAAR,CAAhC;;AAEA,SAASC,iBAAT,CAA4BC,CAA5B,EAA+BC,CAA/B,EAAmC;AAClC,SACC,iBAAeD,CAAC,CAACE,MAAjB,EAAyBD,CAAC,CAACC,MAA3B,KACA,iBAAeF,CAAC,CAACG,QAAjB,EAA2BF,CAAC,CAACE,QAA7B,CAFD;AAIA;;AAED,SAASC,SAAT,OAAoC;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACnC,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,uBAAU,KAAV,CAApC;AACA,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,IAAR;AAAcC,IAAAA;AAAd,MAAgC,yBAAYb,mBAAZ,CAAtC;AACA,QAAMc,OAAO,GAAG,sBAAS,MAAM;AAAA;;AAC9B,WAAO;AACNF,MAAAA,IAAI,EAAE;AACLN,QAAAA,QAAQ,yBAAEE,SAAS,CAACF,QAAZ,qEAAwB,EAD3B;AAELD,QAAAA,MAAM,uBAAEG,SAAS,CAACH,MAAZ,iEAAsB;AAFvB,OADA;AAKNM,MAAAA,IALM;AAMNI,MAAAA,MAAM,EAAE,mDAAyBJ,IAAzB,EAA+BH,SAA/B,CANF;AAONK,MAAAA,aAAa,EAAE,MAAM,CAAE;AAPjB,KAAP;AASA,GAVe,EAU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ADD;AA4BA;;AAEc,SAASe,wBAAT,GAAoC;AAClD,QAAM;AAAEC,IAAAA;AAAF,MAAiB,qBAAaC,MAAF,IAAc;AAC/C,WAAO;AACND,MAAAA,UAAU,EACTC,MAAM,CACLC,eADK,CAAN,CAEEC,mDAFF,MAE2D;AAJtD,KAAP;AAMA,GAPsB,EAOpB,EAPoB,CAAvB;AASA,QAAMC,kBAAkB,GAAG,sBAAS,MAAM;AACzC,WAAO,CACN;AACCN,MAAAA,KAAK,EAAE,cAAI,SAAJ,CADR;AAECjB,MAAAA,QAAQ,EAAE,EAFX;AAGCD,MAAAA,MAAM,EAAE;AAHT,KADM,EAMN,GAAGoB,UAAU,CAACK,GAAX,CAAkBtB,SAAF;AAAA;;AAAA,aAAmB,EACrC,GAAGA,SADkC;AAErCF,QAAAA,QAAQ,0BAAEE,SAAS,CAACF,QAAZ,uEAAwB,EAFK;AAGrCD,QAAAA,MAAM,wBAAEG,SAAS,CAACH,MAAZ,mEAAsB;AAHS,OAAnB;AAAA,KAAhB,CANG,CAAP;AAYA,GAb0B,EAaxB,CAAEoB,UAAF,CAbwB,CAA3B;AAeA,SACC,qDACC,4BAAC,8BAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGI,kBAJH,aAIGA,kBAJH,uBAIGA,kBAAkB,CAAEC,GAApB,CAAyB,CAAEtB,SAAF,EAAauB,KAAb,KAC1B,4BAAC,SAAD;AAAW,IAAA,GAAG,EAAGA,KAAjB;AAAyB,IAAA,SAAS,EAAGvB;AAArC,IADC,CAJH,CADD,CADD;AAYA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, useContext, useState } from '@wordpress/element';\nimport { ENTER } from '@wordpress/keycodes';\nimport { __experimentalGrid as Grid } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from './global-styles-provider';\nimport StylesPreview from './preview';\nimport { unlock } from '../../private-apis';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\nfunction compareVariations( a, b ) {\n\treturn (\n\t\tfastDeepEqual( a.styles, b.styles ) &&\n\t\tfastDeepEqual( a.settings, b.settings )\n\t);\n}\n\nfunction Variation( { variation } ) {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\tconst { base, user, setUserConfig } = useContext( GlobalStylesContext );\n\tconst context = useMemo( () => {\n\t\treturn {\n\t\t\tuser: {\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t},\n\t\t\tbase,\n\t\t\tmerged: mergeBaseAndUserConfigs( base, variation ),\n\t\t\tsetUserConfig: () => {},\n\t\t};\n\t}, [ variation, base ] );\n\n\tconst selectVariation = () => {\n\t\tsetUserConfig( () => {\n\t\t\treturn {\n\t\t\t\tsettings: variation.settings,\n\t\t\t\tstyles: variation.styles,\n\t\t\t};\n\t\t} );\n\t};\n\n\tconst selectOnEnter = ( event ) => {\n\t\tif ( event.keyCode === ENTER ) {\n\t\t\tevent.preventDefault();\n\t\t\tselectVariation();\n\t\t}\n\t};\n\n\tconst isActive = useMemo( () => {\n\t\treturn compareVariations( user, variation );\n\t}, [ user, variation ] );\n\n\treturn (\n\t\t<GlobalStylesContext.Provider value={ context }>\n\t\t\t<div\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'edit-site-global-styles-variations_item',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-active': isActive,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\trole=\"button\"\n\t\t\t\tonClick={ selectVariation }\n\t\t\t\tonKeyDown={ selectOnEnter }\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\taria-label={ variation?.title }\n\t\t\t\taria-current={ isActive }\n\t\t\t\tonFocus={ () => setIsFocused( true ) }\n\t\t\t\tonBlur={ () => setIsFocused( false ) }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-global-styles-variations_item-preview\">\n\t\t\t\t\t<StylesPreview\n\t\t\t\t\t\tlabel={ variation?.title }\n\t\t\t\t\t\tisFocused={ isFocused }\n\t\t\t\t\t\twithHoverView\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</GlobalStylesContext.Provider>\n\t);\n}\n\nexport default function StyleVariationsContainer() {\n\tconst { variations } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tvariations:\n\t\t\t\tselect(\n\t\t\t\t\tcoreStore\n\t\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations() || [],\n\t\t};\n\t}, [] );\n\n\tconst withEmptyVariation = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variations.map( ( variation ) => ( {\n\t\t\t\t...variation,\n\t\t\t\tsettings: variation.settings ?? {},\n\t\t\t\tstyles: variation.styles ?? {},\n\t\t\t} ) ),\n\t\t];\n\t}, [ variations ] );\n\n\treturn (\n\t\t<>\n\t\t\t<Grid\n\t\t\t\tcolumns={ 2 }\n\t\t\t\tclassName=\"edit-site-global-styles-style-variations-container\"\n\t\t\t>\n\t\t\t\t{ withEmptyVariation?.map( ( variation, index ) => (\n\t\t\t\t\t<Variation key={ index } variation={ variation } />\n\t\t\t\t) ) }\n\t\t\t</Grid>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -29,7 +29,7 @@ var _coreData = require("@wordpress/core-data");
|
|
|
29
29
|
|
|
30
30
|
var _screenRoot = _interopRequireDefault(require("./screen-root"));
|
|
31
31
|
|
|
32
|
-
var _screenBlockList =
|
|
32
|
+
var _screenBlockList = _interopRequireWildcard(require("./screen-block-list"));
|
|
33
33
|
|
|
34
34
|
var _screenBlock = _interopRequireDefault(require("./screen-block"));
|
|
35
35
|
|
|
@@ -43,16 +43,6 @@ var _screenColors = _interopRequireDefault(require("./screen-colors"));
|
|
|
43
43
|
|
|
44
44
|
var _screenColorPalette = _interopRequireDefault(require("./screen-color-palette"));
|
|
45
45
|
|
|
46
|
-
var _screenBackgroundColor = _interopRequireDefault(require("./screen-background-color"));
|
|
47
|
-
|
|
48
|
-
var _screenTextColor = _interopRequireDefault(require("./screen-text-color"));
|
|
49
|
-
|
|
50
|
-
var _screenLinkColor = _interopRequireDefault(require("./screen-link-color"));
|
|
51
|
-
|
|
52
|
-
var _screenHeadingColor = _interopRequireDefault(require("./screen-heading-color"));
|
|
53
|
-
|
|
54
|
-
var _screenButtonColor = _interopRequireDefault(require("./screen-button-color"));
|
|
55
|
-
|
|
56
46
|
var _screenLayout = _interopRequireDefault(require("./screen-layout"));
|
|
57
47
|
|
|
58
48
|
var _screenStyleVariations = _interopRequireDefault(require("./screen-style-variations"));
|
|
@@ -69,6 +59,10 @@ var _privateApis = require("../../private-apis");
|
|
|
69
59
|
|
|
70
60
|
var _screenEffects = _interopRequireDefault(require("./screen-effects"));
|
|
71
61
|
|
|
62
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
63
|
+
|
|
64
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
65
|
+
|
|
72
66
|
/**
|
|
73
67
|
* WordPress dependencies
|
|
74
68
|
*/
|
|
@@ -211,6 +205,11 @@ function ContextScreens(_ref4) {
|
|
|
211
205
|
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
212
206
|
name: name,
|
|
213
207
|
element: "heading"
|
|
208
|
+
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
209
|
+
path: parentMenu + '/typography/caption'
|
|
210
|
+
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
211
|
+
name: name,
|
|
212
|
+
element: "caption"
|
|
214
213
|
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
215
214
|
path: parentMenu + '/typography/button'
|
|
216
215
|
}, (0, _element.createElement)(_screenTypographyElement.default, {
|
|
@@ -225,35 +224,10 @@ function ContextScreens(_ref4) {
|
|
|
225
224
|
path: parentMenu + '/colors/palette'
|
|
226
225
|
}, (0, _element.createElement)(_screenColorPalette.default, {
|
|
227
226
|
name: name
|
|
228
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
229
|
-
path: parentMenu + '/colors/background'
|
|
230
|
-
}, (0, _element.createElement)(_screenBackgroundColor.default, {
|
|
231
|
-
name: name,
|
|
232
|
-
variation: variation
|
|
233
227
|
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
234
228
|
path: parentMenu + '/filters'
|
|
235
229
|
}, (0, _element.createElement)(_screenFilters.default, {
|
|
236
230
|
name: name
|
|
237
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
238
|
-
path: parentMenu + '/colors/text'
|
|
239
|
-
}, (0, _element.createElement)(_screenTextColor.default, {
|
|
240
|
-
name: name,
|
|
241
|
-
variation: variation
|
|
242
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
243
|
-
path: parentMenu + '/colors/link'
|
|
244
|
-
}, (0, _element.createElement)(_screenLinkColor.default, {
|
|
245
|
-
name: name,
|
|
246
|
-
variation: variation
|
|
247
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
248
|
-
path: parentMenu + '/colors/heading'
|
|
249
|
-
}, (0, _element.createElement)(_screenHeadingColor.default, {
|
|
250
|
-
name: name,
|
|
251
|
-
variation: variation
|
|
252
|
-
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
253
|
-
path: parentMenu + '/colors/button'
|
|
254
|
-
}, (0, _element.createElement)(_screenButtonColor.default, {
|
|
255
|
-
name: name,
|
|
256
|
-
variation: variation
|
|
257
231
|
})), (0, _element.createElement)(GlobalStylesNavigationScreen, {
|
|
258
232
|
path: parentMenu + '/border'
|
|
259
233
|
}, (0, _element.createElement)(_screenBorder.default, {
|
|
@@ -301,6 +275,46 @@ function GlobalStylesStyleBook(_ref5) {
|
|
|
301
275
|
});
|
|
302
276
|
}
|
|
303
277
|
|
|
278
|
+
function GlobalStylesBlockLink() {
|
|
279
|
+
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
280
|
+
const isMounted = (0, _element.useRef)();
|
|
281
|
+
const {
|
|
282
|
+
selectedBlockName,
|
|
283
|
+
selectedBlockClientId
|
|
284
|
+
} = (0, _data.useSelect)(select => {
|
|
285
|
+
const {
|
|
286
|
+
getSelectedBlockClientId,
|
|
287
|
+
getBlockName
|
|
288
|
+
} = select(_blockEditor.store);
|
|
289
|
+
const clientId = getSelectedBlockClientId();
|
|
290
|
+
return {
|
|
291
|
+
selectedBlockName: getBlockName(clientId),
|
|
292
|
+
selectedBlockClientId: clientId
|
|
293
|
+
};
|
|
294
|
+
}, []);
|
|
295
|
+
const blockHasGlobalStyles = (0, _screenBlockList.useBlockHasGlobalStyles)(selectedBlockName);
|
|
296
|
+
(0, _element.useEffect)(() => {
|
|
297
|
+
// Avoid navigating to the block screen on mount.
|
|
298
|
+
if (!isMounted.current) {
|
|
299
|
+
isMounted.current = true;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (!selectedBlockClientId || !blockHasGlobalStyles) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const path = '/blocks/' + encodeURIComponent(selectedBlockName); // Avoid navigating to the same path. This can happen when selecting
|
|
308
|
+
// a new block of the same type.
|
|
309
|
+
|
|
310
|
+
if (path !== navigator.location.path) {
|
|
311
|
+
navigator.goTo(path, {
|
|
312
|
+
skipFocus: true
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]);
|
|
316
|
+
}
|
|
317
|
+
|
|
304
318
|
function GlobalStylesUI(_ref6) {
|
|
305
319
|
let {
|
|
306
320
|
isStyleBookOpened,
|
|
@@ -332,7 +346,7 @@ function GlobalStylesUI(_ref6) {
|
|
|
332
346
|
});
|
|
333
347
|
}), isStyleBookOpened && (0, _element.createElement)(GlobalStylesStyleBook, {
|
|
334
348
|
onClose: onCloseStyleBook
|
|
335
|
-
}), (0, _element.createElement)(GlobalStylesActionMenu, null));
|
|
349
|
+
}), (0, _element.createElement)(GlobalStylesActionMenu, null), (0, _element.createElement)(GlobalStylesBlockLink, null));
|
|
336
350
|
}
|
|
337
351
|
|
|
338
352
|
var _default = GlobalStylesUI;
|