@wordpress/customize-widgets 5.32.0 → 5.32.1-next.ff1cebbba.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-appender/index.js +33 -27
- package/build/components/block-appender/index.js.map +7 -1
- package/build/components/block-inspector-button/index.js +51 -36
- package/build/components/block-inspector-button/index.js.map +7 -1
- package/build/components/customize-widgets/index.js +83 -61
- package/build/components/customize-widgets/index.js.map +7 -1
- package/build/components/customize-widgets/use-clear-selected-block.js +56 -63
- package/build/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build/components/error-boundary/index.js +46 -45
- package/build/components/error-boundary/index.js.map +7 -1
- package/build/components/focus-control/index.js +69 -57
- package/build/components/focus-control/index.js.map +7 -1
- package/build/components/focus-control/use-blocks-focus-control.js +38 -31
- package/build/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build/components/header/index.js +110 -71
- package/build/components/header/index.js.map +7 -1
- package/build/components/inserter/index.js +77 -53
- package/build/components/inserter/index.js.map +7 -1
- package/build/components/inserter/use-inserter.js +46 -29
- package/build/components/inserter/use-inserter.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
- package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +155 -110
- package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +76 -56
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build/components/keyboard-shortcuts/index.js +60 -51
- package/build/components/keyboard-shortcuts/index.js.map +7 -1
- package/build/components/more-menu/index.js +151 -90
- package/build/components/more-menu/index.js.map +7 -1
- package/build/components/sidebar-block-editor/index.js +133 -105
- package/build/components/sidebar-block-editor/index.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +73 -67
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +51 -33
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js +100 -79
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build/components/sidebar-controls/index.js +45 -31
- package/build/components/sidebar-controls/index.js.map +7 -1
- package/build/components/welcome-guide/index.js +86 -58
- package/build/components/welcome-guide/index.js.map +7 -1
- package/build/controls/inserter-outer-section.js +49 -58
- package/build/controls/inserter-outer-section.js.map +7 -1
- package/build/controls/inspector-section.js +30 -36
- package/build/controls/inspector-section.js.map +7 -1
- package/build/controls/sidebar-control.js +51 -30
- package/build/controls/sidebar-control.js.map +7 -1
- package/build/controls/sidebar-section.js +71 -39
- package/build/controls/sidebar-section.js.map +7 -1
- package/build/filters/index.js +4 -6
- package/build/filters/index.js.map +7 -1
- package/build/filters/move-to-sidebar.js +77 -79
- package/build/filters/move-to-sidebar.js.map +7 -1
- package/build/filters/replace-media-upload.js +9 -11
- package/build/filters/replace-media-upload.js.map +7 -1
- package/build/filters/wide-widget-display.js +20 -25
- package/build/filters/wide-widget-display.js.map +7 -1
- package/build/index.js +81 -70
- package/build/index.js.map +7 -1
- package/build/lock-unlock.js +31 -15
- package/build/lock-unlock.js.map +7 -1
- package/build/store/actions.js +27 -44
- package/build/store/actions.js.map +7 -1
- package/build/store/constants.js +27 -10
- package/build/store/constants.js.map +7 -1
- package/build/store/index.js +44 -40
- package/build/store/index.js.map +7 -1
- package/build/store/reducer.js +25 -19
- package/build/store/reducer.js.map +7 -1
- package/build/store/selectors.js +31 -44
- package/build/store/selectors.js.map +7 -1
- package/build/utils.js +45 -73
- package/build/utils.js.map +7 -1
- package/build-module/components/block-appender/index.js +17 -20
- package/build-module/components/block-appender/index.js.map +7 -1
- package/build-module/components/block-inspector-button/index.js +33 -30
- package/build-module/components/block-inspector-button/index.js.map +7 -1
- package/build-module/components/customize-widgets/index.js +52 -51
- package/build-module/components/customize-widgets/index.js.map +7 -1
- package/build-module/components/customize-widgets/use-clear-selected-block.js +38 -58
- package/build-module/components/customize-widgets/use-clear-selected-block.js.map +7 -1
- package/build-module/components/error-boundary/index.js +27 -37
- package/build-module/components/error-boundary/index.js.map +7 -1
- package/build-module/components/focus-control/index.js +50 -45
- package/build-module/components/focus-control/index.js.map +7 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +17 -22
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +7 -1
- package/build-module/components/header/index.js +81 -63
- package/build-module/components/header/index.js.map +7 -1
- package/build-module/components/inserter/index.js +59 -47
- package/build-module/components/inserter/index.js.map +7 -1
- package/build-module/components/inserter/use-inserter.js +28 -23
- package/build-module/components/inserter/use-inserter.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -103
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -50
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
- package/build-module/components/keyboard-shortcuts/index.js +44 -44
- package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
- package/build-module/components/more-menu/index.js +129 -84
- package/build-module/components/more-menu/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/index.js +109 -96
- package/build-module/components/sidebar-block-editor/index.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +54 -59
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +7 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +22 -25
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +7 -1
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js +70 -70
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.js.map +7 -1
- package/build-module/components/sidebar-controls/index.js +24 -25
- package/build-module/components/sidebar-controls/index.js.map +7 -1
- package/build-module/components/welcome-guide/index.js +68 -52
- package/build-module/components/welcome-guide/index.js.map +7 -1
- package/build-module/controls/inserter-outer-section.js +31 -52
- package/build-module/controls/inserter-outer-section.js.map +7 -1
- package/build-module/controls/inspector-section.js +13 -32
- package/build-module/controls/inspector-section.js.map +7 -1
- package/build-module/controls/sidebar-control.js +22 -22
- package/build-module/controls/sidebar-control.js.map +7 -1
- package/build-module/controls/sidebar-section.js +43 -32
- package/build-module/controls/sidebar-section.js.map +7 -1
- package/build-module/filters/index.js +4 -7
- package/build-module/filters/index.js.map +7 -1
- package/build-module/filters/move-to-sidebar.js +83 -76
- package/build-module/filters/move-to-sidebar.js.map +7 -1
- package/build-module/filters/replace-media-upload.js +8 -7
- package/build-module/filters/replace-media-upload.js.map +7 -1
- package/build-module/filters/wide-widget-display.js +20 -22
- package/build-module/filters/wide-widget-display.js.map +7 -1
- package/build-module/index.js +53 -51
- package/build-module/index.js.map +7 -1
- package/build-module/lock-unlock.js +8 -7
- package/build-module/lock-unlock.js.map +7 -1
- package/build-module/store/actions.js +6 -40
- package/build-module/store/actions.js.map +7 -1
- package/build-module/store/constants.js +5 -5
- package/build-module/store/constants.js.map +7 -1
- package/build-module/store/index.js +10 -30
- package/build-module/store/index.js.map +7 -1
- package/build-module/store/reducer.js +7 -14
- package/build-module/store/reducer.js.map +7 -1
- package/build-module/store/selectors.js +10 -40
- package/build-module/store/selectors.js.map +7 -1
- package/build-module/utils.js +21 -66
- package/build-module/utils.js.map +7 -1
- package/build-style/style-rtl.css +14 -149
- package/build-style/style.css +14 -149
- package/package.json +30 -23
- package/src/components/block-inspector-button/style.scss +3 -0
- package/src/components/header/style.scss +5 -0
- package/src/components/inserter/style.scss +3 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
- package/src/components/more-menu/style.scss +2 -0
- package/src/components/sidebar-block-editor/style.scss +2 -0
- package/src/components/welcome-guide/style.scss +2 -0
- package/src/controls/style.scss +2 -0
- package/src/style.scss +10 -8
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/controls/sidebar-section.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' \u25B8 ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA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zD,eAAK,iBACH,QAAS,kBAAmB,EAC5B,SAAU,cAAe;AAAA,QAC5B,OAAO;AACN,eAAK,iBAAiB,SAAU;AAAA,YAC/B;AAAA,YACA;AAAA,UACD,CAAE;AACF,eAAK,iBACH,QAAS,kBAAmB,EAC5B,SAAU,cAAe;AAC3B,eAAK,iBAAiB,YAAa,MAAO;AAAA,QAC3C;AAEA,cAAM,sBAAsB,MAAM;AACjC,eAAK,iBAAiB,YAAa,MAAO;AAC1C,eAAK,iBAAiB;AAAA,QACvB;AAEA,YAAK,iBAAkB;AACtB,8BAAoB;AAAA,QACrB,OAAO;AACN,eAAK,iBAAiB;AAAA,YACrB;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD,OAAO;AACN,cAAM,iBAAkB,UAAU,IAAK;AAAA,MACxC;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": ["getInspectorSection"]
|
|
7
|
+
}
|
package/build/filters/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require("./
|
|
4
|
-
|
|
5
|
-
require("./wide-widget-display");
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var import_move_to_sidebar = require("./move-to-sidebar");
|
|
2
|
+
var import_replace_media_upload = require("./replace-media-upload");
|
|
3
|
+
var import_wide_widget_display = require("./wide-widget-display");
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport './move-to-sidebar';\nimport './replace-media-upload';\nimport './wide-widget-display';\n"],
|
|
5
|
+
"mappings": "AAGA,6BAAO;AACP,kCAAO;AACP,iCAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,80 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
const sidebarAdapter = newSidebarControl.sidebarAdapter;
|
|
54
|
-
removeBlock(clientId);
|
|
55
|
-
const addedWidgetIds = sidebarAdapter.setWidgets([...sidebarAdapter.getWidgets(), (0, _utils.blockToWidget)(block)]);
|
|
56
|
-
// The last non-null id is the added widget's id.
|
|
57
|
-
widgetId = addedWidgetIds.reverse().find(id => !!id);
|
|
1
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
3
|
+
var import_compose = require("@wordpress/compose");
|
|
4
|
+
var import_data = require("@wordpress/data");
|
|
5
|
+
var import_hooks = require("@wordpress/hooks");
|
|
6
|
+
var import_widgets = require("@wordpress/widgets");
|
|
7
|
+
var import_sidebar_controls = require("../components/sidebar-controls");
|
|
8
|
+
var import_focus_control = require("../components/focus-control");
|
|
9
|
+
var import_utils = require("../utils");
|
|
10
|
+
const withMoveToSidebarToolbarItem = (0, import_compose.createHigherOrderComponent)(
|
|
11
|
+
(BlockEdit) => (props) => {
|
|
12
|
+
let widgetId = (0, import_widgets.getWidgetIdFromBlock)(props);
|
|
13
|
+
const sidebarControls = (0, import_sidebar_controls.useSidebarControls)();
|
|
14
|
+
const activeSidebarControl = (0, import_sidebar_controls.useActiveSidebarControl)();
|
|
15
|
+
const hasMultipleSidebars = sidebarControls?.length > 1;
|
|
16
|
+
const blockName = props.name;
|
|
17
|
+
const clientId = props.clientId;
|
|
18
|
+
const canInsertBlockInSidebar = (0, import_data.useSelect)(
|
|
19
|
+
(select) => {
|
|
20
|
+
return select(import_block_editor.store).canInsertBlockType(
|
|
21
|
+
blockName,
|
|
22
|
+
""
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
[blockName]
|
|
26
|
+
);
|
|
27
|
+
const block = (0, import_data.useSelect)(
|
|
28
|
+
(select) => select(import_block_editor.store).getBlock(clientId),
|
|
29
|
+
[clientId]
|
|
30
|
+
);
|
|
31
|
+
const { removeBlock } = (0, import_data.useDispatch)(import_block_editor.store);
|
|
32
|
+
const [, focusWidget] = (0, import_focus_control.useFocusControl)();
|
|
33
|
+
function moveToSidebar(sidebarControlId) {
|
|
34
|
+
const newSidebarControl = sidebarControls.find(
|
|
35
|
+
(sidebarControl) => sidebarControl.id === sidebarControlId
|
|
36
|
+
);
|
|
37
|
+
if (widgetId) {
|
|
38
|
+
const oldSetting = activeSidebarControl.setting;
|
|
39
|
+
const newSetting = newSidebarControl.setting;
|
|
40
|
+
oldSetting(oldSetting().filter((id) => id !== widgetId));
|
|
41
|
+
newSetting([...newSetting(), widgetId]);
|
|
42
|
+
} else {
|
|
43
|
+
const sidebarAdapter = newSidebarControl.sidebarAdapter;
|
|
44
|
+
removeBlock(clientId);
|
|
45
|
+
const addedWidgetIds = sidebarAdapter.setWidgets([
|
|
46
|
+
...sidebarAdapter.getWidgets(),
|
|
47
|
+
(0, import_utils.blockToWidget)(block)
|
|
48
|
+
]);
|
|
49
|
+
widgetId = addedWidgetIds.reverse().find((id) => !!id);
|
|
50
|
+
}
|
|
51
|
+
focusWidget(widgetId);
|
|
58
52
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(0,
|
|
80
|
-
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockEdit, { ...props }, "edit"),
|
|
55
|
+
hasMultipleSidebars && canInsertBlockInSidebar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
+
import_widgets.MoveToWidgetArea,
|
|
57
|
+
{
|
|
58
|
+
widgetAreas: sidebarControls.map(
|
|
59
|
+
(sidebarControl) => ({
|
|
60
|
+
id: sidebarControl.id,
|
|
61
|
+
name: sidebarControl.params.label,
|
|
62
|
+
description: sidebarControl.params.description
|
|
63
|
+
})
|
|
64
|
+
),
|
|
65
|
+
currentWidgetAreaId: activeSidebarControl?.id,
|
|
66
|
+
onSelect: moveToSidebar
|
|
67
|
+
}
|
|
68
|
+
) })
|
|
69
|
+
] });
|
|
70
|
+
},
|
|
71
|
+
"withMoveToSidebarToolbarItem"
|
|
72
|
+
);
|
|
73
|
+
(0, import_hooks.addFilter)(
|
|
74
|
+
"editor.BlockEdit",
|
|
75
|
+
"core/customize-widgets/block-edit",
|
|
76
|
+
withMoveToSidebarToolbarItem
|
|
77
|
+
);
|
|
78
|
+
//# sourceMappingURL=move-to-sidebar.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/move-to-sidebar.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\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QAAS,CAAE;AAAA,MAC3C,OAAO;AAMN,cAAM,iBAAiB,kBAAkB;AAEzC,oBAAa,QAAS;AACtB,cAAM,iBAAiB,eAAe,WAAY;AAAA,UACjD,GAAG,eAAe,WAAW;AAAA,cAC7B,4BAAe,KAAM;AAAA,QACtB,CAAE;AAEF,mBAAW,eAAe,QAAQ,EAAE,KAAM,CAAE,OAAQ,CAAC,CAAE,EAAG;AAAA,MAC3D;AAGA,kBAAa,QAAS;AAAA,IACvB;AAEA,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,uBAAuB,2BACxB,4CAAC,qCACA;AAAA,QAAC;AAAA;AAAA,UACA,aAAc,gBAAgB;AAAA,YAC7B,CAAE,oBAAsB;AAAA,cACvB,IAAI,eAAe;AAAA,cACnB,MAAM,eAAe,OAAO;AAAA,cAC5B,aACC,eAAe,OAAO;AAAA,YACxB;AAAA,UACD;AAAA,UACA,qBAAsB,sBAAsB;AAAA,UAC5C,UAAW;AAAA;AAAA,MACZ,GACD;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAAA,IAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": ["blockEditorStore"]
|
|
7
|
+
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
(0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
|
|
11
|
-
//# sourceMappingURL=replace-media-upload.js.map
|
|
1
|
+
var import_hooks = require("@wordpress/hooks");
|
|
2
|
+
var import_media_utils = require("@wordpress/media-utils");
|
|
3
|
+
const replaceMediaUpload = () => import_media_utils.MediaUpload;
|
|
4
|
+
(0, import_hooks.addFilter)(
|
|
5
|
+
"editor.MediaUpload",
|
|
6
|
+
"core/edit-widgets/replace-media-upload",
|
|
7
|
+
replaceMediaUpload
|
|
8
|
+
);
|
|
9
|
+
//# sourceMappingURL=replace-media-upload.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/replace-media-upload.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { 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": "AAGA,mBAA0B;AAC1B,yBAA4B;AAE5B,MAAM,qBAAqB,MAAM;AAAA,IAEjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
isWide: isWide
|
|
22
|
-
}, "edit");
|
|
23
|
-
}, 'withWideWidgetDisplay');
|
|
24
|
-
(0, _hooks.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay);
|
|
25
|
-
//# sourceMappingURL=wide-widget-display.js.map
|
|
1
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2
|
+
var import_compose = require("@wordpress/compose");
|
|
3
|
+
var import_hooks = require("@wordpress/hooks");
|
|
4
|
+
const { wp } = window;
|
|
5
|
+
const withWideWidgetDisplay = (0, import_compose.createHigherOrderComponent)(
|
|
6
|
+
(BlockEdit) => (props) => {
|
|
7
|
+
const { idBase } = props.attributes;
|
|
8
|
+
const isWide = wp.customize.Widgets.data.availableWidgets.find(
|
|
9
|
+
(widget) => widget.id_base === idBase
|
|
10
|
+
)?.is_wide ?? false;
|
|
11
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BlockEdit, { ...props, isWide }, "edit");
|
|
12
|
+
},
|
|
13
|
+
"withWideWidgetDisplay"
|
|
14
|
+
);
|
|
15
|
+
(0, import_hooks.addFilter)(
|
|
16
|
+
"editor.BlockEdit",
|
|
17
|
+
"core/customize-widgets/wide-widget-display",
|
|
18
|
+
withWideWidgetDisplay
|
|
19
|
+
);
|
|
20
|
+
//# sourceMappingURL=wide-widget-display.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/wide-widget-display.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { 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": "AAgBS;AAbT,qBAA2C;AAC3C,mBAA0B;AAE1B,MAAM,EAAE,GAAG,IAAI;AAEf,MAAM,4BAAwB;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,4CAAC,aAAuB,GAAG,OAAQ,UAApB,MAAsC;AAAA,EAC7D;AAAA,EACA;AACD;AAAA,IAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -1,91 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
16
|
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var index_exports = {};
|
|
29
|
+
__export(index_exports, {
|
|
30
|
+
initialize: () => initialize,
|
|
31
|
+
store: () => import_store.store
|
|
13
32
|
});
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
require("./
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
wp
|
|
36
|
-
} = window;
|
|
37
|
-
const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part'];
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_element = require("@wordpress/element");
|
|
36
|
+
var import_block_library = require("@wordpress/block-library");
|
|
37
|
+
var import_widgets = require("@wordpress/widgets");
|
|
38
|
+
var import_blocks = require("@wordpress/blocks");
|
|
39
|
+
var import_data = require("@wordpress/data");
|
|
40
|
+
var import_preferences = require("@wordpress/preferences");
|
|
41
|
+
var import_customize_widgets = __toESM(require("./components/customize-widgets"));
|
|
42
|
+
var import_sidebar_section = __toESM(require("./controls/sidebar-section"));
|
|
43
|
+
var import_sidebar_control = __toESM(require("./controls/sidebar-control"));
|
|
44
|
+
var import_filters = require("./filters");
|
|
45
|
+
var import_store = require("./store");
|
|
46
|
+
const { wp } = window;
|
|
47
|
+
const DISABLED_BLOCKS = [
|
|
48
|
+
"core/more",
|
|
49
|
+
"core/block",
|
|
50
|
+
"core/freeform",
|
|
51
|
+
"core/template-part"
|
|
52
|
+
];
|
|
38
53
|
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Initializes the widgets block editor in the customizer.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} editorName The editor name.
|
|
44
|
-
* @param {Object} blockEditorSettings Block editor settings.
|
|
45
|
-
*/
|
|
46
54
|
function initialize(editorName, blockEditorSettings) {
|
|
47
|
-
(0,
|
|
55
|
+
(0, import_data.dispatch)(import_preferences.store).setDefaults("core/customize-widgets", {
|
|
48
56
|
fixedToolbar: false,
|
|
49
57
|
welcomeGuide: true
|
|
50
58
|
});
|
|
51
|
-
(0,
|
|
52
|
-
const coreBlocks = (0,
|
|
53
|
-
return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith(
|
|
59
|
+
(0, import_data.dispatch)(import_blocks.store).reapplyBlockTypeFilters();
|
|
60
|
+
const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter((block) => {
|
|
61
|
+
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"));
|
|
54
62
|
});
|
|
55
|
-
(0,
|
|
56
|
-
(0,
|
|
63
|
+
(0, import_block_library.registerCoreBlocks)(coreBlocks);
|
|
64
|
+
(0, import_widgets.registerLegacyWidgetBlock)();
|
|
57
65
|
if (globalThis.IS_GUTENBERG_PLUGIN) {
|
|
58
|
-
(0,
|
|
66
|
+
(0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({
|
|
59
67
|
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
60
68
|
});
|
|
61
69
|
}
|
|
62
|
-
(0,
|
|
63
|
-
(0,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// do this will result in errors in the default block parser.
|
|
68
|
-
// see: https://github.com/WordPress/gutenberg/issues/33097
|
|
69
|
-
(0, _blocks.setFreeformContentHandlerName)('core/html');
|
|
70
|
-
const SidebarControl = (0, _sidebarControl.default)(blockEditorSettings);
|
|
71
|
-
wp.customize.sectionConstructor.sidebar = (0, _sidebarSection.default)();
|
|
70
|
+
(0, import_widgets.registerLegacyWidgetVariations)(blockEditorSettings);
|
|
71
|
+
(0, import_widgets.registerWidgetGroupBlock)();
|
|
72
|
+
(0, import_blocks.setFreeformContentHandlerName)("core/html");
|
|
73
|
+
const SidebarControl = (0, import_sidebar_control.default)(blockEditorSettings);
|
|
74
|
+
wp.customize.sectionConstructor.sidebar = (0, import_sidebar_section.default)();
|
|
72
75
|
wp.customize.controlConstructor.sidebar_block_editor = SidebarControl;
|
|
73
|
-
const container = document.createElement(
|
|
76
|
+
const container = document.createElement("div");
|
|
74
77
|
document.body.appendChild(container);
|
|
75
|
-
wp.customize.bind(
|
|
78
|
+
wp.customize.bind("ready", () => {
|
|
76
79
|
const sidebarControls = [];
|
|
77
|
-
wp.customize.control.each(control => {
|
|
80
|
+
wp.customize.control.each((control) => {
|
|
78
81
|
if (control instanceof SidebarControl) {
|
|
79
82
|
sidebarControls.push(control);
|
|
80
83
|
}
|
|
81
84
|
});
|
|
82
|
-
(0,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
(0, import_element.createRoot)(container).render(
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_customize_widgets.default,
|
|
88
|
+
{
|
|
89
|
+
api: wp.customize,
|
|
90
|
+
sidebarControls,
|
|
91
|
+
blockEditorSettings
|
|
92
|
+
}
|
|
93
|
+
) })
|
|
94
|
+
);
|
|
89
95
|
});
|
|
90
96
|
}
|
|
91
|
-
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
initialize,
|
|
100
|
+
store
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { 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';\n\n/**\n * Internal dependencies\n */\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);\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;AAAA;AAAA;AAAA;AAAA;AAAA;AA+FI;AA5FJ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Q;AAAA,MAC/B;AAAA,IACD,CAAE;AAEF,mCAAY,SAAU,EAAE;AAAA,MACvB,4CAAC,6BACA;AAAA,QAAC,yBAAAC;AAAA,QAAA;AAAA,UACA,KAAM,GAAG;AAAA,UACT;AAAA,UACA;AAAA;AAAA,MACD,GACD;AAAA,IACD;AAAA,EACD,CAAE;AACH;",
|
|
6
|
+
"names": ["preferencesStore", "blocksStore", "getSidebarControl", "getSidebarSection", "CustomizeWidgets"]
|
|
7
|
+
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var lock_unlock_exports = {};
|
|
19
|
+
__export(lock_unlock_exports, {
|
|
20
|
+
lock: () => lock,
|
|
21
|
+
unlock: () => unlock
|
|
5
22
|
});
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
module.exports = __toCommonJS(lock_unlock_exports);
|
|
24
|
+
var import_private_apis = require("@wordpress/private-apis");
|
|
25
|
+
const { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
26
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
27
|
+
"@wordpress/customize-widgets"
|
|
28
|
+
);
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
13
31
|
lock,
|
|
14
32
|
unlock
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
exports.lock = lock;
|
|
18
|
-
//# sourceMappingURL=lock-unlock.js.map
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=lock-unlock.js.map
|