@wordpress/edit-widgets 6.32.0 → 6.32.1-next.47f435fc9.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/build/blocks/widget-area/block.json +26 -0
- package/build/blocks/widget-area/edit/index.js +94 -87
- package/build/blocks/widget-area/edit/index.js.map +7 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +68 -50
- package/build/blocks/widget-area/edit/inner-blocks.js.map +7 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +34 -40
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
- package/build/blocks/widget-area/index.js +49 -52
- package/build/blocks/widget-area/index.js.map +7 -1
- package/build/components/error-boundary/index.js +49 -51
- package/build/components/error-boundary/index.js.map +7 -1
- package/build/components/header/document-tools/index.js +104 -74
- package/build/components/header/document-tools/index.js.map +7 -1
- package/build/components/header/index.js +81 -62
- package/build/components/header/index.js.map +7 -1
- package/build/components/header/undo-redo/redo.js +50 -38
- package/build/components/header/undo-redo/redo.js.map +7 -1
- package/build/components/header/undo-redo/undo.js +49 -37
- package/build/components/header/undo-redo/undo.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
- package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +154 -103
- package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +74 -56
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +89 -82
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/layout/index.js +75 -49
- package/build/components/layout/index.js.map +7 -1
- package/build/components/layout/interface.js +89 -75
- package/build/components/layout/interface.js.map +7 -1
- package/build/components/layout/unsaved-changes-warning.js +35 -42
- package/build/components/layout/unsaved-changes-warning.js.map +7 -1
- package/build/components/more-menu/index.js +189 -108
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/more-menu/tools-more-menu-group.js +29 -23
- package/build/components/more-menu/tools-more-menu-group.js.map +7 -1
- package/build/components/notices/index.js +62 -48
- package/build/components/notices/index.js.map +7 -1
- package/build/components/save-button/index.js +55 -47
- package/build/components/save-button/index.js.map +7 -1
- package/build/components/secondary-sidebar/index.js +41 -34
- package/build/components/secondary-sidebar/index.js.map +7 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +55 -46
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +76 -67
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
- package/build/components/sidebar/index.js +149 -138
- package/build/components/sidebar/index.js.map +7 -1
- package/build/components/sidebar/widget-areas.js +73 -57
- package/build/components/sidebar/widget-areas.js.map +7 -1
- package/build/components/welcome-guide/index.js +182 -137
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/components/widget-areas-block-editor-content/index.js +64 -43
- package/build/components/widget-areas-block-editor-content/index.js.map +7 -1
- package/build/components/widget-areas-block-editor-provider/index.js +115 -92
- package/build/components/widget-areas-block-editor-provider/index.js.map +7 -1
- package/build/constants.js +30 -8
- package/build/constants.js.map +7 -1
- package/build/filters/index.js +3 -5
- package/build/filters/index.js.map +7 -1
- package/build/filters/move-to-widget-area.js +52 -59
- package/build/filters/move-to-widget-area.js.map +7 -1
- package/build/filters/replace-media-upload.js +9 -11
- package/build/filters/replace-media-upload.js.map +7 -1
- package/build/hooks/use-last-selected-widget-area.js +38 -44
- package/build/hooks/use-last-selected-widget-area.js.map +7 -1
- package/build/hooks/use-widget-library-insertion-point.js +60 -55
- package/build/hooks/use-widget-library-insertion-point.js.map +7 -1
- package/build/index.js +86 -93
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +181 -313
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -10
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +51 -51
- package/build/store/index.js.map +7 -1
- package/build/store/private-selectors.js +28 -7
- package/build/store/private-selectors.js.map +7 -1
- package/build/store/reducer.js +65 -118
- package/build/store/reducer.js.map +7 -1
- package/build/store/resolvers.js +64 -63
- package/build/store/resolvers.js.map +7 -1
- package/build/store/selectors.js +194 -231
- package/build/store/selectors.js.map +7 -1
- package/build/store/transformers.js +47 -41
- package/build/store/transformers.js.map +7 -1
- package/build/store/utils.js +47 -70
- package/build/store/utils.js.map +7 -1
- package/build-module/blocks/widget-area/block.json +26 -0
- package/build-module/blocks/widget-area/edit/index.js +63 -75
- package/build-module/blocks/widget-area/edit/index.js.map +7 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +38 -41
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +7 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +14 -33
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
- package/build-module/blocks/widget-area/index.js +14 -46
- package/build-module/blocks/widget-area/index.js.map +7 -1
- package/build-module/components/error-boundary/index.js +30 -43
- package/build-module/components/error-boundary/index.js.map +7 -1
- package/build-module/components/header/document-tools/index.js +75 -66
- package/build-module/components/header/document-tools/index.js.map +7 -1
- package/build-module/components/header/index.js +52 -54
- package/build-module/components/header/index.js.map +7 -1
- package/build-module/components/header/undo-redo/redo.js +32 -32
- package/build-module/components/header/undo-redo/redo.js.map +7 -1
- package/build-module/components/header/undo-redo/undo.js +31 -31
- package/build-module/components/header/undo-redo/undo.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -97
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +56 -50
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +73 -75
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/layout/index.js +46 -41
- package/build-module/components/layout/index.js.map +7 -1
- package/build-module/components/layout/interface.js +63 -66
- package/build-module/components/layout/interface.js.map +7 -1
- package/build-module/components/layout/unsaved-changes-warning.js +17 -37
- package/build-module/components/layout/unsaved-changes-warning.js.map +7 -1
- package/build-module/components/more-menu/index.js +167 -102
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +11 -17
- package/build-module/components/more-menu/tools-more-menu-group.js.map +7 -1
- package/build-module/components/notices/index.js +43 -42
- package/build-module/components/notices/index.js.map +7 -1
- package/build-module/components/save-button/index.js +37 -41
- package/build-module/components/save-button/index.js.map +7 -1
- package/build-module/components/secondary-sidebar/index.js +14 -27
- package/build-module/components/secondary-sidebar/index.js.map +7 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +26 -38
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +57 -60
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
- package/build-module/components/sidebar/index.js +129 -127
- package/build-module/components/sidebar/index.js.map +7 -1
- package/build-module/components/sidebar/widget-areas.js +53 -49
- package/build-module/components/sidebar/widget-areas.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +165 -132
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +43 -36
- package/build-module/components/widget-areas-block-editor-content/index.js.map +7 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +85 -83
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +7 -1
- package/build-module/constants.js +7 -3
- package/build-module/constants.js.map +7 -1
- package/build-module/filters/index.js +3 -6
- package/build-module/filters/index.js.map +7 -1
- package/build-module/filters/move-to-widget-area.js +52 -57
- package/build-module/filters/move-to-widget-area.js.map +7 -1
- package/build-module/filters/replace-media-upload.js +8 -7
- package/build-module/filters/replace-media-upload.js.map +7 -1
- package/build-module/hooks/use-last-selected-widget-area.js +20 -39
- package/build-module/hooks/use-last-selected-widget-area.js.map +7 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +42 -49
- package/build-module/hooks/use-widget-library-insertion-point.js.map +7 -1
- package/build-module/index.js +60 -72
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +153 -293
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -5
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +16 -40
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/private-selectors.js +7 -3
- package/build-module/store/private-selectors.js.map +7 -1
- package/build-module/store/reducer.js +42 -111
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/resolvers.js +43 -51
- package/build-module/store/resolvers.js.map +7 -1
- package/build-module/store/selectors.js +171 -224
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/store/transformers.js +23 -34
- package/build-module/store/transformers.js.map +7 -1
- package/build-module/store/utils.js +22 -63
- package/build-module/store/utils.js.map +7 -1
- package/build-style/style-rtl.css +216 -88
- package/build-style/style.css +216 -88
- package/package.json +36 -29
- package/src/blocks/widget-area/editor.scss +3 -0
- package/src/components/customizer-edit-widgets-initializer/style.scss +3 -0
- package/src/components/error-boundary/style.scss +2 -0
- package/src/components/header/style.scss +5 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
- package/src/components/layout/style.scss +3 -0
- package/src/components/more-menu/style.scss +2 -0
- package/src/components/notices/style.scss +3 -0
- package/src/components/secondary-sidebar/style.scss +4 -0
- package/src/components/sidebar/style.scss +2 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/components/widget-areas-block-editor-content/style.scss +2 -0
- package/src/style.scss +16 -13
|
@@ -1,76 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var list_view_sidebar_exports = {};
|
|
19
|
+
__export(list_view_sidebar_exports, {
|
|
20
|
+
default: () => ListViewSidebar
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
/**
|
|
19
|
-
* WordPress dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
22
|
+
module.exports = __toCommonJS(list_view_sidebar_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
25
|
+
var import_components = require("@wordpress/components");
|
|
26
|
+
var import_compose = require("@wordpress/compose");
|
|
27
|
+
var import_data = require("@wordpress/data");
|
|
28
|
+
var import_element = require("@wordpress/element");
|
|
29
|
+
var import_i18n = require("@wordpress/i18n");
|
|
30
|
+
var import_icons = require("@wordpress/icons");
|
|
31
|
+
var import_keycodes = require("@wordpress/keycodes");
|
|
32
|
+
var import_store = require("../../store");
|
|
33
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
26
34
|
function ListViewSidebar() {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
33
|
-
|
|
34
|
-
// Use internal state instead of a ref to make sure that the component
|
|
35
|
-
// re-renders when the dropZoneElement updates.
|
|
36
|
-
const [dropZoneElement, setDropZoneElement] = (0, _element.useState)(null);
|
|
37
|
-
const focusOnMountRef = (0, _compose.useFocusOnMount)('firstElement');
|
|
38
|
-
|
|
39
|
-
// When closing the list view, focus should return to the toggle button.
|
|
40
|
-
const closeListView = (0, _element.useCallback)(() => {
|
|
35
|
+
const { setIsListViewOpened } = (0, import_data.useDispatch)(import_store.store);
|
|
36
|
+
const { getListViewToggleRef } = (0, import_lock_unlock.unlock)((0, import_data.useSelect)(import_store.store));
|
|
37
|
+
const [dropZoneElement, setDropZoneElement] = (0, import_element.useState)(null);
|
|
38
|
+
const focusOnMountRef = (0, import_compose.useFocusOnMount)("firstElement");
|
|
39
|
+
const closeListView = (0, import_element.useCallback)(() => {
|
|
41
40
|
setIsListViewOpened(false);
|
|
42
41
|
getListViewToggleRef().current?.focus();
|
|
43
42
|
}, [getListViewToggleRef, setIsListViewOpened]);
|
|
44
|
-
const closeOnEscape = (0,
|
|
45
|
-
|
|
46
|
-
event.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
const closeOnEscape = (0, import_element.useCallback)(
|
|
44
|
+
(event) => {
|
|
45
|
+
if (event.keyCode === import_keycodes.ESCAPE && !event.defaultPrevented) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
closeListView();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[closeListView]
|
|
51
|
+
);
|
|
50
52
|
return (
|
|
51
|
-
/*#__PURE__*/
|
|
52
53
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
53
|
-
(0,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: "edit-widgets-editor__list-view-panel",
|
|
58
|
+
onKeyDown: closeOnEscape,
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: (0, import_i18n.__)("List View") }),
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
import_components.Button,
|
|
64
|
+
{
|
|
65
|
+
icon: import_icons.closeSmall,
|
|
66
|
+
label: (0, import_i18n.__)("Close"),
|
|
67
|
+
onClick: closeListView,
|
|
68
|
+
size: "compact"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: "edit-widgets-editor__list-view-panel-content",
|
|
76
|
+
ref: (0, import_compose.useMergeRefs)([focusOnMountRef, setDropZoneElement]),
|
|
77
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.__experimentalListView, { dropZoneElement })
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
)
|
|
74
83
|
);
|
|
75
84
|
}
|
|
76
|
-
//# sourceMappingURL=list-view-sidebar.js.map
|
|
85
|
+
//# sourceMappingURL=list-view-sidebar.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/secondary-sidebar/list-view-sidebar.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( editWidgetsStore ) );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div className=\"edit-widgets-editor__list-view-panel-header\">\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ closeListView }\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [ focusOnMountRef, setDropZoneElement ] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkDG;AA/CH,0BAAmD;AACnD,wBAAuB;AACvB,qBAA8C;AAC9C,kBAAuC;AACvC,qBAAsC;AACtC,kBAAmB;AACnB,mBAA2B;AAC3B,sBAAuB;AAKvB,mBAA0C;AAC1C,yBAAuB;AAER,SAAR,kBAAmC;AACzC,QAAM,EAAE,oBAAoB,QAAI,yBAAa,aAAAA,KAAiB;AAC9D,QAAM,EAAE,qBAAqB,QAAI,+BAAQ,uBAAW,aAAAA,KAAiB,CAAE;AAIvE,QAAM,CAAE,iBAAiB,kBAAmB,QAAI,yBAAU,IAAK;AAE/D,QAAM,sBAAkB,gCAAiB,cAAe;AAGxD,QAAM,oBAAgB,4BAAa,MAAM;AACxC,wBAAqB,KAAM;AAC3B,yBAAqB,EAAE,SAAS,MAAM;AAAA,EACvC,GAAG,CAAE,sBAAsB,mBAAoB,CAAE;AAEjD,QAAM,oBAAgB;AAAA,IACrB,CAAE,UAAW;AACZ,UAAK,MAAM,YAAY,0BAAU,CAAE,MAAM,kBAAmB;AAC3D,cAAM,eAAe;AACrB,sBAAc;AAAA,MACf;AAAA,IACD;AAAA,IACA,CAAE,aAAc;AAAA,EACjB;AAEA;AAAA;AAAA,IAEC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,WAAY;AAAA,QAEZ;AAAA,uDAAC,SAAI,WAAU,+CACd;AAAA,wDAAC,YAAS,8BAAI,WAAY,GAAG;AAAA,YAC7B;AAAA,cAAC;AAAA;AAAA,gBACA,MAAO;AAAA,gBACP,WAAQ,gBAAI,OAAQ;AAAA,gBACpB,SAAU;AAAA,gBACV,MAAK;AAAA;AAAA,YACN;AAAA,aACD;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,SAAM,6BAAc,CAAE,iBAAiB,kBAAmB,CAAE;AAAA,cAE5D,sDAAC,oBAAAC,wBAAA,EAAS,iBAAoC;AAAA;AAAA,UAC/C;AAAA;AAAA;AAAA,IACD;AAAA;AAEF;",
|
|
6
|
+
"names": ["editWidgetsStore", "ListView"]
|
|
7
|
+
}
|
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var sidebar_exports = {};
|
|
29
|
+
__export(sidebar_exports, {
|
|
30
|
+
default: () => Sidebar
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
* WordPress dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const SIDEBAR_ACTIVE_BY_DEFAULT = _element.Platform.select({
|
|
32
|
+
module.exports = __toCommonJS(sidebar_exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var import_element = require("@wordpress/element");
|
|
35
|
+
var import_i18n = require("@wordpress/i18n");
|
|
36
|
+
var import_interface = require("@wordpress/interface");
|
|
37
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
38
|
+
var import_icons = require("@wordpress/icons");
|
|
39
|
+
var import_components = require("@wordpress/components");
|
|
40
|
+
var import_data = require("@wordpress/data");
|
|
41
|
+
var import_widget_areas = __toESM(require("./widget-areas"));
|
|
42
|
+
var import_store = require("../../store");
|
|
43
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
44
|
+
const SIDEBAR_ACTIVE_BY_DEFAULT = import_element.Platform.select({
|
|
24
45
|
web: true,
|
|
25
46
|
native: false
|
|
26
47
|
});
|
|
27
|
-
const BLOCK_INSPECTOR_IDENTIFIER =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
const {
|
|
38
|
-
Tabs
|
|
39
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
40
|
-
function SidebarHeader({
|
|
41
|
-
selectedWidgetAreaBlock
|
|
42
|
-
}) {
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Tabs.TabList, {
|
|
44
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs.Tab, {
|
|
45
|
-
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
46
|
-
children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0, _i18n.__)('Widget Areas')
|
|
47
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs.Tab, {
|
|
48
|
-
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
49
|
-
children: (0, _i18n.__)('Block')
|
|
50
|
-
})]
|
|
51
|
-
});
|
|
48
|
+
const BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
|
|
49
|
+
const WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
|
|
50
|
+
const { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
51
|
+
function SidebarHeader({ selectedWidgetAreaBlock }) {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs.TabList, { children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0, import_i18n.__)("Widget Areas") }),
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0, import_i18n.__)("Block") })
|
|
55
|
+
] });
|
|
52
56
|
}
|
|
53
57
|
function SidebarContent({
|
|
54
58
|
hasSelectedNonAreaBlock,
|
|
@@ -56,59 +60,68 @@ function SidebarContent({
|
|
|
56
60
|
isGeneralSidebarOpen,
|
|
57
61
|
selectedWidgetAreaBlock
|
|
58
62
|
}) {
|
|
59
|
-
const {
|
|
60
|
-
|
|
61
|
-
} = (0, _data.useDispatch)(_interface.store);
|
|
62
|
-
(0, _element.useEffect)(() => {
|
|
63
|
+
const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
|
|
64
|
+
(0, import_element.useEffect)(() => {
|
|
63
65
|
if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
|
|
64
|
-
enableComplementaryArea(
|
|
66
|
+
enableComplementaryArea(
|
|
67
|
+
"core/edit-widgets",
|
|
68
|
+
BLOCK_INSPECTOR_IDENTIFIER
|
|
69
|
+
);
|
|
65
70
|
}
|
|
66
71
|
if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
|
|
67
|
-
enableComplementaryArea(
|
|
72
|
+
enableComplementaryArea(
|
|
73
|
+
"core/edit-widgets",
|
|
74
|
+
WIDGET_AREAS_IDENTIFIER
|
|
75
|
+
);
|
|
68
76
|
}
|
|
69
|
-
// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`
|
|
70
|
-
// out of the dep array because we want this effect to run based on
|
|
71
|
-
// block selection changes, not sidebar state changes.
|
|
72
77
|
}, [hasSelectedNonAreaBlock, enableComplementaryArea]);
|
|
73
|
-
const tabsContextValue = (0,
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
value: tabsContextValue,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(0,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
const tabsContextValue = (0, import_element.useContext)(Tabs.Context);
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_interface.ComplementaryArea,
|
|
81
|
+
{
|
|
82
|
+
className: "edit-widgets-sidebar",
|
|
83
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
SidebarHeader,
|
|
85
|
+
{
|
|
86
|
+
selectedWidgetAreaBlock
|
|
87
|
+
}
|
|
88
|
+
) }),
|
|
89
|
+
headerClassName: "edit-widgets-sidebar__panel-tabs",
|
|
90
|
+
title: (0, import_i18n.__)("Settings"),
|
|
91
|
+
closeLabel: (0, import_i18n.__)("Close Settings"),
|
|
92
|
+
scope: "core/edit-widgets",
|
|
93
|
+
identifier: currentArea,
|
|
94
|
+
icon: (0, import_i18n.isRTL)() ? import_icons.drawerLeft : import_icons.drawerRight,
|
|
95
|
+
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
+
Tabs.TabPanel,
|
|
99
|
+
{
|
|
100
|
+
tabId: WIDGET_AREAS_IDENTIFIER,
|
|
101
|
+
focusable: false,
|
|
102
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
103
|
+
import_widget_areas.default,
|
|
104
|
+
{
|
|
105
|
+
selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
Tabs.TabPanel,
|
|
112
|
+
{
|
|
113
|
+
tabId: BLOCK_INSPECTOR_IDENTIFIER,
|
|
114
|
+
focusable: false,
|
|
115
|
+
children: hasSelectedNonAreaBlock ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockInspector, {}) : (
|
|
116
|
+
// Pretend that Widget Areas are part of the UI by not
|
|
117
|
+
// showing the Block Inspector when one is selected.
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0, import_i18n.__)("No block selected.") })
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
}
|
|
124
|
+
);
|
|
112
125
|
}
|
|
113
126
|
function Sidebar() {
|
|
114
127
|
const {
|
|
@@ -116,17 +129,11 @@ function Sidebar() {
|
|
|
116
129
|
hasSelectedNonAreaBlock,
|
|
117
130
|
isGeneralSidebarOpen,
|
|
118
131
|
selectedWidgetAreaBlock
|
|
119
|
-
} = (0,
|
|
120
|
-
const {
|
|
121
|
-
|
|
122
|
-
getBlock,
|
|
123
|
-
getBlockParentsByBlockName
|
|
124
|
-
} = select(_blockEditor.store);
|
|
125
|
-
const {
|
|
126
|
-
getActiveComplementaryArea
|
|
127
|
-
} = select(_interface.store);
|
|
132
|
+
} = (0, import_data.useSelect)((select) => {
|
|
133
|
+
const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(import_block_editor.store);
|
|
134
|
+
const { getActiveComplementaryArea } = select(import_interface.store);
|
|
128
135
|
const selectedBlock = getSelectedBlock();
|
|
129
|
-
const activeArea = getActiveComplementaryArea(
|
|
136
|
+
const activeArea = getActiveComplementaryArea(import_store.store.name);
|
|
130
137
|
let currentSelection = activeArea;
|
|
131
138
|
if (!currentSelection) {
|
|
132
139
|
if (selectedBlock) {
|
|
@@ -137,48 +144,52 @@ function Sidebar() {
|
|
|
137
144
|
}
|
|
138
145
|
let widgetAreaBlock;
|
|
139
146
|
if (selectedBlock) {
|
|
140
|
-
if (selectedBlock.name ===
|
|
147
|
+
if (selectedBlock.name === "core/widget-area") {
|
|
141
148
|
widgetAreaBlock = selectedBlock;
|
|
142
149
|
} else {
|
|
143
|
-
widgetAreaBlock = getBlock(
|
|
150
|
+
widgetAreaBlock = getBlock(
|
|
151
|
+
getBlockParentsByBlockName(
|
|
152
|
+
selectedBlock.clientId,
|
|
153
|
+
"core/widget-area"
|
|
154
|
+
)[0]
|
|
155
|
+
);
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
return {
|
|
147
159
|
currentArea: currentSelection,
|
|
148
|
-
hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !==
|
|
160
|
+
hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"),
|
|
149
161
|
isGeneralSidebarOpen: !!activeArea,
|
|
150
162
|
selectedWidgetAreaBlock: widgetAreaBlock
|
|
151
163
|
};
|
|
152
164
|
}, []);
|
|
153
|
-
const {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
165
|
+
const { enableComplementaryArea } = (0, import_data.useDispatch)(import_interface.store);
|
|
166
|
+
const onTabSelect = (0, import_element.useCallback)(
|
|
167
|
+
(newSelectedTabId) => {
|
|
168
|
+
if (!!newSelectedTabId) {
|
|
169
|
+
enableComplementaryArea(
|
|
170
|
+
import_store.store.name,
|
|
171
|
+
newSelectedTabId
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
[enableComplementaryArea]
|
|
176
|
+
);
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
178
|
+
Tabs,
|
|
179
|
+
{
|
|
180
|
+
selectedTabId: isGeneralSidebarOpen ? currentArea : null,
|
|
181
|
+
onSelect: onTabSelect,
|
|
182
|
+
selectOnMove: false,
|
|
183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
184
|
+
SidebarContent,
|
|
185
|
+
{
|
|
186
|
+
hasSelectedNonAreaBlock,
|
|
187
|
+
currentArea,
|
|
188
|
+
isGeneralSidebarOpen,
|
|
189
|
+
selectedWidgetAreaBlock
|
|
190
|
+
}
|
|
191
|
+
)
|
|
164
192
|
}
|
|
165
|
-
|
|
166
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tabs
|
|
167
|
-
// Due to how this component is controlled (via a value from the
|
|
168
|
-
// `interfaceStore`), when the sidebar closes the currently selected
|
|
169
|
-
// tab can't be found. This causes the component to continuously reset
|
|
170
|
-
// the selection to `null` in an infinite loop. Proactively setting
|
|
171
|
-
// the selected tab to `null` avoids that.
|
|
172
|
-
, {
|
|
173
|
-
selectedTabId: isGeneralSidebarOpen ? currentArea : null,
|
|
174
|
-
onSelect: onTabSelect,
|
|
175
|
-
selectOnMove: false,
|
|
176
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SidebarContent, {
|
|
177
|
-
hasSelectedNonAreaBlock: hasSelectedNonAreaBlock,
|
|
178
|
-
currentArea: currentArea,
|
|
179
|
-
isGeneralSidebarOpen: isGeneralSidebarOpen,
|
|
180
|
-
selectedWidgetAreaBlock: selectedWidgetAreaBlock
|
|
181
|
-
})
|
|
182
|
-
});
|
|
193
|
+
);
|
|
183
194
|
}
|
|
184
|
-
//# sourceMappingURL=index.js.map
|
|
195
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_interface","_blockEditor","_icons","_components","_data","_widgetAreas","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","Tabs","unlock","componentsPrivateApis","SidebarHeader","selectedWidgetAreaBlock","jsxs","TabList","children","jsx","Tab","tabId","attributes","name","__","SidebarContent","hasSelectedNonAreaBlock","currentArea","isGeneralSidebarOpen","enableComplementaryArea","useDispatch","interfaceStore","useEffect","tabsContextValue","useContext","Context","ComplementaryArea","className","header","Provider","value","headerClassName","title","closeLabel","scope","identifier","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","TabPanel","focusable","default","selectedWidgetAreaId","id","BlockInspector","Sidebar","useSelect","getSelectedBlock","getBlock","getBlockParentsByBlockName","blockEditorStore","getActiveComplementaryArea","selectedBlock","activeArea","editWidgetsStore","currentSelection","widgetAreaBlock","clientId","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGene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BAAoB,GAAGD,WAAW,GAAG,IAAM;IAC3D+C,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAzD,QAAA,eAEtB,IAAAf,WAAA,CAAAgB,GAAA,EAACM,cAAc;MACdC,uBAAuB,EAAGA,uBAAyB;MACnDC,WAAW,EAAGA,WAAa;MAC3BC,oBAAoB,EAAGA,oBAAsB;MAC7Cb,uBAAuB,EAAGA;IAAyB,CACnD;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/sidebar/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tPlatform,\n\tuseContext,\n\tuseCallback,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6CE;AA1CF,qBAKO;AACP,kBAA0B;AAC1B,uBAGO;AACP,0BAGO;AAEP,mBAAwC;AACxC,wBAAqD;AACrD,kBAAuC;AAgBvC,0BAAwB;AACxB,mBAA0C;AAC1C,yBAAuB;AAhBvB,MAAM,4BAA4B,wBAAS,OAAQ;AAAA,EAClD,KAAK;AAAA,EACL,QAAQ;AACT,CAAE;AAEF,MAAM,6BAA6B;AAInC,MAAM,0BAA0B;AAShC,MAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,cAAe,EAAE,wBAAwB,GAAI;AACrD,SACC,6CAAC,KAAK,SAAL,EACA;AAAA,gDAAC,KAAK,KAAL,EAAS,OAAQ,yBACf,oCACC,wBAAwB,WAAW,WACnC,gBAAI,cAAe,GACvB;AAAA,IACA,4CAAC,KAAK,KAAL,EAAS,OAAQ,4BACf,8BAAI,OAAQ,GACf;AAAA,KACD;AAEF;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