@wordpress/customize-widgets 5.32.0 → 5.32.1-next.ff1cebbba.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/components/block-appender/index.js +33 -27
- package/build/components/block-appender/index.js.map +7 -1
- package/build/components/block-inspector-button/index.js +51 -36
- package/build/components/block-inspector-button/index.js.map +7 -1
- package/build/components/customize-widgets/index.js +83 -61
- package/build/components/customize-widgets/index.js.map +7 -1
- package/build/components/customize-widgets/use-clear-selected-block.js +56 -63
- package/build/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build/components/error-boundary/index.js +46 -45
- package/build/components/error-boundary/index.js.map +7 -1
- package/build/components/focus-control/index.js +69 -57
- package/build/components/focus-control/index.js.map +7 -1
- package/build/components/focus-control/use-blocks-focus-control.js +38 -31
- package/build/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build/components/header/index.js +110 -71
- package/build/components/header/index.js.map +7 -1
- package/build/components/inserter/index.js +77 -53
- package/build/components/inserter/index.js.map +7 -1
- package/build/components/inserter/use-inserter.js +46 -29
- package/build/components/inserter/use-inserter.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 +155 -110
- package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +76 -56
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +60 -51
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/more-menu/index.js +151 -90
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/sidebar-block-editor/index.js +133 -105
- package/build/components/sidebar-block-editor/index.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +73 -67
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +51 -33
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +100 -79
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build/components/sidebar-controls/index.js +45 -31
- package/build/components/sidebar-controls/index.js.map +7 -1
- package/build/components/welcome-guide/index.js +86 -58
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/controls/inserter-outer-section.js +49 -58
- package/build/controls/inserter-outer-section.js.map +7 -1
- package/build/controls/inspector-section.js +30 -36
- package/build/controls/inspector-section.js.map +7 -1
- package/build/controls/sidebar-control.js +51 -30
- package/build/controls/sidebar-control.js.map +7 -1
- package/build/controls/sidebar-section.js +71 -39
- package/build/controls/sidebar-section.js.map +7 -1
- package/build/filters/index.js +4 -6
- package/build/filters/index.js.map +7 -1
- package/build/filters/move-to-sidebar.js +77 -79
- package/build/filters/move-to-sidebar.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/filters/wide-widget-display.js +20 -25
- package/build/filters/wide-widget-display.js.map +7 -1
- package/build/index.js +81 -70
- 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 +27 -44
- 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 +44 -40
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +25 -19
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +31 -44
- package/build/store/selectors.js.map +7 -1
- package/build/utils.js +45 -73
- package/build/utils.js.map +7 -1
- package/build-module/components/block-appender/index.js +17 -20
- package/build-module/components/block-appender/index.js.map +7 -1
- package/build-module/components/block-inspector-button/index.js +33 -30
- package/build-module/components/block-inspector-button/index.js.map +7 -1
- package/build-module/components/customize-widgets/index.js +52 -51
- package/build-module/components/customize-widgets/index.js.map +7 -1
- package/build-module/components/customize-widgets/use-clear-selected-block.js +38 -58
- package/build-module/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build-module/components/error-boundary/index.js +27 -37
- package/build-module/components/error-boundary/index.js.map +7 -1
- package/build-module/components/focus-control/index.js +50 -45
- package/build-module/components/focus-control/index.js.map +7 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +17 -22
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build-module/components/header/index.js +81 -63
- package/build-module/components/header/index.js.map +7 -1
- package/build-module/components/inserter/index.js +59 -47
- package/build-module/components/inserter/index.js.map +7 -1
- package/build-module/components/inserter/use-inserter.js +28 -23
- package/build-module/components/inserter/use-inserter.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 -103
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -50
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +44 -44
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/more-menu/index.js +129 -84
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/index.js +109 -96
- package/build-module/components/sidebar-block-editor/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +54 -59
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +22 -25
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +70 -70
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build-module/components/sidebar-controls/index.js +24 -25
- package/build-module/components/sidebar-controls/index.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +68 -52
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/controls/inserter-outer-section.js +31 -52
- package/build-module/controls/inserter-outer-section.js.map +7 -1
- package/build-module/controls/inspector-section.js +13 -32
- package/build-module/controls/inspector-section.js.map +7 -1
- package/build-module/controls/sidebar-control.js +22 -22
- package/build-module/controls/sidebar-control.js.map +7 -1
- package/build-module/controls/sidebar-section.js +43 -32
- package/build-module/controls/sidebar-section.js.map +7 -1
- package/build-module/filters/index.js +4 -7
- package/build-module/filters/index.js.map +7 -1
- package/build-module/filters/move-to-sidebar.js +83 -76
- package/build-module/filters/move-to-sidebar.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/filters/wide-widget-display.js +20 -22
- package/build-module/filters/wide-widget-display.js.map +7 -1
- package/build-module/index.js +53 -51
- 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 +6 -40
- 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 +10 -30
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +7 -14
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +10 -40
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils.js +21 -66
- package/build-module/utils.js.map +7 -1
- package/build-style/style-rtl.css +14 -149
- package/build-style/style.css +14 -149
- package/package.json +30 -23
- package/src/components/block-inspector-button/style.scss +3 -0
- package/src/components/header/style.scss +5 -0
- package/src/components/inserter/style.scss +3 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
- package/src/components/more-menu/style.scss +2 -0
- package/src/components/sidebar-block-editor/style.scss +2 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/controls/style.scss +2 -0
- package/src/style.scss +10 -8
|
@@ -1,36 +1,39 @@
|
|
|
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 inserter_outer_section_exports = {};
|
|
19
|
+
__export(inserter_outer_section_exports, {
|
|
20
|
+
default: () => getInserterOuterSection
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
22
|
+
module.exports = __toCommonJS(inserter_outer_section_exports);
|
|
23
|
+
var import_keycodes = require("@wordpress/keycodes");
|
|
24
|
+
var import_dom = require("@wordpress/dom");
|
|
25
|
+
var import_data = require("@wordpress/data");
|
|
26
|
+
var import_store = require("../store");
|
|
19
27
|
function getInserterOuterSection() {
|
|
20
28
|
const {
|
|
21
|
-
wp: {
|
|
22
|
-
customize
|
|
23
|
-
}
|
|
29
|
+
wp: { customize }
|
|
24
30
|
} = window;
|
|
25
31
|
const OuterSection = customize.OuterSection;
|
|
26
|
-
// Override the OuterSection class to handle multiple outer sections.
|
|
27
|
-
// It closes all the other outer sections whenever one is opened.
|
|
28
|
-
// The result is that at most one outer section can be opened at the same time.
|
|
29
32
|
customize.OuterSection = class extends OuterSection {
|
|
30
33
|
onChangeExpanded(expanded, args) {
|
|
31
34
|
if (expanded) {
|
|
32
|
-
customize.section.each(section => {
|
|
33
|
-
if (section.params.type ===
|
|
35
|
+
customize.section.each((section) => {
|
|
36
|
+
if (section.params.type === "outer" && section.id !== this.id) {
|
|
34
37
|
if (section.expanded()) {
|
|
35
38
|
section.collapse();
|
|
36
39
|
}
|
|
@@ -40,37 +43,34 @@ function getInserterOuterSection() {
|
|
|
40
43
|
return super.onChangeExpanded(expanded, args);
|
|
41
44
|
}
|
|
42
45
|
};
|
|
43
|
-
// Handle constructor so that "params.type" can be correctly pointed to "outer".
|
|
44
46
|
customize.sectionConstructor.outer = customize.OuterSection;
|
|
45
47
|
return class InserterOuterSection extends customize.OuterSection {
|
|
46
48
|
constructor(...args) {
|
|
47
49
|
super(...args);
|
|
48
|
-
|
|
49
|
-
// This is necessary since we're creating a new class which is not identical to the original OuterSection.
|
|
50
|
-
// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436
|
|
51
|
-
this.params.type = 'outer';
|
|
50
|
+
this.params.type = "outer";
|
|
52
51
|
this.activeElementBeforeExpanded = null;
|
|
53
52
|
const ownerWindow = this.contentContainer[0].ownerDocument.defaultView;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
ownerWindow.addEventListener(
|
|
54
|
+
"keydown",
|
|
55
|
+
(event) => {
|
|
56
|
+
if (this.expanded() && (event.keyCode === import_keycodes.ESCAPE || event.code === "Escape") && !event.defaultPrevented) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
(0, import_data.dispatch)(import_store.store).setIsInserterOpened(
|
|
60
|
+
false
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
// Use capture mode to make this run before other event listeners.
|
|
65
|
+
true
|
|
66
|
+
);
|
|
67
|
+
this.contentContainer.addClass("widgets-inserter");
|
|
69
68
|
this.isFromInternalAction = false;
|
|
70
69
|
this.expanded.bind(() => {
|
|
71
70
|
if (!this.isFromInternalAction) {
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
(0, import_data.dispatch)(import_store.store).setIsInserterOpened(
|
|
72
|
+
this.expanded()
|
|
73
|
+
);
|
|
74
74
|
}
|
|
75
75
|
this.isFromInternalAction = false;
|
|
76
76
|
});
|
|
@@ -82,10 +82,7 @@ function getInserterOuterSection() {
|
|
|
82
82
|
this.isFromInternalAction = true;
|
|
83
83
|
this.expand({
|
|
84
84
|
completeCallback() {
|
|
85
|
-
|
|
86
|
-
// The first one should be the close button,
|
|
87
|
-
// we want to skip it and choose the second one instead, which is the search box.
|
|
88
|
-
const searchBox = _dom.focus.tabbable.find(contentContainer)[1];
|
|
85
|
+
const searchBox = import_dom.focus.tabbable.find(contentContainer)[1];
|
|
89
86
|
if (searchBox) {
|
|
90
87
|
searchBox.focus();
|
|
91
88
|
}
|
|
@@ -100,13 +97,7 @@ function getInserterOuterSection() {
|
|
|
100
97
|
this.isFromInternalAction = true;
|
|
101
98
|
this.collapse({
|
|
102
99
|
completeCallback() {
|
|
103
|
-
// Return back the focus when closing the inserter.
|
|
104
|
-
// Only do this if the active element which triggers the action is inside the inserter,
|
|
105
|
-
// (the close button for instance). In that case the focus will be lost.
|
|
106
|
-
// Otherwise, we don't hijack the focus when the user is focusing on other elements
|
|
107
|
-
// (like the quick inserter).
|
|
108
100
|
if (contentContainer.contains(activeElement)) {
|
|
109
|
-
// Return back the focus when closing the inserter.
|
|
110
101
|
if (this.activeElementBeforeExpanded) {
|
|
111
102
|
this.activeElementBeforeExpanded.focus();
|
|
112
103
|
}
|
|
@@ -117,4 +108,4 @@ function getInserterOuterSection() {
|
|
|
117
108
|
}
|
|
118
109
|
};
|
|
119
110
|
}
|
|
120
|
-
//# sourceMappingURL=inserter-outer-section.js.map
|
|
111
|
+
//# sourceMappingURL=inserter-outer-section.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/controls/inserter-outer-section.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\t( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\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}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\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\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAuB;AACvB,iBAAsB;AACtB,kBAAyB;AAKzB,mBAA+C;AAEhC,SAAR,0BAA2C;AACjD,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,QAAM,eAAe,UAAU;AAI/B,YAAU,eAAe,cAAc,aAAa;AAAA,IACnD,iBAAkB,UAAU,MAAO;AAClC,UAAK,UAAW;AACf,kBAAU,QAAQ,KAAM,CAAE,YAAa;AACtC,cACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IACnB;AACD,gBAAK,QAAQ,SAAS,GAAI;AACzB,sBAAQ,SAAS;AAAA,YAClB;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH;AAEA,aAAO,MAAM,iBAAkB,UAAU,IAAK;AAAA,IAC/C;AAAA,EACD;AAEA,YAAU,mBAAmB,QAAQ,UAAU;AAE/C,SAAO,MAAM,6BAA6B,UAAU,aAAa;AAAA,IAChE,eAAgB,MAAO;AACtB,YAAO,GAAG,IAAK;AAIf,WAAK,OAAO,OAAO;AAEnB,WAAK,8BAA8B;AAEnC,YAAM,cACL,KAAK,iBAAkB,CAAE,EAAE,cAAc;AAG1C,kBAAY;AAAA,QACX;AAAA,QACA,CAAE,UAAW;AACZ,cACC,KAAK,SAAS,MACZ,MAAM,YAAY,0BACnB,MAAM,SAAS,aAChB,CAAE,MAAM,kBACP;AACD,kBAAM,eAAe;AACrB,kBAAM,gBAAgB;AACtB,sCAAU,aAAAA,KAAsB,EAAE;AAAA,cACjC;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA;AAAA,QAEA;AAAA,MACD;AAEA,WAAK,iBAAiB,SAAU,kBAAmB;AAInD,WAAK,uBAAuB;AAC5B,WAAK,SAAS,KAAM,MAAM;AACzB,YAAK,CAAE,KAAK,sBAAuB;AAElC,oCAAU,aAAAA,KAAsB,EAAE;AAAA,YACjC,KAAK,SAAS;AAAA,UACf;AAAA,QACD;AACA,aAAK,uBAAuB;AAAA,MAC7B,CAAE;AAAA,IACH;AAAA,IACA,OAAO;AACN,UAAK,CAAE,KAAK,SAAS,GAAI;AACxB,cAAM,mBAAmB,KAAK,iBAAkB,CAAE;AAClD,aAAK,8BACJ,iBAAiB,cAAc;AAEhC,aAAK,uBAAuB;AAE5B,aAAK,OAAQ;AAAA,UACZ,mBAAmB;AAIlB,kBAAM,YACL,iBAAM,SAAS,KAAM,gBAAiB,EAAG,CAAE;AAC5C,gBAAK,WAAY;AAChB,wBAAU,MAAM;AAAA,YACjB;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,IACA,QAAQ;AACP,UAAK,KAAK,SAAS,GAAI;AACtB,cAAM,mBAAmB,KAAK,iBAAkB,CAAE;AAClD,cAAM,gBACL,iBAAiB,cAAc;AAEhC,aAAK,uBAAuB;AAE5B,aAAK,SAAU;AAAA,UACd,mBAAmB;AAMlB,gBAAK,iBAAiB,SAAU,aAAc,GAAI;AAEjD,kBAAK,KAAK,6BAA8B;AACvC,qBAAK,4BAA4B,MAAM;AAAA,cACxC;AAAA,YACD;AAAA,UACD;AAAA,QACD,CAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["customizeWidgetsStore"]
|
|
7
|
+
}
|
|
@@ -1,14 +1,28 @@
|
|
|
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 inspector_section_exports = {};
|
|
19
|
+
__export(inspector_section_exports, {
|
|
20
|
+
default: () => getInspectorSection
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
22
|
+
module.exports = __toCommonJS(inspector_section_exports);
|
|
7
23
|
function getInspectorSection() {
|
|
8
24
|
const {
|
|
9
|
-
wp: {
|
|
10
|
-
customize
|
|
11
|
-
}
|
|
25
|
+
wp: { customize }
|
|
12
26
|
} = window;
|
|
13
27
|
return class InspectorSection extends customize.Section {
|
|
14
28
|
constructor(id, options) {
|
|
@@ -25,7 +39,9 @@ function getInspectorSection() {
|
|
|
25
39
|
this.triggerActiveCallbacks();
|
|
26
40
|
}
|
|
27
41
|
ready() {
|
|
28
|
-
this.contentContainer[0].classList.add(
|
|
42
|
+
this.contentContainer[0].classList.add(
|
|
43
|
+
"customize-widgets-layout__inspector"
|
|
44
|
+
);
|
|
29
45
|
}
|
|
30
46
|
isContextuallyActive() {
|
|
31
47
|
return this.isOpen;
|
|
@@ -41,8 +57,9 @@ function getInspectorSection() {
|
|
|
41
57
|
this.parentSection.expand({
|
|
42
58
|
manualTransition: true,
|
|
43
59
|
completeCallback: () => {
|
|
44
|
-
|
|
45
|
-
|
|
60
|
+
if (this.returnFocusWhenClose && !this.contentContainer[0].contains(
|
|
61
|
+
this.returnFocusWhenClose
|
|
62
|
+
)) {
|
|
46
63
|
this.returnFocusWhenClose.focus();
|
|
47
64
|
}
|
|
48
65
|
}
|
|
@@ -50,9 +67,7 @@ function getInspectorSection() {
|
|
|
50
67
|
}
|
|
51
68
|
}
|
|
52
69
|
}
|
|
53
|
-
open({
|
|
54
|
-
returnFocusWhenClose
|
|
55
|
-
} = {}) {
|
|
70
|
+
open({ returnFocusWhenClose } = {}) {
|
|
56
71
|
this.isOpen = true;
|
|
57
72
|
this.returnFocusWhenClose = returnFocusWhenClose;
|
|
58
73
|
this.expand({
|
|
@@ -65,33 +80,12 @@ function getInspectorSection() {
|
|
|
65
80
|
});
|
|
66
81
|
}
|
|
67
82
|
collapse(options) {
|
|
68
|
-
// Overridden collapse() function. Mostly call the parent collapse(), but also
|
|
69
|
-
// move our .isOpen to false.
|
|
70
|
-
// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work
|
|
71
|
-
// because the block settings sidebar is a layer "on top of" the G editor sidebar.
|
|
72
|
-
//
|
|
73
|
-
// For example, when closing the block settings sidebar, the G
|
|
74
|
-
// editor sidebar would display, and onChangeExpanded in
|
|
75
|
-
// inspector-section would run with expanded=true, but I want
|
|
76
|
-
// isOpen to be false when the block settings is closed.
|
|
77
83
|
this.isOpen = false;
|
|
78
84
|
super.collapse(options);
|
|
79
85
|
}
|
|
80
86
|
triggerActiveCallbacks() {
|
|
81
|
-
// Manually fire the callbacks associated with moving this.active
|
|
82
|
-
// from false to true. "active" is always true for this section,
|
|
83
|
-
// and "isContextuallyActive" reflects if the block settings
|
|
84
|
-
// sidebar is currently visible, that is, it has replaced the main
|
|
85
|
-
// Gutenberg view.
|
|
86
|
-
// The WP customizer only checks ".isContextuallyActive()" when
|
|
87
|
-
// ".active" changes values. But our ".active" never changes value.
|
|
88
|
-
// The WP customizer never foresaw a section being used a way we
|
|
89
|
-
// fit the block settings sidebar into a section. By manually
|
|
90
|
-
// triggering the "this.active" callbacks, we force the WP
|
|
91
|
-
// customizer to query our .isContextuallyActive() function and
|
|
92
|
-
// update its view of our status.
|
|
93
87
|
this.active.callbacks.fireWith(this.active, [false, true]);
|
|
94
88
|
}
|
|
95
89
|
};
|
|
96
90
|
}
|
|
97
|
-
//# sourceMappingURL=inspector-section.js.map
|
|
91
|
+
//# sourceMappingURL=inspector-section.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/controls/inspector-section.js"],
|
|
4
|
+
"sourcesContent": ["export default function getInspectorSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class InspectorSection extends customize.Section {\n\t\tconstructor( id, options ) {\n\t\t\tsuper( id, options );\n\n\t\t\tthis.parentSection = options.parentSection;\n\n\t\t\tthis.returnFocusWhenClose = null;\n\t\t\tthis._isOpen = false;\n\t\t}\n\t\tget isOpen() {\n\t\t\treturn this._isOpen;\n\t\t}\n\t\tset isOpen( value ) {\n\t\t\tthis._isOpen = value;\n\t\t\tthis.triggerActiveCallbacks();\n\t\t}\n\t\tready() {\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets-layout__inspector'\n\t\t\t);\n\t\t}\n\t\tisContextuallyActive() {\n\t\t\treturn this.isOpen;\n\t\t}\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tsuper.onChangeExpanded( expanded, args );\n\n\t\t\tif ( this.parentSection && ! args.unchanged ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.parentSection.collapse( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tthis.parentSection.expand( {\n\t\t\t\t\t\tmanualTransition: true,\n\t\t\t\t\t\tcompleteCallback: () => {\n\t\t\t\t\t\t\t// Return focus after finishing the transition.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose &&\n\t\t\t\t\t\t\t\t! this.contentContainer[ 0 ].contains(\n\t\t\t\t\t\t\t\t\tthis.returnFocusWhenClose\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tthis.returnFocusWhenClose.focus();\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\t}\n\t\t\t}\n\t\t}\n\t\topen( { returnFocusWhenClose } = {} ) {\n\t\t\tthis.isOpen = true;\n\t\t\tthis.returnFocusWhenClose = returnFocusWhenClose;\n\n\t\t\tthis.expand( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tclose() {\n\t\t\tthis.collapse( {\n\t\t\t\tallowMultiple: true,\n\t\t\t} );\n\t\t}\n\t\tcollapse( options ) {\n\t\t\t// Overridden collapse() function. Mostly call the parent collapse(), but also\n\t\t\t// move our .isOpen to false.\n\t\t\t// Initially, I tried tracking this with onChangeExpanded(), but it doesn't work\n\t\t\t// because the block settings sidebar is a layer \"on top of\" the G editor sidebar.\n\t\t\t//\n\t\t\t// For example, when closing the block settings sidebar, the G\n\t\t\t// editor sidebar would display, and onChangeExpanded in\n\t\t\t// inspector-section would run with expanded=true, but I want\n\t\t\t// isOpen to be false when the block settings is closed.\n\t\t\tthis.isOpen = false;\n\t\t\tsuper.collapse( options );\n\t\t}\n\t\ttriggerActiveCallbacks() {\n\t\t\t// Manually fire the callbacks associated with moving this.active\n\t\t\t// from false to true. \"active\" is always true for this section,\n\t\t\t// and \"isContextuallyActive\" reflects if the block settings\n\t\t\t// sidebar is currently visible, that is, it has replaced the main\n\t\t\t// Gutenberg view.\n\t\t\t// The WP customizer only checks \".isContextuallyActive()\" when\n\t\t\t// \".active\" changes values. But our \".active\" never changes value.\n\t\t\t// The WP customizer never foresaw a section being used a way we\n\t\t\t// fit the block settings sidebar into a section. By manually\n\t\t\t// triggering the \"this.active\" callbacks, we force the WP\n\t\t\t// customizer to query our .isContextuallyActive() function and\n\t\t\t// update its view of our status.\n\t\t\tthis.active.callbacks.fireWith( this.active, [ false, true ] );\n\t\t}\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAe,SAAR,sBAAuC;AAC7C,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,SAAO,MAAM,yBAAyB,UAAU,QAAQ;AAAA,IACvD,YAAa,IAAI,SAAU;AAC1B,YAAO,IAAI,OAAQ;AAEnB,WAAK,gBAAgB,QAAQ;AAE7B,WAAK,uBAAuB;AAC5B,WAAK,UAAU;AAAA,IAChB;AAAA,IACA,IAAI,SAAS;AACZ,aAAO,KAAK;AAAA,IACb;AAAA,IACA,IAAI,OAAQ,OAAQ;AACnB,WAAK,UAAU;AACf,WAAK,uBAAuB;AAAA,IAC7B;AAAA,IACA,QAAQ;AACP,WAAK,iBAAkB,CAAE,EAAE,UAAU;AAAA,QACpC;AAAA,MACD;AAAA,IACD;AAAA,IACA,uBAAuB;AACtB,aAAO,KAAK;AAAA,IACb;AAAA,IACA,iBAAkB,UAAU,MAAO;AAClC,YAAM,iBAAkB,UAAU,IAAK;AAEvC,UAAK,KAAK,iBAAiB,CAAE,KAAK,WAAY;AAC7C,YAAK,UAAW;AACf,eAAK,cAAc,SAAU;AAAA,YAC5B,kBAAkB;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,eAAK,cAAc,OAAQ;AAAA,YAC1B,kBAAkB;AAAA,YAClB,kBAAkB,MAAM;AAEvB,kBACC,KAAK,wBACL,CAAE,KAAK,iBAAkB,CAAE,EAAE;AAAA,gBAC5B,KAAK;AAAA,cACN,GACC;AACD,qBAAK,qBAAqB,MAAM;AAAA,cACjC;AAAA,YACD;AAAA,UACD,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,IACA,KAAM,EAAE,qBAAqB,IAAI,CAAC,GAAI;AACrC,WAAK,SAAS;AACd,WAAK,uBAAuB;AAE5B,WAAK,OAAQ;AAAA,QACZ,eAAe;AAAA,MAChB,CAAE;AAAA,IACH;AAAA,IACA,QAAQ;AACP,WAAK,SAAU;AAAA,QACd,eAAe;AAAA,MAChB,CAAE;AAAA,IACH;AAAA,IACA,SAAU,SAAU;AAUnB,WAAK,SAAS;AACd,YAAM,SAAU,OAAQ;AAAA,IACzB;AAAA,IACA,yBAAyB;AAaxB,WAAK,OAAO,UAAU,SAAU,KAAK,QAAQ,CAAE,OAAO,IAAK,CAAE;AAAA,IAC9D;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,41 +1,59 @@
|
|
|
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_control_exports = {};
|
|
29
|
+
__export(sidebar_control_exports, {
|
|
30
|
+
default: () => getSidebarControl
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const getInserterId = controlId => `widgets-inserter-${controlId}`;
|
|
32
|
+
module.exports = __toCommonJS(sidebar_control_exports);
|
|
33
|
+
var import_data = require("@wordpress/data");
|
|
34
|
+
var import_sidebar_adapter = __toESM(require("../components/sidebar-block-editor/sidebar-adapter"));
|
|
35
|
+
var import_inserter_outer_section = __toESM(require("./inserter-outer-section"));
|
|
36
|
+
var import_store = require("../store");
|
|
37
|
+
const getInserterId = (controlId) => `widgets-inserter-${controlId}`;
|
|
21
38
|
function getSidebarControl() {
|
|
22
39
|
const {
|
|
23
|
-
wp: {
|
|
24
|
-
customize
|
|
25
|
-
}
|
|
40
|
+
wp: { customize }
|
|
26
41
|
} = window;
|
|
27
42
|
return class SidebarControl extends customize.Control {
|
|
28
43
|
constructor(...args) {
|
|
29
44
|
super(...args);
|
|
30
|
-
this.subscribers = new Set();
|
|
45
|
+
this.subscribers = /* @__PURE__ */ new Set();
|
|
31
46
|
}
|
|
32
47
|
ready() {
|
|
33
|
-
const InserterOuterSection = (0,
|
|
34
|
-
this.inserter = new InserterOuterSection(
|
|
48
|
+
const InserterOuterSection = (0, import_inserter_outer_section.default)();
|
|
49
|
+
this.inserter = new InserterOuterSection(
|
|
50
|
+
getInserterId(this.id),
|
|
51
|
+
{}
|
|
52
|
+
);
|
|
35
53
|
customize.section.add(this.inserter);
|
|
36
54
|
this.sectionInstance = customize.section(this.section());
|
|
37
55
|
this.inspector = this.sectionInstance.inspector;
|
|
38
|
-
this.sidebarAdapter = new
|
|
56
|
+
this.sidebarAdapter = new import_sidebar_adapter.default(this.setting, customize);
|
|
39
57
|
}
|
|
40
58
|
subscribe(callback) {
|
|
41
59
|
this.subscribers.add(callback);
|
|
@@ -45,13 +63,16 @@ function getSidebarControl() {
|
|
|
45
63
|
}
|
|
46
64
|
onChangeSectionExpanded(expanded, args) {
|
|
47
65
|
if (!args.unchanged) {
|
|
48
|
-
// Close the inserter when the section collapses.
|
|
49
66
|
if (!expanded) {
|
|
50
|
-
(0,
|
|
67
|
+
(0, import_data.dispatch)(import_store.store).setIsInserterOpened(
|
|
68
|
+
false
|
|
69
|
+
);
|
|
51
70
|
}
|
|
52
|
-
this.subscribers.forEach(
|
|
71
|
+
this.subscribers.forEach(
|
|
72
|
+
(subscriber) => subscriber(expanded, args)
|
|
73
|
+
);
|
|
53
74
|
}
|
|
54
75
|
}
|
|
55
76
|
};
|
|
56
77
|
}
|
|
57
|
-
//# sourceMappingURL=sidebar-control.js.map
|
|
78
|
+
//# sourceMappingURL=sidebar-control.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/controls/sidebar-control.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyB;AAKzB,6BAA2B;AAC3B,oCAAoC;AACpC,mBAA+C;AAE/C,MAAM,gBAAgB,CAAE,cAAe,oBAAqB,SAAU;AAEvD,SAAR,oBAAqC;AAC3C,QAAM;AAAA,IACL,IAAI,EAAE,UAAU;AAAA,EACjB,IAAI;AAEJ,SAAO,MAAM,uBAAuB,UAAU,QAAQ;AAAA,IACrD,eAAgB,MAAO;AACtB,YAAO,GAAG,IAAK;AAEf,WAAK,cAAc,oBAAI,IAAI;AAAA,IAC5B;AAAA,IAEA,QAAQ;AACP,YAAM,2BAAuB,8BAAAA,SAAwB;AACrD,WAAK,WAAW,IAAI;AAAA,QACnB,cAAe,KAAK,EAAG;AAAA,QACvB,CAAC;AAAA,MACF;AACA,gBAAU,QAAQ,IAAK,KAAK,QAAS;AAErC,WAAK,kBAAkB,UAAU,QAAS,KAAK,QAAQ,CAAE;AAEzD,WAAK,YAAY,KAAK,gBAAgB;AAEtC,WAAK,iBAAiB,IAAI,uBAAAC,QAAgB,KAAK,SAAS,SAAU;AAAA,IACnE;AAAA,IAEA,UAAW,UAAW;AACrB,WAAK,YAAY,IAAK,QAAS;AAE/B,aAAO,MAAM;AACZ,aAAK,YAAY,OAAQ,QAAS;AAAA,MACnC;AAAA,IACD;AAAA,IAEA,wBAAyB,UAAU,MAAO;AACzC,UAAK,CAAE,KAAK,WAAY;AAEvB,YAAK,CAAE,UAAW;AACjB,oCAAU,aAAAC,KAAsB,EAAE;AAAA,YACjC;AAAA,UACD;AAAA,QACD;AAEA,aAAK,YAAY;AAAA,UAAS,CAAE,eAC3B,WAAY,UAAU,IAAK;AAAA,QAC5B;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["getInserterOuterSection", "SidebarAdapter", "customizeWidgetsStore"]
|
|
7
|
+
}
|
|
@@ -1,42 +1,68 @@
|
|
|
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_section_exports = {};
|
|
29
|
+
__export(sidebar_section_exports, {
|
|
30
|
+
default: () => getSidebarSection
|
|
6
31
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
* WordPress dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const getInspectorSectionId = sidebarId => `widgets-inspector-${sidebarId}`;
|
|
32
|
+
module.exports = __toCommonJS(sidebar_section_exports);
|
|
33
|
+
var import_i18n = require("@wordpress/i18n");
|
|
34
|
+
var import_inspector_section = __toESM(require("./inspector-section"));
|
|
35
|
+
const getInspectorSectionId = (sidebarId) => `widgets-inspector-${sidebarId}`;
|
|
19
36
|
function getSidebarSection() {
|
|
20
37
|
const {
|
|
21
|
-
wp: {
|
|
22
|
-
customize
|
|
23
|
-
}
|
|
38
|
+
wp: { customize }
|
|
24
39
|
} = window;
|
|
25
|
-
const reduceMotionMediaQuery = window.matchMedia(
|
|
40
|
+
const reduceMotionMediaQuery = window.matchMedia(
|
|
41
|
+
"(prefers-reduced-motion: reduce)"
|
|
42
|
+
);
|
|
26
43
|
let isReducedMotion = reduceMotionMediaQuery.matches;
|
|
27
|
-
reduceMotionMediaQuery.addEventListener(
|
|
44
|
+
reduceMotionMediaQuery.addEventListener("change", (event) => {
|
|
28
45
|
isReducedMotion = event.matches;
|
|
29
46
|
});
|
|
30
47
|
return class SidebarSection extends customize.Section {
|
|
31
48
|
ready() {
|
|
32
|
-
const InspectorSection = (0,
|
|
33
|
-
this.inspector = new InspectorSection(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
const InspectorSection = (0, import_inspector_section.default)();
|
|
50
|
+
this.inspector = new InspectorSection(
|
|
51
|
+
getInspectorSectionId(this.id),
|
|
52
|
+
{
|
|
53
|
+
title: (0, import_i18n.__)("Block Settings"),
|
|
54
|
+
parentSection: this,
|
|
55
|
+
customizeAction: [
|
|
56
|
+
(0, import_i18n.__)("Customizing"),
|
|
57
|
+
(0, import_i18n.__)("Widgets"),
|
|
58
|
+
this.params.title
|
|
59
|
+
].join(" \u25B8 ")
|
|
60
|
+
}
|
|
61
|
+
);
|
|
38
62
|
customize.section.add(this.inspector);
|
|
39
|
-
this.contentContainer[0].classList.add(
|
|
63
|
+
this.contentContainer[0].classList.add(
|
|
64
|
+
"customize-widgets__sidebar-section"
|
|
65
|
+
);
|
|
40
66
|
}
|
|
41
67
|
hasSubSectionOpened() {
|
|
42
68
|
return this.inspector.expanded();
|
|
@@ -46,7 +72,7 @@ function getSidebarSection() {
|
|
|
46
72
|
const args = {
|
|
47
73
|
..._args,
|
|
48
74
|
completeCallback() {
|
|
49
|
-
controls.forEach(control => {
|
|
75
|
+
controls.forEach((control) => {
|
|
50
76
|
control.onChangeSectionExpanded?.(expanded, args);
|
|
51
77
|
});
|
|
52
78
|
_args.completeCallback?.();
|
|
@@ -54,22 +80,28 @@ function getSidebarSection() {
|
|
|
54
80
|
};
|
|
55
81
|
if (args.manualTransition) {
|
|
56
82
|
if (expanded) {
|
|
57
|
-
this.contentContainer.addClass([
|
|
58
|
-
this.contentContainer.removeClass(
|
|
59
|
-
this.contentContainer.closest(
|
|
83
|
+
this.contentContainer.addClass(["busy", "open"]);
|
|
84
|
+
this.contentContainer.removeClass("is-sub-section-open");
|
|
85
|
+
this.contentContainer.closest(".wp-full-overlay").addClass("section-open");
|
|
60
86
|
} else {
|
|
61
|
-
this.contentContainer.addClass([
|
|
62
|
-
|
|
63
|
-
|
|
87
|
+
this.contentContainer.addClass([
|
|
88
|
+
"busy",
|
|
89
|
+
"is-sub-section-open"
|
|
90
|
+
]);
|
|
91
|
+
this.contentContainer.closest(".wp-full-overlay").addClass("section-open");
|
|
92
|
+
this.contentContainer.removeClass("open");
|
|
64
93
|
}
|
|
65
94
|
const handleTransitionEnd = () => {
|
|
66
|
-
this.contentContainer.removeClass(
|
|
95
|
+
this.contentContainer.removeClass("busy");
|
|
67
96
|
args.completeCallback();
|
|
68
97
|
};
|
|
69
98
|
if (isReducedMotion) {
|
|
70
99
|
handleTransitionEnd();
|
|
71
100
|
} else {
|
|
72
|
-
this.contentContainer.one(
|
|
101
|
+
this.contentContainer.one(
|
|
102
|
+
"transitionend",
|
|
103
|
+
handleTransitionEnd
|
|
104
|
+
);
|
|
73
105
|
}
|
|
74
106
|
} else {
|
|
75
107
|
super.onChangeExpanded(expanded, args);
|
|
@@ -77,4 +109,4 @@ function getSidebarSection() {
|
|
|
77
109
|
}
|
|
78
110
|
};
|
|
79
111
|
}
|
|
80
|
-
//# sourceMappingURL=sidebar-section.js.map
|
|
112
|
+
//# sourceMappingURL=sidebar-section.js.map
|