@wordpress/edit-widgets 5.27.2 → 5.28.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/blocks/widget-area/edit/use-is-dragging-within.js +1 -2
  3. package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +1 -1
  4. package/build/blocks/widget-area/index.js +2 -4
  5. package/build/blocks/widget-area/index.js.map +1 -1
  6. package/build/components/header/document-tools/index.js +1 -2
  7. package/build/components/header/document-tools/index.js.map +1 -1
  8. package/build/components/header/index.js +1 -2
  9. package/build/components/header/index.js.map +1 -1
  10. package/build/components/header/undo-redo/redo.js +1 -2
  11. package/build/components/header/undo-redo/redo.js.map +1 -1
  12. package/build/components/header/undo-redo/undo.js +1 -2
  13. package/build/components/header/undo-redo/undo.js.map +1 -1
  14. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  15. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -2
  17. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  19. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  20. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -2
  21. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  22. package/build/components/keyboard-shortcuts/index.js +1 -2
  23. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build/components/layout/index.js +1 -2
  25. package/build/components/layout/index.js.map +1 -1
  26. package/build/components/layout/interface.js +1 -2
  27. package/build/components/layout/interface.js.map +1 -1
  28. package/build/components/more-menu/tools-more-menu-group.js +1 -2
  29. package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
  30. package/build/components/notices/index.js +4 -3
  31. package/build/components/notices/index.js.map +1 -1
  32. package/build/components/save-button/index.js +4 -5
  33. package/build/components/save-button/index.js.map +1 -1
  34. package/build/components/sidebar/index.js +89 -58
  35. package/build/components/sidebar/index.js.map +1 -1
  36. package/build/constants.js +2 -4
  37. package/build/constants.js.map +1 -1
  38. package/build/hooks/use-last-selected-widget-area.js +1 -2
  39. package/build/hooks/use-last-selected-widget-area.js.map +1 -1
  40. package/build/hooks/use-widget-library-insertion-point.js +1 -2
  41. package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
  42. package/build/index.js +3 -4
  43. package/build/index.js.map +1 -1
  44. package/build/store/constants.js +1 -2
  45. package/build/store/constants.js.map +1 -1
  46. package/build/store/index.js +3 -4
  47. package/build/store/index.js.map +1 -1
  48. package/build/store/reducer.js +1 -2
  49. package/build/store/reducer.js.map +1 -1
  50. package/build/store/selectors.js +9 -19
  51. package/build/store/selectors.js.map +1 -1
  52. package/build/store/utils.js +3 -6
  53. package/build/store/utils.js.map +1 -1
  54. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  55. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  56. package/build-module/components/notices/index.js +4 -1
  57. package/build-module/components/notices/index.js.map +1 -1
  58. package/build-module/components/save-button/index.js +3 -3
  59. package/build-module/components/save-button/index.js.map +1 -1
  60. package/build-module/components/sidebar/index.js +92 -61
  61. package/build-module/components/sidebar/index.js.map +1 -1
  62. package/build-module/store/selectors.js +0 -1
  63. package/build-module/store/selectors.js.map +1 -1
  64. package/build-style/style-rtl.css +27 -86
  65. package/build-style/style.css +27 -86
  66. package/package.json +28 -28
  67. package/src/components/header/style.scss +39 -3
  68. package/src/components/notices/index.js +6 -3
  69. package/src/components/save-button/index.js +4 -3
  70. package/src/components/sidebar/index.js +138 -101
  71. package/src/components/sidebar/style.scss +0 -94
