@wordpress/edit-widgets 6.47.0 → 6.48.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/sidebar/index.cjs +1 -4
- package/build/components/sidebar/index.cjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +2 -10
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-style/style-rtl.css +2 -1
- package/build-style/style.css +2 -1
- package/package.json +35 -34
- package/src/components/sidebar/index.js +2 -10
package/CHANGELOG.md
CHANGED
|
@@ -43,10 +43,7 @@ var import_widget_areas = __toESM(require("./widget-areas.cjs"));
|
|
|
43
43
|
var import_store = require("../../store/index.cjs");
|
|
44
44
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
45
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
-
var SIDEBAR_ACTIVE_BY_DEFAULT =
|
|
47
|
-
web: true,
|
|
48
|
-
native: false
|
|
49
|
-
});
|
|
46
|
+
var SIDEBAR_ACTIVE_BY_DEFAULT = true;
|
|
50
47
|
var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
|
|
51
48
|
var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
|
|
52
49
|
var { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useContext, useCallback } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;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;AAAA,IACD;AAEA,WAAO;AAAA,MACN,aAAa;AAAA,MACb,yBAAyB,CAAC,EACzB,iBAAiB,cAAc,SAAS;AAAA,MAEzC,sBAAsB,CAAC,CAAE;AAAA,MACzB,yBAAyB;AAAA,IAC1B;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,EAAE,wBAAwB,QAAI,yBAAa,iBAAAH,KAAe;AAMhE,QAAM,kBAAc;AAAA,IACnB,CAAE,qBAAsB;AACvB,UAAK,CAAC,CAAE,kBAAmB;AAC1B;AAAA,UACC,aAAAG,MAAiB;AAAA,UACjB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,uBAAwB;AAAA,EAC3B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MAMA,eAAgB,uBAAuB,cAAc;AAAA,MACrD,UAAW;AAAA,MACX,cAAe;AAAA,MAEf;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["componentsPrivateApis", "interfaceStore", "WidgetAreas", "blockEditorStore", "editWidgetsStore"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// packages/edit-widgets/src/components/sidebar/index.js
|
|
2
|
-
import {
|
|
3
|
-
useEffect,
|
|
4
|
-
Platform,
|
|
5
|
-
useContext,
|
|
6
|
-
useCallback
|
|
7
|
-
} from "@wordpress/element";
|
|
2
|
+
import { useEffect, useContext, useCallback } from "@wordpress/element";
|
|
8
3
|
import { isRTL, __ } from "@wordpress/i18n";
|
|
9
4
|
import {
|
|
10
5
|
ComplementaryArea,
|
|
@@ -21,10 +16,7 @@ import WidgetAreas from "./widget-areas.mjs";
|
|
|
21
16
|
import { store as editWidgetsStore } from "../../store/index.mjs";
|
|
22
17
|
import { unlock } from "../../lock-unlock.mjs";
|
|
23
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
-
var SIDEBAR_ACTIVE_BY_DEFAULT =
|
|
25
|
-
web: true,
|
|
26
|
-
native: false
|
|
27
|
-
});
|
|
19
|
+
var SIDEBAR_ACTIVE_BY_DEFAULT = true;
|
|
28
20
|
var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
|
|
29
21
|
var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
|
|
30
22
|
var { Tabs } = unlock(componentsPrivateApis);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";AAGA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useContext, useCallback } from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\n\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\n\n// Widget areas were once called block areas, so use 'edit-widgets/block-areas'\n// for backwards compatibility.\nconst WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas';\n\n/**\n * Internal dependencies\n */\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<Tabs.TabList>\n\t\t\t<Tabs.Tab tabId={ WIDGET_AREAS_IDENTIFIER }>\n\t\t\t\t{ selectedWidgetAreaBlock\n\t\t\t\t\t? selectedWidgetAreaBlock.attributes.name\n\t\t\t\t\t: __( 'Widget Areas' ) }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n}\n\nfunction SidebarContent( {\n\thasSelectedNonAreaBlock,\n\tcurrentArea,\n\tisGeneralSidebarOpen,\n\tselectedWidgetAreaBlock,\n} ) {\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\thasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === WIDGET_AREAS_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tBLOCK_INSPECTOR_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\t! hasSelectedNonAreaBlock &&\n\t\t\tcurrentArea === BLOCK_INSPECTOR_IDENTIFIER &&\n\t\t\tisGeneralSidebarOpen\n\t\t) {\n\t\t\tenableComplementaryArea(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\tWIDGET_AREAS_IDENTIFIER\n\t\t\t);\n\t\t}\n\t\t// We're intentionally leaving `currentArea` and `isGeneralSidebarOpen`\n\t\t// out of the dep array because we want this effect to run based on\n\t\t// block selection changes, not sidebar state changes.\n\t}, [ hasSelectedNonAreaBlock, enableComplementaryArea ] );\n\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader\n\t\t\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\theaderClassName=\"edit-widgets-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\tscope=\"core/edit-widgets\"\n\t\t\tidentifier={ currentArea }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ WIDGET_AREAS_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t<WidgetAreas\n\t\t\t\t\t\tselectedWidgetAreaId={\n\t\t\t\t\t\t\tselectedWidgetAreaBlock?.attributes.id\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\ttabId={ BLOCK_INSPECTOR_IDENTIFIER }\n\t\t\t\t\tfocusable={ false }\n\t\t\t\t>\n\t\t\t\t\t{ hasSelectedNonAreaBlock ? (\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t// Pretend that Widget Areas are part of the UI by not\n\t\t\t\t\t\t// showing the Block Inspector when one is selected.\n\t\t\t\t\t\t<span className=\"block-editor-block-inspector__no-blocks\">\n\t\t\t\t\t\t\t{ __( 'No block selected.' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\nexport default function Sidebar() {\n\tconst {\n\t\tcurrentArea,\n\t\thasSelectedNonAreaBlock,\n\t\tisGeneralSidebarOpen,\n\t\tselectedWidgetAreaBlock,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSelectedBlock, getBlock, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\tconst selectedBlock = getSelectedBlock();\n\n\t\tconst activeArea = getActiveComplementaryArea( editWidgetsStore.name );\n\n\t\tlet currentSelection = activeArea;\n\t\tif ( ! currentSelection ) {\n\t\t\tif ( selectedBlock ) {\n\t\t\t\tcurrentSelection = BLOCK_INSPECTOR_IDENTIFIER;\n\t\t\t} else {\n\t\t\t\tcurrentSelection = WIDGET_AREAS_IDENTIFIER;\n\t\t\t}\n\t\t}\n\n\t\tlet widgetAreaBlock;\n\t\tif ( selectedBlock ) {\n\t\t\tif ( selectedBlock.name === 'core/widget-area' ) {\n\t\t\t\twidgetAreaBlock = selectedBlock;\n\t\t\t} else {\n\t\t\t\twidgetAreaBlock = getBlock(\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\tselectedBlock.clientId,\n\t\t\t\t\t\t'core/widget-area'\n\t\t\t\t\t)[ 0 ]\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcurrentArea: currentSelection,\n\t\t\thasSelectedNonAreaBlock: !! (\n\t\t\t\tselectedBlock && selectedBlock.name !== 'core/widget-area'\n\t\t\t),\n\t\t\tisGeneralSidebarOpen: !! activeArea,\n\t\t\tselectedWidgetAreaBlock: widgetAreaBlock,\n\t\t};\n\t}, [] );\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\t// `newSelectedTabId` could technically be falsy if no tab is selected (i.e.\n\t// the initial render) or when we don't want a tab displayed (i.e. the\n\t// sidebar is closed). These cases should both be covered by the `!!` check\n\t// below, so we shouldn't need any additional falsy handling.\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea(\n\t\t\t\t\teditWidgetsStore.name,\n\t\t\t\t\tnewSelectedTabId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\t// Due to how this component is controlled (via a value from the\n\t\t\t// `interfaceStore`), when the sidebar closes the currently selected\n\t\t\t// tab can't be found. This causes the component to continuously reset\n\t\t\t// the selection to `null` in an infinite loop. Proactively setting\n\t\t\t// the selected tab to `null` avoids that.\n\t\t\tselectedTabId={ isGeneralSidebarOpen ? currentArea : null }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\thasSelectedNonAreaBlock={ hasSelectedNonAreaBlock }\n\t\t\t\tcurrentArea={ currentArea }\n\t\t\t\tisGeneralSidebarOpen={ isGeneralSidebarOpen }\n\t\t\t\tselectedWidgetAreaBlock={ selectedWidgetAreaBlock }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW,YAAY,mBAAmB;AACnD,SAAS,OAAO,UAAU;AAC1B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AAEP,SAAS,YAAY,mBAAmB;AACxC,SAAS,eAAe,6BAA6B;AACrD,SAAS,WAAW,mBAAmB;AAavC,OAAO,iBAAiB;AACxB,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAMrB,SACC,KADD;AAnBF,IAAM,4BAA4B;AAElC,IAAM,6BAA6B;AAInC,IAAM,0BAA0B;AAShC,IAAM,EAAE,KAAK,IAAI,OAAQ,qBAAsB;AAE/C,SAAS,cAAe,EAAE,wBAAwB,GAAI;AACrD,SACC,qBAAC,KAAK,SAAL,EACA;AAAA,wBAAC,KAAK,KAAL,EAAS,OAAQ,yBACf,oCACC,wBAAwB,WAAW,OACnC,GAAI,cAAe,GACvB;AAAA,IACA,oBAAC,KAAK,KAAL,EAAS,OAAQ,4BACf,a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AA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -833,7 +833,8 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
|
|
|
833
833
|
.edit-widgets-welcome-guide__image > img {
|
|
834
834
|
display: block;
|
|
835
835
|
max-width: 100%;
|
|
836
|
-
object-fit: cover;
|
|
836
|
+
-o-object-fit: cover;
|
|
837
|
+
object-fit: cover;
|
|
837
838
|
}
|
|
838
839
|
.edit-widgets-welcome-guide__heading {
|
|
839
840
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
package/build-style/style.css
CHANGED
|
@@ -833,7 +833,8 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
|
|
|
833
833
|
.edit-widgets-welcome-guide__image > img {
|
|
834
834
|
display: block;
|
|
835
835
|
max-width: 100%;
|
|
836
|
-
object-fit: cover;
|
|
836
|
+
-o-object-fit: cover;
|
|
837
|
+
object-fit: cover;
|
|
837
838
|
}
|
|
838
839
|
.edit-widgets-welcome-guide__heading {
|
|
839
840
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-widgets",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.48.1",
|
|
4
4
|
"description": "Widgets Page module for WordPress..",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
|
-
"react-native": "src/index",
|
|
44
43
|
"wpScript": true,
|
|
45
44
|
"wpCopyFiles": {
|
|
46
45
|
"files": [
|
|
@@ -48,45 +47,47 @@
|
|
|
48
47
|
]
|
|
49
48
|
},
|
|
50
49
|
"dependencies": {
|
|
51
|
-
"@wordpress/api-fetch": "^7.
|
|
52
|
-
"@wordpress/base-styles": "^
|
|
53
|
-
"@wordpress/block-editor": "^15.
|
|
54
|
-
"@wordpress/block-library": "^9.
|
|
55
|
-
"@wordpress/blocks": "^15.
|
|
56
|
-
"@wordpress/components": "^
|
|
57
|
-
"@wordpress/compose": "^8.
|
|
58
|
-
"@wordpress/core-data": "^7.
|
|
59
|
-
"@wordpress/data": "^10.
|
|
60
|
-
"@wordpress/deprecated": "^4.
|
|
61
|
-
"@wordpress/dom": "^4.
|
|
62
|
-
"@wordpress/element": "^
|
|
63
|
-
"@wordpress/hooks": "^4.
|
|
64
|
-
"@wordpress/i18n": "^6.
|
|
65
|
-
"@wordpress/icons": "^
|
|
66
|
-
"@wordpress/interface": "^9.
|
|
67
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
68
|
-
"@wordpress/keycodes": "^4.
|
|
69
|
-
"@wordpress/media-utils": "^5.
|
|
70
|
-
"@wordpress/notices": "^5.
|
|
71
|
-
"@wordpress/patterns": "^2.
|
|
72
|
-
"@wordpress/plugins": "^7.
|
|
73
|
-
"@wordpress/preferences": "^4.
|
|
74
|
-
"@wordpress/private-apis": "^1.
|
|
75
|
-
"@wordpress/reusable-blocks": "^5.
|
|
76
|
-
"@wordpress/ui": "^0.
|
|
77
|
-
"@wordpress/url": "^4.
|
|
78
|
-
"@wordpress/widgets": "^4.
|
|
50
|
+
"@wordpress/api-fetch": "^7.48.1",
|
|
51
|
+
"@wordpress/base-styles": "^10.0.1",
|
|
52
|
+
"@wordpress/block-editor": "^15.21.1",
|
|
53
|
+
"@wordpress/block-library": "^9.48.1",
|
|
54
|
+
"@wordpress/blocks": "^15.21.1",
|
|
55
|
+
"@wordpress/components": "^35.0.1",
|
|
56
|
+
"@wordpress/compose": "^8.1.1",
|
|
57
|
+
"@wordpress/core-data": "^7.48.1",
|
|
58
|
+
"@wordpress/data": "^10.48.1",
|
|
59
|
+
"@wordpress/deprecated": "^4.48.1",
|
|
60
|
+
"@wordpress/dom": "^4.48.1",
|
|
61
|
+
"@wordpress/element": "^8.0.1",
|
|
62
|
+
"@wordpress/hooks": "^4.48.1",
|
|
63
|
+
"@wordpress/i18n": "^6.21.1",
|
|
64
|
+
"@wordpress/icons": "^14.0.1",
|
|
65
|
+
"@wordpress/interface": "^9.33.1",
|
|
66
|
+
"@wordpress/keyboard-shortcuts": "^5.48.1",
|
|
67
|
+
"@wordpress/keycodes": "^4.48.1",
|
|
68
|
+
"@wordpress/media-utils": "^5.48.1",
|
|
69
|
+
"@wordpress/notices": "^5.48.1",
|
|
70
|
+
"@wordpress/patterns": "^2.48.1",
|
|
71
|
+
"@wordpress/plugins": "^7.48.1",
|
|
72
|
+
"@wordpress/preferences": "^4.48.1",
|
|
73
|
+
"@wordpress/private-apis": "^1.48.1",
|
|
74
|
+
"@wordpress/reusable-blocks": "^5.48.1",
|
|
75
|
+
"@wordpress/ui": "^0.15.1",
|
|
76
|
+
"@wordpress/url": "^4.48.1",
|
|
77
|
+
"@wordpress/widgets": "^4.48.1",
|
|
79
78
|
"clsx": "^2.1.1"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
82
|
-
"
|
|
81
|
+
"@testing-library/dom": "^10.4.1",
|
|
82
|
+
"@testing-library/react": "^16.3.2",
|
|
83
|
+
"deep-freeze": "^0.0.1"
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
|
-
"react": "^
|
|
86
|
-
"react-dom": "^
|
|
86
|
+
"react": "^18.0.0",
|
|
87
|
+
"react-dom": "^18.0.0"
|
|
87
88
|
},
|
|
88
89
|
"publishConfig": {
|
|
89
90
|
"access": "public"
|
|
90
91
|
},
|
|
91
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "99df7432c5c7cb83ba41146fd1f57f3c19004305"
|
|
92
93
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
useEffect,
|
|
6
|
-
Platform,
|
|
7
|
-
useContext,
|
|
8
|
-
useCallback,
|
|
9
|
-
} from '@wordpress/element';
|
|
4
|
+
import { useEffect, useContext, useCallback } from '@wordpress/element';
|
|
10
5
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
6
|
import {
|
|
12
7
|
ComplementaryArea,
|
|
@@ -21,10 +16,7 @@ import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
|
21
16
|
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
22
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
23
18
|
|
|
24
|
-
const SIDEBAR_ACTIVE_BY_DEFAULT =
|
|
25
|
-
web: true,
|
|
26
|
-
native: false,
|
|
27
|
-
} );
|
|
19
|
+
const SIDEBAR_ACTIVE_BY_DEFAULT = true;
|
|
28
20
|
|
|
29
21
|
const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';
|
|
30
22
|
|