@wordpress/edit-widgets 5.16.0 → 5.17.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/CHANGELOG.md +2 -0
- package/build/blocks/widget-area/edit/index.js +4 -16
- package/build/blocks/widget-area/edit/index.js.map +1 -1
- package/build/blocks/widget-area/edit/inner-blocks.js +5 -10
- package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build/blocks/widget-area/edit/use-is-dragging-within.js +5 -10
- package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build/blocks/widget-area/index.js +0 -5
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/error-boundary/index.js +1 -15
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/header/index.js +9 -32
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +3 -9
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +3 -9
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -9
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +4 -20
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -6
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -18
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +2 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/interface.js +5 -21
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/layout/unsaved-changes-warning.js +0 -6
- package/build/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build/components/more-menu/index.js +2 -17
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +1 -5
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/notices/index.js +1 -6
- package/build/components/notices/index.js.map +1 -1
- package/build/components/save-button/index.js +1 -7
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +1 -10
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +1 -11
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -15
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +12 -26
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/widget-areas.js +1 -12
- package/build/components/sidebar/widget-areas.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -12
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +1 -8
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +8 -23
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/constants.js.map +1 -1
- package/build/filters/index.js +0 -1
- package/build/filters/index.js.map +1 -1
- package/build/filters/move-to-widget-area.js +3 -9
- package/build/filters/move-to-widget-area.js.map +1 -1
- package/build/filters/replace-media-upload.js +1 -3
- package/build/filters/replace-media-upload.js.map +1 -1
- package/build/hooks/use-last-selected-widget-area.js +5 -13
- package/build/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build/hooks/use-widget-library-insertion-point.js +6 -14
- package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build/index.js +6 -34
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +41 -79
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +0 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +4 -15
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +4 -16
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +1 -17
- package/build/store/resolvers.js.map +1 -1
- package/build/store/selectors.js +28 -49
- package/build/store/selectors.js.map +1 -1
- package/build/store/transformers.js +7 -16
- package/build/store/transformers.js.map +1 -1
- package/build/store/utils.js +7 -16
- package/build/store/utils.js.map +1 -1
- package/build-module/blocks/widget-area/edit/index.js +5 -8
- package/build-module/blocks/widget-area/edit/index.js.map +1 -1
- package/build-module/blocks/widget-area/edit/inner-blocks.js +6 -6
- package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +6 -9
- package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -1
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +0 -9
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/header/index.js +9 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +2 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +2 -2
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -6
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +5 -13
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -5
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -10
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +2 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/interface.js +5 -9
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/layout/unsaved-changes-warning.js +2 -3
- package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
- package/build-module/components/more-menu/index.js +2 -6
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +0 -3
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/notices/index.js +0 -3
- package/build-module/components/notices/index.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +1 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +1 -2
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -7
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +13 -18
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/widget-areas.js +1 -4
- package/build-module/components/sidebar/widget-areas.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -7
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +1 -2
- package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-provider/index.js +8 -7
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/constants.js.map +1 -1
- package/build-module/filters/index.js.map +1 -1
- package/build-module/filters/move-to-widget-area.js +4 -4
- package/build-module/filters/move-to-widget-area.js.map +1 -1
- package/build-module/filters/replace-media-upload.js +0 -2
- package/build-module/filters/replace-media-upload.js.map +1 -1
- package/build-module/hooks/use-last-selected-widget-area.js +7 -9
- package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
- package/build-module/hooks/use-widget-library-insertion-point.js +6 -10
- package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
- package/build-module/index.js +8 -20
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +43 -56
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js +6 -6
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +5 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +3 -10
- package/build-module/store/resolvers.js.map +1 -1
- package/build-module/store/selectors.js +29 -38
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/transformers.js +8 -13
- package/build-module/store/transformers.js.map +1 -1
- package/build-module/store/utils.js +7 -7
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +14 -8
- package/build-style/style.css +14 -8
- package/package.json +28 -27
- package/src/components/widget-areas-block-editor-provider/index.js +3 -3
- package/src/index.js +0 -1
- package/src/store/selectors.js +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__","useEffect","useSelect","store","editWidgetsStore","UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n *\n * This is a duplicate of the component implemented in the editor package.\n * Duplicated here as edit-widgets doesn't depend on editor.\n *\n * @return {WPComponent} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas } = select( editWidgetsStore );\n\t\tconst editedWidgetAreas = getEditedWidgetAreas();\n\n\t\treturn editedWidgetAreas?.length > 0;\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\tif ( isDirty ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ isDirty ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC/C,MAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACxC,MAAM;MAAEC;IAAqB,CAAC,GAAGD,MAAM,CAAEH,gBAAiB,CAAC;IAC3D,MAAMK,iBAAiB,GAAGD,oBAAoB,CAAC,CAAC;IAEhD,OAAOC,iBAAiB,EAAEC,MAAM,GAAG,CAAC;EACrC,CAAC,EAAE,EAAG,CAAC;EAEPT,SAAS,CAAE,MAAM;IAChB;AACF;AACA;AACA;AACA;AACA;AACA;IACE,MAAMU,oBAAoB,GAAKC,KAAK,IAAM;MACzC,IAAKN,OAAO,EAAG;QACdM,KAAK,CAACC,WAAW,GAAGb,EAAE,CACrB,8DACD,CAAC;QACD,OAAOY,KAAK,CAACC,WAAW;MACzB;IACD,CAAC;IAEDC,MAAM,CAACC,gBAAgB,CAAE,cAAc,EAAEJ,oBAAqB,CAAC;IAE/D,OAAO,MAAM;MACZG,MAAM,CAACE,mBAAmB,CAAE,cAAc,EAAEL,oBAAqB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,CAAEL,OAAO,CAAG,CAAC;EAEhB,OAAO,IAAI;AACZ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -12,17 +11,15 @@ import { PreferenceToggleMenuItem } from '@wordpress/preferences';
|
|
|
12
11
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
13
12
|
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
14
13
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
|
+
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
import KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';
|
|
20
19
|
import ToolsMoreMenuGroup from './tools-more-menu-group';
|
|
21
20
|
export default function MoreMenu() {
|
|
22
21
|
const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = useState(false);
|
|
23
|
-
|
|
24
22
|
const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive);
|
|
25
|
-
|
|
26
23
|
useShortcut('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal);
|
|
27
24
|
const isLargeViewport = useViewportMatch('medium');
|
|
28
25
|
return createElement(Fragment, null, createElement(MoreMenuDropdown, null, onClose => createElement(Fragment, null, isLargeViewport && createElement(MenuGroup, {
|
|
@@ -53,8 +50,7 @@ export default function MoreMenu() {
|
|
|
53
50
|
rel: "noopener noreferrer"
|
|
54
51
|
}, __('Help'), createElement(VisuallyHidden, {
|
|
55
52
|
as: "span"
|
|
56
|
-
},
|
|
57
|
-
/* translators: accessibility text */
|
|
53
|
+
}, /* translators: accessibility text */
|
|
58
54
|
__('(opens in a new tab)'))), createElement(ToolsMoreMenuGroup.Slot, {
|
|
59
55
|
fillProps: {
|
|
60
56
|
onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["MenuGroup","MenuItem","VisuallyHidden","useState","__","_x","external","MoreMenuDropdown","PreferenceToggleMenuItem","displayShortcut","useShortcut","useViewportMatch","KeyboardShortcutHelpModal","ToolsMoreMenuGroup","MoreMenu","isKeyboardShortcutsModalActive","setIsKeyboardShortcutsModalVisible","toggleKeyboardShortcutsModal","isLargeViewport","createElement","Fragment","onClose","label","scope","name","info","messageActivated","messageDeactivated","onClick","shortcut","access","role","icon","href","target","rel","as","Slot","fillProps","isModalActive","toggleModal"],"sources":["@wordpress/edit-widgets/src/components/more-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external } from '@wordpress/icons';\nimport { MoreMenuDropdown } from '@wordpress/interface';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/edit-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\treturn (\n\t\t<>\n\t\t\t<MoreMenuDropdown>\n\t\t\t\t{ ( onClose ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"welcomeGuide\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"themeStyles\"\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</MoreMenuDropdown>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcuts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,aAAA,CAACX,wBAAwB;IACxBe,KAAK,EAAC,mBAAmB;IACzBC,IAAI,EAAC,aAAa;IAClBC,IAAI,EAAGrB,EAAE,CACR,uCACD,CAAG;IACHkB,KAAK,EAAGlB,EAAE,CAAE,kBAAmB;EAAG,CAClC,CAAC,EACAc,eAAe,IAChBC,aAAA,CAACX,wBAAwB;IACxBe,KAAK,EAAC,mBAAmB;IACzBC,IAAI,EAAC,sBAAsB;IAC3BF,KAAK,EAAGlB,EAAE,CAAE,2BAA4B,CAAG;IAC3CqB,IAAI,EAAGrB,EAAE,CACR,sDACD,CAAG;IACHsB,gBAAgB,EAAGtB,EAAE,CACpB,qCACD,CAAG;IACHuB,kBAAkB,EAAGvB,EAAE,CACtB,uCACD;EAAG,CACH,CAEQ,CACV,CAEc,CAAC,EACnBe,aAAA,CAACP,yBAAyB;IACzB2B,aAAa,EAAGxB,8BAAgC;IAChDyB,WAAW,EAAGvB;EAA8B,CAC5C,CACA,CAAC;AAEL"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -8,12 +7,10 @@ const {
|
|
|
8
7
|
Fill: ToolsMoreMenuGroup,
|
|
9
8
|
Slot
|
|
10
9
|
} = createSlotFill('EditWidgetsToolsMoreMenuGroup');
|
|
11
|
-
|
|
12
10
|
ToolsMoreMenuGroup.Slot = ({
|
|
13
11
|
fillProps
|
|
14
12
|
}) => createElement(Slot, {
|
|
15
13
|
fillProps: fillProps
|
|
16
14
|
}, fills => fills.length > 0 && fills);
|
|
17
|
-
|
|
18
15
|
export default ToolsMoreMenuGroup;
|
|
19
16
|
//# sourceMappingURL=tools-more-menu-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["createSlotFill","Fill","ToolsMoreMenuGroup","Slot","fillProps","createElement","fills","length"],"sources":["@wordpress/edit-widgets/src/components/more-menu/tools-more-menu-group.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(\n\t'EditWidgetsToolsMoreMenuGroup'\n);\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) => fills.length > 0 && fills }\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,uBAAuB;AAEtD,MAAM;EAAEC,IAAI,EAAEC,kBAAkB;EAAEC;AAAK,CAAC,GAAGH,cAAc,CACxD,+BACD,CAAC;AAEDE,kBAAkB,CAACC,IAAI,GAAG,CAAE;EAAEC;AAAU,CAAC,KACxCC,aAAA,CAACF,IAAI;EAACC,SAAS,EAAGA;AAAW,GACxBE,KAAK,IAAMA,KAAK,CAACC,MAAM,GAAG,CAAC,IAAID,KAC9B,CACN;AAED,eAAeJ,kBAAkB"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { NoticeList, SnackbarList } from '@wordpress/components';
|
|
7
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
7
|
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
-
|
|
10
8
|
function Notices() {
|
|
11
9
|
const {
|
|
12
10
|
removeNotice
|
|
@@ -42,6 +40,5 @@ function Notices() {
|
|
|
42
40
|
onRemove: removeNotice
|
|
43
41
|
}));
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
export default Notices;
|
|
47
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["NoticeList","SnackbarList","useSelect","useDispatch","store","noticesStore","Notices","removeNotice","notices","select","getNotices","dismissibleNotices","filter","isDismissible","type","nonDismissibleNotices","snackbarNotices","createElement","Fragment","className","onRemove"],"sources":["@wordpress/edit-widgets/src/components/notices/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { NoticeList, SnackbarList } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nfunction Notices() {\n\tconst { removeNotice } = useDispatch( noticesStore );\n\tconst { notices } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tnotices: select( noticesStore ).getNotices(),\n\t\t};\n\t}, [] );\n\n\tconst dismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => isDismissible && type === 'default'\n\t);\n\tconst nonDismissibleNotices = notices.filter(\n\t\t( { isDismissible, type } ) => ! isDismissible && type === 'default'\n\t);\n\tconst snackbarNotices = notices.filter(\n\t\t( { type } ) => type === 'snackbar'\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ nonDismissibleNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__pinned\"\n\t\t\t/>\n\t\t\t<NoticeList\n\t\t\t\tnotices={ dismissibleNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__dismissible\"\n\t\t\t\tonRemove={ removeNotice }\n\t\t\t/>\n\t\t\t<SnackbarList\n\t\t\t\tnotices={ snackbarNotices }\n\t\t\t\tclassName=\"edit-widgets-notices__snackbar\"\n\t\t\t\tonRemove={ removeNotice }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default Notices;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,YAAY,QAAQ,uBAAuB;AAChE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,YAAY,QAAQ,oBAAoB;AAE1D,SAASC,OAAOA,CAAA,EAAG;EAClB,MAAM;IAAEC;EAAa,CAAC,GAAGJ,WAAW,CAAEE,YAAa,CAAC;EACpD,MAAM;IAAEG;EAAQ,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IAC5C,OAAO;MACND,OAAO,EAAEC,MAAM,CAAEJ,YAAa,CAAC,CAACK,UAAU,CAAC;IAC5C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,kBAAkB,GAAGH,OAAO,CAACI,MAAM,CACxC,CAAE;IAAEC,aAAa;IAAEC;EAAK,CAAC,KAAMD,aAAa,IAAIC,IAAI,KAAK,SAC1D,CAAC;EACD,MAAMC,qBAAqB,GAAGP,OAAO,CAACI,MAAM,CAC3C,CAAE;IAAEC,aAAa;IAAEC;EAAK,CAAC,KAAM,CAAED,aAAa,IAAIC,IAAI,KAAK,SAC5D,CAAC;EACD,MAAME,eAAe,GAAGR,OAAO,CAACI,MAAM,CACrC,CAAE;IAAEE;EAAK,CAAC,KAAMA,IAAI,KAAK,UAC1B,CAAC;EAED,OACCG,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACjB,UAAU;IACVQ,OAAO,EAAGO,qBAAuB;IACjCI,SAAS,EAAC;EAA8B,CACxC,CAAC,EACFF,aAAA,CAACjB,UAAU;IACVQ,OAAO,EAAGG,kBAAoB;IAC9BQ,SAAS,EAAC,mCAAmC;IAC7CC,QAAQ,EAAGb;EAAc,CACzB,CAAC,EACFU,aAAA,CAAChB,YAAY;IACZO,OAAO,EAAGQ,eAAiB;IAC3BG,SAAS,EAAC,gCAAgC;IAC1CC,QAAQ,EAAGb;EAAc,CACzB,CACA,CAAC;AAEL;AAEA,eAAeD,OAAO"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
6
5
|
import { Button } from '@wordpress/components';
|
|
7
6
|
import { __ } from '@wordpress/i18n';
|
|
8
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
12
|
import { store as editWidgetsStore } from '../../store';
|
|
14
|
-
|
|
15
13
|
function SaveButton() {
|
|
16
14
|
const {
|
|
17
15
|
hasEditedWidgetAreaIds,
|
|
@@ -37,6 +35,5 @@ function SaveButton() {
|
|
|
37
35
|
disabled: !hasEditedWidgetAreaIds
|
|
38
36
|
}, isSaving ? __('Saving…') : __('Update'));
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
export default SaveButton;
|
|
42
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Button","__","useDispatch","useSelect","store","editWidgetsStore","SaveButton","hasEditedWidgetAreaIds","isSaving","select","getEditedWidgetAreas","isSavingWidgetAreas","length","saveEditedWidgetAreas","createElement","variant","isBusy","onClick","undefined","disabled"],"sources":["@wordpress/edit-widgets/src/components/save-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nfunction SaveButton() {\n\tconst { hasEditedWidgetAreaIds, isSaving } = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas, isSavingWidgetAreas } =\n\t\t\tselect( editWidgetsStore );\n\n\t\treturn {\n\t\t\thasEditedWidgetAreaIds: getEditedWidgetAreas()?.length > 0,\n\t\t\tisSaving: isSavingWidgetAreas(),\n\t\t};\n\t}, [] );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\treturn (\n\t\t<Button\n\t\t\tvariant=\"primary\"\n\t\t\tisBusy={ isSaving }\n\t\t\taria-disabled={ isSaving }\n\t\t\tonClick={ isSaving ? undefined : saveEditedWidgetAreas }\n\t\t\tdisabled={ ! hasEditedWidgetAreaIds }\n\t\t>\n\t\t\t{ isSaving ? __( 'Saving…' ) : __( 'Update' ) }\n\t\t</Button>\n\t);\n}\n\nexport default SaveButton;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,SAASC,UAAUA,CAAA,EAAG;EACrB,MAAM;IAAEC,sBAAsB;IAAEC;EAAS,CAAC,GAAGL,SAAS,CAAIM,MAAM,IAAM;IACrE,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAEJ,gBAAiB,CAAC;IAE3B,OAAO;MACNE,sBAAsB,EAAEG,oBAAoB,CAAC,CAAC,EAAEE,MAAM,GAAG,CAAC;MAC1DJ,QAAQ,EAAEG,mBAAmB,CAAC;IAC/B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEE;EAAsB,CAAC,GAAGX,WAAW,CAAEG,gBAAiB,CAAC;EAEjE,OACCS,aAAA,CAACd,MAAM;IACNe,OAAO,EAAC,SAAS;IACjBC,MAAM,EAAGR,QAAU;IACnB,iBAAgBA,QAAU;IAC1BS,OAAO,EAAGT,QAAQ,GAAGU,SAAS,GAAGL,qBAAuB;IACxDM,QAAQ,EAAG,CAAEZ;EAAwB,GAEnCC,QAAQ,GAAGP,EAAE,CAAE,SAAU,CAAC,GAAGA,EAAE,CAAE,QAAS,CACrC,CAAC;AAEX;AAEA,eAAeK,UAAU"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -7,12 +6,11 @@ import { useSelect } from '@wordpress/data';
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
9
|
import { store as editWidgetsStore } from '../../store';
|
|
10
|
+
|
|
12
11
|
/**
|
|
13
12
|
* Internal dependencies
|
|
14
13
|
*/
|
|
15
|
-
|
|
16
14
|
import InserterSidebar from './inserter-sidebar';
|
|
17
15
|
import ListViewSidebar from './list-view-sidebar';
|
|
18
16
|
export default function SecondarySidebar() {
|
|
@@ -29,15 +27,12 @@ export default function SecondarySidebar() {
|
|
|
29
27
|
isListViewOpen: isListViewOpened()
|
|
30
28
|
};
|
|
31
29
|
}, []);
|
|
32
|
-
|
|
33
30
|
if (isInserterOpen) {
|
|
34
31
|
return createElement(InserterSidebar, null);
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
if (isListViewOpen) {
|
|
38
34
|
return createElement(ListViewSidebar, null);
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
return null;
|
|
42
37
|
}
|
|
43
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","store","editWidgetsStore","InserterSidebar","ListViewSidebar","SecondarySidebar","isInserterOpen","isListViewOpen","select","isInserterOpened","isListViewOpened","createElement"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport InserterSidebar from './inserter-sidebar';\nimport ListViewSidebar from './list-view-sidebar';\n\nexport default function SecondarySidebar() {\n\tconst { isInserterOpen, isListViewOpen } = useSelect( ( select ) => {\n\t\tconst { isInserterOpened, isListViewOpened } =\n\t\t\tselect( editWidgetsStore );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t};\n\t}, [] );\n\n\tif ( isInserterOpen ) {\n\t\treturn <InserterSidebar />;\n\t}\n\tif ( isListViewOpen ) {\n\t\treturn <ListViewSidebar />;\n\t}\n\treturn null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAOC,eAAe,MAAM,qBAAqB;AAEjD,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAGP,SAAS,CAAIQ,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEN,gBAAiB,CAAC;IAC3B,OAAO;MACNI,cAAc,EAAEG,gBAAgB,CAAC,CAAC;MAClCF,cAAc,EAAEG,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKJ,cAAc,EAAG;IACrB,OAAOK,aAAA,CAACR,eAAe,MAAE,CAAC;EAC3B;EACA,IAAKI,cAAc,EAAG;IACrB,OAAOI,aAAA,CAACP,eAAe,MAAE,CAAC;EAC3B;EACA,OAAO,IAAI;AACZ"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -10,10 +9,10 @@ import { useViewportMatch, __experimentalUseDialog as useDialog } from '@wordpre
|
|
|
10
9
|
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
|
11
10
|
import { useDispatch } from '@wordpress/data';
|
|
12
11
|
import { __ } from '@wordpress/i18n';
|
|
12
|
+
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
16
|
import useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';
|
|
18
17
|
import { store as editWidgetsStore } from '../../store';
|
|
19
18
|
export default function InserterSidebar() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Button","VisuallyHidden","close","__experimentalLibrary","Library","useViewportMatch","__experimentalUseDialog","useDialog","useCallback","useEffect","useRef","useDispatch","__","useWidgetLibraryInsertionPoint","store","editWidgetsStore","InserterSidebar","isMobileViewport","rootClientId","insertionIndex","setIsInserterOpened","closeInserter","TagName","inserterDialogRef","inserterDialogProps","onClose","focusOnMount","libraryRef","current","focusSearch","createElement","ref","className","icon","onClick","label","showInserterHelpPanel","shouldFocusBlock","__experimentalInsertionIndex"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/inserter-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, VisuallyHidden } from '@wordpress/components';\nimport { close } from '@wordpress/icons';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useWidgetLibraryInsertionPoint from '../../hooks/use-widget-library-insertion-point';\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { rootClientId, insertionIndex } = useWidgetLibraryInsertionPoint();\n\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst closeInserter = useCallback( () => {\n\t\treturn setIsInserterOpened( false );\n\t}, [ setIsInserterOpened ] );\n\n\tconst TagName = ! isMobileViewport ? VisuallyHidden : 'div';\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: closeInserter,\n\t\tfocusOnMount: null,\n\t} );\n\n\tconst libraryRef = useRef();\n\tuseEffect( () => {\n\t\tlibraryRef.current.focusSearch();\n\t}, [] );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-widgets-layout__inserter-panel\"\n\t\t>\n\t\t\t<TagName className=\"edit-widgets-layout__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ closeInserter }\n\t\t\t\t\tlabel={ __( 'Close block inserter' ) }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t\t<div className=\"edit-widgets-layout__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={ insertionIndex }\n\t\t\t\t\tref={ libraryRef }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,cAAc,QAAQ,uBAAuB;AAC9D,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,yBAAyB;AAC1E,SACCC,gBAAgB,EAChBC,uBAAuB,IAAIC,SAAS,QAC9B,oBAAoB;AAC3B,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACnE,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,8BAA8B,MAAM,gDAAgD;AAC3F,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAMC,gBAAgB,GAAGZ,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAC1D,MAAM;IAAEa,YAAY;IAAEC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ress dependencies
|
|
5
4
|
*/
|
|
@@ -11,30 +10,30 @@ import { useState } from '@wordpress/element';
|
|
|
11
10
|
import { __ } from '@wordpress/i18n';
|
|
12
11
|
import { closeSmall } from '@wordpress/icons';
|
|
13
12
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
13
|
+
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
import { store as editWidgetsStore } from '../../store';
|
|
19
18
|
export default function ListViewSidebar() {
|
|
20
19
|
const {
|
|
21
20
|
setIsListViewOpened
|
|
22
|
-
} = useDispatch(editWidgetsStore);
|
|
23
|
-
// re-renders when the dropZoneElement updates.
|
|
21
|
+
} = useDispatch(editWidgetsStore);
|
|
24
22
|
|
|
23
|
+
// Use internal state instead of a ref to make sure that the component
|
|
24
|
+
// re-renders when the dropZoneElement updates.
|
|
25
25
|
const [dropZoneElement, setDropZoneElement] = useState(null);
|
|
26
26
|
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
27
27
|
const headerFocusReturnRef = useFocusReturn();
|
|
28
28
|
const contentFocusReturnRef = useFocusReturn();
|
|
29
|
-
|
|
30
29
|
function closeOnEscape(event) {
|
|
31
30
|
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
32
31
|
event.preventDefault();
|
|
33
32
|
setIsListViewOpened(false);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return (
|
|
36
|
+
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
38
37
|
createElement("div", {
|
|
39
38
|
className: "edit-widgets-editor__list-view-panel",
|
|
40
39
|
onKeyDown: closeOnEscape
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["__experimentalListView","ListView","Button","useFocusOnMount","useFocusReturn","useMergeRefs","useDispatch","useState","__","closeSmall","ESCAPE","store","editWidgetsStore","ListViewSidebar","setIsListViewOpened","dropZoneElement","setDropZoneElement","focusOnMountRef","headerFocusReturnRef","contentFocusReturnRef","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","createElement","className","onKeyDown","ref","icon","label","onClick"],"sources":["@wordpress/edit-widgets/src/components/secondary-sidebar/list-view-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalListView as ListView } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport {\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { closeSmall } from '@wordpress/icons';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the dropZoneElement updates.\n\tconst [ dropZoneElement, setDropZoneElement ] = useState( null );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst headerFocusReturnRef = useFocusReturn();\n\tconst contentFocusReturnRef = useFocusReturn();\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tclassName=\"edit-widgets-editor__list-view-panel\"\n\t\t\tonKeyDown={ closeOnEscape }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-header\"\n\t\t\t\tref={ headerFocusReturnRef }\n\t\t\t>\n\t\t\t\t<strong>{ __( 'List View' ) }</strong>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\t\tonClick={ () => setIsListViewOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-widgets-editor__list-view-panel-content\"\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tcontentFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\tsetDropZoneElement,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t<ListView dropZoneElement={ dropZoneElement } />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,sBAAsB,IAAIC,QAAQ,QAAQ,yBAAyB;AAC5E,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SACCC,eAAe,EACfC,cAAc,EACdC,YAAY,QACN,oBAAoB;AAC3B,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,MAAM,QAAQ,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,eAAeA,CAAA,EAAG;EACzC,MAAM;IAAEC;EAAoB,CAAC,GAAGR,WAAW,CAAEM,gBAAiB,CAAC;;EAE/D;EACA;EACA,MAAM,CAAEG,eAAe,EAAEC,kBAAkB,CAAE,GAAGT,QAAQ,CAAE,IAAK,CAAC;EAEhE,MAAMU,eAAe,GAAGd,eAAe,CAAE,cAAe,CAAC;EACzD,MAAMe,oBAAoB,GAAGd,cAAc,CAAC,CAAC;EAC7C,MAAMe,qBAAqB,GAAGf,cAAc,CAAC,CAAC;EAE9C,SAASgB,aAAaA,CAAEC,KAAK,EAAG;IAC/B,IAAKA,KAAK,CAACC,OAAO,KAAKZ,MAAM,IAAI,CAAEW,KAAK,CAACE,gBAAgB,EAAG;MAC3DF,KAAK,CAACG,cAAc,CAAC,CAAC;MACtBV,mBAAmB,CAAE,KAAM,CAAC;IAC7B;EACD;EAEA;IACC;IACAW,aAAA;MACCC,SAAS,EAAC,sCAAsC;MAChDC,SAAS,EAAGP;IAAe,GAE3BK,aAAA;MACCC,SAAS,EAAC,6CAA6C;MACvDE,GAAG,EAAGV;IAAsB,GAE5BO,aAAA,iBAAUjB,EAAE,CAAE,WAAY,CAAW,CAAC,EACtCiB,aAAA,CAACvB,MAAM;MACN2B,IAAI,EAAGpB,UAAY;MACnBqB,KAAK,EAAGtB,EAAE,CAAE,OAAQ,CAAG;MACvBuB,OAAO,EAAGA,CAAA,KAAMjB,mBAAmB,CAAE,KAAM;IAAG,CAC9C,CACG,CAAC,EACNW,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDE,GAAG,EAAGvB,YAAY,CAAE,CACnBc,qBAAqB,EACrBF,eAAe,EACfD,kBAAkB,CACjB;IAAG,GAELS,aAAA,CAACxB,QAAQ;MAACc,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* External dependencies
|
|
5
4
|
*/
|
|
6
5
|
import classnames from 'classnames';
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
import { useEffect, Platform } from '@wordpress/element';
|
|
12
11
|
import { isRTL, __, sprintf } from '@wordpress/i18n';
|
|
13
12
|
import { ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
|
|
@@ -19,17 +18,17 @@ const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select({
|
|
|
19
18
|
web: true,
|
|
20
19
|
native: false
|
|
21
20
|
});
|
|
22
|
-
const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';
|
|
23
|
-
// for backwards compatibility.
|
|
21
|
+
const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';
|
|
24
22
|
|
|
23
|
+
// Widget areas were one called block areas, so use 'edit-widgets/block-areas'
|
|
24
|
+
// for backwards compatibility.
|
|
25
25
|
const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';
|
|
26
|
+
|
|
26
27
|
/**
|
|
27
28
|
* Internal dependencies
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
30
|
import WidgetAreas from './widget-areas';
|
|
31
31
|
import { store as editWidgetsStore } from '../../store';
|
|
32
|
-
|
|
33
32
|
function ComplementaryAreaTab({
|
|
34
33
|
identifier,
|
|
35
34
|
label,
|
|
@@ -43,12 +42,12 @@ function ComplementaryAreaTab({
|
|
|
43
42
|
className: classnames('edit-widgets-sidebar__panel-tab', {
|
|
44
43
|
'is-active': isActive
|
|
45
44
|
}),
|
|
46
|
-
"aria-label": isActive ?
|
|
45
|
+
"aria-label": isActive ?
|
|
46
|
+
// translators: %s: sidebar label e.g: "Widget Areas".
|
|
47
47
|
sprintf(__('%s (selected)'), label) : label,
|
|
48
48
|
"data-label": label
|
|
49
49
|
}, label);
|
|
50
50
|
}
|
|
51
|
-
|
|
52
51
|
export default function Sidebar() {
|
|
53
52
|
const {
|
|
54
53
|
enableComplementaryArea
|
|
@@ -70,7 +69,6 @@ export default function Sidebar() {
|
|
|
70
69
|
const selectedBlock = getSelectedBlock();
|
|
71
70
|
const activeArea = getActiveComplementaryArea(editWidgetsStore.name);
|
|
72
71
|
let currentSelection = activeArea;
|
|
73
|
-
|
|
74
72
|
if (!currentSelection) {
|
|
75
73
|
if (selectedBlock) {
|
|
76
74
|
currentSelection = BLOCK_INSPECTOR_IDENTIFIER;
|
|
@@ -78,9 +76,7 @@ export default function Sidebar() {
|
|
|
78
76
|
currentSelection = WIDGET_AREAS_IDENTIFIER;
|
|
79
77
|
}
|
|
80
78
|
}
|
|
81
|
-
|
|
82
79
|
let widgetAreaBlock;
|
|
83
|
-
|
|
84
80
|
if (selectedBlock) {
|
|
85
81
|
if (selectedBlock.name === 'core/widget-area') {
|
|
86
82
|
widgetAreaBlock = selectedBlock;
|
|
@@ -88,21 +84,20 @@ export default function Sidebar() {
|
|
|
88
84
|
widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]);
|
|
89
85
|
}
|
|
90
86
|
}
|
|
91
|
-
|
|
92
87
|
return {
|
|
93
88
|
currentArea: currentSelection,
|
|
94
89
|
hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'),
|
|
95
90
|
isGeneralSidebarOpen: !!activeArea,
|
|
96
91
|
selectedWidgetAreaBlock: widgetAreaBlock
|
|
97
92
|
};
|
|
98
|
-
}, []);
|
|
99
|
-
// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.
|
|
93
|
+
}, []);
|
|
100
94
|
|
|
95
|
+
// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,
|
|
96
|
+
// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.
|
|
101
97
|
useEffect(() => {
|
|
102
98
|
if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) {
|
|
103
99
|
enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER);
|
|
104
100
|
}
|
|
105
|
-
|
|
106
101
|
if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) {
|
|
107
102
|
enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER);
|
|
108
103
|
}
|
|
@@ -119,8 +114,7 @@ export default function Sidebar() {
|
|
|
119
114
|
isActive: currentArea === BLOCK_INSPECTOR_IDENTIFIER
|
|
120
115
|
}))),
|
|
121
116
|
headerClassName: "edit-widgets-sidebar__panel-tabs"
|
|
122
|
-
/* translators: button label text should, if possible, be under 16 characters.
|
|
123
|
-
,
|
|
117
|
+
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
124
118
|
title: __('Settings'),
|
|
125
119
|
closeLabel: __('Close Settings'),
|
|
126
120
|
scope: "core/edit-widgets",
|
|
@@ -129,7 +123,8 @@ export default function Sidebar() {
|
|
|
129
123
|
isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
|
|
130
124
|
}, currentArea === WIDGET_AREAS_IDENTIFIER && createElement(WidgetAreas, {
|
|
131
125
|
selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id
|
|
132
|
-
}), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? createElement(BlockInspector, null) :
|
|
126
|
+
}), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? createElement(BlockInspector, null) :
|
|
127
|
+
// Pretend that Widget Areas are part of the UI by not
|
|
133
128
|
// showing the Block Inspector when one is selected.
|
|
134
129
|
createElement("span", {
|
|
135
130
|
className: "block-editor-block-inspector__no-blocks"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"names":["classnames","useEffect","Platform","isRTL","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","name","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","attributes","id"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAAS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oCC;AAFtC,IApCF,EA0CGd,WAAW,KAAKX,0BAAhB,KACCY,uBAAuB,GACxB,cAAC,cAAD,OADwB,GAGxB;AACA;AACA;AAAM,IAAA,SAAS,EAAC;AAAhB,KACG5B,EAAE,CAAE,oBAAF,CADL,CANA,CA1CH,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"names":["classnames","useEffect","Platform","isRTL","__","sprintf","ComplementaryArea","store","interfaceStore","BlockInspector","blockEditorStore","drawerLeft","drawerRight","Button","useSelect","useDispatch","SIDEBAR_ACTIVE_BY_DEFAULT","select","web","native","BLOCK_INSPECTOR_IDENTIFIER","WIDGET_AREAS_IDENTIFIER","WidgetAreas","editWidgetsStore","ComplementaryAreaTab","identifier","label","isActive","enableComplementaryArea","createElement","onClick","name","className","Sidebar","currentArea","hasSelectedNonAreaBlock","isGeneralSidebarOpen","selectedWidgetAreaBlock","getSelectedBlock","getBlock","getBlockParentsByBlockName","getActiveComplementaryArea","selectedBlock","activeArea","currentSelection","widgetAreaBlock","clientId","header","attributes","headerClassName","title","closeLabel","scope","icon","isActiveByDefault","selectedWidgetAreaId","id"],"sources":["@wordpress/edit-widgets/src/components/sidebar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, Platform } from '@wordpress/element';\nimport { isRTL, __, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were one called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\n\nfunction ComplementaryAreaTab( { identifier, label, isActive } ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\treturn (\n\t\t<Button\n\t\t\tonClick={ () =>\n\t\t\t\tenableComplementaryArea( editWidgetsStore.name, identifier )\n\t\t\t}\n\t\t\tclassName={ classnames( 'edit-widgets-sidebar__panel-tab', {\n\t\t\t\t'is-active': isActive,\n\t\t\t} ) }\n\t\t\taria-label={\n\t\t\t\tisActive\n\t\t\t\t\t? // translators: %s: sidebar label e.g: \"Widget Areas\".\n\t\t\t\t\t sprintf( __( '%s (selected)' ), label )\n\t\t\t\t\t: label\n\t\t\t}\n\t\t\tdata-label={ label }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\t// currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies,\n\t// because we want to run the effect when a block is selected/unselected and not when the sidebar state changes.\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<ul>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tselectedWidgetAreaBlock\n\t\t\t\t\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t\t\t\t\t: __( 'Widget Areas' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisActive={ currentArea === WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li>\n\t\t\t\t\t\t<ComplementaryAreaTab\n\t\t\t\t\t\t\tidentifier={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\t\t\tlabel={ __( 'Block' ) }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t{ currentArea === WIDGET_AREAS_IDENTIFIER && (\n\t\t\t\t<WidgetAreas\n\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ currentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\t\t( hasSelectedNonAreaBlock ? (\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t) : (\n\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t</span>\n\t\t\t\t) ) }\n\t\t</ComplementaryArea>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,KAAK,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACpD,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SACCC,cAAc,EACdF,KAAK,IAAIG,gBAAgB,QACnB,yBAAyB;AAEhC,SAASC,UAAU,EAAEC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AAExD,MAAMC,yBAAyB,GAAGd,QAAQ,CAACe,MAAM,CAAE;EAClDC,GAAG,EAAE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CAACW,UAAU,CAACjB,IAAI,GACvC3B,EAAE,CAAE,cAAe,CACtB;MACDuB,QAAQ,EAAGO,WAAW,KAAKb;IAAyB,CACpD,CACE,CAAC,EACLQ,aAAA,aACCA,aAAA,CAACL,oBAAoB;MACpBC,UAAU,EAAGL,0BAA4B;MACzCM,KAAK,EAAGtB,EAAE,CAAE,OAAQ,CAAG;MACvBuB,QAAQ,EACPO,WAAW,KAAKd;IAChB,CACD,CACE,CACD,CACJ;IACD6B,eAAe,EAAC;IAChB;IACAC,KAAK,EAAG9C,EAAE,CAAE,UAAW,CAAG;IAC1B+C,UAAU,EAAG/C,EAAE,CAAE,gBAAiB,CAAG;IACrCgD,KAAK,EAAC,mBAAmB;IACzB3B,UAAU,EAAGS,WAAa;IAC1BmB,IAAI,EAAGlD,KAAK,CAAC,CAAC,GAAGQ,UAAU,GAAGC,WAAa;IAC3C0C,iBAAiB,EAAGtC;EAA2B,GAE7CkB,WAAW,KAAKb,uBAAuB,IACxCQ,aAAA,CAACP,WAAW;IACXiC,oBAAoB,EACnBlB,uBAAuB,EAAEW,UAAU,CAACQ;EACpC,CACD,CACD,EACCtB,WAAW,KAAKd,0BAA0B,KACzCe,uBAAuB,GACxBN,aAAA,CAACpB,cAAc,MAAE,CAAC;EAElB;EACA;EACAoB,aAAA;IAAMG,SAAS,EAAC;EAAyC,GACtD5B,EAAE,CAAE,oBAAqB,CACtB,CACN,CACgB,CAAC;AAEtB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* WordPress dependencies
|
|
5
4
|
*/
|
|
@@ -11,10 +10,10 @@ import { Button } from '@wordpress/components';
|
|
|
11
10
|
import { __ } from '@wordpress/i18n';
|
|
12
11
|
import { addQueryArgs } from '@wordpress/url';
|
|
13
12
|
import { safeHTML } from '@wordpress/dom';
|
|
13
|
+
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
17
|
import { store as editWidgetsStore } from '../../store';
|
|
19
18
|
export default function WidgetAreas({
|
|
20
19
|
selectedWidgetAreaId
|
|
@@ -22,7 +21,6 @@ export default function WidgetAreas({
|
|
|
22
21
|
const widgetAreas = useSelect(select => select(editWidgetsStore).getWidgetAreas(), []);
|
|
23
22
|
const selectedWidgetArea = useMemo(() => selectedWidgetAreaId && widgetAreas?.find(widgetArea => widgetArea.id === selectedWidgetAreaId), [selectedWidgetAreaId, widgetAreas]);
|
|
24
23
|
let description;
|
|
25
|
-
|
|
26
24
|
if (!selectedWidgetArea) {
|
|
27
25
|
description = __('Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.');
|
|
28
26
|
} else if (selectedWidgetAreaId === 'wp_inactive_widgets') {
|
|
@@ -30,7 +28,6 @@ export default function WidgetAreas({
|
|
|
30
28
|
} else {
|
|
31
29
|
description = selectedWidgetArea.description;
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
return createElement("div", {
|
|
35
32
|
className: "edit-widgets-widget-areas"
|
|
36
33
|
}, createElement("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","blockDefault","BlockIcon","Button","__","addQueryArgs","safeHTML","store","editWidgetsStore","WidgetAreas","selectedWidgetAreaId","widgetAreas","select","getWidgetAreas","selectedWidgetArea","find","widgetArea","id","description","createElement","className","icon","dangerouslySetInnerHTML","__html","length","href","return","window","location","pathname","variant"],"sources":["@wordpress/edit-widgets/src/components/sidebar/widget-areas.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { blockDefault } from '@wordpress/icons';\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs } from '@wordpress/url';\nimport { safeHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WidgetAreas( { selectedWidgetAreaId } ) {\n\tconst widgetAreas = useSelect(\n\t\t( select ) => select( editWidgetsStore ).getWidgetAreas(),\n\t\t[]\n\t);\n\n\tconst selectedWidgetArea = useMemo(\n\t\t() =>\n\t\t\tselectedWidgetAreaId &&\n\t\t\twidgetAreas?.find(\n\t\t\t\t( widgetArea ) => widgetArea.id === selectedWidgetAreaId\n\t\t\t),\n\t\t[ selectedWidgetAreaId, widgetAreas ]\n\t);\n\n\tlet description;\n\tif ( ! selectedWidgetArea ) {\n\t\tdescription = __(\n\t\t\t'Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'\n\t\t);\n\t} else if ( selectedWidgetAreaId === 'wp_inactive_widgets' ) {\n\t\tdescription = __(\n\t\t\t'Blocks in this Widget Area will not be displayed in your site.'\n\t\t);\n\t} else {\n\t\tdescription = selectedWidgetArea.description;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-widgets-widget-areas\">\n\t\t\t<div className=\"edit-widgets-widget-areas__top-container\">\n\t\t\t\t<BlockIcon icon={ blockDefault } />\n\t\t\t\t<div>\n\t\t\t\t\t<p\n\t\t\t\t\t\t// Use `dangerouslySetInnerHTML` to keep backwards\n\t\t\t\t\t\t// compatibility. Basic markup in the description is an\n\t\t\t\t\t\t// established feature of WordPress.\n\t\t\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/33106\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: safeHTML( description ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ widgetAreas?.length === 0 && (\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Your theme does not contain any Widget Areas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! selectedWidgetArea && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ addQueryArgs( 'customize.php', {\n\t\t\t\t\t\t\t\t'autofocus[panel]': 'widgets',\n\t\t\t\t\t\t\t\treturn: window.location.pathname,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Manage with live preview' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,QAAQ,QAAQ,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AAEvD,eAAe,SAASC,WAAWA,CAAE;EAAEC;AAAqB,CAAC,EAAG;EAC/D,MAAMC,WAAW,GAAGZ,SAAS,CAC1Ba,MAAM,IAAMA,MAAM,CAAEJ,gBAAiB,CAAC,CAACK,cAAc,CAAC,CAAC,EACzD,EACD,CAAC;EAED,MAAMC,kBAAkB,GAAGd,OAAO,CACjC,MACCU,oBAAoB,IACpBC,WAAW,EAAEI,IAAI,CACdC,UAAU,IAAMA,UAAU,CAACC,EAAE,KAAKP,oBACrC,CAAC,EACF,CAAEA,oBAAoB,EAAEC,WAAW,CACpC,CAAC;EAED,IAAIO,WAAW;EACf,IAAK,CAAEJ,kBAAkB,EAAG;IAC3BI,WAAW,GAAGd,EAAE,CACf,uJACD,CAAC;EACF,CAAC,MAAM,IAAKM,oBAA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