@wordpress/customize-widgets 4.11.0 → 4.12.1
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/CHANGELOG.md +2 -0
- package/build/components/block-appender/index.js +2 -6
- package/build/components/block-appender/index.js.map +1 -1
- package/build/components/block-inspector-button/index.js +9 -13
- package/build/components/block-inspector-button/index.js.map +1 -1
- package/build/components/customize-widgets/index.js +5 -6
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -5
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/focus-control/index.js +5 -6
- package/build/components/focus-control/index.js.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build/components/header/index.js +7 -8
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter/index.js +3 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +42 -50
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +6 -7
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +19 -27
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +8 -9
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build/components/sidebar-controls/index.js +5 -6
- package/build/components/sidebar-controls/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -4
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inserter-outer-section.js +2 -2
- package/build/controls/inserter-outer-section.js.map +1 -1
- package/build/controls/inspector-section.js +3 -4
- package/build/controls/inspector-section.js.map +1 -1
- package/build/controls/sidebar-control.js +2 -2
- package/build/controls/sidebar-control.js.map +1 -1
- package/build/controls/sidebar-section.js +2 -6
- package/build/controls/sidebar-section.js.map +1 -1
- package/build/filters/move-to-sidebar.js +4 -3
- package/build/filters/move-to-sidebar.js.map +1 -1
- package/build/filters/wide-widget-display.js +4 -8
- package/build/filters/wide-widget-display.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/store/reducer.js +1 -4
- package/build/store/reducer.js.map +1 -1
- package/build/utils.js +8 -10
- package/build/utils.js.map +1 -1
- package/build-module/components/block-appender/index.js +2 -3
- package/build-module/components/block-appender/index.js.map +1 -1
- package/build-module/components/block-inspector-button/index.js +9 -10
- package/build-module/components/block-inspector-button/index.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +5 -6
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -5
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/focus-control/index.js +5 -6
- package/build-module/components/focus-control/index.js.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build-module/components/header/index.js +7 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +6 -7
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +19 -27
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +6 -7
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build-module/components/sidebar-controls/index.js +5 -6
- package/build-module/components/sidebar-controls/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -4
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inserter-outer-section.js +2 -2
- package/build-module/controls/inserter-outer-section.js.map +1 -1
- package/build-module/controls/inspector-section.js +3 -4
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/controls/sidebar-control.js +2 -2
- package/build-module/controls/sidebar-control.js.map +1 -1
- package/build-module/controls/sidebar-section.js +2 -6
- package/build-module/controls/sidebar-section.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js +4 -3
- package/build-module/filters/move-to-sidebar.js.map +1 -1
- package/build-module/filters/wide-widget-display.js +4 -5
- package/build-module/filters/wide-widget-display.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/store/reducer.js +1 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils.js +8 -10
- package/build-module/utils.js.map +1 -1
- package/build-style/style-rtl.css +25 -0
- package/build-style/style.css +25 -0
- package/package.json +22 -22
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/sidebar-block-editor/sidebar-editor-provider.js +1 -1
- package/src/style.scss +31 -0
- package/build/private-apis.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
|
@@ -29,7 +29,7 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
|
|
|
29
29
|
let widgetId = (0, _widgets.getWidgetIdFromBlock)(props);
|
|
30
30
|
const sidebarControls = (0, _sidebarControls.useSidebarControls)();
|
|
31
31
|
const activeSidebarControl = (0, _sidebarControls.useActiveSidebarControl)();
|
|
32
|
-
const hasMultipleSidebars =
|
|
32
|
+
const hasMultipleSidebars = sidebarControls?.length > 1;
|
|
33
33
|
const blockName = props.name;
|
|
34
34
|
const clientId = props.clientId;
|
|
35
35
|
const canInsertBlockInSidebar = (0, _data.useSelect)(select => {
|
|
@@ -71,13 +71,14 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
|
|
|
71
71
|
focusWidget(widgetId);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, props
|
|
74
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, { ...props
|
|
75
|
+
}), hasMultipleSidebars && canInsertBlockInSidebar && (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_widgets.MoveToWidgetArea, {
|
|
75
76
|
widgetAreas: sidebarControls.map(sidebarControl => ({
|
|
76
77
|
id: sidebarControl.id,
|
|
77
78
|
name: sidebarControl.params.label,
|
|
78
79
|
description: sidebarControl.params.description
|
|
79
80
|
})),
|
|
80
|
-
currentWidgetAreaId: activeSidebarControl
|
|
81
|
+
currentWidgetAreaId: activeSidebarControl?.id,
|
|
81
82
|
onSelect: moveToSidebar
|
|
82
83
|
})));
|
|
83
84
|
}, 'withMoveToSidebarToolbarItem');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,MAAMA,4BAA4B,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAG,mCAAsBD,KAAtB,CAAf;AACA,QAAME,eAAe,GAAG,0CAAxB;AACA,QAAMC,oBAAoB,GAAG,+CAA7B;AACA,QAAMC,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AAKA;;AAIA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,MAAMA,4BAA4B,GAAG,yCAClCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAG,mCAAsBD,KAAtB,CAAf;AACA,QAAME,eAAe,GAAG,0CAAxB;AACA,QAAMC,oBAAoB,GAAG,+CAA7B;AACA,QAAMC,mBAAmB,GAAGF,eAAe,EAAEG,MAAjB,GAA0B,CAAtD;AACA,QAAMC,SAAS,GAAGN,KAAK,CAACO,IAAxB;AACA,QAAMC,QAAQ,GAAGR,KAAK,CA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B,cAAc,CAACG,OAAf,GAAyBX,IAAzB,CAAiCE,EAAF,IAAU,CAAC,CAAEA,EAA5C,CAAX;AACA,KA7ByC,CA+B1C;;;AACAN,IAAAA,WAAW,CAAEf,QAAF,CAAX;AACA;;AAED,SACC,qDACC,4BAAC,SAAD,OAAgBD;AAAhB,IADD,EAEGI,mBAAmB,IAAIK,uBAAvB,IACD,4BAAC,0BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAGP,eAAe,CAAC8B,GAAhB,CACXX,cAAF,KAAwB;AACvBC,MAAAA,EAAE,EAAED,cAAc,CAACC,EADI;AAEvBf,MAAAA,IAAI,EAAEc,cAAc,CAACY,MAAf,CAAsBC,KAFL;AAGvBC,MAAAA,WAAW,EACVd,cAAc,CAACY,MAAf,CAAsBE;AAJA,KAAxB,CADa,CADf;AASC,IAAA,mBAAmB,EAAGhC,oBAAoB,EAAEmB,EAT7C;AAUC,IAAA,QAAQ,EAAGL;AAVZ,IADD,CAHF,CADD;AAqBA,CAlFmC,EAmFpC,8BAnFoC,CAArC;AAsFA,sBACC,kBADD,EAEC,mCAFD,EAGCnB,4BAHD","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 { ...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\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
var _element = require("@wordpress/element");
|
|
6
4
|
|
|
7
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
|
-
|
|
9
5
|
var _compose = require("@wordpress/compose");
|
|
10
6
|
|
|
11
7
|
var _hooks = require("@wordpress/hooks");
|
|
@@ -17,15 +13,15 @@ const {
|
|
|
17
13
|
wp
|
|
18
14
|
} = window;
|
|
19
15
|
const withWideWidgetDisplay = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
20
|
-
var _wp$customize$Widgets
|
|
16
|
+
var _wp$customize$Widgets;
|
|
21
17
|
|
|
22
18
|
const {
|
|
23
19
|
idBase
|
|
24
20
|
} = props.attributes;
|
|
25
|
-
const isWide = (_wp$customize$Widgets =
|
|
26
|
-
return (0, _element.createElement)(BlockEdit,
|
|
21
|
+
const isWide = (_wp$customize$Widgets = wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
|
|
22
|
+
return (0, _element.createElement)(BlockEdit, { ...props,
|
|
27
23
|
isWide: isWide
|
|
28
|
-
})
|
|
24
|
+
});
|
|
29
25
|
}, 'withWideWidgetDisplay');
|
|
30
26
|
(0, _hooks.addFilter)('editor.BlockEdit', 'core/customize-widgets/wide-widget-display', withWideWidgetDisplay);
|
|
31
27
|
//# sourceMappingURL=wide-widget-display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":";;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,qBAAqB,GAAG,yCAC3BC,SAAF,IAAmBC,KAAF,IAAa;AAAA;;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAK,CAACE,UAAzB;AACA,QAAMC,MAAM,4BACXP,EAAE,CAACQ,SAAH,CAAaC,OAAb,CAAqBC,IAArB,CAA0BC,gBAA1B,CAA2CC,IAA3C,CACGC,MAAF,IAAcA,MAAM,CAACC,OAAP,KAAmBT,MADlC,GAEGU,OAHQ,yEAGG,KAHf;AAKA,SAAO,4BAAC,SAAD,OAAgBX,KAAhB;AAAwB,IAAA,MAAM,EAAGG;AAAjC,IAAP;AACA,CAT4B,EAU7B,uBAV6B,CAA9B;AAaA,sBACC,kBADD,EAEC,4CAFD,EAGCL,qBAHD","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 { ...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"]}
|
|
@@ -16,4 +16,4 @@ const {
|
|
|
16
16
|
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/customize-widgets');
|
|
17
17
|
exports.unlock = unlock;
|
|
18
18
|
exports.lock = lock;
|
|
19
|
-
//# sourceMappingURL=
|
|
19
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/lock-unlock.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,8BAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/customize-widgets'\n\t);\n"]}
|
package/build/store/reducer.js
CHANGED
|
@@ -17,10 +17,7 @@ var _data = require("@wordpress/data");
|
|
|
17
17
|
* @param {boolean|Object} state
|
|
18
18
|
* @param {Object} action
|
|
19
19
|
*/
|
|
20
|
-
function blockInserterPanel() {
|
|
21
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
22
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
23
|
-
|
|
20
|
+
function blockInserterPanel(state = false, action) {
|
|
24
21
|
switch (action.type) {
|
|
25
22
|
case 'SET_IS_INSERTER_OPENED':
|
|
26
23
|
return action.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["blockInserterPanel","state","action","type","value"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["blockInserterPanel","state","action","type","value"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA;AAD+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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"]}
|
package/build/utils.js
CHANGED
|
@@ -43,8 +43,7 @@ function settingIdToWidgetId(settingId) {
|
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
function blockToWidget(block) {
|
|
47
|
-
let existingWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
46
|
+
function blockToWidget(block, existingWidget = null) {
|
|
48
47
|
let widget;
|
|
49
48
|
const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
|
|
50
49
|
|
|
@@ -64,7 +63,7 @@ function blockToWidget(block) {
|
|
|
64
63
|
|
|
65
64
|
widget = {
|
|
66
65
|
idBase: block.attributes.idBase,
|
|
67
|
-
instance: { ...
|
|
66
|
+
instance: { ...existingWidget?.instance,
|
|
68
67
|
// Required only for the customizer.
|
|
69
68
|
is_widget_customizer_js_value: true,
|
|
70
69
|
encoded_serialized_instance: encoded,
|
|
@@ -108,13 +107,12 @@ function blockToWidget(block) {
|
|
|
108
107
|
*/
|
|
109
108
|
|
|
110
109
|
|
|
111
|
-
function widgetToBlock(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
} = _ref;
|
|
110
|
+
function widgetToBlock({
|
|
111
|
+
id,
|
|
112
|
+
idBase,
|
|
113
|
+
number,
|
|
114
|
+
instance
|
|
115
|
+
}) {
|
|
118
116
|
let block;
|
|
119
117
|
const {
|
|
120
118
|
encoded_serialized_instance: encoded,
|
package/build/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":";;;;;;;;;AAIA;;AACA;;AALA;;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAA/B;AACA;;AAED,SAAOJ,SAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,aAAT,CAAwBC,KAAxB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":";;;;;;;;;AAIA;;AACA;;AALA;;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,C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,MAAAA;AAD0C,KAAnC,CAAR;AAGA;;AAED,SAAO,iCAAoBN,KAApB,EAA2BM,EAA3B,CAAP;AACA","sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -23,8 +22,8 @@ export default function BlockAppender(props) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}, [isBlocksListEmpty]);
|
|
26
|
-
return createElement(ButtonBlockAppender,
|
|
25
|
+
return createElement(ButtonBlockAppender, { ...props,
|
|
27
26
|
ref: ref
|
|
28
|
-
})
|
|
27
|
+
});
|
|
29
28
|
}
|
|
30
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"names":["useRef","useEffect","ButtonBlockAppender","store","blockEditorStore","useSelect","BlockAppender","props","ref","isBlocksListEmpty","select","getBlockCount","current","ownerDocument","activeElement","body","focus"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"names":["useRef","useEffect","ButtonBlockAppender","store","blockEditorStore","useSelect","BlockAppender","props","ref","isBlocksListEmpty","select","getBlockCount","current","ownerDocument","activeElement","body","focus"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SACCC,mBADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,eAAe,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC9C,QAAMC,GAAG,GAAGR,MAAM,EAAlB;AACA,QAAMS,iBAAiB,GAAGJ,SAAS,CAChCK,MAAF,IAAcA,MAAM,CAAEN,gBAAF,CAAN,CAA2BO,aAA3B,OAA+C,CAD3B,CAAnC,CAF8C,CAM9C;AACA;;AACAV,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKQ,iBAAiB,IAAID,GAAG,CAACI,OAA9B,EAAwC;AACvC,YAAM;AAAEC,QAAAA;AAAF,UAAoBL,GAAG,CAACI,OAA9B;;AAEA,UACC,CAAEC,aAAa,CAACC,aAAhB,IACAD,aAAa,CAACC,aAAd,KAAgCD,aAAa,CAACE,IAF/C,EAGE;AACDP,QAAAA,GAAG,CAACI,OAAJ,CAAYI,KAAZ;AACA;AACD;AACD,GAXQ,EAWN,CAAEP,iBAAF,CAXM,CAAT;AAaA,SAAO,cAAC,mBAAD,OAA0BF,KAA1B;AAAkC,IAAA,GAAG,EAAGC;AAAxC,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -10,15 +9,14 @@ import { MenuItem } from '@wordpress/components';
|
|
|
10
9
|
import { useSelect } from '@wordpress/data';
|
|
11
10
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
12
11
|
|
|
13
|
-
function BlockInspectorButton(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
12
|
+
function BlockInspectorButton({
|
|
13
|
+
inspector,
|
|
14
|
+
closeMenu,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
19
17
|
const selectedBlockClientId = useSelect(select => select(blockEditorStore).getSelectedBlockClientId(), []);
|
|
20
18
|
const selectedBlock = useMemo(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
|
|
21
|
-
return createElement(MenuItem,
|
|
19
|
+
return createElement(MenuItem, {
|
|
22
20
|
onClick: () => {
|
|
23
21
|
// Open the inspector.
|
|
24
22
|
inspector.open({
|
|
@@ -26,8 +24,9 @@ function BlockInspectorButton(_ref) {
|
|
|
26
24
|
}); // Then close the dropdown menu.
|
|
27
25
|
|
|
28
26
|
closeMenu();
|
|
29
|
-
}
|
|
30
|
-
|
|
27
|
+
},
|
|
28
|
+
...props
|
|
29
|
+
}, __('Show more settings'));
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
export default BlockInspectorButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"names":["useMemo","__","MenuItem","useSelect","store","blockEditorStore","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","getSelectedBlockClientId","selectedBlock","document","getElementById","open","returnFocusWhenClose"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"names":["useMemo","__","MenuItem","useSelect","store","blockEditorStore","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","getSelectedBlockClientId","selectedBlock","document","getElementById","open","returnFocusWhenClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;;AAEA,SAASC,oBAAT,CAA+B;AAAEC,EAAAA,SAAF;AAAaC,EAAAA,SAAb;AAAwB,KAAGC;AAA3B,CAA/B,EAAoE;AACnE,QAAMC,qBAAqB,GAAGP,SAAS,CACpCQ,MAAF,IAAcA,MAAM,CAAEN,gBAAF,CAAN,CAA2BO,wBAA3B,EADwB,EAEtC,EAFsC,CAAvC;AAKA,QAAMC,aAAa,GAAGb,OAAO,CAC5B,MAAMc,QAAQ,CAACC,cAAT,CAA0B,SAASL,qBAAuB,EAA1D,CADsB,EAE5B,CAAEA,qBAAF,CAF4B,CAA7B;AAKA,SACC,cAAC,QAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACf;AACAH,MAAAA,SAAS,CAACS,IAAV,CAAgB;AACfC,QAAAA,oBAAoB,EAAEJ;AADP,OAAhB,EAFe,CAKf;;AACAL,MAAAA,SAAS;AACT,KARF;AAAA,OASMC;AATN,KAWGR,EAAE,CAAE,oBAAF,CAXL,CADD;AAeA;;AAED,eAAeK,oBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"]}
|
|
@@ -15,12 +15,11 @@ import SidebarBlockEditor from '../sidebar-block-editor';
|
|
|
15
15
|
import FocusControl from '../focus-control';
|
|
16
16
|
import SidebarControls from '../sidebar-controls';
|
|
17
17
|
import useClearSelectedBlock from './use-clear-selected-block';
|
|
18
|
-
export default function CustomizeWidgets(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
18
|
+
export default function CustomizeWidgets({
|
|
19
|
+
api,
|
|
20
|
+
sidebarControls,
|
|
21
|
+
blockEditorSettings
|
|
22
|
+
}) {
|
|
24
23
|
const [activeSidebarControl, setActiveSidebarControl] = useState(null);
|
|
25
24
|
const parentContainer = document.getElementById('customize-theme-controls');
|
|
26
25
|
const popoverRef = useRef();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["useState","useEffect","useRef","createPortal","SlotFillProvider","Popover","ShortcutProvider","ErrorBoundary","SidebarBlockEditor","FocusControl","SidebarControls","useClearSelectedBlock","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,YAAtC,QAA0D,oBAA1D;AACA,SAASC,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,gBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/customize-widgets/index.js"],"names":["useState","useEffect","useRef","createPortal","SlotFillProvider","Popover","ShortcutProvider","ErrorBoundary","SidebarBlockEditor","FocusControl","SidebarControls","useClearSelectedBlock","CustomizeWidgets","api","sidebarControls","blockEditorSettings","activeSidebarControl","setActiveSidebarControl","parentContainer","document","getElementById","popoverRef","unsubscribers","map","sidebarControl","subscribe","expanded","forEach","unsubscriber","activeSidebar","id","sidebarAdapter","inserter","inspector","container","popover"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,EAAsCC,YAAtC,QAA0D,oBAA1D;AACA,SAASC,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,gBAAT,CAA2B;AACzCC,EAAAA,GADyC;AAEzCC,EAAAA,eAFyC;AAGzCC,EAAAA;AAHyC,CAA3B,EAIX;AACH,QAAM,CAAEC,oBAAF,EAAwBC,uBAAxB,IAAoDjB,QAAQ,CAAE,IAAF,CAAlE;AACA,QAAMkB,eAAe,GAAGC,QAAQ,CAACC,cAAT,CACvB,0BADuB,CAAxB;AAGA,QAAMC,UAAU,GAAGnB,MAAM,EAAzB;AAEAS,EAAAA,qBAAqB,CAAEK,oBAAF,EAAwBK,UAAxB,CAArB;AAEApB,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMqB,aAAa,GAAGR,eAAe,CAACS,GAAhB,CAAuBC,cAAF,IAC1CA,cAAc,CAACC,SAAf,CAA4BC,QAAF,IAAgB;AACzC,UAAKA,QAAL,EAAgB;AACfT,QAAAA,uBAAuB,CAAEO,cAAF,CAAvB;AACA;AACD,KAJD,CADqB,CAAtB;AAQA,WAAO,MAAM;AACZF,MAAAA,aAAa,CAACK,OAAd,CAAyBC,YAAF,IAAoBA,YAAY,EAAvD;AACA,KAFD;AAGA,GAZQ,EAYN,CAAEd,eAAF,CAZM,CAAT;AAcA,QAAMe,aAAa,GAClBb,oBAAoB,IACpBb,YAAY,CACX,cAAC,aAAD,QACC,cAAC,kBAAD;AACC,IAAA,GAAG,EAAGa,oBAAoB,CAACc,EAD5B;AAEC,IAAA,mBAAmB,EAAGf,mBAFvB;AAGC,IAAA,OAAO,EAAGC,oBAAoB,CAACe,cAHhC;AAIC,IAAA,QAAQ,EAAGf,oBAAoB,CAACgB,QAJjC;AAKC,IAAA,SAAS,EAAGhB,oBAAoB,CAACiB;AALlC,IADD,CADW,EAUXjB,oBAAoB,CAACkB,SAArB,CAAgC,CAAhC,CAVW,CAFb,CAvBG,CAsCH;AACA;;AACA,QAAMC,OAAO,GACZjB,eAAe,IACff,YAAY,CACX;AAAK,IAAA,SAAS,EAAC,2BAAf;AAA2C,IAAA,GAAG,EAAGkB;AAAjD,KACC,cAAC,OAAD,CAAS,IAAT,OADD,CADW,EAIXH,eAJW,CAFb;AASA,SACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,eAAD;AACC,IAAA,eAAe,EAAGJ,eADnB;AAEC,IAAA,oBAAoB,EAAGE;AAFxB,KAIC,cAAC,YAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,eAAe,EAAGC;AAFnB,KAIGe,aAJH,EAKGM,OALH,CAJD,CADD,CADD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useEffect, useRef, createPortal } from '@wordpress/element';\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundary from '../error-boundary';\nimport SidebarBlockEditor from '../sidebar-block-editor';\nimport FocusControl from '../focus-control';\nimport SidebarControls from '../sidebar-controls';\nimport useClearSelectedBlock from './use-clear-selected-block';\n\nexport default function CustomizeWidgets( {\n\tapi,\n\tsidebarControls,\n\tblockEditorSettings,\n} ) {\n\tconst [ activeSidebarControl, setActiveSidebarControl ] = useState( null );\n\tconst parentContainer = document.getElementById(\n\t\t'customize-theme-controls'\n\t);\n\tconst popoverRef = useRef();\n\n\tuseClearSelectedBlock( activeSidebarControl, popoverRef );\n\n\tuseEffect( () => {\n\t\tconst unsubscribers = sidebarControls.map( ( sidebarControl ) =>\n\t\t\tsidebarControl.subscribe( ( expanded ) => {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tsetActiveSidebarControl( sidebarControl );\n\t\t\t\t}\n\t\t\t} )\n\t\t);\n\n\t\treturn () => {\n\t\t\tunsubscribers.forEach( ( unsubscriber ) => unsubscriber() );\n\t\t};\n\t}, [ sidebarControls ] );\n\n\tconst activeSidebar =\n\t\tactiveSidebarControl &&\n\t\tcreatePortal(\n\t\t\t<ErrorBoundary>\n\t\t\t\t<SidebarBlockEditor\n\t\t\t\t\tkey={ activeSidebarControl.id }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\tsidebar={ activeSidebarControl.sidebarAdapter }\n\t\t\t\t\tinserter={ activeSidebarControl.inserter }\n\t\t\t\t\tinspector={ activeSidebarControl.inspector }\n\t\t\t\t/>\n\t\t\t</ErrorBoundary>,\n\t\t\tactiveSidebarControl.container[ 0 ]\n\t\t);\n\n\t// We have to portal this to the parent of both the editor and the inspector,\n\t// so that the popovers will appear above both of them.\n\tconst popover =\n\t\tparentContainer &&\n\t\tcreatePortal(\n\t\t\t<div className=\"customize-widgets-popover\" ref={ popoverRef }>\n\t\t\t\t<Popover.Slot />\n\t\t\t</div>,\n\t\t\tparentContainer\n\t\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<SidebarControls\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tactiveSidebarControl={ activeSidebarControl }\n\t\t\t\t>\n\t\t\t\t\t<FocusControl\n\t\t\t\t\t\tapi={ api }\n\t\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ activeSidebar }\n\t\t\t\t\t\t{ popover }\n\t\t\t\t\t</FocusControl>\n\t\t\t\t</SidebarControls>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
|
|
@@ -10,11 +10,10 @@ import { Warning } from '@wordpress/block-editor';
|
|
|
10
10
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
11
11
|
import { doAction } from '@wordpress/hooks';
|
|
12
12
|
|
|
13
|
-
function CopyButton(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
13
|
+
function CopyButton({
|
|
14
|
+
text,
|
|
15
|
+
children
|
|
16
|
+
}) {
|
|
18
17
|
const ref = useCopyToClipboard(text);
|
|
19
18
|
return createElement(Button, {
|
|
20
19
|
variant: "secondary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","ErrorBoundary","constructor","arguments","state","error","componentDidCatch","setState","render","props","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,QAAT,QAAyB,kBAAzB;;AAEA,SAASC,UAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/error-boundary/index.js"],"names":["Component","__","Button","Warning","useCopyToClipboard","doAction","CopyButton","text","children","ref","ErrorBoundary","constructor","arguments","state","error","componentDidCatch","setState","render","props","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,QAAT,QAAyB,kBAAzB;;AAEA,SAASC,UAAT,CAAqB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAArB,EAA0C;AACzC,QAAMC,GAAG,GAAGL,kBAAkB,CAAEG,IAAF,CAA9B;AACA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,eAAe,MAAME,aAAN,SAA4BV,SAA5B,CAAsC;AACpDW,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAEDC,EAAAA,iBAAiB,CAAED,KAAF,EAAU;AAC1B,SAAKE,QAAL,CAAe;AAAEF,MAAAA;AAAF,KAAf;AAEAT,IAAAA,QAAQ,CAAE,kCAAF,EAAsCS,KAAtC,CAAR;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEH,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKI,KAAL,CAAWV,QAAlB;AACA;;AAED,WACC,cAAC,OAAD;AACC,MAAA,SAAS,EAAC,kCADX;AAEC,MAAA,OAAO,EAAG,CACT,cAAC,UAAD;AAAY,QAAA,GAAG,EAAC,YAAhB;AAA6B,QAAA,IAAI,EAAGM,KAAK,CAACK;AAA1C,SACGlB,EAAE,CAAE,YAAF,CADL,CADS;AAFX,OAQGA,EAAE,CAAE,iDAAF,CARL,CADD;AAYA;;AAhCmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { doAction } from '@wordpress/hooks';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tcomponentDidCatch( error ) {\n\t\tthis.setState( { error } );\n\n\t\tdoAction( 'editor.ErrorBoundary.errorLogged', error );\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"customize-widgets-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"]}
|
|
@@ -10,12 +10,11 @@ import { createContext, useState, useEffect, useContext, useCallback, useMemo }
|
|
|
10
10
|
|
|
11
11
|
import { settingIdToWidgetId } from '../../utils';
|
|
12
12
|
const FocusControlContext = createContext();
|
|
13
|
-
export default function FocusControl(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} = _ref;
|
|
13
|
+
export default function FocusControl({
|
|
14
|
+
api,
|
|
15
|
+
sidebarControls,
|
|
16
|
+
children
|
|
17
|
+
}) {
|
|
19
18
|
const [focusedWidgetIdRef, setFocusedWidgetIdRef] = useState({
|
|
20
19
|
current: null
|
|
21
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"names":["createContext","useState","useEffect","useContext","useCallback","useMemo","settingIdToWidgetId","FocusControlContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","current","focusWidget","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","handleFocus","settingId","previewBound","handleReady","previewer","preview","bind","unbind","context","useFocusControl"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,QAFD,EAGCC,SAHD,EAICC,UAJD,EAKCC,WALD,EAMCC,OAND,QAOO,oBAPP;AASA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,aAApC;AAEA,MAAMC,mBAAmB,GAAGP,aAAa,EAAzC;AAEA,eAAe,SAASQ,YAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/index.js"],"names":["createContext","useState","useEffect","useContext","useCallback","useMemo","settingIdToWidgetId","FocusControlContext","FocusControl","api","sidebarControls","children","focusedWidgetIdRef","setFocusedWidgetIdRef","current","focusWidget","widgetId","sidebarControl","widgets","setting","get","includes","sectionInstance","expand","completeCallback","handleFocus","settingId","previewBound","handleReady","previewer","preview","bind","unbind","context","useFocusControl"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,QAFD,EAGCC,SAHD,EAICC,UAJD,EAKCC,WALD,EAMCC,OAND,QAOO,oBAPP;AASA;AACA;AACA;;AACA,SAASC,mBAAT,QAAoC,aAApC;AAEA,MAAMC,mBAAmB,GAAGP,aAAa,EAAzC;AAEA,eAAe,SAASQ,YAAT,CAAuB;AAAEC,EAAAA,GAAF;AAAOC,EAAAA,eAAP;AAAwBC,EAAAA;AAAxB,CAAvB,EAA4D;AAC1E,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgDZ,QAAQ,CAAE;AAC/Da,IAAAA,OAAO,EAAE;AADsD,GAAF,CAA9D;AA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AAMkB,OAAO,GAAG5B,OAAO,CACtB,MAAM,CAAEO,kBAAF,EAAsBG,WAAtB,CADgB,EAEtB,CAAEH,kBAAF,EAAsBG,WAAtB,CAFsB,CAAvB;AAKA,SACC,cAAC,mBAAD,CAAqB,QAArB;AAA8B,IAAA,KAAK,EAAGkB;AAAtC,KACGtB,QADH,CADD;AAKA;AAED,OAAO,MAAMuB,eAAe,GAAG,MAAM/B,UAAU,CAAEI,mBAAF,CAAxC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseState,\n\tuseEffect,\n\tuseContext,\n\tuseCallback,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { settingIdToWidgetId } from '../../utils';\n\nconst FocusControlContext = createContext();\n\nexport default function FocusControl( { api, sidebarControls, children } ) {\n\tconst [ focusedWidgetIdRef, setFocusedWidgetIdRef ] = useState( {\n\t\tcurrent: null,\n\t} );\n\n\tconst focusWidget = useCallback(\n\t\t( widgetId ) => {\n\t\t\tfor ( const sidebarControl of sidebarControls ) {\n\t\t\t\tconst widgets = sidebarControl.setting.get();\n\n\t\t\t\tif ( widgets.includes( widgetId ) ) {\n\t\t\t\t\tsidebarControl.sectionInstance.expand( {\n\t\t\t\t\t\t// Schedule it after the complete callback so that\n\t\t\t\t\t\t// it won't be overridden by the \"Back\" button focus.\n\t\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t\t// Create a \"ref-like\" object every time to ensure\n\t\t\t\t\t\t\t// the same widget id can also triggers the focus control.\n\t\t\t\t\t\t\tsetFocusedWidgetIdRef( { current: widgetId } );\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ sidebarControls ]\n\t);\n\n\tuseEffect( () => {\n\t\tfunction handleFocus( settingId ) {\n\t\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\tlet previewBound = false;\n\n\t\tfunction handleReady() {\n\t\t\tapi.previewer.preview.bind(\n\t\t\t\t'focus-control-for-setting',\n\t\t\t\thandleFocus\n\t\t\t);\n\t\t\tpreviewBound = true;\n\t\t}\n\n\t\tapi.previewer.bind( 'ready', handleReady );\n\n\t\treturn () => {\n\t\t\tapi.previewer.unbind( 'ready', handleReady );\n\t\t\tif ( previewBound ) {\n\t\t\t\tapi.previewer.preview.unbind(\n\t\t\t\t\t'focus-control-for-setting',\n\t\t\t\t\thandleFocus\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\t}, [ api, focusWidget ] );\n\n\tconst context = useMemo(\n\t\t() => [ focusedWidgetIdRef, focusWidget ],\n\t\t[ focusedWidgetIdRef, focusWidget ]\n\t);\n\n\treturn (\n\t\t<FocusControlContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</FocusControlContext.Provider>\n\t);\n}\n\nexport const useFocusControl = () => useContext( FocusControlContext );\n"]}
|
|
@@ -29,7 +29,7 @@ export default function useBlocksFocusControl(blocks) {
|
|
|
29
29
|
// We select the DOM and focus it manually here.
|
|
30
30
|
|
|
31
31
|
const blockNode = document.querySelector(`[data-block="${focusedBlock.clientId}"]`);
|
|
32
|
-
blockNode
|
|
32
|
+
blockNode?.focus();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}, [focusedWidgetIdRef, selectBlock]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/use-blocks-focus-control.js"],"names":["useRef","useEffect","useDispatch","store","blockEditorStore","getWidgetIdFromBlock","useFocusControl","useBlocksFocusControl","blocks","selectBlock","focusedWidgetIdRef","blocksRef","current","focusedBlock","find","block","clientId","blockNode","document","querySelector","focus"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,oBAAT,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,GAAhC;AAEA,eAAe,SAASC,qBAAT,CAAgCC,MAAhC,EAAyC;AACvD,QAAM;AAAEC,IAAAA;AAAF,MAAkBP,WAAW,CAAEE,gBAAF,CAAnC;AACA,QAAM,CAAEM,kBAAF,IAAyBJ,eAAe,EAA9C;AAEA,QAAMK,SAAS,GAAGX,MAAM,CAAEQ,MAAF,CAAxB;AAEAP,EAAAA,SAAS,CAAE,MAAM;AAChBU,IAAAA,SAAS,CAACC,OAAV,GAAoBJ,MAApB;AACA,GAFQ,EAEN,CAAEA,MAAF,CAFM,CAAT;AAIAP,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKS,kBAAkB,CAACE,OAAxB,EAAkC;AACjC,YAAMC,YAAY,GAAGF,SAAS,CAACC,OAAV,CAAkBE,IAAlB,CAClBC,KAAF,IACCV,oBAAoB,CAAEU,KAAF,CAApB,KAAkCL,kBAAkB,CAACE,OAFlC,CAArB;;AAKA,UAAKC,YAAL,EAAoB;AACnBJ,QAAAA,WAAW,CAAEI,YAAY,CAACG,QAAf,CAAX,CADmB,CAEnB;AACA;AACA;;AACA,cAAMC,SAAS,GAAGC,QAAQ,CAACC,aAAT,CAChB,gBAAgBN,YAAY,CAACG,QAAU,IADvB,CAAlB;AAGAC,QAAAA,SAAS,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/focus-control/use-blocks-focus-control.js"],"names":["useRef","useEffect","useDispatch","store","blockEditorStore","getWidgetIdFromBlock","useFocusControl","useBlocksFocusControl","blocks","selectBlock","focusedWidgetIdRef","blocksRef","current","focusedBlock","find","block","clientId","blockNode","document","querySelector","focus"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,oBAAT,QAAqC,oBAArC;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,GAAhC;AAEA,eAAe,SAASC,qBAAT,CAAgCC,MAAhC,EAAyC;AACvD,QAAM;AAAEC,IAAAA;AAAF,MAAkBP,WAAW,CAAEE,gBAAF,CAAnC;AACA,QAAM,CAAEM,kBAAF,IAAyBJ,eAAe,EAA9C;AAEA,QAAMK,SAAS,GAAGX,MAAM,CAAEQ,MAAF,CAAxB;AAEAP,EAAAA,SAAS,CAAE,MAAM;AAChBU,IAAAA,SAAS,CAACC,OAAV,GAAoBJ,MAApB;AACA,GAFQ,EAEN,CAAEA,MAAF,CAFM,CAAT;AAIAP,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKS,kBAAkB,CAACE,OAAxB,EAAkC;AACjC,YAAMC,YAAY,GAAGF,SAAS,CAACC,OAAV,CAAkBE,IAAlB,CAClBC,KAAF,IACCV,oBAAoB,CAAEU,KAAF,CAApB,KAAkCL,kBAAkB,CAACE,OAFlC,CAArB;;AAKA,UAAKC,YAAL,EAAoB;AACnBJ,QAAAA,WAAW,CAAEI,YAAY,CAACG,QAAf,CAAX,CADmB,CAEnB;AACA;AACA;;AACA,cAAMC,SAAS,GAAGC,QAAQ,CAACC,aAAT,CAChB,gBAAgBN,YAAY,CAACG,QAAU,IADvB,CAAlB;AAGAC,QAAAA,SAAS,EAAEG,KAAX;AACA;AACD;AACD,GAlBQ,EAkBN,CAAEV,kBAAF,EAAsBD,WAAtB,CAlBM,CAAT;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { useFocusControl } from '.';\n\nexport default function useBlocksFocusControl( blocks ) {\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst [ focusedWidgetIdRef ] = useFocusControl();\n\n\tconst blocksRef = useRef( blocks );\n\n\tuseEffect( () => {\n\t\tblocksRef.current = blocks;\n\t}, [ blocks ] );\n\n\tuseEffect( () => {\n\t\tif ( focusedWidgetIdRef.current ) {\n\t\t\tconst focusedBlock = blocksRef.current.find(\n\t\t\t\t( block ) =>\n\t\t\t\t\tgetWidgetIdFromBlock( block ) === focusedWidgetIdRef.current\n\t\t\t);\n\n\t\t\tif ( focusedBlock ) {\n\t\t\t\tselectBlock( focusedBlock.clientId );\n\t\t\t\t// If the block is already being selected, the DOM node won't\n\t\t\t\t// get focused again automatically.\n\t\t\t\t// We select the DOM and focus it manually here.\n\t\t\t\tconst blockNode = document.querySelector(\n\t\t\t\t\t`[data-block=\"${ focusedBlock.clientId }\"]`\n\t\t\t\t);\n\t\t\t\tblockNode?.focus();\n\t\t\t}\n\t\t}\n\t}, [ focusedWidgetIdRef, selectBlock ] );\n}\n"]}
|
|
@@ -21,14 +21,13 @@ import { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';
|
|
|
21
21
|
import Inserter from '../inserter';
|
|
22
22
|
import MoreMenu from '../more-menu';
|
|
23
23
|
|
|
24
|
-
function Header(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = _ref;
|
|
24
|
+
function Header({
|
|
25
|
+
sidebar,
|
|
26
|
+
inserter,
|
|
27
|
+
isInserterOpened,
|
|
28
|
+
setIsInserterOpened,
|
|
29
|
+
isFixedToolbarActive
|
|
30
|
+
}) {
|
|
32
31
|
const [[hasUndo, hasRedo], setUndoRedo] = useState([sidebar.hasUndo(), sidebar.hasRedo()]);
|
|
33
32
|
const shortcut = isAppleOS() ? displayShortcut.primaryShift('z') : displayShortcut.primary('y');
|
|
34
33
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"names":["classnames","createPortal","useState","useEffect","__","_x","isRTL","ToolbarButton","NavigableToolbar","displayShortcut","isAppleOS","plus","undo","undoIcon","redo","redoIcon","Inserter","MoreMenu","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","shortcut","primaryShift","primary","subscribeHistory","isOpen","contentContainer"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,QAAkD,oBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,KAAjB,QAA8B,iBAA9B;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,gBAAT,QAAiC,yBAAjC;AACA,SAASC,eAAT,EAA0BC,SAA1B,QAA2C,qBAA3C;AACA,SAASC,IAAT,EAAeC,IAAI,IAAIC,QAAvB,EAAiCC,IAAI,IAAIC,QAAzC,QAAyD,kBAAzD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,QAAP,MAAqB,cAArB;;AAEA,SAASC,MAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/header/index.js"],"names":["classnames","createPortal","useState","useEffect","__","_x","isRTL","ToolbarButton","NavigableToolbar","displayShortcut","isAppleOS","plus","undo","undoIcon","redo","redoIcon","Inserter","MoreMenu","Header","sidebar","inserter","isInserterOpened","setIsInserterOpened","isFixedToolbarActive","hasUndo","hasRedo","setUndoRedo","shortcut","primaryShift","primary","subscribeHistory","isOpen","contentContainer"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,QAAkD,oBAAlD;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,KAAjB,QAA8B,iBAA9B;AACA,SAASC,aAAT,QAA8B,uBAA9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B;AAFD;AAGC,IAAA,KAAK,EAAGX,EAAE,CAAE,MAAF,CAHX;AAIC,IAAA,QAAQ,EAAGK,eAAe,CAACoB,OAAhB,CAAyB,GAAzB,CAJZ,CAKC;AACA;AACA;AAPD;AAQC,qBAAgB,CAAEL,OARnB;AASC,IAAA,OAAO,EAAGL,OAAO,CAACP,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAJD,EAgBC,cAAC,aAAD;AACC,IAAA,IAAI,EAAG,CAAEN,KAAK,EAAP,GAAYS,QAAZ,GAAuBF;AAC9B;AAFD;AAGC,IAAA,KAAK,EAAGT,EAAE,CAAE,MAAF,CAHX;AAIC,IAAA,QAAQ,EAAGuB,QAJZ,CAKC;AACA;AACA;AAPD;AAQC,qBAAgB,CAAEF,OARnB;AASC,IAAA,OAAO,EAAGN,OAAO,CAACL,IATnB;AAUC,IAAA,SAAS,EAAC;AAVX,IAhBD,EA6BC,cAAC,aAAD;AACC,IAAA,SAAS,EAAC,mDADX;AAEC,IAAA,SAAS,EAAGO,gBAFb;AAGC,IAAA,OAAO,EAAC,SAHT;AAIC,IAAA,IAAI,EAAGV,IAJR;AAKC,IAAA,KAAK,EAAGN,EAAE,CACT,WADS,EAET,yCAFS,CALX;AASC,IAAA,OAAO,EAAG,MAAM;AACfiB,MAAAA,mBAAmB,CAAIS,MAAF,IAAc,CAAEA,MAAlB,CAAnB;AACA;AAXF,IA7BD,EA0CC,cAAC,QAAD,OA1CD,CALD,CADD,EAoDG9B,YAAY,CACb,cAAC,QAAD;AAAU,IAAA,WAAW,EAAGqB;AAAxB,IADa,EAEbF,QAAQ,CAACY,gBAAT,CAA2B,CAA3B,CAFa,CApDf,CADD;AA2DA;;AAED,eAAed,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createPortal, useState, useEffect } from '@wordpress/element';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { plus, undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Inserter from '../inserter';\nimport MoreMenu from '../more-menu';\n\nfunction Header( {\n\tsidebar,\n\tinserter,\n\tisInserterOpened,\n\tsetIsInserterOpened,\n\tisFixedToolbarActive,\n} ) {\n\tconst [ [ hasUndo, hasRedo ], setUndoRedo ] = useState( [\n\t\tsidebar.hasUndo(),\n\t\tsidebar.hasRedo(),\n\t] );\n\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tuseEffect( () => {\n\t\treturn sidebar.subscribeHistory( () => {\n\t\t\tsetUndoRedo( [ sidebar.hasUndo(), sidebar.hasRedo() ] );\n\t\t} );\n\t}, [ sidebar ] );\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'customize-widgets-header', {\n\t\t\t\t\t'is-fixed-toolbar-active': isFixedToolbarActive,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<NavigableToolbar\n\t\t\t\t\tclassName=\"customize-widgets-header-toolbar\"\n\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Undo' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasUndo }\n\t\t\t\t\t\tonClick={ sidebar.undo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button undo-button\"\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'Redo' ) }\n\t\t\t\t\t\tshortcut={ shortcut }\n\t\t\t\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\t\t\t\taria-disabled={ ! hasRedo }\n\t\t\t\t\t\tonClick={ sidebar.redo }\n\t\t\t\t\t\tclassName=\"customize-widgets-editor-history-button redo-button\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tclassName=\"customize-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\tisPressed={ isInserterOpened }\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t'Add block',\n\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsInserterOpened( ( isOpen ) => ! isOpen );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</NavigableToolbar>\n\t\t\t</div>\n\n\t\t\t{ createPortal(\n\t\t\t\t<Inserter setIsOpened={ setIsInserterOpened } />,\n\t\t\t\tinserter.contentContainer[ 0 ]\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Header;\n"]}
|
|
@@ -15,10 +15,9 @@ import { closeSmall } from '@wordpress/icons';
|
|
|
15
15
|
|
|
16
16
|
import { store as customizeWidgetsStore } from '../../store';
|
|
17
17
|
|
|
18
|
-
function Inserter(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} = _ref;
|
|
18
|
+
function Inserter({
|
|
19
|
+
setIsOpened
|
|
20
|
+
}) {
|
|
22
21
|
const inserterTitleId = useInstanceId(Inserter, 'customize-widget-layout__inserter-panel-title');
|
|
23
22
|
const insertionPoint = useSelect(select => select(customizeWidgetsStore).__experimentalGetInsertionPoint(), []);
|
|
24
23
|
return createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["__","__experimentalLibrary","Library","Button","useInstanceId","useSelect","closeSmall","store","customizeWidgetsStore","Inserter","setIsOpened","inserterTitleId","insertionPoint","select","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;;AAEA,SAASC,QAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/inserter/index.js"],"names":["__","__experimentalLibrary","Library","Button","useInstanceId","useSelect","closeSmall","store","customizeWidgetsStore","Inserter","setIsOpened","inserterTitleId","insertionPoint","select","__experimentalGetInsertionPoint","rootClientId","insertionIndex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,qBAAlB,QAA+C,aAA/C;;AAEA,SAASC,QAAT,CAAmB;AAAEC,EAAAA;AAAF,CAAnB,EAAqC;AACpC,QAAMC,eAAe,GAAGP,aAAa,CACpCK,QADoC,EAEpC,+CAFoC,CAArC;AAIA,QAAMG,cAAc,GAAGP,SAAS,CAC7BQ,MAAF,IACCA,MAAM,CAAEL,qBAAF,CAAN,CAAgCM,+BAAhC,EAF8B,EAG/B,EAH+B,CAAhC;AAMA,SACC;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,uBAAkBH;AAFnB,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AACC,IAAA,EAAE,EAAGA,eADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGX,EAAE,CAAE,aAAF,CAJL,CADD,EAOC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,8DADX;AAEC,IAAA,IAAI,EAAGM,UAFR;AAGC,IAAA,OAAO,EAAG,MAAMI,WAAW,CAAE,KAAF,CAH5B;AAIC,kBAAaV,EAAE,CAAE,gBAAF;AAJhB,IAPD,CAJD,EAkBC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,YAAY,EAAGY,cAAc,CAACG,YAD/B;AAEC,IAAA,4BAA4B,EAC3BH,cAAc,CAACI,cAHjB;AAKC,IAAA,qBAAqB,MALtB;AAMC,IAAA,QAAQ,EAAG,MAAMN,WAAW,CAAE,KAAF;AAN7B,IADD,CAlBD,CADD;AA+BA;;AAED,eAAeD,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as customizeWidgetsStore } from '../../store';\n\nfunction Inserter( { setIsOpened } ) {\n\tconst inserterTitleId = useInstanceId(\n\t\tInserter,\n\t\t'customize-widget-layout__inserter-panel-title'\n\t);\n\tconst insertionPoint = useSelect(\n\t\t( select ) =>\n\t\t\tselect( customizeWidgetsStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"customize-widgets-layout__inserter-panel\"\n\t\t\taria-labelledby={ inserterTitleId }\n\t\t>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-header\">\n\t\t\t\t<h2\n\t\t\t\t\tid={ inserterTitleId }\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-title\"\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Add a block' ) }\n\t\t\t\t</h2>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"customize-widgets-layout__inserter-panel-header-close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tonClick={ () => setIsOpened( false ) }\n\t\t\t\t\taria-label={ __( 'Close inserter' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"customize-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tonSelect={ () => setIsOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default Inserter;\n"]}
|
|
@@ -11,10 +11,9 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
11
11
|
|
|
12
12
|
import Shortcut from './shortcut';
|
|
13
13
|
|
|
14
|
-
function DynamicShortcut(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
14
|
+
function DynamicShortcut({
|
|
15
|
+
name
|
|
16
|
+
}) {
|
|
18
17
|
const {
|
|
19
18
|
keyCombination,
|
|
20
19
|
description,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,eAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"names":["useSelect","store","keyboardShortcutsStore","Shortcut","DynamicShortcut","name","keyCombination","description","aliases","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,sBAAlB,QAAgD,+BAAhD;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,eAAT,CAA0B;AAAEC,EAAAA;AAAF,CAA1B,EAAqC;AACpC,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,WAAlB;AAA+BC,IAAAA;AAA/B,MAA2CR,SAAS,CACvDS,MAAF,IAAc;AACb,UAAM;AACLC,MAAAA,yBADK;AAELC,MAAAA,sBAFK;AAGLC,MAAAA;AAHK,QAIFH,MAAM,CAAEP,sBAAF,CAJV;AAMA,WAAO;AACNI,MAAAA,cAAc,EAAEI,yBAAyB,CAAEL,IAAF,CADnC;AAENG,MAAAA,OAAO,EAAEI,kBAAkB,CAAEP,IAAF,CAFrB;AAGNE,MAAAA,WAAW,EAAEI,sBAAsB,CAAEN,IAAF;AAH7B,KAAP;AAKA,GAbwD,EAczD,CAAEA,IAAF,CAdyD,CAA1D;;AAiBA,MAAK,CAAEC,cAAP,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,QAAD;AACC,IAAA,cAAc,EAAGA,cADlB;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,OAAO,EAAGC;AAHX,IADD;AAOA;;AAED,eAAeJ,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"]}
|