@wordpress/edit-widgets 5.24.1 → 5.25.1-next.79a6196f.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/LICENSE.md +1 -1
- package/build/blocks/widget-area/index.js +1 -0
- package/build/blocks/widget-area/index.js.map +1 -1
- package/build/components/header/document-tools/index.js +19 -18
- package/build/components/header/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +4 -12
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +8 -3
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +8 -3
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/layout/interface.js +2 -7
- package/build/components/layout/interface.js.map +1 -1
- package/build/components/secondary-sidebar/index.js +2 -6
- package/build/components/secondary-sidebar/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +7 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/widget-areas-block-editor-content/index.js +5 -1
- package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
- package/build/components/widget-areas-block-editor-provider/index.js +4 -2
- package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build/store/index.js +3 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-selectors.js +10 -0
- package/build/store/private-selectors.js.map +1 -0
- package/build/store/reducer.js +14 -0
- package/build/store/reducer.js.map +1 -1
- package/build-module/blocks/widget-area/index.js +1 -0
- package/build-module/blocks/widget-area/index.js.map +1 -1
- package/build-module/components/header/document-tools/index.js +19 -18
- package/build-module/components/header/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -13
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +7 -3
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +7 -3
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/layout/interface.js +3 -8
- package/build-module/components/layout/interface.js.map +1 -1
- package/build-module/components/secondary-sidebar/index.js +2 -6
- package/build-module/components/secondary-sidebar/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +8 -6
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/widget-areas-block-editor-content/index.js +6 -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 +4 -2
- package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
- package/build-module/store/index.js +3 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-selectors.js +4 -0
- package/build-module/store/private-selectors.js.map +1 -0
- package/build-module/store/reducer.js +13 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +25 -5
- package/build-style/style.css +25 -5
- package/package.json +30 -29
- package/src/blocks/widget-area/block.json +1 -0
- package/src/components/header/document-tools/index.js +19 -23
- package/src/components/header/index.js +4 -9
- package/src/components/header/style.scss +25 -5
- package/src/components/header/undo-redo/redo.js +8 -3
- package/src/components/header/undo-redo/undo.js +8 -3
- package/src/components/layout/interface.js +3 -14
- package/src/components/secondary-sidebar/index.js +2 -4
- package/src/components/secondary-sidebar/list-view-sidebar.js +6 -4
- package/src/components/widget-areas-block-editor-content/index.js +4 -0
- package/src/components/widget-areas-block-editor-provider/index.js +4 -1
- package/src/store/index.js +4 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +11 -0
package/CHANGELOG.md
CHANGED
package/LICENSE.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_edit","_interopRequireDefault","metadata","$schema","name","category","attributes","id","type","supports","html","inserter","customClassName","reusable","__experimentalToolbar","__experimentalParentSelector","__experimentalDisableBlockOverlay","editorStyle","style","exports","settings","title","__","description","__experimentalLabel","label","edit"],"sources":["@wordpress/edit-widgets/src/blocks/widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAG,QAAA;EAAAC,OAAA;EAAAC,IAAA;EAAAC,QAAA;EAAAC,UAAA;IAAAC,EAAA;MAAAC,IAAA;IAAA;IAAAJ,IAAA;MAAAI,IAAA;IAAA;EAAA;EAAAC,QAAA;IAAAC,IAAA;IAAAC,QAAA;IAAAC,eAAA;IAAAC,QAAA;IAAAC,qBAAA;IAAAC,4BAAA;IAAAC,iCAAA;EAAA;EAAAC,WAAA;EAAAC,KAAA;AAAA;AAAAC,OAAA,CAAAjB,QAAA,GAAAA,QAAA;AAMA,MAAM;EAAEE;AAAK,CAAC,GAAGF,QAAQ;AAACiB,OAAA,CAAAf,IAAA,GAAAA,IAAA;AAGnB,MAAMgB,QAAQ,GAAG;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,aAAc,CAAC;EAC1BC,WAAW,EAAE,IAAAD,QAAE,EAAE,0BAA2B,CAAC;EAC7CE,mBAAmB,EAAEA,CAAE;IAAEpB,IAAI,EAAEqB;EAAM,CAAC,KAAMA,KAAK;EACjDC,IAAI,EAAJA;AACD,CAAC;AAACP,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
|
|
@@ -27,26 +27,27 @@ var _lockUnlock = require("../../../lock-unlock");
|
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
|
-
|
|
30
|
+
useCanBlockToolbarBeFocused
|
|
31
31
|
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
32
|
-
function DocumentTools({
|
|
33
|
-
setListViewToggleElement
|
|
34
|
-
}) {
|
|
32
|
+
function DocumentTools() {
|
|
35
33
|
const isMediumViewport = (0, _compose.useViewportMatch)('medium');
|
|
36
34
|
const inserterButton = (0, _element.useRef)();
|
|
37
35
|
const widgetAreaClientId = (0, _useLastSelectedWidgetArea.default)();
|
|
38
36
|
const isLastSelectedWidgetAreaOpen = (0, _data.useSelect)(select => select(_store.store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]);
|
|
39
37
|
const {
|
|
40
38
|
isInserterOpen,
|
|
41
|
-
isListViewOpen
|
|
39
|
+
isListViewOpen,
|
|
40
|
+
listViewToggleRef
|
|
42
41
|
} = (0, _data.useSelect)(select => {
|
|
43
42
|
const {
|
|
44
43
|
isInserterOpened,
|
|
45
|
-
isListViewOpened
|
|
46
|
-
|
|
44
|
+
isListViewOpened,
|
|
45
|
+
getListViewToggleRef
|
|
46
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
47
47
|
return {
|
|
48
48
|
isInserterOpen: isInserterOpened(),
|
|
49
|
-
isListViewOpen: isListViewOpened()
|
|
49
|
+
isListViewOpen: isListViewOpened(),
|
|
50
|
+
listViewToggleRef: getListViewToggleRef()
|
|
50
51
|
};
|
|
51
52
|
}, []);
|
|
52
53
|
const {
|
|
@@ -77,18 +78,14 @@ function DocumentTools({
|
|
|
77
78
|
}
|
|
78
79
|
};
|
|
79
80
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
80
|
-
|
|
81
|
-
shouldShowContextualToolbar,
|
|
82
|
-
canFocusHiddenToolbar,
|
|
83
|
-
fixedToolbarCanBeFocused
|
|
84
|
-
} = useShouldContextualToolbarShow();
|
|
81
|
+
|
|
85
82
|
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
86
|
-
|
|
87
|
-
const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused;
|
|
83
|
+
const blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();
|
|
88
84
|
return (0, _react.createElement)(_blockEditor.NavigableToolbar, {
|
|
89
85
|
className: "edit-widgets-header-toolbar",
|
|
90
86
|
"aria-label": (0, _i18n.__)('Document tools'),
|
|
91
|
-
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused
|
|
87
|
+
shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused,
|
|
88
|
+
variant: "unstyled"
|
|
92
89
|
}, (0, _react.createElement)(_components.ToolbarItem, {
|
|
93
90
|
ref: inserterButton,
|
|
94
91
|
as: _components.Button,
|
|
@@ -103,7 +100,11 @@ function DocumentTools({
|
|
|
103
100
|
/* translators: button label text should, if possible, be under 16
|
|
104
101
|
characters. */,
|
|
105
102
|
label: (0, _i18n._x)('Toggle block inserter', 'Generic label for block inserter button')
|
|
106
|
-
}), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(
|
|
103
|
+
}), isMediumViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.ToolbarItem, {
|
|
104
|
+
as: _undo.default
|
|
105
|
+
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
106
|
+
as: _redo.default
|
|
107
|
+
}), (0, _react.createElement)(_components.ToolbarItem, {
|
|
107
108
|
as: _components.Button,
|
|
108
109
|
className: "edit-widgets-header-toolbar__list-view-toggle",
|
|
109
110
|
icon: _icons.listView,
|
|
@@ -111,7 +112,7 @@ function DocumentTools({
|
|
|
111
112
|
/* translators: button label text should, if possible, be under 16 characters. */,
|
|
112
113
|
label: (0, _i18n.__)('List View'),
|
|
113
114
|
onClick: toggleListView,
|
|
114
|
-
ref:
|
|
115
|
+
ref: listViewToggleRef
|
|
115
116
|
})));
|
|
116
117
|
}
|
|
117
118
|
var _default = DocumentTools;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_components","_blockEditor","_icons","_element","_compose","_undo","_interopRequireDefault","_redo","_useLastSelectedWidgetArea","_store","_lockUnlock","useCanBlockToolbarBeFocused","unlock","blockEditorPrivateApis","DocumentTools","isMediumViewport","useViewportMatch","inserterButton","useRef","widgetAreaClientId","useLastSelectedWidgetArea","isLastSelectedWidgetAreaOpen","useSelect","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","listViewToggleRef","isInserterOpened","isListViewOpened","getListViewToggleRef","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","useDispatch","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","useCallback","blockToolbarCanBeFocused","_react","createElement","NavigableToolbar","className","__","shouldUseKeyboardFocusShortcut","variant","ToolbarItem","ref","as","Button","isPressed","onMouseDown","event","preventDefault","onClick","icon","plus","label","_x","Fragment","UndoButton","RedoButton","listView","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/document-tools/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport useLastSelectedWidgetArea from '../../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useCanBlockToolbarBeFocused } = unlock( blockEditorPrivateApis );\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\tconst inserterButton = useRef();\n\tconst widgetAreaClientId = useLastSelectedWidgetArea();\n\tconst isLastSelectedWidgetAreaOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getIsWidgetAreaOpen(\n\t\t\t\twidgetAreaClientId\n\t\t\t),\n\t\t[ widgetAreaClientId ]\n\t);\n\tconst { isInserterOpen, isListViewOpen, listViewToggleRef } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isInserterOpened, isListViewOpened, getListViewToggleRef } =\n\t\t\t\tunlock( select( editWidgetsStore ) );\n\t\t\treturn {\n\t\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setIsWidgetAreaOpen, setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\tconst handleClick = () => {\n\t\tif ( isInserterOpen ) {\n\t\t\t// Focusing the inserter button closes the inserter popover.\n\t\t\tsetIsInserterOpened( false );\n\t\t} else {\n\t\t\tif ( ! isLastSelectedWidgetAreaOpen ) {\n\t\t\t\t// Select the last selected block if hasn't already.\n\t\t\t\tselectBlock( widgetAreaClientId );\n\t\t\t\t// Open the last selected widget area when opening the inserter.\n\t\t\t\tsetIsWidgetAreaOpen( widgetAreaClientId, true );\n\t\t\t}\n\t\t\t// The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the\n\t\t\t// same tick and pretty much in a random order. The inserter is closed if any other part of the\n\t\t\t// app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then\n\t\t\t// the inserter is visible for a brief moment and then gets auto-closed due to focus moving to\n\t\t\t// the selected block.\n\t\t\twindow.requestAnimationFrame( () => setIsInserterOpened( true ) );\n\t\t}\n\t};\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\tconst blockToolbarCanBeFocused = useCanBlockToolbarBeFocused();\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tshouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterButton }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ handleClick }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ RedoButton } />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\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={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAK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AAC,aAAA,EAAAD,MAAA,CAAAoB,QAAA,QACC,IAAApB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IAACE,EAAE,EAAGY;EAAY,CAAE,CAAC,EACjC,IAAArB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IAACE,EAAE,EAAGa;EAAY,CAAE,CAAC,EACjC,IAAAtB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAmD,WAAW;IACXE,EAAE,EAAGC,kBAAQ;IACbP,SAAS,EAAC,+CAA+C;IACzDa,IAAI,EAAGO,eAAU;IACjBZ,SAAS,EAAG5B;IACZ;IACAmC,KAAK,EAAG,IAAAd,QAAE,EAAE,WAAY,CAAG;IAC3BW,OAAO,EAAGlB,cAAgB;IAC1BW,GAAG,EAAGxB;EAAmB,CACzB,CACA,CAEc,CAAC;AAErB;AAAC,IAAAwC,QAAA,GAEctD,aAAa;AAAAuD,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -17,7 +17,6 @@ var _preferences = require("@wordpress/preferences");
|
|
|
17
17
|
var _documentTools = _interopRequireDefault(require("./document-tools"));
|
|
18
18
|
var _saveButton = _interopRequireDefault(require("../save-button"));
|
|
19
19
|
var _moreMenu = _interopRequireDefault(require("../more-menu"));
|
|
20
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
21
20
|
/**
|
|
22
21
|
* WordPress dependencies
|
|
23
22
|
*/
|
|
@@ -26,12 +25,7 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
26
25
|
* Internal dependencies
|
|
27
26
|
*/
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
BlockContextualToolbar
|
|
31
|
-
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
32
|
-
function Header({
|
|
33
|
-
setListViewToggleElement
|
|
34
|
-
}) {
|
|
28
|
+
function Header() {
|
|
35
29
|
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
36
30
|
const blockToolbarRef = (0, _element.useRef)();
|
|
37
31
|
const {
|
|
@@ -48,12 +42,10 @@ function Header({
|
|
|
48
42
|
}, (0, _i18n.__)('Widgets')), !isLargeViewport && (0, _react.createElement)(_components.VisuallyHidden, {
|
|
49
43
|
as: "h1",
|
|
50
44
|
className: "edit-widgets-header__title"
|
|
51
|
-
}, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, {
|
|
52
|
-
setListViewToggleElement: setListViewToggleElement
|
|
53
|
-
}), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
45
|
+
}, (0, _i18n.__)('Widgets')), (0, _react.createElement)(_documentTools.default, null), hasFixedToolbar && isLargeViewport && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)("div", {
|
|
54
46
|
className: "selected-block-tools-wrapper"
|
|
55
|
-
}, (0, _react.createElement)(
|
|
56
|
-
|
|
47
|
+
}, (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
48
|
+
hideDragHandle: true
|
|
57
49
|
})), (0, _react.createElement)(_components.Popover.Slot, {
|
|
58
50
|
ref: blockToolbarRef,
|
|
59
51
|
name: "block-toolbar"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_components","_interface","_compose","_preferences","_documentTools","_interopRequireDefault","_saveButton","_moreMenu","Header","isLargeViewport","useViewportMatch","blockToolbarRef","useRef","hasFixedToolbar","useSelect","select","preferencesStore","get","_react","createElement","Fragment","className","__","VisuallyHidden","as","default","BlockToolbar","hideDragHandle","Popover","Slot","ref","name","PinnedItems","scope","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockToolbar } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Popover, VisuallyHidden } from '@wordpress/components';\nimport { PinnedItems } from '@wordpress/interface';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport DocumentTools from './document-tools';\nimport SaveButton from '../save-button';\nimport MoreMenu from '../more-menu';\n\nfunction Header() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst blockToolbarRef = useRef();\n\tconst { hasFixedToolbar } = useSelect(\n\t\t( select ) => ( {\n\t\t\thasFixedToolbar: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-header\">\n\t\t\t\t<div className=\"edit-widgets-header__navigable-toolbar-wrapper\">\n\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t<h1 className=\"edit-widgets-header__title\">\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</h1>\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t<VisuallyHidden\n\t\t\t\t\t\t\tas=\"h1\"\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header__title\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Widgets' ) }\n\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t) }\n\t\t\t\t\t<DocumentTools />\n\t\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<div className=\"selected-block-tools-wrapper\">\n\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<div className=\"edit-widgets-header__actions\">\n\t\t\t\t\t<SaveButton />\n\t\t\t\t\t<PinnedItems.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t\t<MoreMenu />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,WAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,SAAA,GAAAF,sBAAA,CAAAT,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,SAASY,MAAMA,CAAA,EAAG;EACjB,MAAMC,eAAe,GAAG,IAAAC,yBAAgB,EAAE,QAAS,CAAC;EACpD,MAAMC,eAAe,GAAG,IAAAC,eAAM,EAAC,CAAC;EAChC,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,eAAS,EAClCC,MAAM,KAAQ;IACfF,eAAe,EAAE,CAAC,CAAEE,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CACjD,mBAAmB,EACnB,cACD;EACD,CAAC,CAAE,EACH,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QACC,IAAAF,MAAA,CAAAC,aAAA;IAAKE,SAAS,EAAC;EAAqB,GACnC,IAAAH,MAAA,CAAAC,aAAA;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Property(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
@@ -11,17 +11,20 @@ var _data = require("@wordpress/data");
|
|
|
11
11
|
var _icons = require("@wordpress/icons");
|
|
12
12
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
13
|
var _coreData = require("@wordpress/core-data");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
function RedoButton() {
|
|
19
|
+
function RedoButton(props, ref) {
|
|
19
20
|
const shortcut = (0, _keycodes.isAppleOS)() ? _keycodes.displayShortcut.primaryShift('z') : _keycodes.displayShortcut.primary('y');
|
|
20
21
|
const hasRedo = (0, _data.useSelect)(select => select(_coreData.store).hasRedo(), []);
|
|
21
22
|
const {
|
|
22
23
|
redo
|
|
23
24
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
24
|
-
return (0, _react.createElement)(_components.
|
|
25
|
+
return (0, _react.createElement)(_components.Button, {
|
|
26
|
+
...props,
|
|
27
|
+
ref: ref,
|
|
25
28
|
icon: !(0, _i18n.isRTL)() ? _icons.redo : _icons.undo,
|
|
26
29
|
label: (0, _i18n.__)('Redo'),
|
|
27
30
|
shortcut: shortcut
|
|
@@ -33,4 +36,6 @@ function RedoButton() {
|
|
|
33
36
|
onClick: hasRedo ? redo : undefined
|
|
34
37
|
});
|
|
35
38
|
}
|
|
39
|
+
var _default = (0, _element.forwardRef)(RedoButton);
|
|
40
|
+
exports.default = _default;
|
|
36
41
|
//# sourceMappingURL=redo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","RedoButton","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_react","createElement","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","RedoButton","props","ref","shortcut","isAppleOS","displayShortcut","primaryShift","primary","hasRedo","useSelect","select","coreStore","redo","useDispatch","_react","createElement","Button","icon","isRTL","redoIcon","undoIcon","label","__","onClick","undefined","_default","forwardRef","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/redo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction RedoButton( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AATA;AACA;AACA;;AASA,SAASO,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,QAAQ,GAAG,IAAAC,mBAAS,EAAC,CAAC,GACzBC,yBAAe,CAACC,YAAY,CAAE,GAAI,CAAC,GACnCD,yBAAe,CAACE,OAAO,CAAE,GAAI,CAAC;EAEjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAsB,MAAM;IAAA,GACDf,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXe,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBnB,QAAQ,EAAGA;IACX;IACA;IACA;IAAA;IACA,iBAAgB,CAAEK,OAAS;IAC3Be,OAAO,EAAGf,OAAO,GAAGI,IAAI,GAAGY;EAAW,CACtC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAE1B,UAAW,CAAC;AAAA2B,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _i18n = require("@wordpress/i18n");
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
@@ -11,16 +11,19 @@ var _data = require("@wordpress/data");
|
|
|
11
11
|
var _icons = require("@wordpress/icons");
|
|
12
12
|
var _keycodes = require("@wordpress/keycodes");
|
|
13
13
|
var _coreData = require("@wordpress/core-data");
|
|
14
|
+
var _element = require("@wordpress/element");
|
|
14
15
|
/**
|
|
15
16
|
* WordPress dependencies
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
|
-
function UndoButton() {
|
|
19
|
+
function UndoButton(props, ref) {
|
|
19
20
|
const hasUndo = (0, _data.useSelect)(select => select(_coreData.store).hasUndo(), []);
|
|
20
21
|
const {
|
|
21
22
|
undo
|
|
22
23
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
23
|
-
return (0, _react.createElement)(_components.
|
|
24
|
+
return (0, _react.createElement)(_components.Button, {
|
|
25
|
+
...props,
|
|
26
|
+
ref: ref,
|
|
24
27
|
icon: !(0, _i18n.isRTL)() ? _icons.undo : _icons.redo,
|
|
25
28
|
label: (0, _i18n.__)('Undo'),
|
|
26
29
|
shortcut: _keycodes.displayShortcut.primary('z')
|
|
@@ -32,4 +35,6 @@ function UndoButton() {
|
|
|
32
35
|
onClick: hasUndo ? undo : undefined
|
|
33
36
|
});
|
|
34
37
|
}
|
|
38
|
+
var _default = (0, _element.forwardRef)(UndoButton);
|
|
39
|
+
exports.default = _default;
|
|
35
40
|
//# sourceMappingURL=undo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","UndoButton","hasUndo","useSelect","select","coreStore","undo","useDispatch","_react","createElement","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_icons","_keycodes","_coreData","_element","UndoButton","props","ref","hasUndo","useSelect","select","coreStore","undo","useDispatch","_react","createElement","Button","icon","isRTL","undoIcon","redoIcon","label","__","shortcut","displayShortcut","primary","onClick","undefined","_default","forwardRef","exports","default"],"sources":["@wordpress/edit-widgets/src/components/header/undo-redo/undo.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AATA;AACA;AACA;;AASA,SAASO,UAAUA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,eAAU,CAAC,CAACH,OAAO,CAAC,CAAC,EAC3C,EACD,CAAC;EACD,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,iBAAW,EAAEF,eAAU,CAAC;EACzC,OACC,IAAAG,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAAiB,MAAM;IAAA,GACDV,KAAK;IACVC,GAAG,EAAGA,GAAK;IACXU,IAAI,EAAG,CAAE,IAAAC,WAAK,EAAC,CAAC,GAAGC,WAAQ,GAAGC,WAAU;IACxCC,KAAK,EAAG,IAAAC,QAAE,EAAE,MAAO,CAAG;IACtBC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;IACxC;IACA;IACA;IAAA;IACA,iBAAgB,CAAEjB,OAAS;IAC3BkB,OAAO,EAAGlB,OAAO,GAAGI,IAAI,GAAGe;EAAW,CACtC,CAAC;AAEJ;AAAC,IAAAC,QAAA,GAEc,IAAAC,mBAAU,EAAExB,UAAW,CAAC;AAAAyB,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
|
@@ -61,7 +61,6 @@ function Interface({
|
|
|
61
61
|
previousShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/previous-region'),
|
|
62
62
|
nextShortcut: select(_keyboardShortcuts.store).getAllShortcutKeyCombinations('core/edit-widgets/next-region')
|
|
63
63
|
}), []);
|
|
64
|
-
const [listViewToggleElement, setListViewToggleElement] = (0, _element.useState)(null);
|
|
65
64
|
|
|
66
65
|
// Inserter and Sidebars are mutually exclusive
|
|
67
66
|
(0, _element.useEffect)(() => {
|
|
@@ -82,12 +81,8 @@ function Interface({
|
|
|
82
81
|
...interfaceLabels,
|
|
83
82
|
secondarySidebar: secondarySidebarLabel
|
|
84
83
|
},
|
|
85
|
-
header: (0, _react.createElement)(_header.default,
|
|
86
|
-
|
|
87
|
-
}),
|
|
88
|
-
secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, {
|
|
89
|
-
listViewToggleElement: listViewToggleElement
|
|
90
|
-
}),
|
|
84
|
+
header: (0, _react.createElement)(_header.default, null),
|
|
85
|
+
secondarySidebar: hasSecondarySidebar && (0, _react.createElement)(_secondarySidebar.default, null),
|
|
91
86
|
sidebar: hasSidebarEnabled && (0, _react.createElement)(_interface.ComplementaryArea.Slot, {
|
|
92
87
|
scope: "core/edit-widgets"
|
|
93
88
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","
|
|
1
|
+
{"version":3,"names":["_compose","require","_blockEditor","_element","_data","_interface","_i18n","_keyboardShortcuts","_preferences","_header","_interopRequireDefault","_widgetAreasBlockEditorContent","_store","_secondarySidebar","interfaceLabels","header","__","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","useViewportMatch","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","useDispatch","editWidgetsStore","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","previousShortcut","nextShortcut","useSelect","select","interfaceStore","getActiveComplementaryArea","name","preferencesStore","get","keyboardShortcutsStore","getAllShortcutKeyCombinations","useEffect","secondarySidebarLabel","hasSecondarySidebar","_react","createElement","InterfaceSkeleton","labels","secondarySidebar","default","ComplementaryArea","Slot","scope","content","Fragment","className","BlockBreadcrumb","rootLabelText","shortcuts","previous","next","_default","exports"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t'core/edit-widgets/previous-region'\n\t\t\t),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-widgets/next-region' ),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={\n\t\t\t\thasSidebarEnabled && (\n\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-widgets\" />\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb rootLabelText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
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
function SecondarySidebar({
|
|
26
|
-
listViewToggleElement
|
|
27
|
-
}) {
|
|
25
|
+
function SecondarySidebar() {
|
|
28
26
|
const {
|
|
29
27
|
isInserterOpen,
|
|
30
28
|
isListViewOpen
|
|
@@ -42,9 +40,7 @@ function SecondarySidebar({
|
|
|
42
40
|
return (0, _react.createElement)(_inserterSidebar.default, null);
|
|
43
41
|
}
|
|
44
42
|
if (isListViewOpen) {
|
|
45
|
-
return (0, _react.createElement)(_listViewSidebar.default,
|
|
46
|
-
listViewToggleElement: listViewToggleElement
|
|
47
|
-
});
|
|
43
|
+
return (0, _react.createElement)(_listViewSidebar.default, null);
|
|
48
44
|
}
|
|
49
45
|
return null;
|
|
50
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","
|
|
1
|
+
{"version":3,"names":["_data","require","_store","_inserterSidebar","_interopRequireDefault","_listViewSidebar","SecondarySidebar","isInserterOpen","isListViewOpen","useSelect","select","isInserterOpened","isListViewOpened","editWidgetsStore","_react","createElement","default"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,gBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAbA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASK,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,cAAc;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnE,MAAM;MAAEC,gBAAgB;MAAEC;IAAiB,CAAC,GAC3CF,MAAM,CAAEG,YAAiB,CAAC;IAC3B,OAAO;MACNN,cAAc,EAAEI,gBAAgB,CAAC,CAAC;MAClCH,cAAc,EAAEI,gBAAgB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAKL,cAAc,EAAG;IACrB,OAAO,IAAAO,MAAA,CAAAC,aAAA,EAACZ,gBAAA,CAAAa,OAAe,MAAE,CAAC;EAC3B;EACA,IAAKR,cAAc,EAAG;IACrB,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACV,gBAAA,CAAAW,OAAe,MAAE,CAAC;EAC3B;EACA,OAAO,IAAI;AACZ"}
|
|
@@ -14,6 +14,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
var _icons = require("@wordpress/icons");
|
|
15
15
|
var _keycodes = require("@wordpress/keycodes");
|
|
16
16
|
var _store = require("../../store");
|
|
17
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
17
18
|
/**
|
|
18
19
|
* WordPress dependencies
|
|
19
20
|
*/
|
|
@@ -22,12 +23,13 @@ var _store = require("../../store");
|
|
|
22
23
|
* Internal dependencies
|
|
23
24
|
*/
|
|
24
25
|
|
|
25
|
-
function ListViewSidebar({
|
|
26
|
-
listViewToggleElement
|
|
27
|
-
}) {
|
|
26
|
+
function ListViewSidebar() {
|
|
28
27
|
const {
|
|
29
28
|
setIsListViewOpened
|
|
30
29
|
} = (0, _data.useDispatch)(_store.store);
|
|
30
|
+
const {
|
|
31
|
+
getListViewToggleRef
|
|
32
|
+
} = (0, _lockUnlock.unlock)((0, _data.useSelect)(_store.store));
|
|
31
33
|
|
|
32
34
|
// Use internal state instead of a ref to make sure that the component
|
|
33
35
|
// re-renders when the dropZoneElement updates.
|
|
@@ -37,8 +39,8 @@ function ListViewSidebar({
|
|
|
37
39
|
// When closing the list view, focus should return to the toggle button.
|
|
38
40
|
const closeListView = (0, _element.useCallback)(() => {
|
|
39
41
|
setIsListViewOpened(false);
|
|
40
|
-
|
|
41
|
-
}, [
|
|
42
|
+
getListViewToggleRef().current?.focus();
|
|
43
|
+
}, [getListViewToggleRef, setIsListViewOpened]);
|
|
42
44
|
const closeOnEscape = (0, _element.useCallback)(event => {
|
|
43
45
|
if (event.keyCode === _keycodes.ESCAPE && !event.defaultPrevented) {
|
|
44
46
|
event.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_store","_lockUnlock","ListViewSidebar","setIsListViewOpened","useDispatch","editWidgetsStore","getListViewToggleRef","unlock","useSelect","dropZoneElement","setDropZoneElement","useState","focusOnMountRef","useFocusOnMount","closeListView","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","_react","createElement","className","onKeyDown","__","Button","icon","closeSmall","label","onClick","ref","useMergeRefs","__experimentalListView"],"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 { useFocusOnMount, useMergeRefs } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, 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';\nimport { unlock } from '../../lock-unlock';\n\nexport default function ListViewSidebar() {\n\tconst { setIsListViewOpened } = useDispatch( editWidgetsStore );\n\tconst { getListViewToggleRef } = unlock( useSelect( 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\n\t// When closing the list view, focus should return to the toggle button.\n\tconst closeListView = useCallback( () => {\n\t\tsetIsListViewOpened( false );\n\t\tgetListViewToggleRef().current?.focus();\n\t}, [ getListViewToggleRef, setIsListViewOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseListView();\n\t\t\t}\n\t\t},\n\t\t[ closeListView ]\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 className=\"edit-widgets-editor__list-view-panel-header\">\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={ closeListView }\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( [ focusOn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AAC,CAAC;MACtBT,aAAa,CAAC,CAAC;IAChB;EACD,CAAC,EACD,CAAEA,aAAa,CAChB,CAAC;EAED;IACC;IACA,IAAAU,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,sCAAsC;MAChDC,SAAS,EAAGT;IAAe,GAE3B,IAAAM,MAAA,CAAAC,aAAA;MAAKC,SAAS,EAAC;IAA6C,GAC3D,IAAAF,MAAA,CAAAC,aAAA,kBAAU,IAAAG,QAAE,EAAE,WAAY,CAAW,CAAC,EACtC,IAAAJ,MAAA,CAAAC,aAAA,EAAChC,WAAA,CAAAoC,MAAM;MACNC,IAAI,EAAGC,iBAAY;MACnBC,KAAK,EAAG,IAAAJ,QAAE,EAAE,OAAQ,CAAG;MACvBK,OAAO,EAAGnB;IAAe,CACzB,CACG,CAAC,EACN,IAAAU,MAAA,CAAAC,aAAA;MACCC,SAAS,EAAC,8CAA8C;MACxDQ,GAAG,EAAG,IAAAC,qBAAY,EAAE,CAAEvB,eAAe,EAAEF,kBAAkB,CAAG;IAAG,GAE/D,IAAAc,MAAA,CAAAC,aAAA,EAAClC,YAAA,CAAA6C,sBAAQ;MAAC3B,eAAe,EAAGA;IAAiB,CAAE,CAC3C,CACD;EAAC;AAER"}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = WidgetAreasBlockEditorContent;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
+
var _compose = require("@wordpress/compose");
|
|
10
11
|
var _data = require("@wordpress/data");
|
|
11
12
|
var _element = require("@wordpress/element");
|
|
12
13
|
var _preferences = require("@wordpress/preferences");
|
|
@@ -24,12 +25,15 @@ function WidgetAreasBlockEditorContent({
|
|
|
24
25
|
blockEditorSettings
|
|
25
26
|
}) {
|
|
26
27
|
const hasThemeStyles = (0, _data.useSelect)(select => !!select(_preferences.store).get('core/edit-widgets', 'themeStyles'), []);
|
|
28
|
+
const isLargeViewport = (0, _compose.useViewportMatch)('medium');
|
|
27
29
|
const styles = (0, _element.useMemo)(() => {
|
|
28
30
|
return hasThemeStyles ? blockEditorSettings.styles : [];
|
|
29
31
|
}, [blockEditorSettings, hasThemeStyles]);
|
|
30
32
|
return (0, _react.createElement)("div", {
|
|
31
33
|
className: "edit-widgets-block-editor"
|
|
32
|
-
}, (0, _react.createElement)(_notices.default, null),
|
|
34
|
+
}, (0, _react.createElement)(_notices.default, null), !isLargeViewport && (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
35
|
+
hideDragHandle: true
|
|
36
|
+
}), (0, _react.createElement)(_blockEditor.BlockTools, null, (0, _react.createElement)(_keyboardShortcuts.default, null), (0, _react.createElement)(_blockEditor.__unstableEditorStyles, {
|
|
33
37
|
styles: styles,
|
|
34
38
|
scope: ".editor-styles-wrapper"
|
|
35
39
|
}), (0, _react.createElement)(_blockEditor.BlockSelectionClearer, null, (0, _react.createElement)(_blockEditor.WritingFlow, null, (0, _react.createElement)(_blockEditor.BlockList, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_element","_preferences","_notices","_interopRequireDefault","_keyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","useSelect","select","preferencesStore","get","styles","useMemo","_react","createElement","className","default","BlockTools","__unstableEditorStyles","scope","BlockSelectionClearer","WritingFlow","BlockList"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_compose","_data","_element","_preferences","_notices","_interopRequireDefault","_keyboardShortcuts","WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","useSelect","select","preferencesStore","get","isLargeViewport","useViewportMatch","styles","useMemo","_react","createElement","className","default","BlockToolbar","hideDragHandle","BlockTools","__unstableEditorStyles","scope","BlockSelectionClearer","WritingFlow","BlockList"],"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t{ ! isLargeViewport && <BlockToolbar hideDragHandle /> }\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles\n\t\t\t\t\tstyles={ styles }\n\t\t\t\t\tscope=\".editor-styles-wrapper\"\n\t\t\t\t/>\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAQA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAD,sBAAA,CAAAN,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIe,SAASQ,6BAA6BA,CAAE;EACtDC;AACD,CAAC,EAAG;EACH,MAAMC,cAAc,GAAG,IAAAC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