@wordpress/edit-site 5.7.0 → 5.9.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.js +2 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +7 -7
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +6 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +117 -0
- package/build/components/editor-canvas-container/index.js.map +1 -0
- package/build/components/global-styles/border-panel.js +81 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +6 -8
- 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 +50 -0
- package/build/components/global-styles/filters-panel.js.map +1 -0
- package/build/components/global-styles/global-styles-provider.js +4 -15
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/preview.js +1 -1
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +14 -8
- package/build/components/global-styles/screen-block-list.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/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 +52 -15
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/index.js +11 -7
- package/build/components/header-edit-mode/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 +17 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/table.js +3 -3
- package/build/components/list/table.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/sidebar/index.js +4 -0
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +28 -13
- package/build/components/sidebar-edit-mode/global-styles-sidebar.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 +40 -17
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +8 -7
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/start-template-options/index.js +9 -8
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +9 -41
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-details/index.js +3 -1
- package/build/components/template-details/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 +126 -0
- package/build/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build/hooks/commands/use-wp-admin-commands.js +97 -0
- package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
- 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/private-actions.js +19 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +13 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +23 -1
- package/build/store/reducer.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.js +3 -2
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +6 -6
- package/build-module/components/block-editor/index.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/editor-canvas-container/index.js +100 -0
- package/build-module/components/editor-canvas-container/index.js.map +1 -0
- package/build-module/components/global-styles/border-panel.js +81 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +6 -6
- 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 +40 -0
- package/build-module/components/global-styles/filters-panel.js.map +1 -0
- package/build-module/components/global-styles/global-styles-provider.js +5 -16
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/preview.js +1 -1
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +13 -8
- package/build-module/components/global-styles/screen-block-list.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/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 -16
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +10 -7
- package/build-module/components/header-edit-mode/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 +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/table.js +3 -3
- package/build-module/components/list/table.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/sidebar/index.js +3 -0
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +28 -15
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.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 +40 -18
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +8 -7
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +9 -8
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +10 -41
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-details/index.js +3 -1
- package/build-module/components/template-details/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 +109 -0
- package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js +81 -0
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
- 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/private-actions.js +15 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +23 -1
- package/build-module/store/reducer.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 +133 -107
- package/build-style/style.css +133 -107
- package/package.json +34 -32
- package/src/components/add-new-template/new-template.js +3 -0
- package/src/components/block-editor/index.js +8 -8
- package/src/components/editor/index.js +11 -3
- package/src/components/editor-canvas-container/index.js +115 -0
- package/src/components/editor-canvas-container/style.scss +19 -0
- package/src/components/global-styles/border-panel.js +73 -1
- package/src/components/global-styles/context-menu.js +6 -6
- 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 +39 -0
- package/src/components/global-styles/global-styles-provider.js +4 -18
- package/src/components/global-styles/preview.js +1 -1
- package/src/components/global-styles/screen-block-list.js +9 -5
- 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/style-variations-container.js +136 -0
- package/src/components/global-styles/style.scss +0 -39
- package/src/components/global-styles/ui.js +54 -8
- package/src/components/header-edit-mode/index.js +14 -5
- 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 +13 -16
- package/src/components/layout/style.scss +31 -4
- package/src/components/list/table.js +16 -2
- package/src/components/preferences-modal/index.js +7 -0
- package/src/components/secondary-sidebar/style.scss +23 -5
- package/src/components/sidebar/index.js +4 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +36 -17
- 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 +51 -23
- package/src/components/site-icon/index.js +6 -11
- package/src/components/site-icon/style.scss +8 -3
- package/src/components/start-template-options/index.js +13 -12
- package/src/components/start-template-options/style.scss +18 -43
- package/src/components/style-book/index.js +7 -51
- package/src/components/style-book/style.scss +0 -18
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -3
- package/src/components/template-details/index.js +1 -0
- 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 +112 -0
- package/src/hooks/commands/use-wp-admin-commands.js +79 -0
- package/src/hooks/template-part-edit.js +1 -0
- package/src/index.js +1 -0
- package/src/store/private-actions.js +14 -0
- package/src/store/private-selectors.js +11 -0
- package/src/store/reducer.js +18 -0
- package/src/store/selectors.js +2 -1
- package/src/style.scss +1 -0
- 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/shadow-panel.js +0 -197
- package/build/components/global-styles/shadow-panel.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/shadow-panel.js +0 -178
- package/build-module/components/global-styles/shadow-panel.js.map +0 -1
- 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/shadow-panel.js +0 -178
|
@@ -11,17 +11,17 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
15
|
+
|
|
14
16
|
var _header = _interopRequireDefault(require("./header"));
|
|
15
17
|
|
|
16
18
|
var _blockPreviewPanel = _interopRequireDefault(require("./block-preview-panel"));
|
|
17
19
|
|
|
18
20
|
var _utils = require("./utils");
|
|
19
21
|
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
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); }
|
|
22
|
+
var _privateApis = require("../../private-apis");
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
var _effectsPanel = _interopRequireDefault(require("./effects-panel"));
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* WordPress dependencies
|
|
@@ -30,19 +30,27 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
30
30
|
/**
|
|
31
31
|
* Internal dependencies
|
|
32
32
|
*/
|
|
33
|
+
const {
|
|
34
|
+
useGlobalSetting,
|
|
35
|
+
useSettingsForBlockElement,
|
|
36
|
+
useHasEffectsPanel
|
|
37
|
+
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
38
|
+
|
|
33
39
|
function ScreenEffects(_ref) {
|
|
34
40
|
let {
|
|
35
41
|
name,
|
|
36
42
|
variation = ''
|
|
37
43
|
} = _ref;
|
|
44
|
+
const [rawSettings] = useGlobalSetting('', name);
|
|
45
|
+
const settings = useSettingsForBlockElement(rawSettings, name);
|
|
38
46
|
const variationClassName = (0, _utils.getVariationClassName)(variation);
|
|
39
|
-
const
|
|
47
|
+
const hasEffectsPanel = useHasEffectsPanel(settings);
|
|
40
48
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_header.default, {
|
|
41
|
-
title: (0, _i18n.__)('
|
|
49
|
+
title: (0, _i18n.__)('Effects')
|
|
42
50
|
}), (0, _element.createElement)(_blockPreviewPanel.default, {
|
|
43
51
|
name: name,
|
|
44
52
|
variation: variationClassName
|
|
45
|
-
}),
|
|
53
|
+
}), hasEffectsPanel && (0, _element.createElement)(_effectsPanel.default, {
|
|
46
54
|
name: name,
|
|
47
55
|
variation: variation
|
|
48
56
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-effects.js"],"names":["ScreenEffects","name","variation","variationClassName","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-effects.js"],"names":["useGlobalSetting","useSettingsForBlockElement","useHasEffectsPanel","blockEditorPrivateApis","ScreenEffects","name","variation","rawSettings","settings","variationClassName","hasEffectsPanel"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAbA;AACA;AACA;;AAIA;AACA;AACA;AAOA,MAAM;AAAEA,EAAAA,gBAAF;AAAoBC,EAAAA,0BAApB;AAAgDC,EAAAA;AAAhD,IACL,yBAAQC,wBAAR,CADD;;AAGA,SAASC,aAAT,OAAmD;AAAA,MAA3B;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,SAAS,GAAG;AAApB,GAA2B;AAClD,QAAM,CAAEC,WAAF,IAAkBP,gBAAgB,CAAE,EAAF,EAAMK,IAAN,CAAxC;AACA,QAAMG,QAAQ,GAAGP,0BAA0B,CAAEM,WAAF,EAAeF,IAAf,CAA3C;AACA,QAAMI,kBAAkB,GAAG,kCAAuBH,SAAvB,CAA3B;AACA,QAAMI,eAAe,GAAGR,kBAAkB,CAAEM,QAAF,CAA1C;AACA,SACC,qDACC,4BAAC,eAAD;AAAc,IAAA,KAAK,EAAG,cAAI,SAAJ;AAAtB,IADD,EAEC,4BAAC,0BAAD;AAAmB,IAAA,IAAI,EAAGH,IAA1B;AAAiC,IAAA,SAAS,EAAGI;AAA7C,IAFD,EAGGC,eAAe,IAChB,4BAAC,qBAAD;AAAc,IAAA,IAAI,EAAGL,IAArB;AAA4B,IAAA,SAAS,EAAGC;AAAxC,IAJF,CADD;AASA;;eAEcF,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { getVariationClassName } from './utils';\nimport { unlock } from '../../private-apis';\nimport EffectsPanel from './effects-panel';\n\nconst { useGlobalSetting, useSettingsForBlockElement, useHasEffectsPanel } =\n\tunlock( blockEditorPrivateApis );\n\nfunction ScreenEffects( { name, variation = '' } ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst variationClassName = getVariationClassName( variation );\n\tconst hasEffectsPanel = useHasEffectsPanel( settings );\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader title={ __( 'Effects' ) } />\n\t\t\t<BlockPreviewPanel name={ name } variation={ variationClassName } />\n\t\t\t{ hasEffectsPanel && (\n\t\t\t\t<EffectsPanel name={ name } variation={ variation } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenEffects;\n"]}
|
|
@@ -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"]}
|
|
@@ -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":"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","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
|
|
|
@@ -59,6 +59,12 @@ var _privateApis = require("../../private-apis");
|
|
|
59
59
|
|
|
60
60
|
var _screenEffects = _interopRequireDefault(require("./screen-effects"));
|
|
61
61
|
|
|
62
|
+
var _store = require("../../store");
|
|
63
|
+
|
|
64
|
+
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); }
|
|
65
|
+
|
|
66
|
+
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; }
|
|
67
|
+
|
|
62
68
|
/**
|
|
63
69
|
* WordPress dependencies
|
|
64
70
|
*/
|
|
@@ -250,10 +256,7 @@ function ContextScreens(_ref4) {
|
|
|
250
256
|
}));
|
|
251
257
|
}
|
|
252
258
|
|
|
253
|
-
function GlobalStylesStyleBook(
|
|
254
|
-
let {
|
|
255
|
-
onClose
|
|
256
|
-
} = _ref5;
|
|
259
|
+
function GlobalStylesStyleBook() {
|
|
257
260
|
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
258
261
|
const {
|
|
259
262
|
path
|
|
@@ -266,17 +269,53 @@ function GlobalStylesStyleBook(_ref5) {
|
|
|
266
269
|
onSelect: blockName => {
|
|
267
270
|
// Now go to the selected block.
|
|
268
271
|
navigator.goTo('/blocks/' + encodeURIComponent(blockName));
|
|
269
|
-
}
|
|
270
|
-
onClose: onClose
|
|
272
|
+
}
|
|
271
273
|
});
|
|
272
274
|
}
|
|
273
275
|
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
function GlobalStylesBlockLink() {
|
|
277
|
+
const navigator = (0, _components.__experimentalUseNavigator)();
|
|
278
|
+
const isMounted = (0, _element.useRef)();
|
|
279
|
+
const {
|
|
280
|
+
selectedBlockName,
|
|
281
|
+
selectedBlockClientId
|
|
282
|
+
} = (0, _data.useSelect)(select => {
|
|
283
|
+
const {
|
|
284
|
+
getSelectedBlockClientId,
|
|
285
|
+
getBlockName
|
|
286
|
+
} = select(_blockEditor.store);
|
|
287
|
+
const clientId = getSelectedBlockClientId();
|
|
288
|
+
return {
|
|
289
|
+
selectedBlockName: getBlockName(clientId),
|
|
290
|
+
selectedBlockClientId: clientId
|
|
291
|
+
};
|
|
292
|
+
}, []);
|
|
293
|
+
const blockHasGlobalStyles = (0, _screenBlockList.useBlockHasGlobalStyles)(selectedBlockName);
|
|
294
|
+
(0, _element.useEffect)(() => {
|
|
295
|
+
// Avoid navigating to the block screen on mount.
|
|
296
|
+
if (!isMounted.current) {
|
|
297
|
+
isMounted.current = true;
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (!selectedBlockClientId || !blockHasGlobalStyles) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const path = '/blocks/' + encodeURIComponent(selectedBlockName); // Avoid navigating to the same path. This can happen when selecting
|
|
306
|
+
// a new block of the same type.
|
|
307
|
+
|
|
308
|
+
if (path !== navigator.location.path) {
|
|
309
|
+
navigator.goTo(path, {
|
|
310
|
+
skipFocus: true
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}, [selectedBlockClientId, selectedBlockName, blockHasGlobalStyles]);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function GlobalStylesUI() {
|
|
279
317
|
const blocks = (0, _blocks.getBlockTypes)();
|
|
318
|
+
const editorCanvasContainerView = (0, _data.useSelect)(select => (0, _privateApis.unlock)(select(_store.store)).getEditorCanvasContainerView(), []);
|
|
280
319
|
return (0, _element.createElement)(_components.__experimentalNavigatorProvider, {
|
|
281
320
|
className: "edit-site-global-styles-sidebar__navigator-provider",
|
|
282
321
|
initialPath: "/"
|
|
@@ -300,9 +339,7 @@ function GlobalStylesUI(_ref6) {
|
|
|
300
339
|
key: 'screens-block-styles-' + block.name + index,
|
|
301
340
|
name: block.name
|
|
302
341
|
});
|
|
303
|
-
}),
|
|
304
|
-
onClose: onCloseStyleBook
|
|
305
|
-
}), (0, _element.createElement)(GlobalStylesActionMenu, null));
|
|
342
|
+
}), 'style-book' === editorCanvasContainerView && (0, _element.createElement)(GlobalStylesStyleBook, null), (0, _element.createElement)(GlobalStylesActionMenu, null), (0, _element.createElement)(GlobalStylesBlockLink, null));
|
|
306
343
|
}
|
|
307
344
|
|
|
308
345
|
var _default = GlobalStylesUI;
|