@wordpress/edit-widgets 5.10.0 → 5.11.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/components/header/index.js +4 -3
- package/build/components/header/index.js.map +1 -1
- package/build-module/components/header/index.js +3 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-style/style-rtl.css +10 -11
- package/build-style/style.css +10 -11
- package/package.json +27 -27
- package/src/components/header/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -44,6 +44,10 @@ var _privateApis = require("../../private-apis");
|
|
|
44
44
|
/**
|
|
45
45
|
* Internal dependencies
|
|
46
46
|
*/
|
|
47
|
+
const {
|
|
48
|
+
useShouldContextualToolbarShow
|
|
49
|
+
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
50
|
+
|
|
47
51
|
function Header() {
|
|
48
52
|
const isMediumViewport = (0, _compose.useViewportMatch)('medium');
|
|
49
53
|
const inserterButton = (0, _element.useRef)();
|
|
@@ -93,9 +97,6 @@ function Header() {
|
|
|
93
97
|
};
|
|
94
98
|
|
|
95
99
|
const toggleListView = (0, _element.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
96
|
-
const {
|
|
97
|
-
useShouldContextualToolbarShow
|
|
98
|
-
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
99
100
|
const {
|
|
100
101
|
shouldShowContextualToolbar,
|
|
101
102
|
canFocusHiddenToolbar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useShouldContextualToolbarShow","blockEditorPrivateApis","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","editWidgetsStore","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","blockEditorStore","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","Button","event","preventDefault","plus","listView"],"mappings":";;;;;;;;;AAaA;;AAVA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAzBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAM;AAAEA,EAAAA;AAAF,IAAqC,yBAAQC,wBAAR,CAA3C;;AAEA,SAASC,MAAT,GAAkB;AACjB,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,CAAzB;AACA,QAAMC,cAAc,GAAG,sBAAvB;AACA,QAAMC,kBAAkB,GAAG,yCAA3B;AACA,QAAMC,4BAA4B,GAAG,qBAClCC,MAAF,IACCA,MAAM,CAAEC,YAAF,CAAN,CAA2BC,mBAA3B,CACCJ,kBADD,CAFmC,EAKpC,CAAEA,kBAAF,CALoC,CAArC;AAOA,QAAM;AAAEK,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAqC,qBAAaJ,MAAF,IAAc;AACnE,UAAM;AAAEK,MAAAA,gBAAF;AAAoBC,MAAAA;AAApB,QACLN,MAAM,CAAEC,YAAF,CADP;AAEA,WAAO;AACNE,MAAAA,cAAc,EAAEE,gBAAgB,EAD1B;AAEND,MAAAA,cAAc,EAAEE,gBAAgB;AAF1B,KAAP;AAIA,GAP0C,EAOxC,EAPwC,CAA3C;AAQA,QAAM;AAAEC,IAAAA,mBAAF;AAA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AA8B,EAC7B,CAAEuB;AAJJ,KAOC,4BAAC,uBAAD;AACC,IAAA,GAAG,EAAGtB,cADP;AAEC,IAAA,EAAE,EAAGuB,kBAFN;AAGC,IAAA,SAAS,EAAC,8CAHX;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,SAAS,EAAGjB,cALb;AAMC,IAAA,WAAW,EAAKkB,KAAF,IAAa;AAC1BA,MAAAA,KAAK,CAACC,cAAN;AACA,KARF;AASC,IAAA,OAAO,EAAGV,WATX;AAUC,IAAA,IAAI,EAAGW;AACP;AACP;AAZM;AAaC,IAAA,KAAK,EAAG,cACP,uBADO,EAEP,yCAFO;AAbT,IAPD,EAyBG3B,gBAAgB,IACjB,qDACC,4BAAC,aAAD,OADD,EAEC,4BAAC,aAAD,OAFD,EAGC,4BAAC,uBAAD;AACC,IAAA,EAAE,EAAGwB,kBADN;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGI,eAHR;AAIC,IAAA,SAAS,EAAGpB;AACZ;AALD;AAMC,IAAA,KAAK,EAAG,cAAI,WAAJ,CANT;AAOC,IAAA,OAAO,EAAGW;AAPX,IAHD,CA1BF,CAdD,CADD,EAyDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,mBAAD,OADD,EAEC,4BAAC,sBAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,4BAAC,iBAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;eAEcpB,M","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\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 } = 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\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\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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{ isMediumViewport && (\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{ ! isMediumViewport && (\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<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\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"]}
|
|
@@ -22,6 +22,9 @@ import MoreMenu from '../more-menu';
|
|
|
22
22
|
import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';
|
|
23
23
|
import { store as editWidgetsStore } from '../../store';
|
|
24
24
|
import { unlock } from '../../private-apis';
|
|
25
|
+
const {
|
|
26
|
+
useShouldContextualToolbarShow
|
|
27
|
+
} = unlock(blockEditorPrivateApis);
|
|
25
28
|
|
|
26
29
|
function Header() {
|
|
27
30
|
const isMediumViewport = useViewportMatch('medium');
|
|
@@ -72,9 +75,6 @@ function Header() {
|
|
|
72
75
|
};
|
|
73
76
|
|
|
74
77
|
const toggleListView = useCallback(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
|
|
75
|
-
const {
|
|
76
|
-
useShouldContextualToolbarShow
|
|
77
|
-
} = unlock(blockEditorPrivateApis);
|
|
78
78
|
const {
|
|
79
79
|
shouldShowContextualToolbar,
|
|
80
80
|
canFocusHiddenToolbar,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","unlock","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","useShouldContextualToolbarShow","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","event","preventDefault"],"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atch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nfunction Header() {\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 } = 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\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\tconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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{ isMediumViewport && (\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{ ! isMediumViewport && (\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<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-widgets/src/components/header/index.js"],"names":["useSelect","useDispatch","__","_x","Button","ToolbarItem","VisuallyHidden","NavigableToolbar","store","blockEditorStore","privateApis","blockEditorPrivateApis","PinnedItems","listView","plus","useCallback","useRef","useViewportMatch","SaveButton","UndoButton","RedoButton","MoreMenu","useLastSelectedWidgetArea","editWidgetsStore","unlock","useShouldContextualToolbarShow","Header","isMediumViewport","inserterButton","widgetAreaClientId","isLastSelectedWidgetAreaOpen","select","getIsWidgetAreaOpen","isInserterOpen","isListViewOpen","isInserterOpened","isListViewOpened","setIsWidgetAreaOpen","setIsInserterOpened","setIsListViewOpened","selectBlock","handleClick","window","requestAnimationFrame","toggleListView","shouldShowContextualToolbar","canFocusHiddenToolbar","fixedToolbarCanBeFocused","blockToolbarCanBeFocused","event","preventDefault"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,MAAT,EAAiBC,WAAjB,EAA8BC,cAA9B,QAAoD,uBAApD;AACA,SACCC,gBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,kBAA/B;AACA,SAASC,WAAT,EAAsBC,MAA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AAC,8CAHX;AAIC,IAAA,OAAO,EAAC,SAJT;AAKC,IAAA,SAAS,EAAG6B,cALb;AAMC,IAAA,WAAW,EAAKgB,KAAF,IAAa;AAC1BA,MAAAA,KAAK,CAACC,cAAN;AACA,KARF;AASC,IAAA,OAAO,EAAGT,WATX;AAUC,IAAA,IAAI,EAAG3B;AACP;AACP;AAZM;AAaC,IAAA,KAAK,EAAGX,EAAE,CACT,uBADS,EAET,yCAFS;AAbX,IAPD,EAyBGwB,gBAAgB,IACjB,8BACC,cAAC,UAAD,OADD,EAEC,cAAC,UAAD,OAFD,EAGC,cAAC,WAAD;AACC,IAAA,EAAE,EAAGvB,MADN;AAEC,IAAA,SAAS,EAAC,+CAFX;AAGC,IAAA,IAAI,EAAGS,QAHR;AAIC,IAAA,SAAS,EAAGqB;AACZ;AALD;AAMC,IAAA,KAAK,EAAGhC,EAAE,CAAE,WAAF,CANX;AAOC,IAAA,OAAO,EAAG0C;AAPX,IAHD,CA1BF,CAdD,CADD,EAyDC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,UAAD,OADD,EAEC,cAAC,WAAD,CAAa,IAAb;AAAkB,IAAA,KAAK,EAAC;AAAxB,IAFD,EAGC,cAAC,QAAD,OAHD,CAzDD,CADD,CADD;AAmEA;;AAED,eAAelB,MAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem, VisuallyHidden } from '@wordpress/components';\nimport {\n\tNavigableToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PinnedItems } from '@wordpress/interface';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport UndoButton from './undo-redo/undo';\nimport RedoButton from './undo-redo/redo';\nimport MoreMenu from '../more-menu';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );\n\nfunction Header() {\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 } = 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\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\tconst {\n\t\tshouldShowContextualToolbar,\n\t\tcanFocusHiddenToolbar,\n\t\tfixedToolbarCanBeFocused,\n\t} = useShouldContextualToolbarShow();\n\t// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.\n\t// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.\n\tconst blockToolbarCanBeFocused =\n\t\tshouldShowContextualToolbar ||\n\t\tcanFocusHiddenToolbar ||\n\t\tfixedToolbarCanBeFocused;\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{ isMediumViewport && (\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{ ! isMediumViewport && (\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<NavigableToolbar\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\t\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\t\t\t\tshouldUseKeyboardFocusShortcut={\n\t\t\t\t\t\t\t! blockToolbarCanBeFocused\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\tref={ inserterButton }\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ handleClick }\n\t\t\t\t\t\t\ticon={ plus }\n\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t\t\t'Toggle block inserter',\n\t\t\t\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ isMediumViewport && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<UndoButton />\n\t\t\t\t\t\t\t\t<RedoButton />\n\t\t\t\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</NavigableToolbar>\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"]}
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
99
|
}
|
|
100
|
-
@media (
|
|
100
|
+
@media (min-resolution: 192dpi) {
|
|
101
101
|
:root {
|
|
102
102
|
--wp-admin-border-width-focus: 1.5px;
|
|
103
103
|
}
|
|
@@ -958,8 +958,7 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
|
|
|
958
958
|
.edit-widgets-welcome-guide__image > img {
|
|
959
959
|
display: block;
|
|
960
960
|
max-width: 100%;
|
|
961
|
-
|
|
962
|
-
object-fit: cover;
|
|
961
|
+
object-fit: cover;
|
|
963
962
|
}
|
|
964
963
|
.edit-widgets-welcome-guide__heading {
|
|
965
964
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
@@ -1124,7 +1123,7 @@ body.admin-color-light {
|
|
|
1124
1123
|
--wp-admin-theme-color-darker-20--rgb: 0, 97, 135;
|
|
1125
1124
|
--wp-admin-border-width-focus: 2px;
|
|
1126
1125
|
}
|
|
1127
|
-
@media (
|
|
1126
|
+
@media (min-resolution: 192dpi) {
|
|
1128
1127
|
body.admin-color-light {
|
|
1129
1128
|
--wp-admin-border-width-focus: 1.5px;
|
|
1130
1129
|
}
|
|
@@ -1139,7 +1138,7 @@ body.admin-color-modern {
|
|
|
1139
1138
|
--wp-admin-theme-color-darker-20--rgb: 24, 58, 214;
|
|
1140
1139
|
--wp-admin-border-width-focus: 2px;
|
|
1141
1140
|
}
|
|
1142
|
-
@media (
|
|
1141
|
+
@media (min-resolution: 192dpi) {
|
|
1143
1142
|
body.admin-color-modern {
|
|
1144
1143
|
--wp-admin-border-width-focus: 1.5px;
|
|
1145
1144
|
}
|
|
@@ -1154,7 +1153,7 @@ body.admin-color-blue {
|
|
|
1154
1153
|
--wp-admin-theme-color-darker-20--rgb: 6, 64, 84;
|
|
1155
1154
|
--wp-admin-border-width-focus: 2px;
|
|
1156
1155
|
}
|
|
1157
|
-
@media (
|
|
1156
|
+
@media (min-resolution: 192dpi) {
|
|
1158
1157
|
body.admin-color-blue {
|
|
1159
1158
|
--wp-admin-border-width-focus: 1.5px;
|
|
1160
1159
|
}
|
|
@@ -1169,7 +1168,7 @@ body.admin-color-coffee {
|
|
|
1169
1168
|
--wp-admin-theme-color-darker-20--rgb: 43, 39, 36;
|
|
1170
1169
|
--wp-admin-border-width-focus: 2px;
|
|
1171
1170
|
}
|
|
1172
|
-
@media (
|
|
1171
|
+
@media (min-resolution: 192dpi) {
|
|
1173
1172
|
body.admin-color-coffee {
|
|
1174
1173
|
--wp-admin-border-width-focus: 1.5px;
|
|
1175
1174
|
}
|
|
@@ -1184,7 +1183,7 @@ body.admin-color-ectoplasm {
|
|
|
1184
1183
|
--wp-admin-theme-color-darker-20--rgb: 58, 44, 77;
|
|
1185
1184
|
--wp-admin-border-width-focus: 2px;
|
|
1186
1185
|
}
|
|
1187
|
-
@media (
|
|
1186
|
+
@media (min-resolution: 192dpi) {
|
|
1188
1187
|
body.admin-color-ectoplasm {
|
|
1189
1188
|
--wp-admin-border-width-focus: 1.5px;
|
|
1190
1189
|
}
|
|
@@ -1199,7 +1198,7 @@ body.admin-color-midnight {
|
|
|
1199
1198
|
--wp-admin-theme-color-darker-20--rgb: 208, 44, 33;
|
|
1200
1199
|
--wp-admin-border-width-focus: 2px;
|
|
1201
1200
|
}
|
|
1202
|
-
@media (
|
|
1201
|
+
@media (min-resolution: 192dpi) {
|
|
1203
1202
|
body.admin-color-midnight {
|
|
1204
1203
|
--wp-admin-border-width-focus: 1.5px;
|
|
1205
1204
|
}
|
|
@@ -1214,7 +1213,7 @@ body.admin-color-ocean {
|
|
|
1214
1213
|
--wp-admin-theme-color-darker-20--rgb: 76, 96, 102;
|
|
1215
1214
|
--wp-admin-border-width-focus: 2px;
|
|
1216
1215
|
}
|
|
1217
|
-
@media (
|
|
1216
|
+
@media (min-resolution: 192dpi) {
|
|
1218
1217
|
body.admin-color-ocean {
|
|
1219
1218
|
--wp-admin-border-width-focus: 1.5px;
|
|
1220
1219
|
}
|
|
@@ -1229,7 +1228,7 @@ body.admin-color-sunrise {
|
|
|
1229
1228
|
--wp-admin-theme-color-darker-20--rgb: 195, 105, 34;
|
|
1230
1229
|
--wp-admin-border-width-focus: 2px;
|
|
1231
1230
|
}
|
|
1232
|
-
@media (
|
|
1231
|
+
@media (min-resolution: 192dpi) {
|
|
1233
1232
|
body.admin-color-sunrise {
|
|
1234
1233
|
--wp-admin-border-width-focus: 1.5px;
|
|
1235
1234
|
}
|
package/build-style/style.css
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
99
|
}
|
|
100
|
-
@media (
|
|
100
|
+
@media (min-resolution: 192dpi) {
|
|
101
101
|
:root {
|
|
102
102
|
--wp-admin-border-width-focus: 1.5px;
|
|
103
103
|
}
|
|
@@ -958,8 +958,7 @@ body.is-fullscreen-mode .edit-widgets-notices__snackbar {
|
|
|
958
958
|
.edit-widgets-welcome-guide__image > img {
|
|
959
959
|
display: block;
|
|
960
960
|
max-width: 100%;
|
|
961
|
-
|
|
962
|
-
object-fit: cover;
|
|
961
|
+
object-fit: cover;
|
|
963
962
|
}
|
|
964
963
|
.edit-widgets-welcome-guide__heading {
|
|
965
964
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
@@ -1124,7 +1123,7 @@ body.admin-color-light {
|
|
|
1124
1123
|
--wp-admin-theme-color-darker-20--rgb: 0, 97, 135;
|
|
1125
1124
|
--wp-admin-border-width-focus: 2px;
|
|
1126
1125
|
}
|
|
1127
|
-
@media (
|
|
1126
|
+
@media (min-resolution: 192dpi) {
|
|
1128
1127
|
body.admin-color-light {
|
|
1129
1128
|
--wp-admin-border-width-focus: 1.5px;
|
|
1130
1129
|
}
|
|
@@ -1139,7 +1138,7 @@ body.admin-color-modern {
|
|
|
1139
1138
|
--wp-admin-theme-color-darker-20--rgb: 24, 58, 214;
|
|
1140
1139
|
--wp-admin-border-width-focus: 2px;
|
|
1141
1140
|
}
|
|
1142
|
-
@media (
|
|
1141
|
+
@media (min-resolution: 192dpi) {
|
|
1143
1142
|
body.admin-color-modern {
|
|
1144
1143
|
--wp-admin-border-width-focus: 1.5px;
|
|
1145
1144
|
}
|
|
@@ -1154,7 +1153,7 @@ body.admin-color-blue {
|
|
|
1154
1153
|
--wp-admin-theme-color-darker-20--rgb: 6, 64, 84;
|
|
1155
1154
|
--wp-admin-border-width-focus: 2px;
|
|
1156
1155
|
}
|
|
1157
|
-
@media (
|
|
1156
|
+
@media (min-resolution: 192dpi) {
|
|
1158
1157
|
body.admin-color-blue {
|
|
1159
1158
|
--wp-admin-border-width-focus: 1.5px;
|
|
1160
1159
|
}
|
|
@@ -1169,7 +1168,7 @@ body.admin-color-coffee {
|
|
|
1169
1168
|
--wp-admin-theme-color-darker-20--rgb: 43, 39, 36;
|
|
1170
1169
|
--wp-admin-border-width-focus: 2px;
|
|
1171
1170
|
}
|
|
1172
|
-
@media (
|
|
1171
|
+
@media (min-resolution: 192dpi) {
|
|
1173
1172
|
body.admin-color-coffee {
|
|
1174
1173
|
--wp-admin-border-width-focus: 1.5px;
|
|
1175
1174
|
}
|
|
@@ -1184,7 +1183,7 @@ body.admin-color-ectoplasm {
|
|
|
1184
1183
|
--wp-admin-theme-color-darker-20--rgb: 58, 44, 77;
|
|
1185
1184
|
--wp-admin-border-width-focus: 2px;
|
|
1186
1185
|
}
|
|
1187
|
-
@media (
|
|
1186
|
+
@media (min-resolution: 192dpi) {
|
|
1188
1187
|
body.admin-color-ectoplasm {
|
|
1189
1188
|
--wp-admin-border-width-focus: 1.5px;
|
|
1190
1189
|
}
|
|
@@ -1199,7 +1198,7 @@ body.admin-color-midnight {
|
|
|
1199
1198
|
--wp-admin-theme-color-darker-20--rgb: 208, 44, 33;
|
|
1200
1199
|
--wp-admin-border-width-focus: 2px;
|
|
1201
1200
|
}
|
|
1202
|
-
@media (
|
|
1201
|
+
@media (min-resolution: 192dpi) {
|
|
1203
1202
|
body.admin-color-midnight {
|
|
1204
1203
|
--wp-admin-border-width-focus: 1.5px;
|
|
1205
1204
|
}
|
|
@@ -1214,7 +1213,7 @@ body.admin-color-ocean {
|
|
|
1214
1213
|
--wp-admin-theme-color-darker-20--rgb: 76, 96, 102;
|
|
1215
1214
|
--wp-admin-border-width-focus: 2px;
|
|
1216
1215
|
}
|
|
1217
|
-
@media (
|
|
1216
|
+
@media (min-resolution: 192dpi) {
|
|
1218
1217
|
body.admin-color-ocean {
|
|
1219
1218
|
--wp-admin-border-width-focus: 1.5px;
|
|
1220
1219
|
}
|
|
@@ -1229,7 +1228,7 @@ body.admin-color-sunrise {
|
|
|
1229
1228
|
--wp-admin-theme-color-darker-20--rgb: 195, 105, 34;
|
|
1230
1229
|
--wp-admin-border-width-focus: 2px;
|
|
1231
1230
|
}
|
|
1232
|
-
@media (
|
|
1231
|
+
@media (min-resolution: 192dpi) {
|
|
1233
1232
|
body.admin-color-sunrise {
|
|
1234
1233
|
--wp-admin-border-width-focus: 1.5px;
|
|
1235
1234
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-widgets",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.11.0",
|
|
4
4
|
"description": "Widgets Page module for WordPress..",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,31 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/api-fetch": "^6.
|
|
31
|
-
"@wordpress/block-editor": "^12.
|
|
32
|
-
"@wordpress/block-library": "^8.
|
|
33
|
-
"@wordpress/blocks": "^12.
|
|
34
|
-
"@wordpress/components": "^
|
|
35
|
-
"@wordpress/compose": "^6.
|
|
36
|
-
"@wordpress/core-data": "^6.
|
|
37
|
-
"@wordpress/data": "^9.
|
|
38
|
-
"@wordpress/deprecated": "^3.
|
|
39
|
-
"@wordpress/dom": "^3.
|
|
40
|
-
"@wordpress/element": "^5.
|
|
41
|
-
"@wordpress/hooks": "^3.
|
|
42
|
-
"@wordpress/i18n": "^4.
|
|
43
|
-
"@wordpress/icons": "^9.
|
|
44
|
-
"@wordpress/interface": "^5.
|
|
45
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
46
|
-
"@wordpress/keycodes": "^3.
|
|
47
|
-
"@wordpress/media-utils": "^4.
|
|
48
|
-
"@wordpress/notices": "^4.
|
|
49
|
-
"@wordpress/plugins": "^6.
|
|
50
|
-
"@wordpress/preferences": "^3.
|
|
51
|
-
"@wordpress/private-apis": "^0.
|
|
52
|
-
"@wordpress/reusable-blocks": "^4.
|
|
53
|
-
"@wordpress/url": "^3.
|
|
54
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/api-fetch": "^6.31.0",
|
|
31
|
+
"@wordpress/block-editor": "^12.2.0",
|
|
32
|
+
"@wordpress/block-library": "^8.11.0",
|
|
33
|
+
"@wordpress/blocks": "^12.11.0",
|
|
34
|
+
"@wordpress/components": "^25.0.0",
|
|
35
|
+
"@wordpress/compose": "^6.11.0",
|
|
36
|
+
"@wordpress/core-data": "^6.11.0",
|
|
37
|
+
"@wordpress/data": "^9.4.0",
|
|
38
|
+
"@wordpress/deprecated": "^3.34.0",
|
|
39
|
+
"@wordpress/dom": "^3.34.0",
|
|
40
|
+
"@wordpress/element": "^5.11.0",
|
|
41
|
+
"@wordpress/hooks": "^3.34.0",
|
|
42
|
+
"@wordpress/i18n": "^4.34.0",
|
|
43
|
+
"@wordpress/icons": "^9.25.0",
|
|
44
|
+
"@wordpress/interface": "^5.11.0",
|
|
45
|
+
"@wordpress/keyboard-shortcuts": "^4.11.0",
|
|
46
|
+
"@wordpress/keycodes": "^3.34.0",
|
|
47
|
+
"@wordpress/media-utils": "^4.25.0",
|
|
48
|
+
"@wordpress/notices": "^4.2.0",
|
|
49
|
+
"@wordpress/plugins": "^6.2.0",
|
|
50
|
+
"@wordpress/preferences": "^3.11.0",
|
|
51
|
+
"@wordpress/private-apis": "^0.16.0",
|
|
52
|
+
"@wordpress/reusable-blocks": "^4.11.0",
|
|
53
|
+
"@wordpress/url": "^3.35.0",
|
|
54
|
+
"@wordpress/widgets": "^3.11.0",
|
|
55
55
|
"classnames": "^2.3.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
|
|
65
65
|
}
|
|
@@ -25,6 +25,8 @@ import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area
|
|
|
25
25
|
import { store as editWidgetsStore } from '../../store';
|
|
26
26
|
import { unlock } from '../../private-apis';
|
|
27
27
|
|
|
28
|
+
const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
|
|
29
|
+
|
|
28
30
|
function Header() {
|
|
29
31
|
const isMediumViewport = useViewportMatch( 'medium' );
|
|
30
32
|
const inserterButton = useRef();
|
|
@@ -72,7 +74,6 @@ function Header() {
|
|
|
72
74
|
[ setIsListViewOpened, isListViewOpen ]
|
|
73
75
|
);
|
|
74
76
|
|
|
75
|
-
const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
|
|
76
77
|
const {
|
|
77
78
|
shouldShowContextualToolbar,
|
|
78
79
|
canFocusHiddenToolbar,
|