@@ -1 +1 @@
1
- {"version":3,"names":["createRegistrySelector","getWidgetIdFromBlock","store","coreStore","blockEditorStore","buildWidgetsQuery","buildWidgetAreasQuery","buildWidgetAreaPostId","KIND","POST_TYPE","WIDGET_AREA_ENTITY_TYPE","STORE_NAME","editWidgetsStoreName","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","getWidgets","select","widgets","getEntityRecords","reduce","allWidgets","widget","id","getWidget","state","getWidgetAreas","query","getWidgetAreaForWidgetId","widgetId","widgetAreas","find","widgetArea","post","getEditedEntityRecord","blockWidgetIds","blocks","map","block","includes","getParentWidgetAreaBlock","clientId","getBlock","getBlockName","getBlockParents","blockParents","widgetAreaClientId","parentClientId","getEditedWidgetAreas","ids","filter","hasEditsForEntityRecord","getReferenceWidgetBlocks","referenceWidgetName","results","_widgetArea","name","attributes","push","isSavingWidgetAreas","widgetAreasIds","isSaving","isSavingEntityRecord","widgetIds","Object","keys","getIsWidgetAreaOpen","widgetAreasOpenState","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","canInsertBlockInWidgetArea","blockName","getBlocks","firstWidgetArea","canInsertBlockType","isListViewOpened","listViewPanel"],"sources":["@wordpress/edit-widgets/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuildWidgetsQuery,\n\tbuildWidgetAreasQuery,\n\tbuildWidgetAreaPostId,\n\tKIND,\n\tPOST_TYPE,\n\tWIDGET_AREA_ENTITY_TYPE,\n} from './utils';\nimport { STORE_NAME as editWidgetsStoreName } from './constants';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n};\n\n/**\n * Returns all API widgets.\n *\n * @return {Object[]} API List of widgets.\n */\nexport const getWidgets = createRegistrySelector( ( select ) => () => {\n\tconst widgets = select( coreStore ).getEntityRecords(\n\t\t'root',\n\t\t'widget',\n\t\tbuildWidgetsQuery()\n\t);\n\n\treturn (\n\t\t// Key widgets by their ID.\n\t\twidgets?.reduce(\n\t\t\t( allWidgets, widget ) => ( {\n\t\t\t\t...allWidgets,\n\t\t\t\t[ widget.id ]: widget,\n\t\t\t} ),\n\t\t\t{}\n\t\t) || {}\n\t);\n} );\n\n/**\n * Returns API widget data for a particular widget ID.\n *\n * @param {number} id Widget ID.\n *\n * @return {Object} API widget data for a particular widget ID.\n */\nexport const getWidget = createRegistrySelector(\n\t( select ) => ( state, id ) => {\n\t\tconst widgets = select( editWidgetsStoreName ).getWidgets();\n\t\treturn widgets[ id ];\n\t}\n);\n\n/**\n * Returns all API widget areas.\n *\n * @return {Object[]} API List of widget areas.\n */\nexport const getWidgetAreas = createRegistrySelector( ( select ) => () => {\n\tconst query = buildWidgetAreasQuery();\n\treturn select( coreStore ).getEntityRecords(\n\t\tKIND,\n\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\tquery\n\t);\n} );\n\n/**\n * Returns widgetArea containing a block identify by given widgetId\n *\n * @param {string} widgetId The ID of the widget.\n * @return {Object} Containing widget area.\n */\nexport const getWidgetAreaForWidgetId = createRegistrySelector(\n\t( select ) => ( state, widgetId ) => {\n\t\tconst widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\treturn widgetAreas.find( ( widgetArea ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tKIND,\n\t\t\t\tPOST_TYPE,\n\t\t\t\tbuildWidgetAreaPostId( widgetArea.id )\n\t\t\t);\n\t\t\tconst blockWidgetIds = post.blocks.map( ( block ) =>\n\t\t\t\tgetWidgetIdFromBlock( block )\n\t\t\t);\n\t\t\treturn blockWidgetIds.includes( widgetId );\n\t\t} );\n\t}\n);\n\n/**\n * Given a child client id, returns the parent widget area block.\n *\n * @param {string} clientId The client id of a block in a widget area.\n *\n * @return {WPBlock} The widget area block.\n */\nexport const getParentWidgetAreaBlock = createRegistrySelector(\n\t( select ) => ( state, clientId ) => {\n\t\tconst { getBlock, getBlockName, getBlockParents } =\n\t\t\tselect( blockEditorStore );\n\t\tconst blockParents = getBlockParents( clientId );\n\t\tconst widgetAreaClientId = blockParents.find(\n\t\t\t( parentClientId ) =>\n\t\t\t\tgetBlockName( parentClientId ) === 'core/widget-area'\n\t\t);\n\t\treturn getBlock( widgetAreaClientId );\n\t}\n);\n\n/**\n * Returns all edited widget area entity records.\n *\n * @return {Object[]} List of edited widget area entity records.\n */\nexport const getEditedWidgetAreas = createRegistrySelector(\n\t( select ) => ( state, ids ) => {\n\t\tlet widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\tif ( ! widgetAreas ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( ids ) {\n\t\t\twidgetAreas = widgetAreas.filter( ( { id } ) =>\n\t\t\t\tids.includes( id )\n\t\t\t);\n\t\t}\n\t\treturn widgetAreas\n\t\t\t.filter( ( { id } ) =>\n\t\t\t\tselect( coreStore ).hasEditsForEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tPOST_TYPE,\n\t\t\t\t\tbuildWidgetAreaPostId( id )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.map( ( { id } ) =>\n\t\t\t\tselect( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\t\t\tid\n\t\t\t\t)\n\t\t\t);\n\t}\n);\n\n/**\n * Returns all blocks representing reference widgets.\n *\n * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned.\n * @return {Array} List of all blocks representing reference widgets\n */\nexport const getReferenceWidgetBlocks = createRegistrySelector(\n\t( select ) =>\n\t\t( state, referenceWidgetName = null ) => {\n\t\t\tconst results = [];\n\t\t\tconst widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\t\tfor ( const _widgetArea of widgetAreas ) {\n\t\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tPOST_TYPE,\n\t\t\t\t\tbuildWidgetAreaPostId( _widgetArea.id )\n\t\t\t\t);\n\t\t\t\tfor ( const block of post.blocks ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tblock.name === 'core/legacy-widget' &&\n\t\t\t\t\t\t( ! referenceWidgetName ||\n\t\t\t\t\t\t\tblock.attributes?.referenceWidgetName ===\n\t\t\t\t\t\t\t\treferenceWidgetName )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresults.push( block );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n);\n\n/**\n * Returns true if any widget area is currently being saved.\n *\n * @return {boolean} True if any widget area is currently being saved. False otherwise.\n */\nexport const isSavingWidgetAreas = createRegistrySelector( ( select ) => () => {\n\tconst widgetAreasIds = select( editWidgetsStoreName )\n\t\t.getWidgetAreas()\n\t\t?.map( ( { id } ) => id );\n\tif ( ! widgetAreasIds ) {\n\t\treturn false;\n\t}\n\n\tfor ( const id of widgetAreasIds ) {\n\t\tconst isSaving = select( coreStore ).isSavingEntityRecord(\n\t\t\tKIND,\n\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\tid\n\t\t);\n\t\tif ( isSaving ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tconst widgetIds = [\n\t\t...Object.keys( select( editWidgetsStoreName ).getWidgets() ),\n\t\tundefined, // account for new widgets without an ID\n\t];\n\tfor ( const id of widgetIds ) {\n\t\tconst isSaving = select( coreStore ).isSavingEntityRecord(\n\t\t\t'root',\n\t\t\t'widget',\n\t\t\tid\n\t\t);\n\t\tif ( isSaving ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n} );\n\n/**\n * Gets whether the widget area is opened.\n *\n * @param {Array} state The open state of the widget areas.\n * @param {string} clientId The clientId of the widget area.\n *\n * @return {boolean} True if the widget area is open.\n */\nexport const getIsWidgetAreaOpen = ( state, clientId ) => {\n\tconst { widgetAreasOpenState } = state;\n\treturn !! widgetAreasOpenState[ clientId ];\n};\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tif ( typeof state.blockInserterPanel === 'boolean' ) {\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n\n\treturn state.blockInserterPanel;\n}\n\n/**\n * Returns true if a block can be inserted into a widget area.\n *\n * @param {Array} state The open state of the widget areas.\n * @param {string} blockName The name of the block being inserted.\n *\n * @return {boolean} True if the block can be inserted in a widget area.\n */\nexport const canInsertBlockInWidgetArea = createRegistrySelector(\n\t( select ) => ( state, blockName ) => {\n\t\t// Widget areas are always top-level blocks, which getBlocks will return.\n\t\tconst widgetAreas = select( blockEditorStore ).getBlocks();\n\n\t\t// Makes an assumption that a block that can be inserted into one\n\t\t// widget area can be inserted into any widget area. Uses the first\n\t\t// widget area for testing whether the block can be inserted.\n\t\tconst [ firstWidgetArea ] = widgetAreas;\n\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\tblockName,\n\t\t\tfirstWidgetArea.clientId\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,qBAAqB,EACrBC,qBAAqB,EACrBC,IAAI,EACJC,SAAS,EACTC,uBAAuB,QACjB,SAAS;AAChB,SAASC,UAAU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ACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAAE7C,KAAK,EAAG;EACxD,IAAK,OAAOA,KAAK,CAAC4C,kBAAkB,KAAK,SAAS,EAAG;IACpD,OAAOzD,qBAAqB;EAC7B;EAEA,OAAOa,KAAK,CAAC4C,kBAAkB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,0BAA0B,GAAGxE,sBAAsB,CAC7DkB,MAAM,IAAM,CAAEQ,KAAK,EAAE+C,SAAS,KAAM;EACrC;EACA,MAAM1C,WAAW,GAAGb,MAAM,CAAEd,gBAAiB,CAAC,CAACsE,SAAS,CAAC,CAAC;;EAE1D;EACA;EACA;EACA,MAAM,CAAEC,eAAe,CAAE,GAAG5C,WAAW;EACvC,OAAOb,MAAM,CAAEd,gBAAiB,CAAC,CAACwE,kBAAkB,CACnDH,SAAS,EACTE,eAAe,CAACjC,QACjB,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmC,gBAAgBA,CAAEnD,KAAK,EAAG;EACzC,OAAOA,KAAK,CAACoD,aAAa;AAC3B"}
1
+ {"version":3,"names":["createRegistrySelector","getWidgetIdFromBlock","store","coreStore","blockEditorStore","buildWidgetsQuery","buildWidgetAreasQuery","buildWidgetAreaPostId","KIND","POST_TYPE","WIDGET_AREA_ENTITY_TYPE","STORE_NAME","editWidgetsStoreName","EMPTY_INSERTION_POINT","rootClientId","undefined","insertionIndex","getWidgets","select","widgets","getEntityRecords","reduce","allWidgets","widget","id","getWidget","state","getWidgetAreas","query","getWidgetAreaForWidgetId","widgetId","widgetAreas","find","widgetArea","post","getEditedEntityRecord","blockWidgetIds","blocks","map","block","includes","getParentWidgetAreaBlock","clientId","getBlock","getBlockName","getBlockParents","blockParents","widgetAreaClientId","parentClientId","getEditedWidgetAreas","ids","filter","hasEditsForEntityRecord","getReferenceWidgetBlocks","referenceWidgetName","results","_widgetArea","name","attributes","push","isSavingWidgetAreas","widgetAreasIds","isSaving","isSavingEntityRecord","widgetIds","Object","keys","getIsWidgetAreaOpen","widgetAreasOpenState","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","canInsertBlockInWidgetArea","blockName","getBlocks","firstWidgetArea","canInsertBlockType","isListViewOpened","listViewPanel"],"sources":["@wordpress/edit-widgets/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuildWidgetsQuery,\n\tbuildWidgetAreasQuery,\n\tbuildWidgetAreaPostId,\n\tKIND,\n\tPOST_TYPE,\n\tWIDGET_AREA_ENTITY_TYPE,\n} from './utils';\nimport { STORE_NAME as editWidgetsStoreName } from './constants';\n\nconst EMPTY_INSERTION_POINT = {\n\trootClientId: undefined,\n\tinsertionIndex: undefined,\n};\n\n/**\n * Returns all API widgets.\n *\n * @return {Object[]} API List of widgets.\n */\nexport const getWidgets = createRegistrySelector( ( select ) => () => {\n\tconst widgets = select( coreStore ).getEntityRecords(\n\t\t'root',\n\t\t'widget',\n\t\tbuildWidgetsQuery()\n\t);\n\n\treturn (\n\t\t// Key widgets by their ID.\n\t\twidgets?.reduce(\n\t\t\t( allWidgets, widget ) => ( {\n\t\t\t\t...allWidgets,\n\t\t\t\t[ widget.id ]: widget,\n\t\t\t} ),\n\t\t\t{}\n\t\t) || {}\n\t);\n} );\n\n/**\n * Returns API widget data for a particular widget ID.\n *\n * @param {number} id Widget ID.\n *\n * @return {Object} API widget data for a particular widget ID.\n */\nexport const getWidget = createRegistrySelector(\n\t( select ) => ( state, id ) => {\n\t\tconst widgets = select( editWidgetsStoreName ).getWidgets();\n\t\treturn widgets[ id ];\n\t}\n);\n\n/**\n * Returns all API widget areas.\n *\n * @return {Object[]} API List of widget areas.\n */\nexport const getWidgetAreas = createRegistrySelector( ( select ) => () => {\n\tconst query = buildWidgetAreasQuery();\n\treturn select( coreStore ).getEntityRecords(\n\t\tKIND,\n\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\tquery\n\t);\n} );\n\n/**\n * Returns widgetArea containing a block identify by given widgetId\n *\n * @param {string} widgetId The ID of the widget.\n * @return {Object} Containing widget area.\n */\nexport const getWidgetAreaForWidgetId = createRegistrySelector(\n\t( select ) => ( state, widgetId ) => {\n\t\tconst widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\treturn widgetAreas.find( ( widgetArea ) => {\n\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\tKIND,\n\t\t\t\tPOST_TYPE,\n\t\t\t\tbuildWidgetAreaPostId( widgetArea.id )\n\t\t\t);\n\t\t\tconst blockWidgetIds = post.blocks.map( ( block ) =>\n\t\t\t\tgetWidgetIdFromBlock( block )\n\t\t\t);\n\t\t\treturn blockWidgetIds.includes( widgetId );\n\t\t} );\n\t}\n);\n\n/**\n * Given a child client id, returns the parent widget area block.\n *\n * @param {string} clientId The client id of a block in a widget area.\n *\n * @return {WPBlock} The widget area block.\n */\nexport const getParentWidgetAreaBlock = createRegistrySelector(\n\t( select ) => ( state, clientId ) => {\n\t\tconst { getBlock, getBlockName, getBlockParents } =\n\t\t\tselect( blockEditorStore );\n\t\tconst blockParents = getBlockParents( clientId );\n\t\tconst widgetAreaClientId = blockParents.find(\n\t\t\t( parentClientId ) =>\n\t\t\t\tgetBlockName( parentClientId ) === 'core/widget-area'\n\t\t);\n\t\treturn getBlock( widgetAreaClientId );\n\t}\n);\n\n/**\n * Returns all edited widget area entity records.\n *\n * @return {Object[]} List of edited widget area entity records.\n */\nexport const getEditedWidgetAreas = createRegistrySelector(\n\t( select ) => ( state, ids ) => {\n\t\tlet widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\tif ( ! widgetAreas ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( ids ) {\n\t\t\twidgetAreas = widgetAreas.filter( ( { id } ) =>\n\t\t\t\tids.includes( id )\n\t\t\t);\n\t\t}\n\t\treturn widgetAreas\n\t\t\t.filter( ( { id } ) =>\n\t\t\t\tselect( coreStore ).hasEditsForEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tPOST_TYPE,\n\t\t\t\t\tbuildWidgetAreaPostId( id )\n\t\t\t\t)\n\t\t\t)\n\t\t\t.map( ( { id } ) =>\n\t\t\t\tselect( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\t\t\tid\n\t\t\t\t)\n\t\t\t);\n\t}\n);\n\n/**\n * Returns all blocks representing reference widgets.\n *\n * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned.\n * @return {Array} List of all blocks representing reference widgets\n */\nexport const getReferenceWidgetBlocks = createRegistrySelector(\n\t( select ) =>\n\t\t( state, referenceWidgetName = null ) => {\n\t\t\tconst results = [];\n\t\t\tconst widgetAreas = select( editWidgetsStoreName ).getWidgetAreas();\n\t\t\tfor ( const _widgetArea of widgetAreas ) {\n\t\t\t\tconst post = select( coreStore ).getEditedEntityRecord(\n\t\t\t\t\tKIND,\n\t\t\t\t\tPOST_TYPE,\n\t\t\t\t\tbuildWidgetAreaPostId( _widgetArea.id )\n\t\t\t\t);\n\t\t\t\tfor ( const block of post.blocks ) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tblock.name === 'core/legacy-widget' &&\n\t\t\t\t\t\t( ! referenceWidgetName ||\n\t\t\t\t\t\t\tblock.attributes?.referenceWidgetName ===\n\t\t\t\t\t\t\t\treferenceWidgetName )\n\t\t\t\t\t) {\n\t\t\t\t\t\tresults.push( block );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn results;\n\t\t}\n);\n\n/**\n * Returns true if any widget area is currently being saved.\n *\n * @return {boolean} True if any widget area is currently being saved. False otherwise.\n */\nexport const isSavingWidgetAreas = createRegistrySelector( ( select ) => () => {\n\tconst widgetAreasIds = select( editWidgetsStoreName )\n\t\t.getWidgetAreas()\n\t\t?.map( ( { id } ) => id );\n\tif ( ! widgetAreasIds ) {\n\t\treturn false;\n\t}\n\n\tfor ( const id of widgetAreasIds ) {\n\t\tconst isSaving = select( coreStore ).isSavingEntityRecord(\n\t\t\tKIND,\n\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\tid\n\t\t);\n\t\tif ( isSaving ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tconst widgetIds = [\n\t\t...Object.keys( select( editWidgetsStoreName ).getWidgets() ),\n\t\tundefined, // account for new widgets without an ID\n\t];\n\tfor ( const id of widgetIds ) {\n\t\tconst isSaving = select( coreStore ).isSavingEntityRecord(\n\t\t\t'root',\n\t\t\t'widget',\n\t\t\tid\n\t\t);\n\t\tif ( isSaving ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n} );\n\n/**\n * Gets whether the widget area is opened.\n *\n * @param {Array} state The open state of the widget areas.\n * @param {string} clientId The clientId of the widget area.\n *\n * @return {boolean} True if the widget area is open.\n */\nexport const getIsWidgetAreaOpen = ( state, clientId ) => {\n\tconst { widgetAreasOpenState } = state;\n\treturn !! widgetAreasOpenState[ clientId ];\n};\n\n/**\n * Returns true if the inserter is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID and index to insert at.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tif ( typeof state.blockInserterPanel === 'boolean' ) {\n\t\treturn EMPTY_INSERTION_POINT;\n\t}\n\n\treturn state.blockInserterPanel;\n}\n\n/**\n * Returns true if a block can be inserted into a widget area.\n *\n * @param {Array} state The open state of the widget areas.\n * @param {string} blockName The name of the block being inserted.\n *\n * @return {boolean} True if the block can be inserted in a widget area.\n */\nexport const canInsertBlockInWidgetArea = createRegistrySelector(\n\t( select ) => ( state, blockName ) => {\n\t\t// Widget areas are always top-level blocks, which getBlocks will return.\n\t\tconst widgetAreas = select( blockEditorStore ).getBlocks();\n\n\t\t// Makes an assumption that a block that can be inserted into one\n\t\t// widget area can be inserted into any widget area. Uses the first\n\t\t// widget area for testing whether the block can be inserted.\n\t\tconst [ firstWidgetArea ] = widgetAreas;\n\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\tblockName,\n\t\t\tfirstWidgetArea.clientId\n\t\t);\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,oBAAoB,QAAQ,oBAAoB;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SACCC,iBAAiB,EACjBC,qBAAqB,EACrBC,qBAAqB,EACrBC,IAAI,EACJC,SAAS,EACTC,uBAAuB,QACjB,SAAS;AAChB,SAASC,UAAU,IAAIC,oBAAoB,QAAQ,aAAa;AAEhE,MAAMC,qBAAqB,GAAG;EAC7BC,YAAY,EAAEC,SAAS;EACvBC,cAAc,EAAED;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,UAAU,GAAGjB,sBAAsB,CAAIkB,MAAM,IAAM,MAAM;EACrE,MAAMC,OAAO,GAAGD,MAAM,CAAEf,SAAU,CAAC,CAACiB,gBAAgB,CACnD,MAAM,EACN,QAAQ,EACRf,iBAAiB,CAAC,CACnB,CAAC;EAED;IACC;IACAc,OAAO,EAAEE,MAAM,CACd,CAAEC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CAAEd,gBAAiB,CAAC,CAACsE,SAAS,CAAC,CAAC;;EAE1D;EACA;EACA;EACA,MAAM,CAAEC,eAAe,CAAE,GAAG5C,WAAW;EACvC,OAAOb,MAAM,CAAEd,gBAAiB,CAAC,CAACwE,kBAAkB,CACnDH,SAAS,EACTE,eAAe,CAACjC,QACjB,CAAC;AACF,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmC,gBAAgBA,CAAEnD,KAAK,EAAG;EACzC,OAAOA,KAAK,CAACoD,aAAa;AAC3B"}
@@ -451,7 +451,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
451
451
  }
452
452
 
453
453
  .interface-more-menu-dropdown__content .components-popover__content {
454
- min-width: 280px;
454
+ min-width: 300px;
455
455
  }
456
456
  @media (min-width: 480px) {
457
457
  .interface-more-menu-dropdown__content .components-popover__content {
@@ -556,10 +556,21 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
556
556
  }
557
557
  }
558
558
  .edit-widgets-header .selected-block-tools-wrapper {
559
- overflow-x: hidden;
559
+ overflow: hidden;
560
+ display: flex;
561
+ align-items: center;
562
+ height: 60px;
560
563
  }
561
564
  .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-contextual-toolbar {
562
565
  border-bottom: 0;
566
+ height: 100%;
567
+ }
568
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-toolbar {
569
+ height: 100%;
570
+ padding-top: 15px;
571
+ }
572
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-toolbar .components-button:not(.block-editor-block-mover-button) {
573
+ height: 32px;
563
574
  }
564
575
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar-group,
565
576
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar {
@@ -569,22 +580,34 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
569
580
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar::after {
570
581
  content: "";
571
582
  width: 1px;
572
- margin-top: 12px;
573
- margin-bottom: 12px;
583
+ height: 24px;
574
584
  background-color: #ddd;
585
+ margin-top: 4px;
575
586
  margin-right: 8px;
576
587
  }
577
588
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar-group .components-toolbar-group.components-toolbar-group::after,
578
589
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar .components-toolbar-group.components-toolbar-group::after {
579
590
  display: none;
580
591
  }
592
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-mover.is-horizontal .block-editor-block-mover-button {
593
+ height: 32px;
594
+ overflow: visible;
595
+ }
596
+ @media (min-width: 600px) {
597
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container {
598
+ position: relative;
599
+ top: -10px;
600
+ }
601
+ }
581
602
 
582
603
  .edit-widgets-header__navigable-toolbar-wrapper {
583
604
  display: flex;
584
605
  align-items: center;
585
606
  justify-content: center;
586
607
  flex-shrink: 2;
608
+ padding-left: 8px;
587
609
  padding-right: 16px;
610
+ overflow: hidden;
588
611
  }
589
612
 
590
613
  .edit-widgets-header__title {
@@ -703,89 +726,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
703
726
  }
704
727
 
705
728
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
706
- justify-content: flex-start;
707
729
  padding-right: 0;
708
- padding-left: 4px;
709
- border-top: 0;
710
- margin-top: 0;
711
- }
712
- .components-panel__header.edit-widgets-sidebar__panel-tabs ul {
713
- display: flex;
714
- }
715
- .components-panel__header.edit-widgets-sidebar__panel-tabs li {
716
- margin: 0;
717
- }
718
- .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon {
719
- display: none;
720
- margin-right: auto;
721
- }
722
- @media (min-width: 782px) {
723
- .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon {
724
- display: flex;
725
- }
726
- }
727
-
728
- .components-button.edit-widgets-sidebar__panel-tab {
729
- position: relative;
730
- border-radius: 0;
731
- height: 48px;
732
- background: transparent;
733
- border: none;
734
- box-shadow: none;
735
- cursor: pointer;
736
- padding: 3px 16px;
737
- margin-right: 0;
738
- font-weight: 500;
739
- }
740
- .components-button.edit-widgets-sidebar__panel-tab:focus:not(:disabled) {
741
- position: relative;
742
- box-shadow: none;
743
- outline: none;
744
- }
745
- .components-button.edit-widgets-sidebar__panel-tab::after {
746
- content: "";
747
- position: absolute;
748
- left: 0;
749
- bottom: 0;
750
- right: 0;
751
- pointer-events: none;
752
- background: var(--wp-admin-theme-color);
753
- height: calc(0 * var(--wp-admin-border-width-focus));
754
- border-radius: 0;
755
- transition: all 0.1s linear;
756
- }
757
- @media (prefers-reduced-motion: reduce) {
758
- .components-button.edit-widgets-sidebar__panel-tab::after {
759
- transition-duration: 0s;
760
- transition-delay: 0s;
761
- }
762
- }
763
- .components-button.edit-widgets-sidebar__panel-tab.is-active::after {
764
- height: calc(1 * var(--wp-admin-border-width-focus));
765
- outline: 2px solid transparent;
766
- outline-offset: -1px;
767
- }
768
- .components-button.edit-widgets-sidebar__panel-tab::before {
769
- content: "";
770
- position: absolute;
771
- top: 12px;
772
- left: 12px;
773
- bottom: 12px;
774
- right: 12px;
775
- pointer-events: none;
776
- box-shadow: 0 0 0 0 transparent;
777
- border-radius: 2px;
778
- transition: all 0.1s linear;
779
- }
780
- @media (prefers-reduced-motion: reduce) {
781
- .components-button.edit-widgets-sidebar__panel-tab::before {
782
- transition-duration: 0s;
783
- transition-delay: 0s;
784
- }
785
- }
786
- .components-button.edit-widgets-sidebar__panel-tab:focus-visible::before {
787
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
788
- outline: 2px solid transparent;
789
730
  }
790
731
 
791
732
  .edit-widgets-widget-areas__top-container {
@@ -451,7 +451,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
451
451
  }
452
452
 
453
453
  .interface-more-menu-dropdown__content .components-popover__content {
454
- min-width: 280px;
454
+ min-width: 300px;
455
455
  }
456
456
  @media (min-width: 480px) {
457
457
  .interface-more-menu-dropdown__content .components-popover__content {
@@ -556,10 +556,21 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
556
556
  }
557
557
  }
558
558
  .edit-widgets-header .selected-block-tools-wrapper {
559
- overflow-x: hidden;
559
+ overflow: hidden;
560
+ display: flex;
561
+ align-items: center;
562
+ height: 60px;
560
563
  }
561
564
  .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-contextual-toolbar {
562
565
  border-bottom: 0;
566
+ height: 100%;
567
+ }
568
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-toolbar {
569
+ height: 100%;
570
+ padding-top: 15px;
571
+ }
572
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-toolbar .components-button:not(.block-editor-block-mover-button) {
573
+ height: 32px;
563
574
  }
564
575
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar-group,
565
576
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar {
@@ -569,22 +580,34 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
569
580
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar::after {
570
581
  content: "";
571
582
  width: 1px;
572
- margin-top: 12px;
573
- margin-bottom: 12px;
583
+ height: 24px;
574
584
  background-color: #ddd;
585
+ margin-top: 4px;
575
586
  margin-left: 8px;
576
587
  }
577
588
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar-group .components-toolbar-group.components-toolbar-group::after,
578
589
  .edit-widgets-header .selected-block-tools-wrapper .components-toolbar .components-toolbar-group.components-toolbar-group::after {
579
590
  display: none;
580
591
  }
592
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-mover.is-horizontal .block-editor-block-mover-button {
593
+ height: 32px;
594
+ overflow: visible;
595
+ }
596
+ @media (min-width: 600px) {
597
+ .edit-widgets-header .selected-block-tools-wrapper .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container {
598
+ position: relative;
599
+ top: -10px;
600
+ }
601
+ }
581
602
 
582
603
  .edit-widgets-header__navigable-toolbar-wrapper {
583
604
  display: flex;
584
605
  align-items: center;
585
606
  justify-content: center;
586
607
  flex-shrink: 2;
608
+ padding-right: 8px;
587
609
  padding-left: 16px;
610
+ overflow: hidden;
588
611
  }
589
612
 
590
613
  .edit-widgets-header__title {
@@ -703,89 +726,7 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
703
726
  }
704
727
 
705
728
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
706
- justify-content: flex-start;
707
729
  padding-left: 0;
708
- padding-right: 4px;
709
- border-top: 0;
710
- margin-top: 0;
711
- }
712
- .components-panel__header.edit-widgets-sidebar__panel-tabs ul {
713
- display: flex;
714
- }
715
- .components-panel__header.edit-widgets-sidebar__panel-tabs li {
716
- margin: 0;
717
- }
718
- .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon {
719
- display: none;
720
- margin-left: auto;
721
- }
722
- @media (min-width: 782px) {
723
- .components-panel__header.edit-widgets-sidebar__panel-tabs .components-button.has-icon {
724
- display: flex;
725
- }
726
- }
727
-
728
- .components-button.edit-widgets-sidebar__panel-tab {
729
- position: relative;
730
- border-radius: 0;
731
- height: 48px;
732
- background: transparent;
733
- border: none;
734
- box-shadow: none;
735
- cursor: pointer;
736
- padding: 3px 16px;
737
- margin-left: 0;
738
- font-weight: 500;
739
- }
740
- .components-button.edit-widgets-sidebar__panel-tab:focus:not(:disabled) {
741
- position: relative;
742
- box-shadow: none;
743
- outline: none;
744
- }
745
- .components-button.edit-widgets-sidebar__panel-tab::after {
746
- content: "";
747
- position: absolute;
748
- right: 0;
749
- bottom: 0;
750
- left: 0;
751
- pointer-events: none;
752
- background: var(--wp-admin-theme-color);
753
- height: calc(0 * var(--wp-admin-border-width-focus));
754
- border-radius: 0;
755
- transition: all 0.1s linear;
756
- }
757
- @media (prefers-reduced-motion: reduce) {
758
- .components-button.edit-widgets-sidebar__panel-tab::after {
759
- transition-duration: 0s;
760
- transition-delay: 0s;
761
- }
762
- }
763
- .components-button.edit-widgets-sidebar__panel-tab.is-active::after {
764
- height: calc(1 * var(--wp-admin-border-width-focus));
765
- outline: 2px solid transparent;
766
- outline-offset: -1px;
767
- }
768
- .components-button.edit-widgets-sidebar__panel-tab::before {
769
- content: "";
770
- position: absolute;
771
- top: 12px;
772
- right: 12px;
773
- bottom: 12px;
774
- left: 12px;
775
- pointer-events: none;
776
- box-shadow: 0 0 0 0 transparent;
777
- border-radius: 2px;
778
- transition: all 0.1s linear;
779
- }
780
- @media (prefers-reduced-motion: reduce) {
781
- .components-button.edit-widgets-sidebar__panel-tab::before {
782
- transition-duration: 0s;
783
- transition-delay: 0s;
784
- }
785
- }
786
- .components-button.edit-widgets-sidebar__panel-tab:focus-visible::before {
787
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
788
- outline: 2px solid transparent;
789
730
  }
790
731
 
791
732
  .edit-widgets-widget-areas__top-container {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "5.27.2",
3
+ "version": "5.28.1",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,32 +27,32 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.47.0",
31
- "@wordpress/block-editor": "^12.18.2",
32
- "@wordpress/block-library": "^8.27.2",
33
- "@wordpress/blocks": "^12.27.1",
34
- "@wordpress/components": "^25.16.0",
35
- "@wordpress/compose": "^6.27.0",
36
- "@wordpress/core-data": "^6.27.2",
37
- "@wordpress/data": "^9.20.0",
38
- "@wordpress/deprecated": "^3.50.0",
39
- "@wordpress/dom": "^3.50.0",
40
- "@wordpress/element": "^5.27.0",
41
- "@wordpress/hooks": "^3.50.0",
42
- "@wordpress/i18n": "^4.50.0",
43
- "@wordpress/icons": "^9.41.0",
44
- "@wordpress/interface": "^5.27.0",
45
- "@wordpress/keyboard-shortcuts": "^4.27.0",
46
- "@wordpress/keycodes": "^3.50.0",
47
- "@wordpress/media-utils": "^4.41.0",
48
- "@wordpress/notices": "^4.18.0",
49
- "@wordpress/patterns": "^1.11.2",
50
- "@wordpress/plugins": "^6.18.0",
51
- "@wordpress/preferences": "^3.27.0",
52
- "@wordpress/private-apis": "^0.32.0",
53
- "@wordpress/reusable-blocks": "^4.27.2",
54
- "@wordpress/url": "^3.51.0",
55
- "@wordpress/widgets": "^3.27.2",
30
+ "@wordpress/api-fetch": "^6.48.0",
31
+ "@wordpress/block-editor": "^12.19.1",
32
+ "@wordpress/block-library": "^8.28.1",
33
+ "@wordpress/blocks": "^12.28.1",
34
+ "@wordpress/components": "^26.0.1",
35
+ "@wordpress/compose": "^6.28.0",
36
+ "@wordpress/core-data": "^6.28.1",
37
+ "@wordpress/data": "^9.21.0",
38
+ "@wordpress/deprecated": "^3.51.0",
39
+ "@wordpress/dom": "^3.51.0",
40
+ "@wordpress/element": "^5.28.0",
41
+ "@wordpress/hooks": "^3.51.0",
42
+ "@wordpress/i18n": "^4.51.0",
43
+ "@wordpress/icons": "^9.42.0",
44
+ "@wordpress/interface": "^5.28.1",
45
+ "@wordpress/keyboard-shortcuts": "^4.28.0",
46
+ "@wordpress/keycodes": "^3.51.0",
47
+ "@wordpress/media-utils": "^4.42.0",
48
+ "@wordpress/notices": "^4.19.0",
49
+ "@wordpress/patterns": "^1.12.1",
50
+ "@wordpress/plugins": "^6.19.1",
51
+ "@wordpress/preferences": "^3.28.1",
52
+ "@wordpress/private-apis": "^0.33.0",
53
+ "@wordpress/reusable-blocks": "^4.28.1",
54
+ "@wordpress/url": "^3.52.0",
55
+ "@wordpress/widgets": "^3.28.1",
56
56
  "classnames": "^2.3.1",
57
57
  "rememo": "^4.0.2"
58
58
  },
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "fefb6f718fbfd5df9390f366d5733369f613084a"
66
+ "gitHead": "5902fc0f490528da6965dd4cf97f11192bcf5956"
67
67
  }
