@wordpress/customize-widgets 5.57.0 → 6.1.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.cjs +24 -41
- package/build/components/block-appender/index.cjs.map +1 -7
- package/build/components/block-inspector-button/index.cjs +24 -52
- package/build/components/block-inspector-button/index.cjs.map +1 -7
- package/build/components/customize-widgets/index.cjs +76 -95
- package/build/components/customize-widgets/index.cjs.map +1 -7
- package/build/components/customize-widgets/use-clear-selected-block.cjs +58 -67
- package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -7
- package/build/components/error-boundary/index.cjs +115 -155
- package/build/components/error-boundary/index.cjs.map +1 -7
- package/build/components/focus-control/index.cjs +44 -84
- package/build/components/focus-control/index.cjs.map +1 -7
- package/build/components/focus-control/use-blocks-focus-control.cjs +28 -49
- package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -7
- package/build/components/header/index.cjs +84 -122
- package/build/components/header/index.cjs.map +1 -7
- package/build/components/inserter/index.cjs +43 -78
- package/build/components/inserter/index.cjs.map +1 -7
- package/build/components/inserter/use-inserter.cjs +22 -54
- package/build/components/inserter/use-inserter.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/index.cjs +103 -165
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +37 -76
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcuts/index.cjs +70 -100
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
- package/build/components/more-menu/index.cjs +103 -151
- package/build/components/more-menu/index.cjs.map +1 -7
- package/build/components/sidebar-block-editor/index.cjs +122 -155
- package/build/components/sidebar-block-editor/index.cjs.map +1 -7
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs +207 -270
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -7
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +40 -50
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -7
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +75 -110
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -7
- package/build/components/sidebar-controls/index.cjs +27 -53
- package/build/components/sidebar-controls/index.cjs.map +1 -7
- package/build/components/welcome-guide/index.cjs +70 -94
- package/build/components/welcome-guide/index.cjs.map +1 -7
- package/build/controls/inserter-outer-section.cjs +68 -110
- package/build/controls/inserter-outer-section.cjs.map +1 -7
- package/build/controls/inspector-section.cjs +57 -90
- package/build/controls/inspector-section.cjs.map +1 -7
- package/build/controls/sidebar-control.cjs +55 -69
- package/build/controls/sidebar-control.cjs.map +1 -7
- package/build/controls/sidebar-section.cjs +79 -103
- package/build/controls/sidebar-section.cjs.map +1 -7
- package/build/filters/index.cjs +8 -5
- package/build/filters/move-to-sidebar.cjs +62 -78
- package/build/filters/move-to-sidebar.cjs.map +1 -7
- package/build/filters/replace-media-upload.cjs +11 -9
- package/build/filters/replace-media-upload.cjs.map +1 -7
- package/build/filters/wide-widget-display.cjs +20 -20
- package/build/filters/wide-widget-display.cjs.map +1 -7
- package/build/index.cjs +84 -91
- package/build/index.cjs.map +1 -7
- package/build/lock-unlock.cjs +10 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/store/actions.cjs +49 -32
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +12 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +49 -41
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +20 -33
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +47 -38
- package/build/store/selectors.cjs.map +1 -7
- package/build/utils.cjs +81 -108
- package/build/utils.cjs.map +1 -7
- package/build-module/components/block-appender/index.mjs +18 -23
- package/build-module/components/block-appender/index.mjs.map +1 -7
- package/build-module/components/block-inspector-button/index.mjs +15 -28
- package/build-module/components/block-inspector-button/index.mjs.map +1 -7
- package/build-module/components/customize-widgets/index.mjs +46 -72
- package/build-module/components/customize-widgets/index.mjs.map +1 -7
- package/build-module/components/customize-widgets/use-clear-selected-block.mjs +52 -46
- package/build-module/components/customize-widgets/use-clear-selected-block.mjs.map +1 -7
- package/build-module/components/error-boundary/index.mjs +103 -128
- package/build-module/components/error-boundary/index.mjs.map +1 -7
- package/build-module/components/focus-control/index.mjs +37 -66
- package/build-module/components/focus-control/index.mjs.map +1 -7
- package/build-module/components/focus-control/use-blocks-focus-control.mjs +21 -27
- package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -7
- package/build-module/components/header/index.mjs +55 -92
- package/build-module/components/header/index.mjs.map +1 -7
- package/build-module/components/inserter/index.mjs +33 -53
- package/build-module/components/inserter/index.mjs.map +1 -7
- package/build-module/components/inserter/use-inserter.mjs +17 -34
- package/build-module/components/inserter/use-inserter.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +75 -139
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +31 -55
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcuts/index.mjs +62 -79
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
- package/build-module/components/more-menu/index.mjs +76 -128
- package/build-module/components/more-menu/index.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/index.mjs +86 -128
- package/build-module/components/sidebar-block-editor/index.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs +202 -250
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs +17 -25
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs +54 -86
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs.map +1 -7
- package/build-module/components/sidebar-controls/index.mjs +19 -27
- package/build-module/components/sidebar-controls/index.mjs.map +1 -7
- package/build-module/components/welcome-guide/index.mjs +62 -71
- package/build-module/components/welcome-guide/index.mjs.map +1 -7
- package/build-module/controls/inserter-outer-section.mjs +61 -88
- package/build-module/controls/inserter-outer-section.mjs.map +1 -7
- package/build-module/controls/inspector-section.mjs +52 -70
- package/build-module/controls/inspector-section.mjs.map +1 -7
- package/build-module/controls/sidebar-control.mjs +33 -45
- package/build-module/controls/sidebar-control.mjs.map +1 -7
- package/build-module/controls/sidebar-section.mjs +59 -80
- package/build-module/controls/sidebar-section.mjs.map +1 -7
- package/build-module/filters/index.mjs +0 -2
- package/build-module/filters/move-to-sidebar.mjs +52 -79
- package/build-module/filters/move-to-sidebar.mjs.map +1 -7
- package/build-module/filters/replace-media-upload.mjs +5 -8
- package/build-module/filters/replace-media-upload.mjs.map +1 -7
- package/build-module/filters/wide-widget-display.mjs +13 -18
- package/build-module/filters/wide-widget-display.mjs.map +1 -7
- package/build-module/index.mjs +53 -71
- package/build-module/index.mjs.map +1 -7
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/store/actions.mjs +44 -8
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +7 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +15 -11
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +15 -13
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +41 -13
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/utils.mjs +74 -82
- package/build-module/utils.mjs.map +1 -7
- package/package.json +30 -31
- package/src/components/customize-widgets/index.jsx +5 -2
- package/src/components/customize-widgets/use-clear-selected-block.js +2 -1
- package/src/components/welcome-guide/index.jsx +6 -2
- package/CHANGELOG.md +0 -289
- package/build/filters/index.cjs.map +0 -7
- package/build-module/filters/index.mjs.map +0 -7
|
@@ -1,97 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
// packages/customize-widgets/src/components/welcome-guide/index.jsx
|
|
20
|
-
var welcome_guide_exports = {};
|
|
21
|
-
__export(welcome_guide_exports, {
|
|
22
|
-
default: () => WelcomeGuide
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
6
|
+
let _wordpress_i18n = require("@wordpress/i18n");
|
|
7
|
+
let _wordpress_components = require("@wordpress/components");
|
|
8
|
+
let _wordpress_data = require("@wordpress/data");
|
|
9
|
+
let _wordpress_preferences = require("@wordpress/preferences");
|
|
10
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
|
+
// packages/customize-widgets/src/components/welcome-guide/index.jsx
|
|
30
12
|
function WelcomeGuide({ sidebar }) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
href: (0, import_i18n.__)(
|
|
89
|
-
"https://wordpress.org/documentation/article/wordpress-block-editor/"
|
|
90
|
-
),
|
|
91
|
-
children: (0, import_i18n.__)("Here's a detailed guide.")
|
|
92
|
-
}
|
|
93
|
-
)
|
|
94
|
-
] })
|
|
95
|
-
] });
|
|
13
|
+
const { set: setPreference } = (0, _wordpress_data.useDispatch)(_wordpress_preferences.store);
|
|
14
|
+
const isEntirelyBlockWidgets = sidebar.getWidgets().every((widget) => widget.id.startsWith("block-"));
|
|
15
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
16
|
+
className: "customize-widgets-welcome-guide",
|
|
17
|
+
children: [
|
|
18
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
19
|
+
className: "customize-widgets-welcome-guide__image__wrapper",
|
|
20
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("picture", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("source", {
|
|
21
|
+
srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
|
|
22
|
+
media: "(prefers-reduced-motion: reduce)"
|
|
23
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
24
|
+
className: "customize-widgets-welcome-guide__image",
|
|
25
|
+
src: "https://s.w.org/images/block-editor/welcome-editor.gif",
|
|
26
|
+
width: "312",
|
|
27
|
+
height: "240",
|
|
28
|
+
alt: ""
|
|
29
|
+
})] })
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
32
|
+
className: "customize-widgets-welcome-guide__heading",
|
|
33
|
+
children: (0, _wordpress_i18n.__)("Welcome to block Widgets")
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
36
|
+
className: "customize-widgets-welcome-guide__text",
|
|
37
|
+
children: isEntirelyBlockWidgets ? (0, _wordpress_i18n.__)("Your theme provides different “block” areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.") : (0, _wordpress_i18n.__)("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")
|
|
38
|
+
}),
|
|
39
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.Button, {
|
|
40
|
+
size: "compact",
|
|
41
|
+
variant: "primary",
|
|
42
|
+
onClick: () => setPreference("core/customize-widgets", "welcomeGuide", false),
|
|
43
|
+
children: (0, _wordpress_i18n.__)("Got it")
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }),
|
|
46
|
+
!isEntirelyBlockWidgets && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
47
|
+
className: "customize-widgets-welcome-guide__more-info",
|
|
48
|
+
children: [
|
|
49
|
+
(0, _wordpress_i18n.__)("Want to stick with the old widgets?"),
|
|
50
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
|
|
51
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ExternalLink, {
|
|
52
|
+
href: (0, _wordpress_i18n.__)("https://wordpress.org/plugins/classic-widgets/"),
|
|
53
|
+
children: (0, _wordpress_i18n.__)("Get the Classic Widgets plugin.")
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
58
|
+
className: "customize-widgets-welcome-guide__more-info",
|
|
59
|
+
children: [
|
|
60
|
+
(0, _wordpress_i18n.__)("New to the block editor?"),
|
|
61
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {}),
|
|
62
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.ExternalLink, {
|
|
63
|
+
href: (0, _wordpress_i18n.__)("https://wordpress.org/documentation/article/wordpress-block-editor/"),
|
|
64
|
+
children: (0, _wordpress_i18n.__)("Here's a detailed guide.")
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
96
70
|
}
|
|
97
|
-
|
|
71
|
+
exports.default = WelcomeGuide;
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/welcome-guide/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t\t)\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,wBAAqC;AACrC,kBAA4B;AAC5B,yBAA0C;AAYtC;AAVW,SAAR,aAA+B,EAAE,QAAQ,GAAI;AACnD,QAAM,EAAE,OAAO,QAAI,yBAAa,mBAAAA,KAAiB;AAEjD,QAAM,yBAAyB,QAC7B,WAAW,EACX,MAAO,CAAE,WAAY,OAAO,GAAG,WAAY,QAAS,CAAE;AAExD,SACC,6CAAC,SAAI,WAAU,mCACd;AAAA,gDAAC,SAAI,WAAU,mDACd,uDAAC,aACA;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,QAAO;AAAA,UACP,OAAM;AAAA;AAAA,MACP;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,KAAI;AAAA,UACJ,OAAM;AAAA,UACN,QAAO;AAAA,UACP,KAAI;AAAA;AAAA,MACL;AAAA,OACD,GACD;AAAA,IACA,4CAAC,QAAG,WAAU,4CACX,8BAAI,0BAA2B,GAClC;AAAA,IACA,4CAAC,OAAE,WAAU,yCACV,uCACC;AAAA,MACA;AAAA,IACD,QACC;AAAA,MACA;AAAA,IACD,GACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,SAAU,MACT,OAAQ,0BAA0B,cAAe;AAAA,QAGhD,8BAAI,QAAS;AAAA;AAAA,IAChB;AAAA,IACA,4CAAC,QAAG,WAAU,8CAA6C;AAAA,IACzD,CAAE,0BACH,6CAAC,OAAE,WAAU,8CACV;AAAA,0BAAI,qCAAsC;AAAA,MAC5C,4CAAC,QAAG;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UACA,UAAO;AAAA,YACN;AAAA,UACD;AAAA,UAEE,8BAAI,iCAAkC;AAAA;AAAA,MACzC;AAAA,OACD;AAAA,IAED,6CAAC,OAAE,WAAU,8CACV;AAAA,0BAAI,0BAA2B;AAAA,MACjC,4CAAC,QAAG;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UACA,UAAO;AAAA,YACN;AAAA,UACD;AAAA,UAEE,8BAAI,0BAA2B;AAAA;AAAA,MAClC;AAAA,OACD;AAAA,KACD;AAEF;",
|
|
6
|
-
"names": ["preferencesStore"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useDispatch","preferencesStore","__","Button","ExternalLink"],"sources":["../../../src/components/welcome-guide/index.jsx"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t\t)\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\tsetPreference(\n\t\t\t\t\t\t'core/customize-widgets',\n\t\t\t\t\t\t'welcomeGuide',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAKA,SAAwB,aAAc,EAAE,WAAY;CACnD,MAAM,EAAE,KAAK,mBAAA,GAAkBA,gBAAAA,YAAAA,CAAaC,uBAAAA,KAAiB;CAE7D,MAAM,yBAAyB,QAC7B,WAAW,CAAC,CACZ,OAAS,WAAY,OAAO,GAAG,WAAY,QAAS,CAAE;CAExD,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IAAK,WAAU;IACd,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAAC,WAAD,EAAA,UAAA,CACC,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;KACC,QAAO;KACP,OAAM;IACN,CAAA,GACD,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KACC,WAAU;KACV,KAAI;KACJ,OAAM;KACN,QAAO;KACP,KAAI;IACJ,CAAA,CACO,EAAA,CAAA;GACL,CAAA;GACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;IAAI,WAAU;IACXC,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,0BAA2B;GAC9B,CAAA;GACJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;IAAG,WAAU;IACV,UAAA,0BAAA,GACCA,gBAAAA,GAAAA,CACA,6LACD,KAAA,GACCA,gBAAAA,GAAAA,CACA,yHACD;GACA,CAAA;GACH,iBAAA,GAAA,kBAAA,IAAA,CAACC,sBAAAA,QAAD;IACC,MAAK;IACL,SAAQ;IACR,eACC,cACC,0BACA,gBACA,KACD;IAGCD,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,QAAS;GACR,CAAA;GACR,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAI,WAAU,6CAA8C,CAAA;GAC1D,CAAE,0BACH,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;IAAG,WAAU;IAAb,UAAA;MACGA,GAAAA,gBAAAA,GAAAA,CAAI,qCAAsC;KAC5C,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,CAAK,CAAA;KACL,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,cAAD;MACC,OAAA,GAAOF,gBAAAA,GAAAA,CACN,gDACD;MAEEA,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,iCAAkC;KAC3B,CAAA;IACZ;;GAEJ,iBAAA,GAAA,kBAAA,KAAA,CAAC,KAAD;IAAG,WAAU;IAAb,UAAA;MACGA,GAAAA,gBAAAA,GAAAA,CAAI,0BAA2B;KACjC,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,CAAK,CAAA;KACL,iBAAA,GAAA,kBAAA,IAAA,CAACE,sBAAAA,cAAD;MACC,OAAA,GAAOF,gBAAAA,GAAAA,CACN,qEACD;MAEEA,WAAAA,GAAAA,gBAAAA,GAAAA,CAAI,0BAA2B;KACpB,CAAA;IACZ;;EACC;;AAEP"}
|
|
@@ -1,113 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
// packages/customize-widgets/src/controls/inserter-outer-section.js
|
|
20
|
-
var inserter_outer_section_exports = {};
|
|
21
|
-
__export(inserter_outer_section_exports, {
|
|
22
|
-
default: () => getInserterOuterSection
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
23
5
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
6
|
+
let _wordpress_keycodes = require("@wordpress/keycodes");
|
|
7
|
+
let _wordpress_dom = require("@wordpress/dom");
|
|
8
|
+
let _wordpress_data = require("@wordpress/data");
|
|
9
|
+
let ___store_index_js = require("../store/index.cjs");
|
|
10
|
+
// packages/customize-widgets/src/controls/inserter-outer-section.js
|
|
29
11
|
function getInserterOuterSection() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
completeCallback() {
|
|
87
|
-
const searchBox = import_dom.focus.tabbable.find(contentContainer)[1];
|
|
88
|
-
if (searchBox) {
|
|
89
|
-
searchBox.focus();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
close() {
|
|
96
|
-
if (this.expanded()) {
|
|
97
|
-
const contentContainer = this.contentContainer[0];
|
|
98
|
-
const activeElement = contentContainer.ownerDocument.activeElement;
|
|
99
|
-
this.isFromInternalAction = true;
|
|
100
|
-
this.collapse({
|
|
101
|
-
completeCallback() {
|
|
102
|
-
if (contentContainer.contains(activeElement)) {
|
|
103
|
-
if (this.activeElementBeforeExpanded) {
|
|
104
|
-
this.activeElementBeforeExpanded.focus();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
};
|
|
12
|
+
const { wp: { customize } } = window;
|
|
13
|
+
const OuterSection = customize.OuterSection;
|
|
14
|
+
customize.OuterSection = class extends OuterSection {
|
|
15
|
+
onChangeExpanded(expanded, args) {
|
|
16
|
+
if (expanded) customize.section.each((section) => {
|
|
17
|
+
if (section.params.type === "outer" && section.id !== this.id) {
|
|
18
|
+
if (section.expanded()) section.collapse();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return super.onChangeExpanded(expanded, args);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
customize.sectionConstructor.outer = customize.OuterSection;
|
|
25
|
+
return class InserterOuterSection extends customize.OuterSection {
|
|
26
|
+
constructor(...args) {
|
|
27
|
+
super(...args);
|
|
28
|
+
this.params.type = "outer";
|
|
29
|
+
this.activeElementBeforeExpanded = null;
|
|
30
|
+
this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown", (event) => {
|
|
31
|
+
if (this.expanded() && (event.keyCode === _wordpress_keycodes.ESCAPE || event.code === "Escape") && !event.defaultPrevented) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
event.stopPropagation();
|
|
34
|
+
(0, _wordpress_data.dispatch)(___store_index_js.store).setIsInserterOpened(false);
|
|
35
|
+
}
|
|
36
|
+
}, true);
|
|
37
|
+
this.contentContainer.addClass("widgets-inserter");
|
|
38
|
+
this.isFromInternalAction = false;
|
|
39
|
+
this.expanded.bind(() => {
|
|
40
|
+
if (!this.isFromInternalAction) (0, _wordpress_data.dispatch)(___store_index_js.store).setIsInserterOpened(this.expanded());
|
|
41
|
+
this.isFromInternalAction = false;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
open() {
|
|
45
|
+
if (!this.expanded()) {
|
|
46
|
+
const contentContainer = this.contentContainer[0];
|
|
47
|
+
this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement;
|
|
48
|
+
this.isFromInternalAction = true;
|
|
49
|
+
this.expand({ completeCallback() {
|
|
50
|
+
const searchBox = _wordpress_dom.focus.tabbable.find(contentContainer)[1];
|
|
51
|
+
if (searchBox) searchBox.focus();
|
|
52
|
+
} });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
close() {
|
|
56
|
+
if (this.expanded()) {
|
|
57
|
+
const contentContainer = this.contentContainer[0];
|
|
58
|
+
const activeElement = contentContainer.ownerDocument.activeElement;
|
|
59
|
+
this.isFromInternalAction = true;
|
|
60
|
+
this.collapse({ completeCallback() {
|
|
61
|
+
if (contentContainer.contains(activeElement)) {
|
|
62
|
+
if (this.activeElementBeforeExpanded) this.activeElementBeforeExpanded.focus();
|
|
63
|
+
}
|
|
64
|
+
} });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
112
68
|
}
|
|
113
|
-
|
|
69
|
+
exports.default = getInserterOuterSection;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=inserter-outer-section.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/controls/inserter-outer-section.js"],
|
|
4
|
-
"sourcesContent": ["import { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\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;AAAA,sBAAuB;AACvB,iBAAsB;AACtB,kBAAyB;AACzB,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
|
+
{"version":3,"file":"inserter-outer-section.cjs","names":["ESCAPE","customizeWidgetsStore","focus"],"sources":["../../src/controls/inserter-outer-section.js"],"sourcesContent":["import { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\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"],"mappings":";;;;;;;;;;AAKA,SAAwB,0BAA0B;CACjD,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,eAAe,UAAU;CAI/B,UAAU,eAAe,cAAc,aAAa;EACnD,iBAAkB,UAAU,MAAO;GAClC,IAAK,UACJ,UAAU,QAAQ,MAAQ,YAAa;IACtC,IACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IAEf;SAAA,QAAQ,SAAS,GACrB,QAAQ,SAAS;IAAA;GAGpB,CAAE;GAGH,OAAO,MAAM,iBAAkB,UAAU,IAAK;EAC/C;CACD;CAEA,UAAU,mBAAmB,QAAQ,UAAU;CAE/C,OAAO,MAAM,6BAA6B,UAAU,aAAa;EAChE,YAAa,GAAG,MAAO;GACtB,MAAO,GAAG,IAAK;GAIf,KAAK,OAAO,OAAO;GAEnB,KAAK,8BAA8B;GAMnC,KAHM,iBAAkB,EAAG,CAAC,cAAc,YAG9B,iBACX,YACE,UAAW;IACZ,IACC,KAAK,SAAS,MACZ,MAAM,YAAYA,oBAAAA,UACnB,MAAM,SAAS,aAChB,CAAE,MAAM,kBACP;KACD,MAAM,eAAe;KACrB,MAAM,gBAAgB;KACtB,CAAA,GAAA,gBAAA,SAAA,CAAUC,kBAAAA,KAAsB,CAAC,CAAC,oBACjC,KACD;IACD;GACD,GAEA,IACD;GAEA,KAAK,iBAAiB,SAAU,kBAAmB;GAInD,KAAK,uBAAuB;GAC5B,KAAK,SAAS,WAAY;IACzB,IAAK,CAAE,KAAK,sBAEX,CAAA,GAAA,gBAAA,SAAA,CAAUA,kBAAAA,KAAsB,CAAC,CAAC,oBACjC,KAAK,SAAS,CACf;IAED,KAAK,uBAAuB;GAC7B,CAAE;EACH;EACA,OAAO;GACN,IAAK,CAAE,KAAK,SAAS,GAAI;IACxB,MAAM,mBAAmB,KAAK,iBAAkB;IAChD,KAAK,8BACJ,iBAAiB,cAAc;IAEhC,KAAK,uBAAuB;IAE5B,KAAK,OAAQ,EACZ,mBAAmB;KAIlB,MAAM,YACLC,eAAAA,MAAM,SAAS,KAAM,gBAAiB,CAAC,CAAE;KAC1C,IAAK,WACJ,UAAU,MAAM;IAElB,EACD,CAAE;GACH;EACD;EACA,QAAQ;GACP,IAAK,KAAK,SAAS,GAAI;IACtB,MAAM,mBAAmB,KAAK,iBAAkB;IAChD,MAAM,gBACL,iBAAiB,cAAc;IAEhC,KAAK,uBAAuB;IAE5B,KAAK,SAAU,EACd,mBAAmB;KAMlB,IAAK,iBAAiB,SAAU,aAAc,GAExC;UAAA,KAAK,6BACT,KAAK,4BAA4B,MAAM;KAAA;IAG1C,EACD,CAAE;GACH;EACD;CACD;AACD"}
|
|
@@ -1,93 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
// packages/customize-widgets/src/controls/inspector-section.js
|
|
20
|
-
var inspector_section_exports = {};
|
|
21
|
-
__export(inspector_section_exports, {
|
|
22
|
-
default: () => getInspectorSection
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
23
5
|
});
|
|
24
|
-
|
|
6
|
+
// packages/customize-widgets/src/controls/inspector-section.js
|
|
25
7
|
function getInspectorSection() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.expand({
|
|
76
|
-
allowMultiple: true
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
close() {
|
|
80
|
-
this.collapse({
|
|
81
|
-
allowMultiple: true
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
collapse(options) {
|
|
85
|
-
this.isOpen = false;
|
|
86
|
-
super.collapse(options);
|
|
87
|
-
}
|
|
88
|
-
triggerActiveCallbacks() {
|
|
89
|
-
this.active.callbacks.fireWith(this.active, [false, true]);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
8
|
+
const { wp: { customize } } = window;
|
|
9
|
+
return class InspectorSection extends customize.Section {
|
|
10
|
+
constructor(id, options) {
|
|
11
|
+
super(id, options);
|
|
12
|
+
this.parentSection = options.parentSection;
|
|
13
|
+
this.returnFocusWhenClose = null;
|
|
14
|
+
this._isOpen = false;
|
|
15
|
+
}
|
|
16
|
+
get isOpen() {
|
|
17
|
+
return this._isOpen;
|
|
18
|
+
}
|
|
19
|
+
set isOpen(value) {
|
|
20
|
+
this._isOpen = value;
|
|
21
|
+
this.triggerActiveCallbacks();
|
|
22
|
+
}
|
|
23
|
+
ready() {
|
|
24
|
+
this.contentContainer[0].classList.add("customize-widgets-layout__inspector");
|
|
25
|
+
}
|
|
26
|
+
isContextuallyActive() {
|
|
27
|
+
return this.isOpen;
|
|
28
|
+
}
|
|
29
|
+
onChangeExpanded(expanded, args) {
|
|
30
|
+
super.onChangeExpanded(expanded, args);
|
|
31
|
+
if (this.parentSection && !args.unchanged) {
|
|
32
|
+
if (expanded) this.parentSection.collapse({ manualTransition: true });
|
|
33
|
+
else this.parentSection.expand({
|
|
34
|
+
manualTransition: true,
|
|
35
|
+
completeCallback: () => {
|
|
36
|
+
if (this.returnFocusWhenClose && !this.contentContainer[0].contains(this.returnFocusWhenClose)) this.returnFocusWhenClose.focus();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
open({ returnFocusWhenClose } = {}) {
|
|
42
|
+
this.isOpen = true;
|
|
43
|
+
this.returnFocusWhenClose = returnFocusWhenClose;
|
|
44
|
+
this.expand({ allowMultiple: true });
|
|
45
|
+
}
|
|
46
|
+
close() {
|
|
47
|
+
this.collapse({ allowMultiple: true });
|
|
48
|
+
}
|
|
49
|
+
collapse(options) {
|
|
50
|
+
this.isOpen = false;
|
|
51
|
+
super.collapse(options);
|
|
52
|
+
}
|
|
53
|
+
triggerActiveCallbacks() {
|
|
54
|
+
this.active.callbacks.fireWith(this.active, [false, true]);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
92
57
|
}
|
|
93
|
-
|
|
58
|
+
exports.default = getInspectorSection;
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=inspector-section.cjs.map
|
|
@@ -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
|
+
{"version":3,"file":"inspector-section.cjs","names":[],"sources":["../../src/controls/inspector-section.js"],"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"],"mappings":";;;;;;AAAA,SAAwB,sBAAsB;CAC7C,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,OAAO,MAAM,yBAAyB,UAAU,QAAQ;EACvD,YAAa,IAAI,SAAU;GAC1B,MAAO,IAAI,OAAQ;GAEnB,KAAK,gBAAgB,QAAQ;GAE7B,KAAK,uBAAuB;GAC5B,KAAK,UAAU;EAChB;EACA,IAAI,SAAS;GACZ,OAAO,KAAK;EACb;EACA,IAAI,OAAQ,OAAQ;GACnB,KAAK,UAAU;GACf,KAAK,uBAAuB;EAC7B;EACA,QAAQ;GACP,KAAK,iBAAkB,EAAG,CAAC,UAAU,IACpC,qCACD;EACD;EACA,uBAAuB;GACtB,OAAO,KAAK;EACb;EACA,iBAAkB,UAAU,MAAO;GAClC,MAAM,iBAAkB,UAAU,IAAK;GAEvC,IAAK,KAAK,iBAAiB,CAAE,KAAK,WAAY;IAC7C,IAAK,UACJ,KAAK,cAAc,SAAU,EAC5B,kBAAkB,KACnB,CAAE;SAEF,KAAK,cAAc,OAAQ;KAC1B,kBAAkB;KAClB,wBAAwB;MAEvB,IACC,KAAK,wBACL,CAAE,KAAK,iBAAkB,EAAG,CAAC,SAC5B,KAAK,oBACN,GAEA,KAAK,qBAAqB,MAAM;KAElC;IACD,CAAE;GAEJ;EACD;EACA,KAAM,EAAE,yBAAyB,CAAC,GAAI;GACrC,KAAK,SAAS;GACd,KAAK,uBAAuB;GAE5B,KAAK,OAAQ,EACZ,eAAe,KAChB,CAAE;EACH;EACA,QAAQ;GACP,KAAK,SAAU,EACd,eAAe,KAChB,CAAE;EACH;EACA,SAAU,SAAU;GAUnB,KAAK,SAAS;GACd,MAAM,SAAU,OAAQ;EACzB;EACA,yBAAyB;GAaxB,KAAK,OAAO,UAAU,SAAU,KAAK,QAAQ,CAAE,OAAO,IAAK,CAAE;EAC9D;CACD;AACD"}
|