@wordpress/customize-widgets 6.0.0 → 6.2.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 -97
- 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 +38 -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 +102 -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 +45 -73
- 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 +104 -129
- 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 +32 -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 +75 -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/build-style/style-rtl.css +23 -5
- package/build-style/style.css +23 -5
- package/package.json +27 -27
- package/src/components/customize-widgets/index.jsx +2 -2
- package/src/components/error-boundary/index.jsx +2 -2
- package/src/components/header/style.scss +16 -5
- package/src/components/inserter/style.scss +8 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +1 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
- package/src/components/more-menu/index.jsx +0 -1
- package/src/components/welcome-guide/index.jsx +6 -2
- package/build/filters/index.cjs.map +0 -7
- package/build-module/filters/index.mjs.map +0 -7
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/filters/replace-media-upload.js"],
|
|
4
|
-
"sourcesContent": ["import { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAE5B,IAAM,qBAAqB,MAAM;AAEjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"replace-media-upload.mjs","names":[],"sources":["../../src/filters/replace-media-upload.js"],"sourcesContent":["import { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;;AAGA,MAAM,2BAA2B;AAEjC,UACC,sBACA,0CACA,kBACD"}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
// packages/customize-widgets/src/filters/wide-widget-display.jsx
|
|
2
1
|
import { createHigherOrderComponent } from "@wordpress/compose";
|
|
3
2
|
import { addFilter } from "@wordpress/hooks";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"core/customize-widgets/wide-widget-display",
|
|
19
|
-
withWideWidgetDisplay
|
|
20
|
-
);
|
|
21
|
-
//# sourceMappingURL=wide-widget-display.mjs.map
|
|
4
|
+
// packages/customize-widgets/src/filters/wide-widget-display.jsx
|
|
5
|
+
const { wp } = window;
|
|
6
|
+
const withWideWidgetDisplay = createHigherOrderComponent((BlockEdit) => (props) => {
|
|
7
|
+
const { idBase } = props.attributes;
|
|
8
|
+
const isWide = wp.customize.Widgets.data.availableWidgets.find((widget) => widget.id_base === idBase)?.is_wide ?? false;
|
|
9
|
+
return /* @__PURE__ */ jsx(BlockEdit, {
|
|
10
|
+
...props,
|
|
11
|
+
isWide
|
|
12
|
+
}, "edit");
|
|
13
|
+
}, "withWideWidgetDisplay");
|
|
14
|
+
addFilter("editor.BlockEdit", "core/customize-widgets/wide-widget-display", withWideWidgetDisplay);
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=wide-widget-display.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/filters/wide-widget-display.jsx"],
|
|
4
|
-
"sourcesContent": ["import { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\nconst { wp } = window;\n\nconst withWideWidgetDisplay = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { idBase } = props.attributes;\n\t\tconst isWide =\n\t\t\twp.customize.Widgets.data.availableWidgets.find(\n\t\t\t\t( widget ) => widget.id_base === idBase\n\t\t\t)?.is_wide ?? false;\n\n\t\treturn <BlockEdit key=\"edit\" { ...props } isWide={ isWide } />;\n\t},\n\t'withWideWidgetDisplay'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/wide-widget-display',\n\twithWideWidgetDisplay\n);\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAYjB;AAVT,IAAM,EAAE,GAAG,IAAI;AAEf,IAAM,wBAAwB;AAAA,EAC7B,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,EAAE,OAAO,IAAI,MAAM;AACzB,UAAM,SACL,GAAG,UAAU,QAAQ,KAAK,iBAAiB;AAAA,MAC1C,CAAE,WAAY,OAAO,YAAY;AAAA,IAClC,GAAG,WAAW;AAEf,WAAO,oBAAC,aAAuB,GAAG,OAAQ,UAApB,MAAsC;AAAA,EAC7D;AAAA,EACA;AACD;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"wide-widget-display.mjs","names":[],"sources":["../../src/filters/wide-widget-display.jsx"],"sourcesContent":["import { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\nconst { wp } = window;\n\nconst withWideWidgetDisplay = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { idBase } = props.attributes;\n\t\tconst isWide =\n\t\t\twp.customize.Widgets.data.availableWidgets.find(\n\t\t\t\t( widget ) => widget.id_base === idBase\n\t\t\t)?.is_wide ?? false;\n\n\t\treturn <BlockEdit key=\"edit\" { ...props } isWide={ isWide } />;\n\t},\n\t'withWideWidgetDisplay'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/wide-widget-display',\n\twithWideWidgetDisplay\n);\n"],"mappings":";;;;AAGA,MAAM,EAAE,OAAO;AAEf,MAAM,wBAAwB,4BAC3B,eAAiB,UAAW;CAC7B,MAAM,EAAE,WAAW,MAAM;CACzB,MAAM,SACL,GAAG,UAAU,QAAQ,KAAK,iBAAiB,MACxC,WAAY,OAAO,YAAY,MAClC,CAAC,EAAE,WAAW;CAEf,OAAO,oBAAC,WAAD;EAAsB,GAAK;EAAiB;CAAU,GAAvC,MAAuC;AAC9D,GACA,uBACD;AAEA,UACC,oBACA,8CACA,qBACD"}
|
package/build-module/index.mjs
CHANGED
|
@@ -1,80 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
__experimentalGetCoreBlocks,
|
|
6
|
-
__experimentalRegisterExperimentalCoreBlocks
|
|
7
|
-
} from "@wordpress/block-library";
|
|
8
|
-
import {
|
|
9
|
-
registerLegacyWidgetBlock,
|
|
10
|
-
registerLegacyWidgetVariations,
|
|
11
|
-
registerWidgetGroupBlock
|
|
12
|
-
} from "@wordpress/widgets";
|
|
13
|
-
import {
|
|
14
|
-
setFreeformContentHandlerName,
|
|
15
|
-
store as blocksStore
|
|
16
|
-
} from "@wordpress/blocks";
|
|
1
|
+
import { StrictMode, createRoot } from "@wordpress/element";
|
|
2
|
+
import { __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks, registerCoreBlocks } from "@wordpress/block-library";
|
|
3
|
+
import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from "@wordpress/widgets";
|
|
4
|
+
import { setFreeformContentHandlerName, store as store$1 } from "@wordpress/blocks";
|
|
17
5
|
import { dispatch } from "@wordpress/data";
|
|
18
|
-
import { store as
|
|
6
|
+
import { store as store$2 } from "@wordpress/preferences";
|
|
19
7
|
import CustomizeWidgets from "./components/customize-widgets/index.mjs";
|
|
20
8
|
import getSidebarSection from "./controls/sidebar-section.mjs";
|
|
21
9
|
import getSidebarControl from "./controls/sidebar-control.mjs";
|
|
22
10
|
import "./filters/index.mjs";
|
|
23
|
-
import { store } from "./store/index.mjs";
|
|
24
11
|
import { jsx } from "react/jsx-runtime";
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
import { store } from "./store/index.mjs";
|
|
13
|
+
// packages/customize-widgets/src/index.jsx
|
|
14
|
+
const { wp } = window;
|
|
15
|
+
const DISABLED_BLOCKS = [
|
|
16
|
+
"core/more",
|
|
17
|
+
"core/block",
|
|
18
|
+
"core/freeform",
|
|
19
|
+
"core/template-part"
|
|
31
20
|
];
|
|
32
|
-
|
|
21
|
+
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
22
|
+
/**
|
|
23
|
+
* Initializes the widgets block editor in the customizer.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} editorName The editor name.
|
|
26
|
+
* @param {Object} blockEditorSettings Block editor settings.
|
|
27
|
+
*/
|
|
33
28
|
function initialize(editorName, blockEditorSettings) {
|
|
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
|
-
createRoot(container).render(
|
|
65
|
-
/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(
|
|
66
|
-
CustomizeWidgets,
|
|
67
|
-
{
|
|
68
|
-
api: wp.customize,
|
|
69
|
-
sidebarControls,
|
|
70
|
-
blockEditorSettings
|
|
71
|
-
}
|
|
72
|
-
) })
|
|
73
|
-
);
|
|
74
|
-
});
|
|
29
|
+
dispatch(store$2).setDefaults("core/customize-widgets", {
|
|
30
|
+
fixedToolbar: false,
|
|
31
|
+
welcomeGuide: true
|
|
32
|
+
});
|
|
33
|
+
dispatch(store$1).reapplyBlockTypeFilters();
|
|
34
|
+
const coreBlocks = __experimentalGetCoreBlocks().filter((block) => {
|
|
35
|
+
return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith("core/post") || block.name.startsWith("core/query") || block.name.startsWith("core/site") || block.name.startsWith("core/navigation") || block.name.startsWith("core/term"));
|
|
36
|
+
});
|
|
37
|
+
registerCoreBlocks(coreBlocks);
|
|
38
|
+
registerLegacyWidgetBlock();
|
|
39
|
+
if (globalThis.IS_GUTENBERG_PLUGIN) __experimentalRegisterExperimentalCoreBlocks({ enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS });
|
|
40
|
+
registerLegacyWidgetVariations(blockEditorSettings);
|
|
41
|
+
registerWidgetGroupBlock();
|
|
42
|
+
setFreeformContentHandlerName("core/html");
|
|
43
|
+
const SidebarControl = getSidebarControl(blockEditorSettings);
|
|
44
|
+
wp.customize.sectionConstructor.sidebar = getSidebarSection();
|
|
45
|
+
wp.customize.controlConstructor.sidebar_block_editor = SidebarControl;
|
|
46
|
+
const container = document.createElement("div");
|
|
47
|
+
document.body.appendChild(container);
|
|
48
|
+
wp.customize.bind("ready", () => {
|
|
49
|
+
const sidebarControls = [];
|
|
50
|
+
wp.customize.control.each((control) => {
|
|
51
|
+
if (control instanceof SidebarControl) sidebarControls.push(control);
|
|
52
|
+
});
|
|
53
|
+
createRoot(container).render(/* @__PURE__ */ jsx(StrictMode, { children: /* @__PURE__ */ jsx(CustomizeWidgets, {
|
|
54
|
+
api: wp.customize,
|
|
55
|
+
sidebarControls,
|
|
56
|
+
blockEditorSettings
|
|
57
|
+
}) }));
|
|
58
|
+
});
|
|
75
59
|
}
|
|
76
|
-
export {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=index.mjs.map
|
|
60
|
+
export { initialize, store };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/index.jsx"],
|
|
4
|
-
"sourcesContent": ["import { createRoot, StrictMode } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' ) ||\n\t\t\tblock.name.startsWith( 'core/term' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\tcreateRoot( container ).render(\n\t\t\t<StrictMode>\n\t\t\t\t<CustomizeWidgets\n\t\t\t\t\tapi={ wp.customize }\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t/>\n\t\t\t</StrictMode>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,kBAAkB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,wBAAwB;AAC1C,OAAO,sBAAsB;AAC7B,OAAO,uBAAuB;AAC9B,OAAO,uBAAuB;AAC9B,OAAO;AA8EP,SAAS,aAAa;AATlB;AAnEJ,IAAM,EAAE,GAAG,IAAI;AAEf,IAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AACA,IAAM,iCAAiC;AAQhC,SAAS,WAAY,YAAY,qBAAsB;AAC7D,WAAU,gBAAiB,EAAE,YAAa,0BAA0B;AAAA,IACnE,cAAc;AAAA,IACd,cAAc;AAAA,EACf,CAAE;AAEF,WAAU,WAAY,EAAE,wBAAwB;AAChD,QAAM,aAAa,4BAA4B,EAAE,OAAQ,CAAE,UAAW;AACrE,WAAO,EACN,gBAAgB,SAAU,MAAM,IAAK,KACrC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,YAAa,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,iBAAkB,KACzC,MAAM,KAAK,WAAY,WAAY;AAAA,EAErC,CAAE;AACF,qBAAoB,UAAW;AAC/B,4BAA0B;AAC1B,MAAK,WAAW,qBAAsB;AACrC,iDAA8C;AAAA,MAC7C,iBAAiB;AAAA,IAClB,CAAE;AAAA,EACH;AACA,iCAAgC,mBAAoB;AACpD,2BAAyB;AAMzB,gCAA+B,WAAY;AAE3C,QAAM,iBAAiB,kBAAmB,mBAAoB;AAE9D,KAAG,UAAU,mBAAmB,UAAU,kBAAkB;AAC5D,KAAG,UAAU,mBAAmB,uBAAuB;AAEvD,QAAM,YAAY,SAAS,cAAe,KAAM;AAChD,WAAS,KAAK,YAAa,SAAU;AAErC,KAAG,UAAU,KAAM,SAAS,MAAM;AACjC,UAAM,kBAAkB,CAAC;AACzB,OAAG,UAAU,QAAQ,KAAM,CAAE,YAAa;AACzC,UAAK,mBAAmB,gBAAiB;AACxC,wBAAgB,KAAM,OAAQ;AAAA,MAC/B;AAAA,IACD,CAAE;AAEF,eAAY,SAAU,EAAE;AAAA,MACvB,oBAAC,cACA;AAAA,QAAC;AAAA;AAAA,UACA,KAAM,GAAG;AAAA,UACT;AAAA,UACA;AAAA;AAAA,MACD,GACD;AAAA,IACD;AAAA,EACD,CAAE;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["preferencesStore","blocksStore"],"sources":["../src/index.jsx"],"sourcesContent":["import { createRoot, StrictMode } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' ) ||\n\t\t\tblock.name.startsWith( 'core/term' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\tcreateRoot( container ).render(\n\t\t\t<StrictMode>\n\t\t\t\t<CustomizeWidgets\n\t\t\t\t\tapi={ wp.customize }\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t/>\n\t\t\t</StrictMode>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,EAAE,OAAO;AAEf,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;AACD;AACA,MAAM,iCAAiC;;;;;;;AAQvC,SAAgB,WAAY,YAAY,qBAAsB;CAC7D,SAAUA,OAAiB,CAAC,CAAC,YAAa,0BAA0B;EACnE,cAAc;EACd,cAAc;CACf,CAAE;CAEF,SAAUC,OAAY,CAAC,CAAC,wBAAwB;CAChD,MAAM,aAAa,4BAA4B,CAAC,CAAC,QAAU,UAAW;EACrE,OAAO,EACN,gBAAgB,SAAU,MAAM,IAAK,KACrC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,YAAa,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,iBAAkB,KACzC,MAAM,KAAK,WAAY,WAAY;CAErC,CAAE;CACF,mBAAoB,UAAW;CAC/B,0BAA0B;CAC1B,IAAK,WAAW,qBACf,6CAA8C,EAC7C,iBAAiB,+BAClB,CAAE;CAEH,+BAAgC,mBAAoB;CACpD,yBAAyB;CAMzB,8BAA+B,WAAY;CAE3C,MAAM,iBAAiB,kBAAmB,mBAAoB;CAE9D,GAAG,UAAU,mBAAmB,UAAU,kBAAkB;CAC5D,GAAG,UAAU,mBAAmB,uBAAuB;CAEvD,MAAM,YAAY,SAAS,cAAe,KAAM;CAChD,SAAS,KAAK,YAAa,SAAU;CAErC,GAAG,UAAU,KAAM,eAAe;EACjC,MAAM,kBAAkB,CAAC;EACzB,GAAG,UAAU,QAAQ,MAAQ,YAAa;GACzC,IAAK,mBAAmB,gBACvB,gBAAgB,KAAM,OAAQ;EAEhC,CAAE;EAEF,WAAY,SAAU,CAAC,CAAC,OACvB,oBAAC,YAAD,EAAA,UACC,oBAAC,kBAAD;GACC,KAAM,GAAG;GACS;GACI;EACtB,CAAA,EACU,CAAA,CACb;CACD,CAAE;AACH"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
// packages/customize-widgets/src/lock-unlock.js
|
|
2
1
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
lock,
|
|
9
|
-
unlock
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=lock-unlock.mjs.map
|
|
2
|
+
// packages/customize-widgets/src/lock-unlock.js
|
|
3
|
+
const { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/customize-widgets");
|
|
4
|
+
export { lock, unlock };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=lock-unlock.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/lock-unlock.js"],
|
|
4
|
-
"sourcesContent": ["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,wDAAwD;AAE1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"lock-unlock.mjs","names":[],"sources":["../src/lock-unlock.js"],"sourcesContent":["import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"],"mappings":";;AAEA,MAAa,EAAE,MAAM,WACpB,iDACC,iIACA,8BACD"}
|
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
// packages/customize-widgets/src/store/actions.js
|
|
2
|
+
/**
|
|
3
|
+
* Returns an action object used to open/close the inserter.
|
|
4
|
+
*
|
|
5
|
+
* @param {boolean|Object} value Whether the inserter should be
|
|
6
|
+
* opened (true) or closed (false).
|
|
7
|
+
* To specify an insertion point,
|
|
8
|
+
* use an object.
|
|
9
|
+
* @param {string} value.rootClientId The root client ID to insert at.
|
|
10
|
+
* @param {number} value.insertionIndex The index to insert at.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```js
|
|
14
|
+
* import { useState } from 'react';
|
|
15
|
+
* import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';
|
|
16
|
+
* import { __ } from '@wordpress/i18n';
|
|
17
|
+
* import { useDispatch } from '@wordpress/data';
|
|
18
|
+
* import { Button } from '@wordpress/components';
|
|
19
|
+
*
|
|
20
|
+
* const ExampleComponent = () => {
|
|
21
|
+
* const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );
|
|
22
|
+
* const [ isOpen, setIsOpen ] = useState( false );
|
|
23
|
+
*
|
|
24
|
+
* return (
|
|
25
|
+
* <Button
|
|
26
|
+
* onClick={ () => {
|
|
27
|
+
* setIsInserterOpened( ! isOpen );
|
|
28
|
+
* setIsOpen( ! isOpen );
|
|
29
|
+
* } }
|
|
30
|
+
* >
|
|
31
|
+
* { __( 'Open/close inserter' ) }
|
|
32
|
+
* </Button>
|
|
33
|
+
* );
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @return {Object} Action object.
|
|
38
|
+
*/
|
|
2
39
|
function setIsInserterOpened(value) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
40
|
+
return {
|
|
41
|
+
type: "SET_IS_INSERTER_OPENED",
|
|
42
|
+
value
|
|
43
|
+
};
|
|
7
44
|
}
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=actions.mjs.map
|
|
45
|
+
export { setIsInserterOpened };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=actions.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/actions.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @example\n * ```js\n * import { useState } from 'react';\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );\n * const [ isOpen, setIsOpen ] = useState( false );\n *\n * return (\n * <Button\n * onClick={ () => {\n * setIsInserterOpened( ! isOpen );\n * setIsOpen( ! isOpen );\n * } }\n * >\n * { __( 'Open/close inserter' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";AAqCO,SAAS,oBAAqB,OAAQ;AAC5C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,EACD;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"actions.mjs","names":[],"sources":["../../src/store/actions.js"],"sourcesContent":["/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @example\n * ```js\n * import { useState } from 'react';\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useDispatch } from '@wordpress/data';\n * import { Button } from '@wordpress/components';\n *\n * const ExampleComponent = () => {\n * const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );\n * const [ isOpen, setIsOpen ] = useState( false );\n *\n * return (\n * <Button\n * onClick={ () => {\n * setIsInserterOpened( ! isOpen );\n * setIsOpen( ! isOpen );\n * } }\n * >\n * { __( 'Open/close inserter' ) }\n * </Button>\n * );\n * };\n * ```\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAgB,oBAAqB,OAAQ;CAC5C,OAAO;EACN,MAAM;EACN;CACD;AACD"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// packages/customize-widgets/src/store/constants.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Module Constants
|
|
4
|
+
*/
|
|
5
|
+
const STORE_NAME = "core/customize-widgets";
|
|
6
|
+
export { STORE_NAME };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/constants.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Module Constants\n */\nexport const STORE_NAME = 'core/customize-widgets';\n"],
|
|
5
|
-
"mappings": ";AAGO,IAAM,aAAa;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../src/store/constants.js"],"sourcesContent":["/**\n * Module Constants\n */\nexport const STORE_NAME = 'core/customize-widgets';\n"],"mappings":";;;;AAGA,MAAa,aAAa"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
// packages/customize-widgets/src/store/index.js
|
|
2
1
|
import { createReduxStore, register } from "@wordpress/data";
|
|
3
2
|
import reducer from "./reducer.mjs";
|
|
4
3
|
import * as selectors from "./selectors.mjs";
|
|
5
4
|
import * as actions from "./actions.mjs";
|
|
6
5
|
import { STORE_NAME } from "./constants.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Store definition for the edit widgets namespace.
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
|
10
|
+
*
|
|
11
|
+
* @type {Object}
|
|
12
|
+
*/
|
|
13
|
+
const store = createReduxStore(STORE_NAME, {
|
|
14
|
+
reducer,
|
|
15
|
+
selectors,
|
|
16
|
+
actions
|
|
17
|
+
});
|
|
13
18
|
register(store);
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=index.mjs.map
|
|
19
|
+
export { store };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/index.js"],
|
|
4
|
-
"sourcesContent": ["import { createReduxStore, register } from '@wordpress/data';\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,kBAAkB,gBAAgB;AAC3C,OAAO,aAAa;AACpB,YAAY,eAAe;AAC3B,YAAY,aAAa;AACzB,SAAS,kBAAkB;AAS3B,IAAM,cAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AACD;AASO,IAAM,QAAQ,iBAAkB,YAAY,WAAY;AAC/D,SAAU,KAAM;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/store/index.js"],"sourcesContent":["import { createReduxStore, register } from '@wordpress/data';\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registering-a-store\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAa,QAAQ,iBAAkB,YAAY;CAZlD;CACA;CACA;AAUkD,CAAY;AAC/D,SAAU,KAAM"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
// packages/customize-widgets/src/store/reducer.js
|
|
2
1
|
import { combineReducers } from "@wordpress/data";
|
|
2
|
+
// packages/customize-widgets/src/store/reducer.js
|
|
3
|
+
/**
|
|
4
|
+
* Reducer tracking whether the inserter is open.
|
|
5
|
+
*
|
|
6
|
+
* @param {boolean|Object} state
|
|
7
|
+
* @param {Object} action
|
|
8
|
+
*/
|
|
3
9
|
function blockInserterPanel(state = false, action) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return state;
|
|
10
|
+
switch (action.type) {
|
|
11
|
+
case "SET_IS_INSERTER_OPENED": return action.value;
|
|
12
|
+
}
|
|
13
|
+
return state;
|
|
9
14
|
}
|
|
10
|
-
var reducer_default = combineReducers({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
reducer_default as default
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=reducer.mjs.map
|
|
15
|
+
var reducer_default = combineReducers({ blockInserterPanel });
|
|
16
|
+
export { reducer_default as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=reducer.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/reducer.js"],
|
|
4
|
-
"sourcesContent": ["import { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,uBAAuB;AAQhC,SAAS,mBAAoB,QAAQ,OAAO,QAAS;AACpD,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK;AACJ,aAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACR;AAEA,IAAO,kBAAQ,gBAAiB;AAAA,EAC/B;AACD,CAAE;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"reducer.mjs","names":[],"sources":["../../src/store/reducer.js"],"sourcesContent":["import { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"],"mappings":";;;;;;;;AAQA,SAAS,mBAAoB,QAAQ,OAAO,QAAS;CACpD,QAAS,OAAO,MAAhB;EACC,KAAK,0BACJ,OAAO,OAAO;CAChB;CACA,OAAO;AACR;AAEA,IAAA,kBAAe,gBAAiB,EAC/B,mBACD,CAAE"}
|
|
@@ -1,19 +1,47 @@
|
|
|
1
1
|
// packages/customize-widgets/src/store/selectors.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const EMPTY_INSERTION_POINT = {
|
|
3
|
+
rootClientId: void 0,
|
|
4
|
+
insertionIndex: void 0
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Returns true if the inserter is opened.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} state Global application state.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';
|
|
14
|
+
* import { __ } from '@wordpress/i18n';
|
|
15
|
+
* import { useSelect } from '@wordpress/data';
|
|
16
|
+
*
|
|
17
|
+
* const ExampleComponent = () => {
|
|
18
|
+
* const { isInserterOpened } = useSelect(
|
|
19
|
+
* ( select ) => select( customizeWidgetsStore ),
|
|
20
|
+
* []
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* return isInserterOpened()
|
|
24
|
+
* ? __( 'Inserter is open' )
|
|
25
|
+
* : __( 'Inserter is closed.' );
|
|
26
|
+
* };
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @return {boolean} Whether the inserter is opened.
|
|
30
|
+
*/
|
|
6
31
|
function isInserterOpened(state) {
|
|
7
|
-
|
|
32
|
+
return !!state.blockInserterPanel;
|
|
8
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the insertion point for the inserter.
|
|
36
|
+
*
|
|
37
|
+
* @param {Object} state Global application state.
|
|
38
|
+
*
|
|
39
|
+
* @return {Object} The root client ID and index to insert at.
|
|
40
|
+
*/
|
|
9
41
|
function __experimentalGetInsertionPoint(state) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
return state.blockInserterPanel;
|
|
42
|
+
if (typeof state.blockInserterPanel === "boolean") return EMPTY_INSERTION_POINT;
|
|
43
|
+
return state.blockInserterPanel;
|
|
14
44
|
}
|
|
15
|
-
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=selectors.mjs.map
|
|
45
|
+
export { __experimentalGetInsertionPoint, isInserterOpened };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=selectors.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/store/selectors.js"],
|
|
4
|
-
"sourcesContent": ["const EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n};\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const { isInserterOpened } = useSelect(\n * ( select ) => select( customizeWidgetsStore ),\n * []\n * );\n *\n * return isInserterOpened()\n * ? __( 'Inserter is open' )\n * : __( 'Inserter is closed.' );\n * };\n * ```\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tif ( typeof state.blockInserterPanel === 'boolean' ) {\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n\n\treturn state.blockInserterPanel;\n}\n"],
|
|
5
|
-
"mappings": ";AAAA,IAAM,wBAAwB;AAAA,EAC7B,cAAc;AAAA,EACd,gBAAgB;AACjB;AA2BO,SAAS,iBAAkB,OAAQ;AACzC,SAAO,CAAC,CAAE,MAAM;AACjB;AASO,SAAS,gCAAiC,OAAQ;AACxD,MAAK,OAAO,MAAM,uBAAuB,WAAY;AACpD,WAAO;AAAA,EACR;AAEA,SAAO,MAAM;AACd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"selectors.mjs","names":[],"sources":["../../src/store/selectors.js"],"sourcesContent":["const EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n};\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```js\n * import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';\n * import { __ } from '@wordpress/i18n';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * const { isInserterOpened } = useSelect(\n * ( select ) => select( customizeWidgetsStore ),\n * []\n * );\n *\n * return isInserterOpened()\n * ? __( 'Inserter is open' )\n * : __( 'Inserter is closed.' );\n * };\n * ```\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tif ( typeof state.blockInserterPanel === 'boolean' ) {\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n\n\treturn state.blockInserterPanel;\n}\n"],"mappings":";AAAA,MAAM,wBAAwB;CAC7B,cAAc,KAAA;CACd,gBAAgB,KAAA;AACjB;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAAgB,iBAAkB,OAAQ;CACzC,OAAO,CAAC,CAAE,MAAM;AACjB;;;;;;;;AASA,SAAgB,gCAAiC,OAAQ;CACxD,IAAK,OAAO,MAAM,uBAAuB,WACxC,OAAO;CAGR,OAAO,MAAM;AACd"}
|