@@ -11,10 +11,28 @@
11
11
  }
12
12
 
13
13
  .selected-block-tools-wrapper {
14
- overflow-x: hidden;
14
+ overflow: hidden;
15
+ display: flex;
16
+ align-items: center;
17
+ height: $header-height;
15
18
 
16
19
  .block-editor-block-contextual-toolbar {
17
20
  border-bottom: 0;
21
+ height: 100%;
22
+ }
23
+
24
+ // These rules ensure that icons are always positioned in a way that lines up with the rest of the icons in the toolbar.
25
+ .block-editor-block-toolbar {
26
+ height: 100%;
27
+ // Push down so that buttons are centered vertically.
28
+ // It should be 14px (60px header height - 32px compact button height = 28 / 2),
29
+ // but there is a -1px top-margin down the stack that affects this.
30
+ padding-top: math.div($header-height - $button-size-compact, 2) + 1;
31
+
32
+ // Match the height of other buttons in the header toolbar.
33
+ .components-button:not(.block-editor-block-mover-button) {
34
+ height: $button-size-compact;
35
+ }
18
36
  }
19
37
 
20
38
  // Modified group borders.
@@ -25,9 +43,9 @@
25
43
  &::after {
26
44
  content: "";
27
45
  width: $border-width;
28
- margin-top: $grid-unit + $grid-unit-05;
29
- margin-bottom: $grid-unit + $grid-unit-05;
46
+ height: $grid-unit-30;
30
47
  background-color: $gray-300;
48
+ margin-top: $grid-unit-05;
31
49
  margin-left: $grid-unit;
32
50
  }
33
51
 
@@ -37,6 +55,22 @@
37
55
  }
