@wordpress/edit-site 5.28.3 → 5.29.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 +2 -0
- package/build/components/block-editor/use-site-editor-settings.js +2 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/code-editor/index.js +3 -2
- package/build/components/code-editor/index.js.map +1 -1
- package/build/components/editor/index.js +4 -4
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +1 -2
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +3 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +7 -4
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -18
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +0 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +0 -1
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/save-button/index.js +2 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +48 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/style-book/index.js +2 -0
- package/build/components/style-book/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +3 -171
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +4 -5
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +91 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build/store/actions.js +19 -50
- package/build/store/actions.js.map +1 -1
- package/build/utils/clone-deep.js +15 -0
- package/build/utils/clone-deep.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +2 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/code-editor/index.js +3 -2
- package/build-module/components/code-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +4 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +2 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +1 -2
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +3 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +6 -3
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -13
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -18
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +1 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +25 -8
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +0 -1
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +5 -5
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +20 -5
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +50 -7
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +2 -9
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +6 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/style-book/index.js +2 -0
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +4 -172
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +82 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -0
- package/build-module/store/actions.js +19 -50
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/clone-deep.js +9 -0
- package/build-module/utils/clone-deep.js.map +1 -0
- package/build-style/style-rtl.css +24 -208
- package/build-style/style.css +24 -208
- package/package.json +43 -42
- package/src/components/block-editor/use-site-editor-settings.js +1 -0
- package/src/components/code-editor/index.js +3 -2
- package/src/components/editor/index.js +10 -7
- package/src/components/editor-canvas-container/index.js +2 -5
- package/src/components/{test → error-boundary/test}/error-boundary.js +7 -5
- package/src/components/global-styles/screen-revisions/style.scss +2 -2
- package/src/components/global-styles/style.scss +1 -1
- package/src/components/header-edit-mode/document-tools/index.js +1 -2
- package/src/components/header-edit-mode/index.js +1 -1
- package/src/components/header-edit-mode/more-menu/index.js +8 -3
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -11
- package/src/components/keyboard-shortcuts/register.js +0 -19
- package/src/components/layout/index.js +0 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +41 -10
- package/src/components/page-patterns/header.js +1 -0
- package/src/components/page-patterns/index.js +0 -1
- package/src/components/page-patterns/style.scss +0 -182
- package/src/components/save-button/index.js +2 -1
- package/src/components/save-hub/style.scss +1 -1
- package/src/components/sidebar/index.js +2 -1
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +5 -7
- package/src/components/sidebar-edit-mode/style.scss +4 -0
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +37 -24
- package/src/components/sidebar-edit-mode/template-panel/index.js +76 -18
- package/src/components/sidebar-edit-mode/template-panel/style.scss +5 -14
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +1 -12
- package/src/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/src/components/style-book/index.js +5 -1
- package/src/hooks/commands/use-edit-mode-commands.js +3 -184
- package/src/hooks/index.js +0 -1
- package/src/hooks/push-changes-to-global-styles/index.js +1 -4
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +964 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +92 -0
- package/src/store/actions.js +21 -85
- package/src/store/test/actions.js +0 -75
- package/src/style.scss +1 -6
- package/src/utils/clone-deep.js +8 -0
- package/build/components/header-edit-mode/mode-switcher/index.js +0 -62
- package/build/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build/components/page-patterns/duplicate-menu-item.js +0 -93
- package/build/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build/components/page-patterns/grid-item.js +0 -223
- package/build/components/page-patterns/grid-item.js.map +0 -1
- package/build/components/page-patterns/grid.js +0 -31
- package/build/components/page-patterns/grid.js.map +0 -1
- package/build/components/page-patterns/no-patterns.js +0 -18
- package/build/components/page-patterns/no-patterns.js.map +0 -1
- package/build/components/page-patterns/patterns-list.js +0 -168
- package/build/components/page-patterns/patterns-list.js.map +0 -1
- package/build/components/page-patterns/rename-menu-item.js +0 -105
- package/build/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -83
- package/build/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build/hooks/navigation-menu-edit.js +0 -82
- package/build/hooks/navigation-menu-edit.js.map +0 -1
- package/build-module/components/header-edit-mode/mode-switcher/index.js +0 -56
- package/build-module/components/header-edit-mode/mode-switcher/index.js.map +0 -1
- package/build-module/components/page-patterns/duplicate-menu-item.js +0 -85
- package/build-module/components/page-patterns/duplicate-menu-item.js.map +0 -1
- package/build-module/components/page-patterns/grid-item.js +0 -215
- package/build-module/components/page-patterns/grid-item.js.map +0 -1
- package/build-module/components/page-patterns/grid.js +0 -23
- package/build-module/components/page-patterns/grid.js.map +0 -1
- package/build-module/components/page-patterns/no-patterns.js +0 -11
- package/build-module/components/page-patterns/no-patterns.js.map +0 -1
- package/build-module/components/page-patterns/patterns-list.js +0 -160
- package/build-module/components/page-patterns/patterns-list.js.map +0 -1
- package/build-module/components/page-patterns/rename-menu-item.js +0 -98
- package/build-module/components/page-patterns/rename-menu-item.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -76
- package/build-module/components/sidebar-edit-mode/template-panel/replace-template-button.js.map +0 -1
- package/build-module/hooks/navigation-menu-edit.js +0 -75
- package/build-module/hooks/navigation-menu-edit.js.map +0 -1
- package/src/components/header-edit-mode/mode-switcher/index.js +0 -60
- package/src/components/page-patterns/duplicate-menu-item.js +0 -105
- package/src/components/page-patterns/grid-item.js +0 -331
- package/src/components/page-patterns/grid.js +0 -22
- package/src/components/page-patterns/no-patterns.js +0 -12
- package/src/components/page-patterns/patterns-list.js +0 -229
- package/src/components/page-patterns/rename-menu-item.js +0 -132
- package/src/components/sidebar-edit-mode/template-panel/replace-template-button.js +0 -89
- package/src/hooks/navigation-menu-edit.js +0 -92
|
@@ -12,8 +12,6 @@ var _components = require("@wordpress/components");
|
|
|
12
12
|
var _icons = require("@wordpress/icons");
|
|
13
13
|
var _store = require("../../../store");
|
|
14
14
|
var _isTemplateRevertable = _interopRequireDefault(require("../../../utils/is-template-revertable"));
|
|
15
|
-
var _replaceTemplateButton = _interopRequireDefault(require("./replace-template-button"));
|
|
16
|
-
var _hooks = require("./hooks");
|
|
17
15
|
/**
|
|
18
16
|
* WordPress dependencies
|
|
19
17
|
*/
|
|
@@ -25,12 +23,11 @@ var _hooks = require("./hooks");
|
|
|
25
23
|
function Actions({
|
|
26
24
|
template
|
|
27
25
|
}) {
|
|
28
|
-
const availablePatterns = (0, _hooks.useAvailablePatterns)(template);
|
|
29
26
|
const {
|
|
30
27
|
revertTemplate
|
|
31
28
|
} = (0, _data.useDispatch)(_store.store);
|
|
32
29
|
const isRevertable = (0, _isTemplateRevertable.default)(template);
|
|
33
|
-
if (!isRevertable
|
|
30
|
+
if (!isRevertable) {
|
|
34
31
|
return null;
|
|
35
32
|
}
|
|
36
33
|
return (0, _react.createElement)(_components.DropdownMenu, {
|
|
@@ -48,10 +45,6 @@ function Actions({
|
|
|
48
45
|
revertTemplate(template);
|
|
49
46
|
onClose();
|
|
50
47
|
}
|
|
51
|
-
}, (0, _i18n.__)('Clear customizations'))
|
|
52
|
-
availableTemplates: availablePatterns,
|
|
53
|
-
template: template,
|
|
54
|
-
onClick: onClose
|
|
55
|
-
})));
|
|
48
|
+
}, (0, _i18n.__)('Clear customizations'))));
|
|
56
49
|
}
|
|
57
50
|
//# sourceMappingURL=template-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_icons","_store","_isTemplateRevertable","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_icons","_store","_isTemplateRevertable","_interopRequireDefault","Actions","template","revertTemplate","useDispatch","editSiteStore","isRevertable","isTemplateRevertable","_react","createElement","DropdownMenu","icon","moreVertical","label","__","className","toggleProps","isSmall","onClose","MenuGroup","MenuItem","info","onClick"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/template-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\n\nexport default function Actions( { template } ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAZA;AACA;AACA;;AAMA;AACA;AACA;;AAIe,SAASO,OAAOA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC/C,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EACvD,MAAMC,YAAY,GAAG,IAAAC,6BAAoB,EAAEL,QAAS,CAAC;EAErD,IAAK,CAAEI,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAE,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,YAAY;IACZC,IAAI,EAAGC,mBAAc;IACrBC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IACzBC,SAAS,EAAC,kCAAkC;IAC5CC,WAAW,EAAG;MAAEC,OAAO,EAAE;IAAK;EAAG,GAE/B,CAAE;IAAEC;EAAQ,CAAC,KACd,IAAAV,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAuB,SAAS,QACPb,YAAY,IACb,IAAAE,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAwB,QAAQ;IACRC,IAAI,EAAG,IAAAP,QAAE,EACR,4CACD,CAAG;IACHQ,OAAO,EAAGA,CAAA,KAAM;MACfnB,cAAc,CAAED,QAAS,CAAC;MAC1BgB,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAJ,QAAE,EAAE,sBAAuB,CACpB,CAED,CAEC,CAAC;AAEjB"}
|
|
@@ -16,6 +16,7 @@ var _compose = require("@wordpress/compose");
|
|
|
16
16
|
var _blockEditor = require("@wordpress/block-editor");
|
|
17
17
|
var _element = require("@wordpress/element");
|
|
18
18
|
var _editor = require("@wordpress/editor");
|
|
19
|
+
var _preferences = require("@wordpress/preferences");
|
|
19
20
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
20
21
|
var _styleVariationsContainer = _interopRequireDefault(require("../global-styles/style-variations-container"));
|
|
21
22
|
var _lockUnlock = require("../../lock-unlock");
|
|
@@ -120,9 +121,12 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
120
121
|
revisionsCount: (_globalStyles$_links$ = globalStyles?._links?.['version-history']?.[0]?.count) !== null && _globalStyles$_links$ !== void 0 ? _globalStyles$_links$ : 0
|
|
121
122
|
};
|
|
122
123
|
}, []);
|
|
124
|
+
const {
|
|
125
|
+
set: setPreference
|
|
126
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
123
127
|
const openGlobalStyles = (0, _element.useCallback)(async () => {
|
|
124
|
-
return Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
125
|
-
}, [setCanvasMode, openGeneralSidebar]);
|
|
128
|
+
return Promise.all([setPreference('core', 'distractionFree', false), setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
129
|
+
}, [setCanvasMode, openGeneralSidebar, setPreference]);
|
|
126
130
|
const openStyleBook = (0, _element.useCallback)(async () => {
|
|
127
131
|
await openGlobalStyles();
|
|
128
132
|
// Open the Style Book once the canvas mode is set to edit,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_data","_coreData","_components","_compose","_blockEditor","_element","_editor","_sidebarNavigationScreen","_interopRequireDefault","_styleVariationsContainer","_lockUnlock","_store","_sidebarButton","_sidebarNavigationItem","_styleBook","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","setCanvasMode","unlock","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","_react","createElement","__experimentalNavigatorButton","as","SidebarNavigationItem","path","default","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","BlockEditorProvider","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","setIsListViewOpened","editorStore","isMobileViewport","useViewportMatch","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","openGlobalStyles","useCallback","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","__","description","content","footer","record","actions","icon","seen","label","isPressed","edit","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,wBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,yBAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,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tD,IAAAzB,MAAA,CAAAC,aAAA,EAAClB,UAAA,CAAAuB,OAAS;IACTuD,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BvD,OAAO,EAAGmC,aAAe;IACzBqB,QAAQ,EAAGrB,aAAe;IAC1BsB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_data","_coreData","_components","_compose","_blockEditor","_element","_editor","_preferences","_sidebarNavigationScreen","_interopRequireDefault","_styleVariationsContainer","_lockUnlock","_store","_sidebarButton","_sidebarNavigationItem","_styleBook","_useGlobalStylesRevisions","_sidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","useDispatch","editSiteStore","setCanvasMode","unlock","hasGlobalStyleVariations","useSelect","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","_react","createElement","__experimentalNavigatorButton","as","SidebarNavigationItem","path","default","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","BlockEditorProvider","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","useGlobalStylesRevisions","setIsListViewOpened","editorStore","isMobileViewport","useViewportMatch","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","preferencesStore","openGlobalStyles","useCallback","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","__","description","content","footer","record","actions","icon","seen","label","isPressed","edit","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,O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AgB,IACnB,IAAAtB,MAAA,CAAAC,aAAA,EAACpB,cAAA,CAAAyB,OAAa;MACbqD,IAAI,EAAGC,WAAM;MACbC,KAAK,EAAG,IAAAR,QAAE,EAAE,YAAa,CAAG;MAC5B9C,OAAO,EAAGA,CAAA,KACTiB,4BAA4B,CAC3B,CAAEE,iBAAiB,GAChB,YAAY,GACZS,SACJ,CACA;MACD2B,SAAS,EAAGpC;IAAmB,CAC/B,CACD,EACD,IAAA1B,MAAA,CAAAC,aAAA,EAACpB,cAAA,CAAAyB,OAAa;MACbqD,IAAI,EAAGI,WAAM;MACbF,KAAK,EAAG,IAAAR,QAAE,EAAE,aAAc,CAAG;MAC7B9C,OAAO,EAAG,MAAAA,CAAA,KAAY,MAAMkC,gBAAgB,CAAC;IAAG,CAChD,CACA;EACF,CACD,CAAC,EACAf,iBAAiB,IAAI,CAAEJ,gBAAgB,IAAIG,UAAU,IACtD,IAAAzB,MAAA,CAAAC,aAAA,EAAClB,UAAA,CAAAuB,OAAS;IACT0D,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1B1D,OAAO,EAAGsC,aAAe;IACzBqB,QAAQ,EAAGrB,aAAe;IAC1BsB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
@@ -340,6 +340,8 @@ const Example = ({
|
|
|
340
340
|
const originalSettings = (0, _data.useSelect)(select => select(_blockEditor.store).getSettings(), []);
|
|
341
341
|
const settings = (0, _element.useMemo)(() => ({
|
|
342
342
|
...originalSettings,
|
|
343
|
+
focusMode: false,
|
|
344
|
+
// Disable "Spotlight mode".
|
|
343
345
|
__unstableIsPreviewMode: true
|
|
344
346
|
}), [originalSettings]);
|
|
345
347
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_blocks","_blockEditor","_data","_compose","_element","_keycodes","_lockUnlock","_editorCanvasContainer","_globalStylesProvider","ExperimentalBlockEditorProvider","useGlobalStyle","GlobalStylesContext","useGlobalStylesOutputWithConfig","unlock","blockEditorPrivateApis","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","Tabs","componentsPrivateApis","STYLE_BOOK_IFRAME_STYLES","isObjectEmpty","object","Object","keys","length","getExamples","headingsExample","name","title","__","category","blocks","createBlock","content","level","otherExamples","getBlockTypes","filter","blockType","example","supports","inserter","map","getBlockFromExample","StyleBook","enableResizing","isSelected","onClick","onSelect","showCloseButton","onClose","showTabs","userConfig","resizeObserver","sizes","useResizeObserver","textColor","backgroundColor","examples","useMemo","tabs","getCategories","some","slug","icon","base","baseConfig","useContext","mergedConfig","mergeBaseAndUserConfigs","originalSettings","useSelect","select","blockEditorStore","getSettings","settings","__unstableIsPreviewMode","globalStyles","styles","_react","createElement","default","closeButtonLabel","className","classnames","width","style","color","background","TabList","tab","Tab","tabId","key","TabPanel","focusable","StyleBookBody","isFocused","setIsFocused","useState","buttonModeProps","role","onFocus","onBlur","onKeyDown","event","defaultPrevented","keyCode","ENTER","SPACE","preventDefault","readonly","buttonModeStyles","__unstableIframe","tabIndex","__unstableEditorStyles","Examples","label","sprintf","memo","compositeStore","orientation","store","Example","id","renderedBlocks","Array","isArray","render","Disabled","value","BlockList","renderAppender","_default","exports"],"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDisabled,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, useState, memo, useContext } from '@wordpress/element';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport { mergeBaseAndUserConfigs } from '../global-styles/global-styles-provider';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tuseGlobalStyle,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n\tTabs,\n} = unlock( componentsPrivateApis );\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nconst STYLE_BOOK_IFRAME_STYLES = `\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( {\n\tenableResizing = true,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tshowCloseButton = true,\n\tonClose,\n\tshowTabs = true,\n\tuserConfig = {},\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\t// Copied from packages/edit-site/src/components/revisions/index.js\n\t// could we create a shared hook?\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tsettings.styles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\tonClose={ onClose }\n\t\t\tenableResizing={ enableResizing }\n\t\t\tcloseButtonLabel={\n\t\t\t\tshowCloseButton ? __( 'Close Style Book' ) : null\n\t\t\t}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t\t'is-button': !! onClick,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<div className=\"edit-site-style-book__tabs\">\n\t\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t\t\t\t\t\ttitle={ tab.title }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nconst StyleBookBody = ( {\n\tcategory,\n\texamples,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tsettings,\n\tsizes,\n\ttitle,\n} ) => {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\t// The presence of an `onClick` prop indicates that the Style Book is being used as a button.\n\t// In this case, add additional props to the iframe to make it behave like a button.\n\tconst buttonModeProps = {\n\t\trole: 'button',\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\tonClick: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( onClick ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\tconst buttonModeStyles = onClick\n\t\t? 'body { cursor: pointer; } body * { pointer-events: none; }'\n\t\t: '';\n\n\treturn (\n\t\t<Iframe\n\t\t\tclassName={ classnames( 'edit-site-style-book__iframe', {\n\t\t\t\t'is-focused': isFocused && !! onClick,\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tname=\"style-book-canvas\"\n\t\t\ttabIndex={ 0 }\n\t\t\t{ ...( onClick ? buttonModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>\n\t\t\t\t{\n\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }` +\n\t\t\t\t\t\tSTYLE_BOOK_IFRAME_STYLES +\n\t\t\t\t\t\tbuttonModeStyles\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<Examples\n\t\t\t\tclassName={ classnames( 'edit-site-style-book__examples', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\texamples={ examples }\n\t\t\t\tcategory={ category }\n\t\t\t\tlabel={\n\t\t\t\t\ttitle\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t__( 'Examples of blocks in the %s category' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Examples of blocks' )\n\t\t\t\t}\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tkey={ category }\n\t\t\t/>\n\t\t</Iframe>\n\t);\n};\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst compositeStore = useCompositeStore( { orientation: 'vertical' } );\n\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\tstore={ compositeStore }\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t\trole=\"grid\"\n\t\t\t>\n\t\t\t\t{ examples\n\t\t\t\t\t.filter( ( example ) =>\n\t\t\t\t\t\tcategory ? example.category === category : true\n\t\t\t\t\t)\n\t\t\t\t\t.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect?.( example.name );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Example = ( { id, title, blocks, isSelected, onClick } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<div role=\"row\">\n\t\t\t<div role=\"gridcell\">\n\t\t\t\t<CompositeItem\n\t\t\t\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t} ) }\n\t\t\t\t\tid={ id }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t\trender={ <div /> }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-site-style-book__example-preview\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t\t</Disabled>\n\t\t\t\t\t</div>\n\t\t\t\t</CompositeItem>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default StyleBook;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AAOA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AApCA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;;AAKA,MAAM;EACLY,+BAA+B;EAC/BC,cAAc;EACdC,mBAAmB;EACnBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEpC,MAAM;EACLC,WAAW,EAAEC,SAAS;EACtBC,eAAe,EAAEC,aAAa;EAC9BC,mBAAmB,EAAEC,iBAAiB;EACtCC;AACD,CAAC,GAAG,IAAAR,kBAAM,EAAES,uBAAsB,CAAC;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,wBAAwB,GAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;AAEA,SAASC,WAAWA,CAAA,EAAG;EACtB;EACA;EACA,MAAMC,eAAe,GAAG;IACvBC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAE,IAAAC,QAAE,EAAE,UAAW,CAAC;IACvBC,QAAQ,EAAE,MAAM;IAChBC,MAAM,EAA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AAG;IACHoG,MAAM,EAAG,IAAAjD,MAAA,CAAAC,aAAA,aAAM,CAAG;IAClBqB,IAAI,EAAC,QAAQ;IACbtD,OAAO,EAAGA;EAAS,GAEnB,IAAAgC,MAAA,CAAAC,aAAA;IAAMG,SAAS,EAAC;EAAqC,GAClDvD,KACG,CAAC,EACP,IAAAmD,MAAA,CAAAC,aAAA;IACCG,SAAS,EAAC,uCAAuC;IACjD;EAAW,GAEX,IAAAJ,MAAA,CAAAC,aAAA,EAACtF,WAAA,CAAAuI,QAAQ;IAAC9C,SAAS,EAAC;EAAgD,GACnE,IAAAJ,MAAA,CAAAC,aAAA,EAAC3E,+BAA+B;IAC/B6H,KAAK,EAAGL,cAAgB;IACxBlD,QAAQ,EAAGA;EAAU,GAErB,IAAAI,MAAA,CAAAC,aAAA,EAACnF,YAAA,CAAAsI,SAAS;IAACC,cAAc,EAAG;EAAO,CAAE,CACL,CACxB,CACN,CACS,CACX,CACD,CAAC;AAER,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArD,OAAA,GAEarC,SAAS"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_blocks","_blockEditor","_data","_compose","_element","_keycodes","_lockUnlock","_editorCanvasContainer","_globalStylesProvider","ExperimentalBlockEditorProvider","useGlobalStyle","GlobalStylesContext","useGlobalStylesOutputWithConfig","unlock","blockEditorPrivateApis","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","Tabs","componentsPrivateApis","STYLE_BOOK_IFRAME_STYLES","isObjectEmpty","object","Object","keys","length","getExamples","headingsExample","name","title","__","category","blocks","createBlock","content","level","otherExamples","getBlockTypes","filter","blockType","example","supports","inserter","map","getBlockFromExample","StyleBook","enableResizing","isSelected","onClick","onSelect","showCloseButton","onClose","showTabs","userConfig","resizeObserver","sizes","useResizeObserver","textColor","backgroundColor","examples","useMemo","tabs","getCategories","some","slug","icon","base","baseConfig","useContext","mergedConfig","mergeBaseAndUserConfigs","originalSettings","useSelect","select","blockEditorStore","getSettings","settings","__unstableIsPreviewMode","globalStyles","styles","_react","createElement","default","closeButtonLabel","className","classnames","width","style","color","background","TabList","tab","Tab","tabId","key","TabPanel","focusable","StyleBookBody","isFocused","setIsFocused","useState","buttonModeProps","role","onFocus","onBlur","onKeyDown","event","defaultPrevented","keyCode","ENTER","SPACE","preventDefault","readonly","buttonModeStyles","__unstableIframe","tabIndex","__unstableEditorStyles","Examples","label","sprintf","memo","compositeStore","orientation","store","Example","id","focusMode","renderedBlocks","Array","isArray","render","Disabled","value","BlockList","renderAppender","_default","exports"],"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDisabled,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, useState, memo, useContext } from '@wordpress/element';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport { mergeBaseAndUserConfigs } from '../global-styles/global-styles-provider';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tuseGlobalStyle,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n\tTabs,\n} = unlock( componentsPrivateApis );\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nconst STYLE_BOOK_IFRAME_STYLES = `\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t\tscroll-margin-top: 32px;\n\t\tscroll-margin-bottom: 32px;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( {\n\tenableResizing = true,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tshowCloseButton = true,\n\tonClose,\n\tshowTabs = true,\n\tuserConfig = {},\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\t// Copied from packages/edit-site/src/components/revisions/index.js\n\t// could we create a shared hook?\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tsettings.styles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\tonClose={ onClose }\n\t\t\tenableResizing={ enableResizing }\n\t\t\tcloseButtonLabel={\n\t\t\t\tshowCloseButton ? __( 'Close Style Book' ) : null\n\t\t\t}\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t\t'is-button': !! onClick,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t{ showTabs ? (\n\t\t\t\t\t<div className=\"edit-site-style-book__tabs\">\n\t\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t\t\t\t\t\ttitle={ tab.title }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<StyleBookBody\n\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\tsizes={ sizes }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nconst StyleBookBody = ( {\n\tcategory,\n\texamples,\n\tisSelected,\n\tonClick,\n\tonSelect,\n\tsettings,\n\tsizes,\n\ttitle,\n} ) => {\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\t// The presence of an `onClick` prop indicates that the Style Book is being used as a button.\n\t// In this case, add additional props to the iframe to make it behave like a button.\n\tconst buttonModeProps = {\n\t\trole: 'button',\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( onClick && ( keyCode === ENTER || keyCode === SPACE ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\tonClick: ( event ) => {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( onClick ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tonClick( event );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\n\tconst buttonModeStyles = onClick\n\t\t? 'body { cursor: pointer; } body * { pointer-events: none; }'\n\t\t: '';\n\n\treturn (\n\t\t<Iframe\n\t\t\tclassName={ classnames( 'edit-site-style-book__iframe', {\n\t\t\t\t'is-focused': isFocused && !! onClick,\n\t\t\t\t'is-button': !! onClick,\n\t\t\t} ) }\n\t\t\tname=\"style-book-canvas\"\n\t\t\ttabIndex={ 0 }\n\t\t\t{ ...( onClick ? buttonModeProps : {} ) }\n\t\t>\n\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t<style>\n\t\t\t\t{\n\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }` +\n\t\t\t\t\t\tSTYLE_BOOK_IFRAME_STYLES +\n\t\t\t\t\t\tbuttonModeStyles\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<Examples\n\t\t\t\tclassName={ classnames( 'edit-site-style-book__examples', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\texamples={ examples }\n\t\t\t\tcategory={ category }\n\t\t\t\tlabel={\n\t\t\t\t\ttitle\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t__( 'Examples of blocks in the %s category' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Examples of blocks' )\n\t\t\t\t}\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tonSelect={ onSelect }\n\t\t\t\tkey={ category }\n\t\t\t/>\n\t\t</Iframe>\n\t);\n};\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst compositeStore = useCompositeStore( { orientation: 'vertical' } );\n\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\tstore={ compositeStore }\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t\trole=\"grid\"\n\t\t\t>\n\t\t\t\t{ examples\n\t\t\t\t\t.filter( ( example ) =>\n\t\t\t\t\t\tcategory ? example.category === category : true\n\t\t\t\t\t)\n\t\t\t\t\t.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect?.( example.name );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Example = ( { id, title, blocks, isSelected, onClick } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( {\n\t\t\t...originalSettings,\n\t\t\tfocusMode: false, // Disable \"Spotlight mode\".\n\t\t\t__unstableIsPreviewMode: true,\n\t\t} ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<div role=\"row\">\n\t\t\t<div role=\"gridcell\">\n\t\t\t\t<CompositeItem\n\t\t\t\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t\t\t\t'is-selected': isSelected,\n\t\t\t\t\t} ) }\n\t\t\t\t\tid={ id }\n\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\t\t\ttitle\n\t\t\t\t\t) }\n\t\t\t\t\trender={ <div /> }\n\t\t\t\t\trole=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</span>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"edit-site-style-book__example-preview\"\n\t\t\t\t\t\taria-hidden\n\t\t\t\t\t>\n\t\t\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t\t\t</Disabled>\n\t\t\t\t\t</div>\n\t\t\t\t</CompositeItem>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default StyleBook;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAMA,IAAAI,YAAA,GAAAJ,OAAA;AAOA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AApCA;AACA;AACA;;AAGA;AACA;AACA;;AAwBA;AACA;AACA;;AAKA,MAAM;EACLY,+BAA+B;EAC/BC,cAAc;EACdC,mBAAmB;EACnBC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEp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;EAAgD,GACnE,IAAAJ,MAAA,CAAAC,aAAA,EAAC3E,+BAA+B;IAC/B8H,KAAK,EAAGL,cAAgB;IACxBnD,QAAQ,EAAGA;EAAU,GAErB,IAAAI,MAAA,CAAAC,aAAA,EAACnF,YAAA,CAAAuI,SAAS;IAACC,cAAc,EAAG;EAAO,CAAE,CACL,CACxB,CACN,CACS,CACX,CACD,CAAC;AAER,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtD,OAAA,GAEarC,SAAS"}
|
|
@@ -11,9 +11,7 @@ var _icons = require("@wordpress/icons");
|
|
|
11
11
|
var _commands = require("@wordpress/commands");
|
|
12
12
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
13
13
|
var _router = require("@wordpress/router");
|
|
14
|
-
var _preferences = require("@wordpress/preferences");
|
|
15
14
|
var _interface = require("@wordpress/interface");
|
|
16
|
-
var _notices = require("@wordpress/notices");
|
|
17
15
|
var _editor = require("@wordpress/editor");
|
|
18
16
|
var _store = require("../../store");
|
|
19
17
|
var _useEditedEntityRecord = _interopRequireDefault(require("../../components/use-edited-entity-record"));
|
|
@@ -108,42 +106,6 @@ function usePageContentFocusCommands() {
|
|
|
108
106
|
commands
|
|
109
107
|
};
|
|
110
108
|
}
|
|
111
|
-
function useEditorModeCommands() {
|
|
112
|
-
const {
|
|
113
|
-
switchEditorMode
|
|
114
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
115
|
-
const {
|
|
116
|
-
canvasMode,
|
|
117
|
-
editorMode
|
|
118
|
-
} = (0, _data.useSelect)(select => ({
|
|
119
|
-
canvasMode: (0, _lockUnlock.unlock)(select(_store.store)).getCanvasMode(),
|
|
120
|
-
editorMode: select(_store.store).getEditorMode()
|
|
121
|
-
}), []);
|
|
122
|
-
if (canvasMode !== 'edit' || editorMode !== 'text') {
|
|
123
|
-
return {
|
|
124
|
-
isLoading: false,
|
|
125
|
-
commands: []
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
const commands = [];
|
|
129
|
-
if (editorMode === 'text') {
|
|
130
|
-
commands.push({
|
|
131
|
-
name: 'core/exit-code-editor',
|
|
132
|
-
label: (0, _i18n.__)('Exit code editor'),
|
|
133
|
-
icon: _icons.code,
|
|
134
|
-
callback: ({
|
|
135
|
-
close
|
|
136
|
-
}) => {
|
|
137
|
-
switchEditorMode('visual');
|
|
138
|
-
close();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
isLoading: false,
|
|
144
|
-
commands
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
109
|
function useManipulateDocumentCommands() {
|
|
148
110
|
const {
|
|
149
111
|
isLoaded,
|
|
@@ -207,50 +169,20 @@ function useManipulateDocumentCommands() {
|
|
|
207
169
|
function useEditUICommands() {
|
|
208
170
|
const {
|
|
209
171
|
openGeneralSidebar,
|
|
210
|
-
closeGeneralSidebar
|
|
211
|
-
toggleDistractionFree,
|
|
212
|
-
setIsListViewOpened,
|
|
213
|
-
switchEditorMode
|
|
172
|
+
closeGeneralSidebar
|
|
214
173
|
} = (0, _data.useDispatch)(_store.store);
|
|
215
174
|
const {
|
|
216
175
|
canvasMode,
|
|
217
|
-
|
|
218
|
-
activeSidebar,
|
|
219
|
-
showBlockBreadcrumbs,
|
|
220
|
-
isListViewOpen,
|
|
221
|
-
isDistractionFree,
|
|
222
|
-
isTopToolbar,
|
|
223
|
-
isFocusMode
|
|
176
|
+
activeSidebar
|
|
224
177
|
} = (0, _data.useSelect)(select => {
|
|
225
|
-
const {
|
|
226
|
-
get
|
|
227
|
-
} = select(_preferences.store);
|
|
228
|
-
const {
|
|
229
|
-
getEditorMode
|
|
230
|
-
} = select(_store.store);
|
|
231
|
-
const {
|
|
232
|
-
isListViewOpened
|
|
233
|
-
} = select(_editor.store);
|
|
234
178
|
return {
|
|
235
179
|
canvasMode: (0, _lockUnlock.unlock)(select(_store.store)).getCanvasMode(),
|
|
236
|
-
|
|
237
|
-
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name),
|
|
238
|
-
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
239
|
-
isListViewOpen: isListViewOpened(),
|
|
240
|
-
isDistractionFree: get('core', 'distractionFree'),
|
|
241
|
-
isFocusMode: get('core', 'focusMode'),
|
|
242
|
-
isTopToolbar: get('core', 'fixedToolbar')
|
|
180
|
+
activeSidebar: select(_interface.store).getActiveComplementaryArea(_store.store.name)
|
|
243
181
|
};
|
|
244
182
|
}, []);
|
|
245
183
|
const {
|
|
246
184
|
openModal
|
|
247
185
|
} = (0, _data.useDispatch)(_interface.store);
|
|
248
|
-
const {
|
|
249
|
-
toggle
|
|
250
|
-
} = (0, _data.useDispatch)(_preferences.store);
|
|
251
|
-
const {
|
|
252
|
-
createInfoNotice
|
|
253
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
254
186
|
if (canvasMode !== 'edit') {
|
|
255
187
|
return {
|
|
256
188
|
isLoading: false,
|
|
@@ -288,72 +220,6 @@ function useEditUICommands() {
|
|
|
288
220
|
}
|
|
289
221
|
}
|
|
290
222
|
});
|
|
291
|
-
commands.push({
|
|
292
|
-
name: 'core/toggle-spotlight-mode',
|
|
293
|
-
label: (0, _i18n.__)('Toggle spotlight'),
|
|
294
|
-
callback: ({
|
|
295
|
-
close
|
|
296
|
-
}) => {
|
|
297
|
-
toggle('core', 'focusMode');
|
|
298
|
-
close();
|
|
299
|
-
createInfoNotice(isFocusMode ? (0, _i18n.__)('Spotlight off.') : (0, _i18n.__)('Spotlight on.'), {
|
|
300
|
-
id: 'core/edit-site/toggle-spotlight-mode/notice',
|
|
301
|
-
type: 'snackbar',
|
|
302
|
-
actions: [{
|
|
303
|
-
label: (0, _i18n.__)('Undo'),
|
|
304
|
-
onClick: () => {
|
|
305
|
-
toggle('core', 'focusMode');
|
|
306
|
-
}
|
|
307
|
-
}]
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
commands.push({
|
|
312
|
-
name: 'core/toggle-distraction-free',
|
|
313
|
-
label: isDistractionFree ? (0, _i18n.__)('Exit Distraction Free') : (0, _i18n.__)('Enter Distraction Free '),
|
|
314
|
-
callback: ({
|
|
315
|
-
close
|
|
316
|
-
}) => {
|
|
317
|
-
toggleDistractionFree();
|
|
318
|
-
close();
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
commands.push({
|
|
322
|
-
name: 'core/toggle-top-toolbar',
|
|
323
|
-
label: (0, _i18n.__)('Toggle top toolbar'),
|
|
324
|
-
callback: ({
|
|
325
|
-
close
|
|
326
|
-
}) => {
|
|
327
|
-
toggle('core', 'fixedToolbar');
|
|
328
|
-
if (isDistractionFree) {
|
|
329
|
-
toggleDistractionFree();
|
|
330
|
-
}
|
|
331
|
-
close();
|
|
332
|
-
createInfoNotice(isTopToolbar ? (0, _i18n.__)('Top toolbar off.') : (0, _i18n.__)('Top toolbar on.'), {
|
|
333
|
-
id: 'core/edit-site/toggle-top-toolbar/notice',
|
|
334
|
-
type: 'snackbar',
|
|
335
|
-
actions: [{
|
|
336
|
-
label: (0, _i18n.__)('Undo'),
|
|
337
|
-
onClick: () => {
|
|
338
|
-
toggle('core', 'fixedToolbar');
|
|
339
|
-
}
|
|
340
|
-
}]
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
if (editorMode === 'visual') {
|
|
345
|
-
commands.push({
|
|
346
|
-
name: 'core/toggle-code-editor',
|
|
347
|
-
label: (0, _i18n.__)('Open code editor'),
|
|
348
|
-
icon: _icons.code,
|
|
349
|
-
callback: ({
|
|
350
|
-
close
|
|
351
|
-
}) => {
|
|
352
|
-
switchEditorMode('text');
|
|
353
|
-
close();
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
223
|
commands.push({
|
|
358
224
|
name: 'core/open-preferences',
|
|
359
225
|
label: (0, _i18n.__)('Editor preferences'),
|
|
@@ -369,35 +235,6 @@ function useEditUICommands() {
|
|
|
369
235
|
openModal(_keyboardShortcutHelpModal.KEYBOARD_SHORTCUT_HELP_MODAL_NAME);
|
|
370
236
|
}
|
|
371
237
|
});
|
|
372
|
-
commands.push({
|
|
373
|
-
name: 'core/toggle-breadcrumbs',
|
|
374
|
-
label: showBlockBreadcrumbs ? (0, _i18n.__)('Hide block breadcrumbs') : (0, _i18n.__)('Show block breadcrumbs'),
|
|
375
|
-
callback: ({
|
|
376
|
-
close
|
|
377
|
-
}) => {
|
|
378
|
-
toggle('core', 'showBlockBreadcrumbs');
|
|
379
|
-
close();
|
|
380
|
-
createInfoNotice(showBlockBreadcrumbs ? (0, _i18n.__)('Breadcrumbs hidden.') : (0, _i18n.__)('Breadcrumbs visible.'), {
|
|
381
|
-
id: 'core/edit-site/toggle-breadcrumbs/notice',
|
|
382
|
-
type: 'snackbar'
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
commands.push({
|
|
387
|
-
name: 'core/toggle-list-view',
|
|
388
|
-
label: isListViewOpen ? (0, _i18n.__)('Close List View') : (0, _i18n.__)('Open List View'),
|
|
389
|
-
icon: _icons.listView,
|
|
390
|
-
callback: ({
|
|
391
|
-
close
|
|
392
|
-
}) => {
|
|
393
|
-
setIsListViewOpened(!isListViewOpen);
|
|
394
|
-
close();
|
|
395
|
-
createInfoNotice(isListViewOpen ? (0, _i18n.__)('List View off.') : (0, _i18n.__)('List View on.'), {
|
|
396
|
-
id: 'core/edit-site/toggle-list-view/notice',
|
|
397
|
-
type: 'snackbar'
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
238
|
return {
|
|
402
239
|
isLoading: false,
|
|
403
240
|
commands
|
|
@@ -448,11 +285,6 @@ function usePatternCommands() {
|
|
|
448
285
|
};
|
|
449
286
|
}
|
|
450
287
|
function useEditModeCommands() {
|
|
451
|
-
(0, _commands.useCommandLoader)({
|
|
452
|
-
name: 'core/exit-code-editor',
|
|
453
|
-
hook: useEditorModeCommands,
|
|
454
|
-
context: 'site-editor-edit'
|
|
455
|
-
});
|
|
456
288
|
(0, _commands.useCommandLoader)({
|
|
457
289
|
name: 'core/edit-site/page-content-focus',
|
|
458
290
|
hook: usePageContentFocusCommands,
|