38
56
  }
39
57
  }
58
+
59
+ .block-editor-block-mover {
60
+ // Match the height of other buttons in the header toolbar.
61
+ &.is-horizontal .block-editor-block-mover-button {
62
+ height: $button-size-compact;
63
+ overflow: visible;
64
+ }
65
+
66
+ // Move up a little to prevent the toolbar shift when focus is on the vertical movers.
67
+ @include break-small() {
68
+ &:not(.is-horizontal) .block-editor-block-mover__move-button-container {
69
+ position: relative;
70
+ top: -10px;
71
+ }
72
+ }
73
+ }
40
74
  }
41
75
  }
42
76
 
@@ -45,7 +79,9 @@
45
79
  align-items: center;
46
80
  justify-content: center;
47
81
  flex-shrink: 2;
82
+ padding-right: $grid-unit-10;
48
83
  padding-left: $grid-unit-20;
84
+ overflow: hidden;
49
85
  }
50
86
 
51
87
  .edit-widgets-header__title {
@@ -5,6 +5,9 @@ import { NoticeList, SnackbarList } from '@wordpress/components';
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
7
 
8
+ // Last three notices. Slices from the tail end of the list.
9
+ const MAX_VISIBLE_NOTICES = -3;
10
+
8
11
  function Notices() {
9
12
  const { removeNotice } = useDispatch( noticesStore );
10
13
  const { notices } = useSelect( ( select ) => {
@@ -19,9 +22,9 @@ function Notices() {
19
22
  const nonDismissibleNotices = notices.filter(
20
23
  ( { isDismissible, type } ) => ! isDismissible && type === 'default'
21
24
  );
22
- const snackbarNotices = notices.filter(
23
- ( { type } ) => type === 'snackbar'
24
- );
25
+ const snackbarNotices = notices
26
+ .filter( ( { type } ) => type === 'snackbar' )
27
+ .slice( MAX_VISIBLE_NOTICES );
25
28
 
26
29
  return (
27
30
  <>
@@ -22,13 +22,14 @@ function SaveButton() {
22
22
  }, [] );
23
23
  const { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );
24
24
 
25
+ const isDisabled = isSaving || ! hasEditedWidgetAreaIds;
26
+
25
27
  return (
26
28
  <Button
27
29
  variant="primary"
28
30
  isBusy={ isSaving }
29
- aria-disabled={ isSaving }
30
- onClick={ isSaving ? undefined : saveEditedWidgetAreas }
31
- disabled={ ! hasEditedWidgetAreaIds }
31
+ aria-disabled={ isDisabled }
32
+ onClick={ isDisabled ? undefined : saveEditedWidgetAreas }
32
33
  >
33
34
  { isSaving ? __( 'Saving…' ) : __( 'Update' ) }
34
35
  </Button>