@wordpress/edit-widgets 7.2.0 → 7.3.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.
Files changed (187) hide show
  1. package/build/blocks/widget-area/edit/index.cjs +10 -8
  2. package/build/blocks/widget-area/edit/index.cjs.map +1 -1
  3. package/build/blocks/widget-area/edit/inner-blocks.cjs +10 -8
  4. package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -1
  5. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -1
  6. package/build/blocks/widget-area/index.cjs +9 -7
  7. package/build/blocks/widget-area/index.cjs.map +1 -1
  8. package/build/components/error-boundary/index.cjs.map +1 -1
  9. package/build/components/header/document-tools/index.cjs +20 -10
  10. package/build/components/header/document-tools/index.cjs.map +1 -1
  11. package/build/components/header/index.cjs +12 -10
  12. package/build/components/header/index.cjs.map +1 -1
  13. package/build/components/keyboard-shortcut-help-modal/config.cjs +5 -0
  14. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -1
  15. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +9 -7
  16. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -1
  17. package/build/components/keyboard-shortcut-help-modal/index.cjs +12 -11
  18. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -1
  19. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +34 -13
  20. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
  21. package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
  22. package/build/components/layout/index.cjs +19 -13
  23. package/build/components/layout/index.cjs.map +1 -1
  24. package/build/components/layout/interface.cjs +27 -13
  25. package/build/components/layout/interface.cjs.map +1 -1
  26. package/build/components/layout/unsaved-changes-warning.cjs.map +1 -1
  27. package/build/components/more-menu/index.cjs +14 -9
  28. package/build/components/more-menu/index.cjs.map +1 -1
  29. package/build/components/secondary-sidebar/index.cjs +10 -8
  30. package/build/components/secondary-sidebar/index.cjs.map +1 -1
  31. package/build/components/secondary-sidebar/inserter-sidebar.cjs +9 -7
  32. package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -1
  33. package/build/components/sidebar/index.cjs +23 -15
  34. package/build/components/sidebar/index.cjs.map +1 -1
  35. package/build/components/welcome-guide/index.cjs +5 -1
  36. package/build/components/welcome-guide/index.cjs.map +1 -1
  37. package/build/components/widget-areas-block-editor-content/index.cjs +10 -8
  38. package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -1
  39. package/build/components/widget-areas-block-editor-provider/index.cjs +10 -8
  40. package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -1
  41. package/build/constants.cjs +0 -2
  42. package/build/constants.cjs.map +1 -1
  43. package/build/index.cjs +12 -10
  44. package/build/index.cjs.map +1 -1
  45. package/build/store/actions.cjs +11 -7
  46. package/build/store/actions.cjs.map +1 -1
  47. package/build/store/index.cjs +14 -12
  48. package/build/store/index.cjs.map +1 -1
  49. package/build/store/selectors.cjs +3 -1
  50. package/build/store/selectors.cjs.map +1 -1
  51. package/build-module/blocks/widget-area/index.mjs.map +1 -1
  52. package/build-module/components/header/document-tools/index.mjs +10 -2
  53. package/build-module/components/header/document-tools/index.mjs.map +1 -1
  54. package/build-module/components/header/undo-redo/redo.mjs.map +1 -1
  55. package/build-module/components/header/undo-redo/undo.mjs.map +1 -1
  56. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +5 -0
  57. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -1
  58. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +1 -2
  59. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -1
  60. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +34 -13
  61. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
  62. package/build-module/components/layout/index.mjs +5 -1
  63. package/build-module/components/layout/index.mjs.map +1 -1
  64. package/build-module/components/layout/interface.mjs +16 -4
  65. package/build-module/components/layout/interface.mjs.map +1 -1
  66. package/build-module/components/more-menu/index.mjs +4 -1
  67. package/build-module/components/more-menu/index.mjs.map +1 -1
  68. package/build-module/components/sidebar/index.mjs +14 -8
  69. package/build-module/components/sidebar/index.mjs.map +1 -1
  70. package/build-module/components/welcome-guide/index.mjs +5 -1
  71. package/build-module/components/welcome-guide/index.mjs.map +1 -1
  72. package/build-module/constants.mjs +1 -2
  73. package/build-module/constants.mjs.map +1 -1
  74. package/build-module/index.mjs +2 -2
  75. package/build-module/index.mjs.map +1 -1
  76. package/build-module/store/actions.mjs +11 -7
  77. package/build-module/store/actions.mjs.map +1 -1
  78. package/build-module/store/selectors.mjs +3 -1
  79. package/build-module/store/selectors.mjs.map +1 -1
  80. package/build-style/style-rtl.css +42 -37
  81. package/build-style/style.css +42 -37
  82. package/build-types/blocks/widget-area/edit/index.d.ts +10 -0
  83. package/build-types/blocks/widget-area/edit/index.d.ts.map +1 -0
  84. package/build-types/blocks/widget-area/edit/inner-blocks.d.ts +4 -0
  85. package/build-types/blocks/widget-area/edit/inner-blocks.d.ts.map +1 -0
  86. package/build-types/blocks/widget-area/edit/use-is-dragging-within.d.ts +12 -0
  87. package/build-types/blocks/widget-area/edit/use-is-dragging-within.d.ts.map +1 -0
  88. package/build-types/blocks/widget-area/index.d.ts +14 -0
  89. package/build-types/blocks/widget-area/index.d.ts.map +1 -0
  90. package/build-types/components/error-boundary/index.d.ts +14 -0
  91. package/build-types/components/error-boundary/index.d.ts.map +1 -0
  92. package/build-types/components/header/document-tools/index.d.ts +3 -0
  93. package/build-types/components/header/document-tools/index.d.ts.map +1 -0
  94. package/build-types/components/header/index.d.ts +3 -0
  95. package/build-types/components/header/index.d.ts.map +1 -0
  96. package/build-types/components/header/undo-redo/redo.d.ts +3 -0
  97. package/build-types/components/header/undo-redo/redo.d.ts.map +1 -0
  98. package/build-types/components/header/undo-redo/undo.d.ts +3 -0
  99. package/build-types/components/header/undo-redo/undo.d.ts.map +1 -0
  100. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -0
  101. package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
  102. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
  103. package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
  104. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +5 -0
  105. package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
  106. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +25 -0
  107. package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
  108. package/build-types/components/keyboard-shortcuts/index.d.ts +7 -0
  109. package/build-types/components/keyboard-shortcuts/index.d.ts.map +1 -0
  110. package/build-types/components/layout/index.d.ts +5 -0
  111. package/build-types/components/layout/index.d.ts.map +1 -0
  112. package/build-types/components/layout/interface.d.ts +5 -0
  113. package/build-types/components/layout/interface.d.ts.map +1 -0
  114. package/build-types/components/layout/unsaved-changes-warning.d.ts +10 -0
  115. package/build-types/components/layout/unsaved-changes-warning.d.ts.map +1 -0
  116. package/build-types/components/more-menu/index.d.ts +2 -0
  117. package/build-types/components/more-menu/index.d.ts.map +1 -0
  118. package/build-types/components/more-menu/tools-more-menu-group.d.ts +6 -0
  119. package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -0
  120. package/build-types/components/notices/index.d.ts +3 -0
  121. package/build-types/components/notices/index.d.ts.map +1 -0
  122. package/build-types/components/save-button/index.d.ts +3 -0
  123. package/build-types/components/save-button/index.d.ts.map +1 -0
  124. package/build-types/components/secondary-sidebar/index.d.ts +2 -0
  125. package/build-types/components/secondary-sidebar/index.d.ts.map +1 -0
  126. package/build-types/components/secondary-sidebar/inserter-sidebar.d.ts +2 -0
  127. package/build-types/components/secondary-sidebar/inserter-sidebar.d.ts.map +1 -0
  128. package/build-types/components/secondary-sidebar/list-view-sidebar.d.ts +2 -0
  129. package/build-types/components/secondary-sidebar/list-view-sidebar.d.ts.map +1 -0
  130. package/build-types/components/sidebar/index.d.ts +2 -0
  131. package/build-types/components/sidebar/index.d.ts.map +1 -0
  132. package/build-types/components/sidebar/widget-areas.d.ts +4 -0
  133. package/build-types/components/sidebar/widget-areas.d.ts.map +1 -0
  134. package/build-types/components/welcome-guide/index.d.ts +2 -0
  135. package/build-types/components/welcome-guide/index.d.ts.map +1 -0
  136. package/build-types/components/widget-areas-block-editor-content/index.d.ts +4 -0
  137. package/build-types/components/widget-areas-block-editor-content/index.d.ts.map +1 -0
  138. package/build-types/components/widget-areas-block-editor-provider/index.d.ts +6 -0
  139. package/build-types/components/widget-areas-block-editor-provider/index.d.ts.map +1 -0
  140. package/build-types/constants.d.ts +2 -0
  141. package/build-types/constants.d.ts.map +1 -0
  142. package/build-types/filters/index.d.ts +3 -0
  143. package/build-types/filters/index.d.ts.map +1 -0
  144. package/build-types/filters/move-to-widget-area.d.ts +2 -0
  145. package/build-types/filters/move-to-widget-area.d.ts.map +1 -0
  146. package/build-types/filters/replace-media-upload.d.ts +2 -0
  147. package/build-types/filters/replace-media-upload.d.ts.map +1 -0
  148. package/build-types/hooks/use-last-selected-widget-area.d.ts +9 -0
  149. package/build-types/hooks/use-last-selected-widget-area.d.ts.map +1 -0
  150. package/build-types/hooks/use-widget-library-insertion-point.d.ts +3 -0
  151. package/build-types/hooks/use-widget-library-insertion-point.d.ts.map +1 -0
  152. package/build-types/index.d.ts +16 -0
  153. package/build-types/index.d.ts.map +1 -0
  154. package/build-types/lock-unlock.d.ts +2 -0
  155. package/build-types/lock-unlock.d.ts.map +1 -0
  156. package/build-types/store/actions.d.ts +144 -0
  157. package/build-types/store/actions.d.ts.map +1 -0
  158. package/build-types/store/constants.d.ts +5 -0
  159. package/build-types/store/constants.d.ts.map +1 -0
  160. package/build-types/store/index.d.ts +9 -0
  161. package/build-types/store/index.d.ts.map +1 -0
  162. package/build-types/store/private-selectors.d.ts +3 -0
  163. package/build-types/store/private-selectors.d.ts.map +1 -0
  164. package/build-types/store/reducer.d.ts +73 -0
  165. package/build-types/store/reducer.d.ts.map +1 -0
  166. package/build-types/store/resolvers.d.ts +17 -0
  167. package/build-types/store/resolvers.d.ts.map +1 -0
  168. package/build-types/store/selectors.d.ts +159 -0
  169. package/build-types/store/selectors.d.ts.map +1 -0
  170. package/build-types/store/transformers.d.ts +16 -0
  171. package/build-types/store/transformers.d.ts.map +1 -0
  172. package/build-types/store/utils.d.ts +53 -0
  173. package/build-types/store/utils.d.ts.map +1 -0
  174. package/package.json +33 -33
  175. package/src/components/header/style.scss +1 -1
  176. package/src/components/keyboard-shortcut-help-modal/config.js +3 -0
  177. package/src/components/keyboard-shortcut-help-modal/index.jsx +0 -2
  178. package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +43 -29
  179. package/src/components/sidebar/index.jsx +1 -1
  180. package/src/components/sidebar/style.scss +6 -0
  181. package/src/components/welcome-guide/style.scss +1 -1
  182. package/src/components/widget-areas-block-editor-content/style.scss +1 -1
  183. package/src/constants.js +0 -1
  184. package/src/index.jsx +2 -7
  185. package/src/store/actions.js +8 -12
  186. package/src/store/selectors.js +4 -1
  187. package/src/store/test/actions.jsdom.test.js +47 -2
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.cjs","names":["createRegistrySelector","createSelector","coreStore","buildWidgetsQuery","editWidgetsStoreName","buildWidgetAreasQuery","KIND","WIDGET_AREA_ENTITY_TYPE","POST_TYPE","buildWidgetAreaPostId","getWidgetIdFromBlock","blockEditorStore"],"sources":["../../src/store/selectors.js"],"sourcesContent":["import { createSelector, 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';\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\tcreateSelector(\n\t\t() => {\n\t\t\tconst widgets = select( coreStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\tbuildWidgetsQuery()\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t// Key widgets by their ID.\n\t\t\t\twidgets?.reduce(\n\t\t\t\t\t( allWidgets, widget ) => ( {\n\t\t\t\t\t\t...allWidgets,\n\t\t\t\t\t\t[ widget.id ]: widget,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t\t) ?? {}\n\t\t\t);\n\t\t},\n\t\t() => [\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\tbuildWidgetsQuery()\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\tif ( ! firstWidgetArea ) {\n\t\t\treturn false;\n\t\t}\n\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\n/**\n * Returns whether widget saving is locked.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import { store as widgetStore } from '@wordpress/edit-widgets';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * \tconst isSavingLocked = useSelect(\n * \t\t( select ) => select( widgetStore ).isWidgetSavingLocked(),\n * \t\t[]\n * \t);\n *\n * \treturn isSavingLocked ? (\n * \t\t<p>{ __( 'Widget saving is locked' ) }</p>\n * \t) : (\n * \t\t<p>{ __( 'Widget saving is not locked' ) }</p>\n * \t);\n * };\n * ```\n *\n * @return {boolean} Is locked.\n */\nexport function isWidgetSavingLocked( state ) {\n\treturn Object.keys( state.widgetSavingLock ).length > 0;\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,wBAAwB;CAC7B,cAAc,KAAA;CACd,gBAAgB,KAAA;AACjB;;;;;;AAOA,MAAa,cAAA,GAAaA,gBAAAA,uBAAAA,EAA0B,YAAA,GACnDC,gBAAAA,eAAAA,OACO;CAOL,OANgB,OAAQC,qBAAAA,KAAU,CAAC,CAAC,iBACnC,QACA,WAAA,GACAC,WAAAA,kBAAAA,CAAkB,CAKZ,CAAC,EAAE,QACN,YAAY,YAAc;EAC3B,GAAG;GACD,OAAO,KAAM;CAChB,IACA,CAAC,CACF,KAAK,CAAC;AAER,SACM,CACL,OAAQD,qBAAAA,KAAU,CAAC,CAAC,iBACnB,QACA,WAAA,GACAC,WAAAA,kBAAAA,CAAkB,CACnB,CACD,CACD,CACD;;;;;;;;AASA,MAAa,aA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ACA,EAEW,GACX,OAAO;CAIT,OAAO;AACR,CAAE;;;;;;;;;AAUF,MAAa,uBAAwB,OAAO,aAAc;CACzD,MAAM,EAAE,yBAAyB;CACjC,OAAO,CAAC,CAAE,qBAAsB;AACjC;;;;;;;;AASA,SAAgB,iBAAkB,OAAQ;CACzC,OAAO,CAAC,CAAE,MAAM;AACjB;;;;;;;;AASA,SAAgB,gCAAiC,OAAQ;CACxD,IAAK,OAAO,MAAM,uBAAuB,WACxC,OAAO;CAGR,OAAO,MAAM;AACd;;;;;;;;;AAUA,MAAa,8BAAA,GAA6BF,gBAAAA,uBAAAA,EACvC,YAAc,OAAO,cAAe;CAOrC,MAAM,CAAE,mBALY,OAAQW,wBAAAA,KAAiB,CAAC,CAAC,UAKT;CACtC,IAAK,CAAE,iBACN,OAAO;CAGR,OAAO,OAAQA,wBAAAA,KAAiB,CAAC,CAAC,mBACjC,WACA,gBAAgB,QACjB;AACD,CACD;;;;;;;;AASA,SAAgB,iBAAkB,OAAQ;CACzC,OAAO,MAAM;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,qBAAsB,OAAQ;CAC7C,OAAO,OAAO,KAAM,MAAM,gBAAiB,CAAC,CAAC,SAAS;AACvD"}
1
+ {"version":3,"file":"selectors.cjs","names":["createRegistrySelector","createSelector","coreStore","buildWidgetsQuery","editWidgetsStoreName","buildWidgetAreasQuery","KIND","WIDGET_AREA_ENTITY_TYPE","POST_TYPE","buildWidgetAreaPostId","getWidgetIdFromBlock","blockEditorStore"],"sources":["../../src/store/selectors.js"],"sourcesContent":["import { createSelector, 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';\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\n/** @typedef {import('@wordpress/blocks').Block} Block */\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\tcreateSelector(\n\t\t() => {\n\t\t\tconst widgets = select( coreStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\tbuildWidgetsQuery()\n\t\t\t);\n\n\t\t\treturn (\n\t\t\t\t// Key widgets by their ID.\n\t\t\t\twidgets?.reduce(\n\t\t\t\t\t( allWidgets, widget ) => ( {\n\t\t\t\t\t\t...allWidgets,\n\t\t\t\t\t\t[ widget.id ]: widget,\n\t\t\t\t\t} ),\n\t\t\t\t\t{}\n\t\t\t\t) ?? {}\n\t\t\t);\n\t\t},\n\t\t() => [\n\t\t\tselect( coreStore ).getEntityRecords(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\tbuildWidgetsQuery()\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 {Block | null} The widget area block.\n * @type {(state: Record<string, unknown>, clientId: string) => Block | null}\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\tif ( ! firstWidgetArea ) {\n\t\t\treturn false;\n\t\t}\n\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\n/**\n * Returns whether widget saving is locked.\n *\n * @param {Object} state Global application state.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import { store as widgetStore } from '@wordpress/edit-widgets';\n * import { useSelect } from '@wordpress/data';\n *\n * const ExampleComponent = () => {\n * \tconst isSavingLocked = useSelect(\n * \t\t( select ) => select( widgetStore ).isWidgetSavingLocked(),\n * \t\t[]\n * \t);\n *\n * \treturn isSavingLocked ? (\n * \t\t<p>{ __( 'Widget saving is locked' ) }</p>\n * \t) : (\n * \t\t<p>{ __( 'Widget saving is not locked' ) }</p>\n * \t);\n * };\n * ```\n *\n * @return {boolean} Is locked.\n */\nexport function isWidgetSavingLocked( state ) {\n\treturn Object.keys( state.widgetSavingLock ).length > 0;\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,wBAAwB;CAC7B,cAAc,KAAA;CACd,gBAAgB,KAAA;AACjB;;;;;;AAOA,MAAa,cAAA,GAAaA,gBAAAA,uBAAAA,EAA0B,YAAA,GACnDC,gBAAAA,eAAAA,OACO;CAOL,OANgB,OAAQC,qBAAAA,KAAU,CAAC,CAAC,iBACnC,QACA,WAAA,GACAC,WAAAA,kBAAAA,CAAkB,CAKZ,CAAC,EAAE,QACN,YAAY,YAAc;EAC3B,GAAG;GACD,OAAO,KAAM;CAChB,IACA,CAAC,CACF,KAAK,CAAC;AAER,SACM,CACL,OAAQD,qBAAAA,KAAU,CAAC,CAAC,iBACnB,QAC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ACA,KAAM,MAAM,MAAM,WAMjB,IALiB,OAAQF,qBAAAA,KAAU,CAAC,CAAC,qBACpC,QACA,UACA,EAEW,GACX,OAAO;CAIT,OAAO;AACR,CAAE;;;;;;;;;AAUF,MAAa,uBAAwB,OAAO,aAAc;CACzD,MAAM,EAAE,yBAAyB;CACjC,OAAO,CAAC,CAAE,qBAAsB;AACjC;;;;;;;;AASA,SAAgB,iBAAkB,OAAQ;CACzC,OAAO,CAAC,CAAE,MAAM;AACjB;;;;;;;;AASA,SAAgB,gCAAiC,OAAQ;CACxD,IAAK,OAAO,MAAM,uBAAuB,WACxC,OAAO;CAGR,OAAO,MAAM;AACd;;;;;;;;;AAUA,MAAa,8BAAA,GAA6BF,gBAAAA,uBAAAA,EACvC,YAAc,OAAO,cAAe;CAOrC,MAAM,CAAE,mBALY,OAAQW,wBAAAA,KAAiB,CAAC,CAAC,UAKT;CACtC,IAAK,CAAE,iBACN,OAAO;CAGR,OAAO,OAAQA,wBAAAA,KAAiB,CAAC,CAAC,mBACjC,WACA,gBAAgB,QACjB;AACD,CACD;;;;;;;;AASA,SAAgB,iBAAkB,OAAQ;CACzC,OAAO,MAAM;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,qBAAsB,OAAQ;CAC7C,OAAO,OAAO,KAAM,MAAM,gBAAiB,CAAC,CAAC,SAAS;AACvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/blocks/widget-area/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { layout as icon } from '@wordpress/icons';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\ticon,\n\tedit,\n};\n"],"mappings":";;;;;AAKA,MAAM,EAAE,SAAS;AAGjB,MAAa,WAAW;CACvB,OAAO,GAAI,aAAc;CACzB,aAAa,GAAI,0BAA2B;CAC5C,sBAAuB,EAAE,MAAM,YAAa;CAC5C,MAAA;CACA;AACD"}
1
+ {"version":3,"file":"index.mjs","names":["icon"],"sources":["../../../src/blocks/widget-area/index.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { layout as icon } from '@wordpress/icons';\nimport metadata from './block.json';\nimport edit from './edit';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Area' ),\n\tdescription: __( 'A widget area container.' ),\n\t__experimentalLabel: ( { name: label } ) => label,\n\ticon,\n\tedit,\n};\n"],"mappings":";;;;;AAKA,MAAM,EAAE,SAAS;AAGjB,MAAa,WAAW;CACvB,OAAO,GAAI,aAAc;CACzB,aAAa,GAAI,0BAA2B;CAC5C,sBAAuB,EAAE,MAAM,YAAa;CAC5CA,MAAAA;CACA;AACD"}
@@ -40,7 +40,12 @@ function DocumentTools() {
40
40
  },
41
41
  onClick: toggleInserterSidebar,
42
42
  icon: plus,
43
- label: _x("Block Inserter", "Generic label for block inserter button"),
43
+ label: _x(
44
+ /** translators: button label text should, if possible, be under 16
45
+ characters. */
46
+ "Block Inserter",
47
+ "Generic label for block inserter button"
48
+ ),
44
49
  size: "compact"
45
50
  }), isMediumViewport && /* @__PURE__ */ jsxs(Fragment, { children: [
46
51
  /* @__PURE__ */ jsx(ToolbarItem, { as: UndoButton }),
@@ -50,7 +55,10 @@ function DocumentTools() {
50
55
  className: "edit-widgets-header-toolbar__list-view-toggle",
51
56
  icon: listView,
52
57
  isPressed: isListViewOpen,
53
- label: __("List View"),
58
+ label: __(
59
+ /** translators: button label text should, if possible, be under 16 characters. */
60
+ "List View"
61
+ ),
54
62
  onClick: toggleListView,
55
63
  ref: listViewToggleRef,
56
64
  size: "compact"
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["editWidgetsStore"],"sources":["../../../../src/components/header/document-tools/index.jsx"],"sourcesContent":["import { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ toggleInserterSidebar }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Block Inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ RedoButton } />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAS,gBAAgB;CACxB,MAAM,mBAAmB,iBAAkB,QAAS;CAEpD,MAAM,EACL,gBACA,gBACA,0BACA,sBACG,WAAa,WAAY;EAC5B,MAAM,EACL,kBACA,6BACA,kBACA,yBACG,OAAQ,OAAQA,KAAiB,CAAE;EACvC,OAAO;GACN,gBAAgB,iBAAiB;GACjC,gBAAgB,iBAAiB;GACjC,0BAA0B,4BAA4B;GACtD,mBAAmB,qBAAqB;EACzC;CACD,GAAG,CAAC,CAAE;CACN,MAAM,EAAE,qBAAqB,wBAC5B,YAAaA,KAAiB;CAE/B,MAAM,iBAAiB,kBAChB,oBAAqB,CAAE,cAAe,GAC5C,CAAE,qBAAqB,cAAe,CACvC;CAEA,MAAM,wBAAwB,kBACvB,oBAAqB,CAAE,cAAe,GAC5C,CAAE,qBAAqB,cAAe,CACvC;CAEA,OACC,qBAAC,kBAAD;EACC,WAAU;EACV,cAAa,GAAI,gBAAiB;EAClC,SAAQ;EAHT,UAAA,CAKC,oBAAC,aAAD;GACC,KAAM;GACN,IAAK;GACL,WAAU;GACV,SAAQ;GACR,WAAY;GACZ,cAAgB,UAAW;IAC1B,MAAM,eAAe;GACtB;GACA,SAAU;GACV,MAAO;GAGP,OAAQ,GACP,kBACA,yCACD;GACA,MAAK;EACL,CAAA,GACC,oBACD,qBAAA,UAAA,EAAA,UAAA;GACC,oBAAC,aAAD,EAAa,IAAK,WAAc,CAAA;GAChC,oBAAC,aAAD,EAAa,IAAK,WAAc,CAAA;GAChC,oBAAC,aAAD;IACC,IAAK;IACL,WAAU;IACV,MAAO;IACP,WAAY;IAEZ,OAAQ,GAAI,WAAY;IACxB,SAAU;IACV,KAAM;IACN,MAAK;GACL,CAAA;EACA,EAAA,CAAA,CAEc;;AAEpB"}
1
+ {"version":3,"file":"index.mjs","names":["editWidgetsStore"],"sources":["../../../../src/components/header/document-tools/index.jsx"],"sourcesContent":["import { useSelect, useDispatch } from '@wordpress/data';\nimport { __, _x } from '@wordpress/i18n';\nimport { Button, ToolbarItem } from '@wordpress/components';\nimport { NavigableToolbar } from '@wordpress/block-editor';\nimport { listView, plus } from '@wordpress/icons';\nimport { useCallback } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport UndoButton from '../undo-redo/undo';\nimport RedoButton from '../undo-redo/redo';\nimport { store as editWidgetsStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nfunction DocumentTools() {\n\tconst isMediumViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tinserterSidebarToggleRef,\n\t\tlistViewToggleRef,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisInserterOpened,\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tisListViewOpened,\n\t\t\tgetListViewToggleRef,\n\t\t} = unlock( select( editWidgetsStore ) );\n\t\treturn {\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tlistViewToggleRef: getListViewToggleRef(),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened, setIsListViewOpened } =\n\t\tuseDispatch( editWidgetsStore );\n\n\tconst toggleListView = useCallback(\n\t\t() => setIsListViewOpened( ! isListViewOpen ),\n\t\t[ setIsListViewOpened, isListViewOpen ]\n\t);\n\n\tconst toggleInserterSidebar = useCallback(\n\t\t() => setIsInserterOpened( ! isInserterOpen ),\n\t\t[ setIsInserterOpened, isInserterOpen ]\n\t);\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tclassName=\"edit-widgets-header-toolbar\"\n\t\t\taria-label={ __( 'Document tools' ) }\n\t\t\tvariant=\"unstyled\"\n\t\t>\n\t\t\t<ToolbarItem\n\t\t\t\tref={ inserterSidebarToggleRef }\n\t\t\t\tas={ Button }\n\t\t\t\tclassName=\"edit-widgets-header-toolbar__inserter-toggle\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tisPressed={ isInserterOpen }\n\t\t\t\tonMouseDown={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t} }\n\t\t\t\tonClick={ toggleInserterSidebar }\n\t\t\t\ticon={ plus }\n\t\t\t\t/* translators: button label text should, if possible, be under 16\n\t\t\t\t\tcharacters. */\n\t\t\t\tlabel={ _x(\n\t\t\t\t\t'Block Inserter',\n\t\t\t\t\t'Generic label for block inserter button'\n\t\t\t\t) }\n\t\t\t\tsize=\"compact\"\n\t\t\t/>\n\t\t\t{ isMediumViewport && (\n\t\t\t\t<>\n\t\t\t\t\t<ToolbarItem as={ UndoButton } />\n\t\t\t\t\t<ToolbarItem as={ RedoButton } />\n\t\t\t\t\t<ToolbarItem\n\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\tclassName=\"edit-widgets-header-toolbar__list-view-toggle\"\n\t\t\t\t\t\ticon={ listView }\n\t\t\t\t\t\tisPressed={ isListViewOpen }\n\t\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\t\tlabel={ __( 'List View' ) }\n\t\t\t\t\t\tonClick={ toggleListView }\n\t\t\t\t\t\tref={ listViewToggleRef }\n\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</NavigableToolbar>\n\t);\n}\n\nexport default DocumentTools;\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAS,gBAAgB;CACxB,MAAM,mBAAmB,iBAAkB,QAAS;CAEpD,MAAM,EACL,gBACA,gBACA,0BACA,sBACG,WAAa,WAAY;EAC5B,MAAM,EACL,kBACA,6BACA,kBACA,yBACG,OAAQ,OAAQA,KAAiB,CAAE;EACvC,OAAO;GACN,gBAAgB,iBAAiB;GACjC,gBAAgB,iBAAiB;GACjC,0BAA0B,4BAA4B;GACtD,mBAAmB,qBAAqB;EACzC;CACD,GAAG,CAAC,CAAE;CACN,MAAM,EAAE,qBAAqB,wBAC5B,YAAaA,KAAiB;CAE/B,MAAM,iBAAiB,kBAChB,oBAAqB,CAAE,cAAe,GAC5C,CAAE,qBAAqB,cAAe,CACvC;CAEA,MAAM,wBAAwB,kBACvB,oBAAqB,CAAE,cAAe,GAC5C,CAAE,qBAAqB,cAAe,CACvC;CAEA,OACC,qBAAC,kBAAD;EACC,WAAU;EACV,cAAa,GAAI,gBAAiB;EAClC,SAAQ;EAHT,UAAA,CAKC,oBAAC,aAAD;GACC,KAAM;GACN,IAAK;GACL,WAAU;GACV,SAAQ;GACR,WAAY;GACZ,cAAgB,UAAW;IAC1B,MAAM,eAAe;GACtB;GACA,SAAU;GACV,MAAO;GAGP,OAAQ;;;IACP;IACA;GACD;GACA,MAAK;EACL,CAAA,GACC,oBACD,qBAAA,UAAA,EAAA,UAAA;GACC,oBAAC,aAAD,EAAa,IAAK,WAAc,CAAA;GAChC,oBAAC,aAAD,EAAa,IAAK,WAAc,CAAA;GAChC,oBAAC,aAAD;IACC,IAAK;IACL,WAAU;IACV,MAAO;IACP,WAAY;IAEZ,OAAQ;;KAAI;IAAY;IACxB,SAAU;IACV,KAAM;IACN,MAAK;GACL,CAAA;EACA,EAAA,CAAA,CAEc;;AAEpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"redo.mjs","names":["coreStore","redoIcon","undoIcon","redo"],"sources":["../../../../src/components/header/undo-redo/redo.jsx"],"sourcesContent":["import { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction RedoButton( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\n"],"mappings":";;;;;;;;;AAQA,SAAS,WAAY,OAAO,KAAM;CACjC,MAAM,WAAW,UAAU,IACxB,gBAAgB,aAAc,GAAI,IAClC,gBAAgB,QAAS,GAAI;CAEhC,MAAM,UAAU,WACb,WAAY,OAAQA,KAAU,CAAC,CAAC,QAAQ,GAC1C,CAAC,CACF;CACA,MAAM,EAAE,MAAA,WAAS,YAAaA,KAAU;CACxC,OACC,oBAAC,QAAD;EACC,GAAK;EACC;EACN,MAAO,CAAE,MAAM,IAAIC,OAAWC;EAC9B,OAAQ,GAAI,MAAO;EACR;EAIX,iBAAgB,CAAE;EAClB,SAAU,UAAUC,SAAO,KAAA;EAC3B,MAAK;CACL,CAAA;AAEH;AAEA,IAAA,eAAe,WAAY,UAAW"}
1
+ {"version":3,"file":"redo.mjs","names":["coreStore","redo","redoIcon","undoIcon"],"sources":["../../../../src/components/header/undo-redo/redo.jsx"],"sourcesContent":["import { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { redo as redoIcon, undo as undoIcon } from '@wordpress/icons';\nimport { displayShortcut, isAppleOS } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction RedoButton( props, ref ) {\n\tconst shortcut = isAppleOS()\n\t\t? displayShortcut.primaryShift( 'z' )\n\t\t: displayShortcut.primary( 'y' );\n\n\tconst hasRedo = useSelect(\n\t\t( select ) => select( coreStore ).hasRedo(),\n\t\t[]\n\t);\n\tconst { redo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? redoIcon : undoIcon }\n\t\t\tlabel={ __( 'Redo' ) }\n\t\t\tshortcut={ shortcut }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasRedo }\n\t\t\tonClick={ hasRedo ? redo : undefined }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( RedoButton );\n"],"mappings":";;;;;;;;;AAQA,SAAS,WAAY,OAAO,KAAM;CACjC,MAAM,WAAW,UAAU,IACxB,gBAAgB,aAAc,GAAI,IAClC,gBAAgB,QAAS,GAAI;CAEhC,MAAM,UAAU,WACb,WAAY,OAAQA,KAAU,CAAC,CAAC,QAAQ,GAC1C,CAAC,CACF;CACA,MAAM,EAAEC,MAAAA,WAAS,YAAaD,KAAU;CACxC,OACC,oBAAC,QAAD;EACC,GAAK;EACC;EACN,MAAO,CAAE,MAAM,IAAIE,OAAWC;EAC9B,OAAQ,GAAI,MAAO;EACR;EAIX,iBAAgB,CAAE;EAClB,SAAU,UAAUF,SAAO,KAAA;EAC3B,MAAK;CACL,CAAA;AAEH;AAEA,IAAA,eAAe,WAAY,UAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"undo.mjs","names":["coreStore","undoIcon","redoIcon","undo"],"sources":["../../../../src/components/header/undo-redo/undo.jsx"],"sourcesContent":["import { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":";;;;;;;;;AAQA,SAAS,WAAY,OAAO,KAAM;CACjC,MAAM,UAAU,WACb,WAAY,OAAQA,KAAU,CAAC,CAAC,QAAQ,GAC1C,CAAC,CACF;CACA,MAAM,EAAE,MAAA,WAAS,YAAaA,KAAU;CACxC,OACC,oBAAC,QAAD;EACC,GAAK;EACC;EACN,MAAO,CAAE,MAAM,IAAIC,OAAWC;EAC9B,OAAQ,GAAI,MAAO;EACnB,UAAW,gBAAgB,QAAS,GAAI;EAIxC,iBAAgB,CAAE;EAClB,SAAU,UAAUC,SAAO,KAAA;EAC3B,MAAK;CACL,CAAA;AAEH;AAEA,IAAA,eAAe,WAAY,UAAW"}
1
+ {"version":3,"file":"undo.mjs","names":["coreStore","undo","undoIcon","redoIcon"],"sources":["../../../../src/components/header/undo-redo/undo.jsx"],"sourcesContent":["import { __, isRTL } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { undo as undoIcon, redo as redoIcon } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\nfunction UndoButton( props, ref ) {\n\tconst hasUndo = useSelect(\n\t\t( select ) => select( coreStore ).hasUndo(),\n\t\t[]\n\t);\n\tconst { undo } = useDispatch( coreStore );\n\treturn (\n\t\t<Button\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\ticon={ ! isRTL() ? undoIcon : redoIcon }\n\t\t\tlabel={ __( 'Undo' ) }\n\t\t\tshortcut={ displayShortcut.primary( 'z' ) }\n\t\t\t// If there are no undo levels we don't want to actually disable this\n\t\t\t// button, because it will remove focus for keyboard users.\n\t\t\t// See: https://github.com/WordPress/gutenberg/issues/3486\n\t\t\taria-disabled={ ! hasUndo }\n\t\t\tonClick={ hasUndo ? undo : undefined }\n\t\t\tsize=\"compact\"\n\t\t/>\n\t);\n}\n\nexport default forwardRef( UndoButton );\n"],"mappings":";;;;;;;;;AAQA,SAAS,WAAY,OAAO,KAAM;CACjC,MAAM,UAAU,WACb,WAAY,OAAQA,KAAU,CAAC,CAAC,QAAQ,GAC1C,CAAC,CACF;CACA,MAAM,EAAEC,MAAAA,WAAS,YAAaD,KAAU;CACxC,OACC,oBAAC,QAAD;EACC,GAAK;EACC;EACN,MAAO,CAAE,MAAM,IAAIE,OAAWC;EAC9B,OAAQ,GAAI,MAAO;EACnB,UAAW,gBAAgB,QAAS,GAAI;EAIxC,iBAAgB,CAAE;EAClB,SAAU,UAAUF,SAAO,KAAA;EAC3B,MAAK;CACL,CAAA;AAEH;AAEA,IAAA,eAAe,WAAY,UAAW"}
@@ -1,5 +1,6 @@
1
1
  import { __ } from "@wordpress/i18n";
2
2
  // packages/edit-widgets/src/components/keyboard-shortcut-help-modal/config.js
3
+ /** @type {Array<import('react').ComponentProps<typeof import('./shortcut').default>>} */
3
4
  const textFormattingShortcuts = [
4
5
  {
5
6
  keyCombination: {
@@ -31,6 +32,10 @@ const textFormattingShortcuts = [
31
32
  },
32
33
  {
33
34
  keyCombination: { character: "[[" },
35
+ ariaLabel: __(
36
+ /** translators: The keyboard sequence [[, pressing the left bracket key twice. */
37
+ "Left bracket twice"
38
+ ),
34
39
  description: __("Insert a link to a post or page.")
35
40
  },
36
41
  {
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: '0',\n\t\t},\n\t\taliases: [\n\t\t\t{\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '7',\n\t\t\t},\n\t\t],\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'SPACE' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":";;AAEA,MAAa,0BAA0B;CACtC;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,8BAA+B;CACjD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,gCAAiC;CACnD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,wCAAyC;CAC3D;CACA;EACC,gBAAgB;GAAE,UAAU;GAAgB,WAAW;EAAI;EAC3D,aAAa,GAAI,gBAAiB;CACnC;CACA;EACC,gBAAgB,EAAE,WAAW,KAAK;EAClC,aAAa,GAAI,kCAAmC;CACrD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,8BAA+B;CACjD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAI;EACrD,aAAa,GAAI,kCAAmC;CACrD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAI;EACrD,aAAa,GAAI,qCAAsC;CACxD;CACA;EACC,gBAAgB;GACf,UAAU;GACV,WAAW;EACZ;EACA,SAAS,CACR;GACC,UAAU;GACV,WAAW;EACZ,CACD;EACA,aAAa,GAAI,6CAA8C;CAChE;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAM;EACvD,aAAa,GACZ,wEACD;CACD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAgB,WAAW;EAAQ;EAC/D,aAAa,GAAI,yBAA0B;CAC5C;AACD"}
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["import { __ } from '@wordpress/i18n';\n\n/** @type {Array<import('react').ComponentProps<typeof import('./shortcut').default>>} */\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\t/* translators: The keyboard sequence [[, pressing the left bracket key twice. */\n\t\tariaLabel: __( 'Left bracket twice' ),\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: {\n\t\t\tmodifier: 'access',\n\t\t\tcharacter: '0',\n\t\t},\n\t\taliases: [\n\t\t\t{\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: '7',\n\t\t\t},\n\t\t],\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'SPACE' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":";;;AAGA,MAAa,0BAA0B;CACtC;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,8BAA+B;CACjD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,gCAAiC;CACnD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,wCAAyC;CAC3D;CACA;EACC,gBAAgB;GAAE,UAAU;GAAgB,WAAW;EAAI;EAC3D,aAAa,GAAI,gBAAiB;CACnC;CACA;EACC,gBAAgB,EAAE,WAAW,KAAK;EAElC,WAAW;;GAAI;EAAqB;EACpC,aAAa,GAAI,kCAAmC;CACrD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAW,WAAW;EAAI;EACtD,aAAa,GAAI,8BAA+B;CACjD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAI;EACrD,aAAa,GAAI,kCAAmC;CACrD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAI;EACrD,aAAa,GAAI,qCAAsC;CACxD;CACA;EACC,gBAAgB;GACf,UAAU;GACV,WAAW;EACZ;EACA,SAAS,CACR;GACC,UAAU;GACV,WAAW;EACZ,CACD;EACA,aAAa,GAAI,6CAA8C;CAChE;CACA;EACC,gBAAgB;GAAE,UAAU;GAAU,WAAW;EAAM;EACvD,aAAa,GACZ,wEACD;CACD;CACA;EACC,gBAAgB;GAAE,UAAU;GAAgB,WAAW;EAAQ;EAC/D,aAAa,GAAI,yBAA0B;CAC5C;AACD"}
@@ -57,8 +57,7 @@ function KeyboardShortcutHelpModal({ isModalActive, toggleModal }) {
57
57
  categoryName: "block",
58
58
  additionalShortcuts: [{
59
59
  keyCombination: { character: "/" },
60
- description: __("Change the block type after adding a new paragraph."),
61
- ariaLabel: __("Forward-slash")
60
+ description: __("Change the block type after adding a new paragraph.")
62
61
  }]
63
62
  }),
64
63
  /* @__PURE__ */ jsx(ShortcutSection, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["keyboardShortcutsStore"],"sources":["../../../src/components/keyboard-shortcut-help-modal/index.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'edit-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tuseShortcut( 'core/edit-widgets/keyboard-shortcuts', toggleModal, {\n\t\tbindGlobal: true,\n\t} );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'List View shortcuts' ) }\n\t\t\t\tcategoryName=\"list-view\"\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,gBAAiB,EAAE,gBAMxB,oBAAC,MAAD;CACC,WAAU;CACV,MAAK;CAEH,UAAA,UAAU,KAAO,UAAU,UAC5B,oBAAC,MAAD;EACC,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ACC,OAAQ,GAAI,iBAAkB;IAC9B,WAAY;GACZ,CAAA;GACD,oBAAC,yBAAD;IACC,OAAQ,GAAI,qBAAsB;IAClC,cAAa;GACb,CAAA;EACK;;AAET"}
1
+ {"version":3,"file":"index.mjs","names":["keyboardShortcutsStore"],"sources":["../../../src/components/keyboard-shortcut-help-modal/index.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useSelect } from '@wordpress/data';\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ clsx(\n\t\t\t'edit-widgets-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-widgets-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport default function KeyboardShortcutHelpModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tuseShortcut( 'core/edit-widgets/keyboard-shortcuts', toggleModal, {\n\t\tbindGlobal: true,\n\t} );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-widgets/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'List View shortcuts' ) }\n\t\t\t\tcategoryName=\"list-view\"\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAM,gBAAiB,EAAE,gBAMxB,oBAAC,MAAD;CACC,WAAU;CACV,MAAK;CAEH,UAAA,UAAU,KAAO,UAAU,UAC5B,oBAAC,MAAD;EACC,WAAU;EAGR,UAAA,OAAO,aAAa,WACrB,oBAAC,iBAAD,EAAiB,MAAO,SAAY,CAAA,IAEpC,oBAAC,UAAD,EAAU,GAAK,SAAY,CAAA;CAEzB,GAPG,KAOH,CACH;AACC,CAAA;AAIL,MAAM,mBAAoB,EAAE,OAAO,WAAW,gBAC7C,qBAAC,WAAD;CACC,WAAY,KACX,sDACA,SACD;CAJD,UAAA,CAMG,CAAC,CAAE,SACJ,oBAAC,MAAD;EAAI,WAAU;EACX,UAAA;CACC,CAAA,GAEL,oBAAC,cAAD,EAA0B,UAAa,CAAA,CAC/B;;AAGV,MAAM,2BAA4B,EACjC,OACA,cACA,sBAAsB,CAAC,QACjB;CACN,MAAM,oBAAoB,WACvB,WAAY;EACb,OAAO,OAAQA,KAAuB,CAAC,CAAC,qBACvC,YACD;CACD,GACA,CAAE,YAAa,CAChB;CAEA,OACC,oBAAC,iBAAD;EACS;EACR,WAAY,kBAAkB,OAAQ,mBAAoB;CAC1D,CAAA;AAEH;AAEA,SAAwB,0BAA2B,EAClD,eACA,eACG;CACH,YAAa,wCAAwC,aAAa,EACjE,YAAY,KACb,CAAE;CAEF,IAAK,CAAE,eACN,OAAO;CAGR,OACC,qBAAC,OAAD;EACC,WAAU;EACV,OAAQ,GAAI,oBAAqB;EACjC,gBAAiB;EAHlB,UAAA;GAKC,oBAAC,iBAAD;IACC,WAAU;IACV,WAAY,CAAE,sCAAuC;GACrD,CAAA;GACD,oBAAC,yBAAD;IACC,OAAQ,GAAI,kBAAmB;IAC/B,cAAa;GACb,CAAA;GAED,oBAAC,yBAAD;IACC,OAAQ,GAAI,qBAAsB;IAClC,cAAa;GACb,CAAA;GAED,oBAAC,yBAAD;IACC,OAAQ,GAAI,iBAAkB;IAC9B,cAAa;IACb,qBAAsB,CACrB;KACC,gBAAgB,EAAE,WAAW,IAAI;KACjC,aAAa,GACZ,qDACD;IACD,CACD;GACA,CAAA;GACD,oBAAC,iBAAD;IACC,OAAQ,GAAI,iBAAkB;IAC9B,WAAY;GACZ,CAAA;GACD,oBAAC,yBAAD;IACC,OAAQ,GAAI,qBAAsB;IAClC,cAAa;GACb,CAAA;EACK;;AAET"}
@@ -1,23 +1,44 @@
1
1
  import { Fragment } from "@wordpress/element";
2
2
  import { displayShortcutList, shortcutAriaLabel } from "@wordpress/keycodes";
3
+ import { VisuallyHidden } from "@wordpress/ui";
3
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
4
5
  // packages/edit-widgets/src/components/keyboard-shortcut-help-modal/shortcut.jsx
5
- function KeyCombination({ keyCombination, forceAriaLabel }) {
6
- const shortcut = keyCombination.modifier ? displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
7
- const ariaLabel = keyCombination.modifier ? shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
8
- return /* @__PURE__ */ jsx("kbd", {
6
+ /**
7
+ * @typedef {Object} ShortcutKeyCombination
8
+ * @property {string} character Shortcut key.
9
+ * @property {import('@wordpress/keycodes').WPKeycodeModifier | null} [modifier] Optional shortcut modifier.
10
+ */
11
+ /**
12
+ * @param {Object} props Component props.
13
+ * @param {ShortcutKeyCombination} props.keyCombination Shortcut to display.
14
+ * @param {string} [props.ariaLabel] Custom readable shortcut label.
15
+ */
16
+ function KeyCombination({ keyCombination, ariaLabel }) {
17
+ const { character, modifier } = keyCombination;
18
+ const normalizedModifier = modifier ?? "undefined";
19
+ const keys = displayShortcutList[normalizedModifier](character);
20
+ return /* @__PURE__ */ jsxs("kbd", {
9
21
  className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination",
10
22
  dir: "ltr",
11
- "aria-label": forceAriaLabel || ariaLabel,
12
- children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
13
- if (character === "+") return /* @__PURE__ */ jsx(Fragment, { children: character }, index);
14
- return /* @__PURE__ */ jsx("kbd", {
23
+ children: [/* @__PURE__ */ jsx(VisuallyHidden, {
24
+ render: /* @__PURE__ */ jsx("span", {}),
25
+ children: ariaLabel || shortcutAriaLabel[normalizedModifier](character)
26
+ }), /* @__PURE__ */ jsx("span", {
27
+ "aria-hidden": "true",
28
+ children: keys.map((key, index) => key === "+" && index < keys.length - 1 ? /* @__PURE__ */ jsx(Fragment, { children: key }, index) : /* @__PURE__ */ jsx("kbd", {
15
29
  className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key",
16
- children: character
17
- }, index);
18
- })
30
+ children: key
31
+ }, index))
32
+ })]
19
33
  });
20
34
  }
35
+ /**
36
+ * @param {Object} props Component props.
37
+ * @param {string} props.description Description of the shortcut action.
38
+ * @param {ShortcutKeyCombination} props.keyCombination Primary shortcut.
39
+ * @param {ShortcutKeyCombination[]} [props.aliases] Alternative shortcuts.
40
+ * @param {string} [props.ariaLabel] Custom readable shortcut label.
41
+ */
21
42
  function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) {
22
43
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
23
44
  className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description",
@@ -26,10 +47,10 @@ function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) {
26
47
  className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term",
27
48
  children: [/* @__PURE__ */ jsx(KeyCombination, {
28
49
  keyCombination,
29
- forceAriaLabel: ariaLabel
50
+ ariaLabel
30
51
  }), aliases.map((alias, index) => /* @__PURE__ */ jsx(KeyCombination, {
31
52
  keyCombination: alias,
32
- forceAriaLabel: ariaLabel
53
+ ariaLabel
33
54
  }, index))]
34
55
  })] });
35
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"shortcut.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t\t)\n\t\t: keyCombination.character;\n\tconst shortcuts = Array.isArray( shortcut ) ? shortcut : [ shortcut ];\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\tdir=\"ltr\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ shortcuts.map( ( character, index ) => {\n\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<kbd\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ character }\n\t\t\t\t\t</kbd>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;AAGA,SAAS,eAAgB,EAAE,gBAAgB,kBAAmB;CAC7D,MAAM,WAAW,eAAe,WAC7B,oBAAqB,eAAe,SAAU,CAC9C,eAAe,SAChB,IACC,eAAe;CAClB,MAAM,YAAY,eAAe,WAC9B,kBAAmB,eAAe,SAAU,CAC5C,eAAe,SAChB,IACC,eAAe;CAGlB,OACC,oBAAC,OAAD;EACC,WAAU;EACV,KAAI;EACJ,cAAa,kBAAkB;EANf,WAAA,MAAM,QAAS,QAAS,IAAI,WAAW,CAAE,QAAS,EAAA,CAQtD,KAAO,WAAW,UAAW;GACxC,IAAK,cAAc,KAClB,OAAO,oBAAC,UAAD,EAAA,UAA0B,UAAqB,GAA/B,KAA+B;GAGvD,OACC,oBAAC,OAAD;IAEC,WAAU;IAER,UAAA;GACE,GAJE,KAIF;EAEP,CAAE;CACE,CAAA;AAEP;AAEA,SAAS,SAAU,EAAE,aAAa,gBAAgB,UAAU,CAAC,GAAG,aAAc;CAC7E,OACC,qBAAA,YAAA,EAAA,UAAA,CACC,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA;CACE,CAAA,GACL,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,oBAAC,gBAAD;GACkB;GACjB,gBAAiB;EACjB,CAAA,GACC,QAAQ,KAAO,OAAO,UACvB,oBAAC,gBAAD;GACC,gBAAiB;GACjB,gBAAiB;EAEjB,GADM,KACN,CACA,CACE;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}
1
+ {"version":3,"file":"shortcut.mjs","names":[],"sources":["../../../src/components/keyboard-shortcut-help-modal/shortcut.jsx"],"sourcesContent":["import { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\nimport { VisuallyHidden } from '@wordpress/ui';\n\n/**\n * @typedef {Object} ShortcutKeyCombination\n * @property {string} character Shortcut key.\n * @property {import('@wordpress/keycodes').WPKeycodeModifier | null} [modifier] Optional shortcut modifier.\n */\n\n/**\n * @param {Object} props Component props.\n * @param {ShortcutKeyCombination} props.keyCombination Shortcut to display.\n * @param {string} [props.ariaLabel] Custom readable shortcut label.\n */\nfunction KeyCombination( { keyCombination, ariaLabel } ) {\n\tconst { character, modifier } = keyCombination;\n\tconst normalizedModifier = modifier ?? 'undefined';\n\tconst keys = displayShortcutList[ normalizedModifier ]( character );\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\tdir=\"ltr\"\n\t\t>\n\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t{ ariaLabel ||\n\t\t\t\t\tshortcutAriaLabel[ normalizedModifier ]( character ) }\n\t\t\t</VisuallyHidden>\n\t\t\t<span aria-hidden=\"true\">\n\t\t\t\t{ keys.map( ( key, index ) =>\n\t\t\t\t\tkey === '+' && index < keys.length - 1 ? (\n\t\t\t\t\t\t<Fragment key={ index }>{ key }</Fragment>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ key }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t</span>\n\t\t</kbd>\n\t);\n}\n\n/**\n * @param {Object} props Component props.\n * @param {string} props.description Description of the shortcut action.\n * @param {ShortcutKeyCombination} props.keyCombination Primary shortcut.\n * @param {ShortcutKeyCombination[]} [props.aliases] Alternative shortcuts.\n * @param {string} [props.ariaLabel] Custom readable shortcut label.\n */\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"edit-widgets-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tariaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tariaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default Shortcut;\n"],"mappings":";;;;;;;;;;;;;;;AAeA,SAAS,eAAgB,EAAE,gBAAgB,aAAc;CACxD,MAAM,EAAE,WAAW,aAAa;CAChC,MAAM,qBAAqB,YAAY;CACvC,MAAM,OAAO,oBAAqB,mBAAoB,CAAE,SAAU;CAElE,OACC,qBAAC,OAAD;EACC,WAAU;EACV,KAAI;EAFL,UAAA,CAIC,oBAAC,gBAAD;GAAgB,QAAS,oBAAC,QAAD,CAAO,CAAA;GAC7B,UAAA,aACD,kBAAmB,mBAAoB,CAAE,SAAU;EACrC,CAAA,GAChB,oBAAC,QAAD;GAAM,eAAY;GACf,UAAA,KAAK,KAAO,KAAK,UAClB,QAAQ,OAAO,QAAQ,KAAK,SAAS,IACpC,oBAAC,UAAD,EAAA,UAA0B,IAAe,GAAzB,KAAyB,IAEzC,oBAAC,OAAD;IAEC,WAAU;IAER,UAAA;GACE,GAJE,KAIF,CAEP;EACK,CAAA,CACF;;AAEP;;;;;;;;AASA,SAAS,SAAU,EAAE,aAAa,gBAAgB,UAAU,CAAC,GAAG,aAAc;CAC7E,OACC,qBAAA,YAAA,EAAA,UAAA,CACC,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA;CACE,CAAA,GACL,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,oBAAC,gBAAD;GACkB;GACL;EACZ,CAAA,GACC,QAAQ,KAAO,OAAO,UACvB,oBAAC,gBAAD;GACC,gBAAiB;GACL;EAEZ,GADM,KACN,CACA,CACE;CACJ,CAAA,CAAA,EAAA,CAAA;AAEJ"}
@@ -17,7 +17,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
17
17
  function Layout({ blockEditorSettings }) {
18
18
  const { createErrorNotice } = useDispatch(store);
19
19
  function onPluginAreaError(name) {
20
- createErrorNotice(sprintf(__("The \"%s\" plugin has encountered an error and cannot be rendered."), name));
20
+ createErrorNotice(sprintf(
21
+ /** translators: %s: plugin name */
22
+ __("The \"%s\" plugin has encountered an error and cannot be rendered."),
23
+ name
24
+ ));
21
25
  }
22
26
  const navigateRegionsProps = __unstableUseNavigateRegions();
23
27
  const adminPrimary = useMemo(() => getAdminThemeColors().primary, []);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["noticesStore","useNavigateRegions"],"sources":["../../../src/components/layout/index.jsx"],"sourcesContent":["import { getAdminThemeColors } from '@wordpress/admin-ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\nimport { ThemeProvider } from '@wordpress/theme';\nimport ErrorBoundary from '../error-boundary';\nimport WidgetAreasBlockEditorProvider from '../widget-areas-block-editor-provider';\nimport Sidebar from '../sidebar';\nimport Interface from './interface';\nimport UnsavedChangesWarning from './unsaved-changes-warning';\nimport WelcomeGuide from '../welcome-guide';\n\nfunction Layout( { blockEditorSettings } ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst adminPrimary = useMemo( () => getAdminThemeColors().primary, [] );\n\n\treturn (\n\t\t<ThemeProvider isRoot color={ { primary: adminPrimary } }>\n\t\t\t<ErrorBoundary>\n\t\t\t\t<div { ...navigateRegionsProps }>\n\t\t\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Interface\n\t\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t\t\t</div>\n\t\t\t</ErrorBoundary>\n\t\t</ThemeProvider>\n\t);\n}\n\nexport default Layout;\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,OAAQ,EAAE,uBAAwB;CAC1C,MAAM,EAAE,sBAAsB,YAAaA,KAAa;CAExD,SAAS,kBAAmB,MAAO;EAClC,kBACC,QAEC,GACC,oEACD,GACA,IACD,CACD;CACD;CAEA,MAAM,uBAAuBC,6BAAmB;CAChD,MAAM,eAAe,cAAe,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAE;CAEtE,OACC,oBAAC,eAAD;EAAe,QAAA;EAAO,OAAQ,EAAE,SAAS,aAAa;EACrD,UAAA,oBAAC,eAAD,EAAA,UACC,oBAAC,OAAD;GAAK,GAAK;GACT,UAAA,qBAAC,gCAAD;IACuB;IADvB,UAAA;KAGC,oBAAC,WAAD,EACuB,oBACtB,CAAA;KACD,oBAAC,SAAD,CAAU,CAAA;KACV,oBAAC,YAAD,EAAY,SAAU,kBAAqB,CAAA;KAC3C,oBAAC,uBAAD,CAAwB,CAAA;KACxB,oBAAC,cAAD,CAAe,CAAA;IACgB;;EAC5B,CAAA,EACS,CAAA;CACD,CAAA;AAEjB"}
1
+ {"version":3,"file":"index.mjs","names":["noticesStore","useNavigateRegions"],"sources":["../../../src/components/layout/index.jsx"],"sourcesContent":["import { getAdminThemeColors } from '@wordpress/admin-ui';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\nimport { ThemeProvider } from '@wordpress/theme';\nimport ErrorBoundary from '../error-boundary';\nimport WidgetAreasBlockEditorProvider from '../widget-areas-block-editor-provider';\nimport Sidebar from '../sidebar';\nimport Interface from './interface';\nimport UnsavedChangesWarning from './unsaved-changes-warning';\nimport WelcomeGuide from '../welcome-guide';\n\nfunction Layout( { blockEditorSettings } ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\tconst navigateRegionsProps = useNavigateRegions();\n\tconst adminPrimary = useMemo( () => getAdminThemeColors().primary, [] );\n\n\treturn (\n\t\t<ThemeProvider isRoot color={ { primary: adminPrimary } }>\n\t\t\t<ErrorBoundary>\n\t\t\t\t<div { ...navigateRegionsProps }>\n\t\t\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Interface\n\t\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Sidebar />\n\t\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t\t\t</div>\n\t\t\t</ErrorBoundary>\n\t\t</ThemeProvider>\n\t);\n}\n\nexport default Layout;\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAS,OAAQ,EAAE,uBAAwB;CAC1C,MAAM,EAAE,sBAAsB,YAAaA,KAAa;CAExD,SAAS,kBAAmB,MAAO;EAClC,kBACC;;GAEC,GACC,oEACD;GACA;EACD,CACD;CACD;CAEA,MAAM,uBAAuBC,6BAAmB;CAChD,MAAM,eAAe,cAAe,oBAAoB,CAAC,CAAC,SAAS,CAAC,CAAE;CAEtE,OACC,oBAAC,eAAD;EAAe,QAAA;EAAO,OAAQ,EAAE,SAAS,aAAa;EACrD,UAAA,oBAAC,eAAD,EAAA,UACC,oBAAC,OAAD;GAAK,GAAK;GACT,UAAA,qBAAC,gCAAD;IACuB;IADvB,UAAA;KAGC,oBAAC,WAAD,EACuB,oBACtB,CAAA;KACD,oBAAC,SAAD,CAAU,CAAA;KACV,oBAAC,YAAD,EAAY,SAAU,kBAAqB,CAAA;KAC3C,oBAAC,uBAAD,CAAwB,CAAA;KACxB,oBAAC,cAAD,CAAe,CAAA;IACgB;;EAC5B,CAAA,EACS,CAAA;CACD,CAAA;AAEjB"}
@@ -12,10 +12,22 @@ import SecondarySidebar from "../secondary-sidebar/index.mjs";
12
12
  import { Fragment, jsx } from "react/jsx-runtime";
13
13
  // packages/edit-widgets/src/components/layout/interface.jsx
14
14
  const interfaceLabels = {
15
- header: __("Widgets top bar"),
16
- body: __("Widgets and blocks"),
17
- sidebar: __("Widgets settings"),
18
- footer: __("Widgets footer")
15
+ header: __(
16
+ /** translators: accessibility text for the widgets screen top bar landmark region. */
17
+ "Widgets top bar"
18
+ ),
19
+ body: __(
20
+ /** translators: accessibility text for the widgets screen content landmark region. */
21
+ "Widgets and blocks"
22
+ ),
23
+ sidebar: __(
24
+ /** translators: accessibility text for the widgets screen settings landmark region. */
25
+ "Widgets settings"
26
+ ),
27
+ footer: __(
28
+ /** translators: accessibility text for the widgets screen footer landmark region. */
29
+ "Widgets footer"
30
+ )
19
31
  };
20
32
  function Interface({ blockEditorSettings }) {
21
33
  const isMobileViewport = useViewportMatch("medium", "<");
@@ -1 +1 @@
1
- {"version":3,"file":"interface.mjs","names":["editWidgetsStore","interfaceStore","preferencesStore"],"sources":["../../../src/components/layout/interface.jsx"],"sourcesContent":["import { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={ <ComplementaryArea.Slot scope=\"core/edit-widgets\" /> }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\tclassName=\"edit-widgets-layout__breadcrumbs\"\n\t\t\t\t\t\t\trootLabelText={ __( 'Widgets' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,kBAAkB;CAEvB,QAAQ,GAAI,iBAAkB;CAE9B,MAAM,GAAI,oBAAqB;CAE/B,SAAS,GAAI,kBAAmB;CAEhC,QAAQ,GAAI,gBAAiB;AAC9B;AAEA,SAAS,UAAW,EAAE,uBAAwB;CAC7C,MAAM,mBAAmB,iBAAkB,UAAU,GAAI;CACzD,MAAM,iBAAiB,iBAAkB,QAAQ,IAAK;CACtD,MAAM,EAAE,qBAAqB,qBAAqB,wBACjD,YAAaA,OAAiB;CAC/B,MAAM,EACL,4BACA,mBACA,kBACA,qBACG,WACD,YAAc;EACf,mBAAmB,CAAC,CAAE,OACrBC,KACD,CAAC,CAAC,2BAA4BD,QAAiB,IAAK;EACpD,kBAAkB,CAAC,CAAE,OAAQA,OAAiB,CAAC,CAAC,iBAAiB;EACjE,kBAAkB,CAAC,CAAE,OAAQA,OAAiB,CAAC,CAAC,iBAAiB;EACjE,4BAA4B,CAAC,CAAE,OAAQE,OAAiB,CAAC,CAAC,IACzD,qBACA,sBACD;CACD,IACA,CAAC,CACF;CAGA,gBAAiB;EAChB,IAAK,qBAAqB,CAAE,gBAAiB;GAC5C,oBAAqB,KAAM;GAC3B,oBAAqB,KAAM;EAC5B;CACD,GAAG,CAAE,mBAAmB,cAAe,CAAE;CAEzC,gBAAiB;EAChB,KAAO,oBAAoB,qBAAsB,CAAE,gBAClD,oBAAoB;CAEtB,GAAG;EAAE;EAAkB;EAAkB;CAAe,CAAE;CAE1D,MAAM,wBAAwB,mBAC3B,GAAI,WAAY,IAChB,GAAI,eAAgB;CAEvB,MAAM,sBAAsB,oBAAoB;CAEhD,OACC,oBAAC,mBAAD;EACC,QAAS;GACR,GAAG;GACH,kBAAkB;EACnB;EACA,QAAS,oBAAC,QAAD,CAAS,CAAA;EAClB,kBAAmB,uBAAuB,oBAAC,kBAAD,CAAmB,CAAA;EAC7D,SAAU,oBAAC,kBAAkB,MAAnB,EAAwB,OAAM,oBAAqB,CAAA;EAC7D,SACC,oBAAA,UAAA,EAAA,UACC,oBAAC,+BAAD,EACuB,oBACtB,CAAA,EACA,CAAA;EAEH,QACC,8BACA,CAAE,oBACD,oBAAC,OAAD;GAAK,WAAU;GACd,UAAA,oBAAC,iBAAD;IACC,WAAU;IACV,eAAgB,GAAI,SAAU;GAC9B,CAAA;EACG,CAAA;CAGP,CAAA;AAEH"}
1
+ {"version":3,"file":"interface.mjs","names":["editWidgetsStore","interfaceStore","preferencesStore"],"sources":["../../../src/components/layout/interface.jsx"],"sourcesContent":["import { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasSidebarEnabled: !! select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( editWidgetsStore.name ),\n\t\t\tisInserterOpened: !! select( editWidgetsStore ).isInserterOpened(),\n\t\t\tisListViewOpened: !! select( editWidgetsStore ).isListViewOpened(),\n\t\t\thasBlockBreadCrumbsEnabled: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( hasSidebarEnabled && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t\tsetIsListViewOpened( false );\n\t\t}\n\t}, [ hasSidebarEnabled, isHugeViewport ] );\n\n\tuseEffect( () => {\n\t\tif ( ( isInserterOpened || isListViewOpened ) && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isListViewOpened, isHugeViewport ] );\n\n\tconst secondarySidebarLabel = isListViewOpened\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\n\tconst hasSecondarySidebar = isListViewOpened || isInserterOpened;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tlabels={ {\n\t\t\t\t...interfaceLabels,\n\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t} }\n\t\t\theader={ <Header /> }\n\t\t\tsecondarySidebar={ hasSecondarySidebar && <SecondarySidebar /> }\n\t\t\tsidebar={ <ComplementaryArea.Slot scope=\"core/edit-widgets\" /> }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t<WidgetAreasBlockEditorContent\n\t\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\thasBlockBreadCrumbsEnabled &&\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<div className=\"edit-widgets-layout__footer\">\n\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\tclassName=\"edit-widgets-layout__breadcrumbs\"\n\t\t\t\t\t\t\trootLabelText={ __( 'Widgets' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n\nexport default Interface;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,kBAAkB;CAEvB,QAAQ;;EAAI;CAAkB;CAE9B,MAAM;;EAAI;CAAqB;CAE/B,SAAS;;EAAI;CAAmB;CAEhC,QAAQ;;EAAI;CAAiB;AAC9B;AAEA,SAAS,UAAW,EAAE,uBAAwB;CAC7C,MAAM,mBAAmB,iBAAkB,UAAU,GAAI;CACzD,MAAM,iBAAiB,iBAAkB,QAAQ,IAAK;CACtD,MAAM,EAAE,qBAAqB,qBAAqB,wB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 jsx(VisuallyHidden, {
65
65
  render: /* @__PURE__ */ jsx("span", {}),
66
- children: __("(opens in a new tab)")
66
+ children: __(
67
+ /** translators: accessibility text */
68
+ "(opens in a new tab)"
69
+ )
67
70
  })]
68
71
  }),
69
72
  /* @__PURE__ */ jsx(ToolsMoreMenuGroup.Slot, { fillProps: { onClose } })
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["preferencesStore"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import { MenuGroup, MenuItem, DropdownMenu } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/edit-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( onClose ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"themeStyles\"\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal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C,WAAY,EAAE,QAAQ,EACtB,CAAA;IACS;;GACX,qBAAC,WAAD;IAAW,OAAQ,GAAI,aAAc;IAArC,UAAA;KACC,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,OAAQ,GACP,kCACD;MACA,MAAO,GACN,iEACD;MACA,kBAAmB,GAClB,4CACD;MACA,oBAAqB,GACpB,8CACD;KACA,CAAA;KACD,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,MAAO,GACN,uCACD;MACA,OAAQ,GAAI,kBAAmB;KAC/B,CAAA;KACC,mBACD,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,OAAQ,GAAI,2BAA4B;MACxC,MAAO,GACN,sDACD;MACA,kBAAmB,GAClB,qCACD;MACA,oBAAqB,GACpB,uCACD;KACA,CAAA;IAEQ;;EACV,EAAA,CAAA;CAEU,CAAA,GACd,oBAAC,2BAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
1
+ {"version":3,"file":"index.mjs","names":["preferencesStore"],"sources":["../../../src/components/more-menu/index.jsx"],"sourcesContent":["import { MenuGroup, MenuItem, DropdownMenu } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __, _x } from '@wordpress/i18n';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { VisuallyHidden } from '@wordpress/ui';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ToolsMoreMenuGroup from './tools-more-menu-group';\n\nexport default function MoreMenu() {\n\tconst [\n\t\tisKeyboardShortcutsModalActive,\n\t\tsetIsKeyboardShortcutsModalVisible,\n\t] = useState( false );\n\tconst toggleKeyboardShortcutsModal = () =>\n\t\tsetIsKeyboardShortcutsModalVisible( ! isKeyboardShortcutsModalActive );\n\n\tuseShortcut(\n\t\t'core/edit-widgets/keyboard-shortcuts',\n\t\ttoggleKeyboardShortcutsModal\n\t);\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tplacement: 'bottom-end',\n\t\t\t\t\tclassName: 'more-menu-dropdown__content',\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t\tsize: 'compact',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ ( onClose ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetIsKeyboardShortcutsModalVisible( true );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\ttoggle(\n\t\t\t\t\t\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Welcome Guide' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/block-based-widgets-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden render={ <span /> }>\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Preferences' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\tname=\"themeStyles\"\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t\t<PreferenceToggleMenuItem\n\t\t\t\t\t\t\t\t\tscope=\"core/edit-widgets\"\n\t\t\t\t\t\t\t\t\tname=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs activated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t\t'Display block breadcrumbs deactivated'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isKeyboardShortcutsModalActive }\n\t\t\t\ttoggleModal={ toggleKeyboardShortcutsModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAwB,WAAW;CAClC,MAAM,CACL,gCACA,sCACG,SAAU,KAAM;CACpB,MAAM,qCACL,mCAAoC,CAAE,8BAA+B;CAEtE,YACC,wCACA,4BACD;CAEA,MAAM,kBAAkB,iBAAkB,QAAS;CACnD,MAAM,EAAE,WAAW,YAAaA,KAAiB;CAEjD,OACC,qBAAA,UAAA,EAAA,UAAA,CACC,oBAAC,cAAD;EACC,MAAO;EACP,OAAQ,GAAI,SAAU;EACtB,cAAe;GACd,WAAW;GACX,WAAW;EACZ;EACA,aAAc;GACb,iBAAiB;GACjB,MAAM;EACP;EAEI,WAAA,YACH,qBAAA,UAAA,EAAA,UAAA;GACG,mBACD,oBAAC,WAAD;IAAW,OAAQ,GAAI,QAAQ,MAAO;IACrC,UAAA,oBAAC,0BAAD;KACC,OAAM;KACN,MAAK;KACL,OAAQ,GAAI,aAAc;KAC1B,MAAO,GACN,uDACD;KACA,kBAAmB,GAClB,uBACD;KACA,oBAAqB,GACpB,yBACD;IACA,CAAA;GACS,CAAA;GAEZ,qBAAC,WAAD;IAAW,OAAQ,GAAI,OAAQ;IAA/B,UAAA;KACC,oBAAC,UAAD;MACC,eAAgB;OACf,mCAAoC,IAAK;MAC1C;MACA,UAAW,gBAAgB,OAAQ,GAAI;MAErC,UAAA,GAAI,oBAAqB;KAClB,CAAA;KACV,oBAAC,UAAD;MACC,eACC,OACC,qBACA,cACD;MAED,iBAAc;MAEZ,UAAA,GAAI,eAAgB;KACb,CAAA;KACV,qBAAC,UAAD;MACC,MAAK;MACL,MAAO;MACP,MAAO,GACN,yEACD;MACA,QAAO;MANR,UAAA,CAQG,GAAI,MAAO,GACb,oBAAC,gBAAD;OAAgB,QAAS,oBAAC,QAAD,CAAO,CAAA;OAG9B,UAAA;;QAAI;OAAuB;MAEb,CAAA,CACP;;KACV,oBAAC,mBAAmB,MAApB,EACC,WAAY,EAAE,QAAQ,EACtB,CAAA;IACS;;GACX,qBAAC,WAAD;IAAW,OAAQ,GAAI,aAAc;IAArC,UAAA;KACC,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,OAAQ,GACP,kCACD;MACA,MAAO,GACN,iEACD;MACA,kBAAmB,GAClB,4CACD;MACA,oBAAqB,GACpB,8CACD;KACA,CAAA;KACD,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,MAAO,GACN,uCACD;MACA,OAAQ,GAAI,kBAAmB;KAC/B,CAAA;KACC,mBACD,oBAAC,0BAAD;MACC,OAAM;MACN,MAAK;MACL,OAAQ,GAAI,2BAA4B;MACxC,MAAO,GACN,sDACD;MACA,kBAAmB,GAClB,qCACD;MACA,oBAAqB,GACpB,uCACD;KACA,CAAA;IAEQ;;EACV,EAAA,CAAA;CAEU,CAAA,GACd,oBAAC,2BAAD;EACC,eAAgB;EAChB,aAAc;CACd,CAAA,CACA,EAAA,CAAA;AAEJ"}
@@ -15,13 +15,16 @@ const BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector";
15
15
  const WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas";
16
16
  const { Tabs: WCTabs } = unlock(privateApis);
17
17
  function SidebarHeader({ selectedWidgetAreaBlock }) {
18
- return /* @__PURE__ */ jsxs(WCTabs.TabList, { children: [/* @__PURE__ */ jsx(WCTabs.Tab, {
19
- tabId: WIDGET_AREAS_IDENTIFIER,
20
- children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __("Widget Areas")
21
- }), /* @__PURE__ */ jsx(WCTabs.Tab, {
22
- tabId: BLOCK_INSPECTOR_IDENTIFIER,
23
- children: __("Block")
24
- })] });
18
+ return /* @__PURE__ */ jsxs(WCTabs.TabList, {
19
+ className: "edit-widgets-sidebar__panel-tablist",
20
+ children: [/* @__PURE__ */ jsx(WCTabs.Tab, {
21
+ tabId: WIDGET_AREAS_IDENTIFIER,
22
+ children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : __("Widget Areas")
23
+ }), /* @__PURE__ */ jsx(WCTabs.Tab, {
24
+ tabId: BLOCK_INSPECTOR_IDENTIFIER,
25
+ children: __("Block")
26
+ })]
27
+ });
25
28
  }
26
29
  function SidebarContent({ hasSelectedNonAreaBlock, currentArea, isGeneralSidebarOpen, selectedWidgetAreaBlock }) {
27
30
  const { enableComplementaryArea } = useDispatch(store);
@@ -37,7 +40,10 @@ function SidebarContent({ hasSelectedNonAreaBlock, currentArea, isGeneralSidebar
37
40
  children: /* @__PURE__ */ jsx(SidebarHeader, { selectedWidgetAreaBlock })
38
41
  }),
39
42
  headerClassName: "edit-widgets-sidebar__panel-tabs",
40
- title: __("Settings"),
43
+ title: __(
44
+ /** translators: button label text should, if possible, be under 16 characters. */
45
+ "Settings"
46
+ ),
41
47
  closeLabel: __("Close Settings"),
42
48
  scope: "core/edit-widgets",
43
49
  identifier: currentArea,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["componentsPrivateApis","interfaceStore","blockEditorStore","editWidgetsStore"],"sources":["../../../src/components/sidebar/index.jsx"],"sourcesContent":["import { 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';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\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';\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs: WCTabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<WCTabs.TabList>\n\t\t\t<WCTabs.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</WCTabs.Tab>\n\t\t\t<WCTabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</WCTabs.Tab>\n\t\t</WCTabs.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( WCTabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<WCTabs.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</WCTabs.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<WCTabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<WCTabs.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</WCTabs.TabPanel>\n\t\t\t\t<WCTabs.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</WCTabs.TabPanel>\n\t\t\t</WCTabs.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<WCTabs\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</WCTabs>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,4BAA4B;AAClC,MAAM,6BAA6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;KAAM,WAAU;KACb,UAAA,GAAI,oBAAqB;IACtB,CAAA;GAES,CAAA,CACO;;CACP,CAAA;AAErB;AAEA,SAAwB,UAAU;CACjC,MAAM,EACL,aACA,yBACA,sBACA,4BACG,WAAa,WAAY;EAC5B,MAAM,EAAE,kBAAkB,UAAU,+BACnC,OAAQC,OAAiB;EAC1B,MAAM,EAAE,+BAA+B,OAAQD,KAAe;EAE9D,MAAM,gBAAgB,iBAAiB;EAEvC,MAAM,aAAa,2BAA4BE,QAAiB,IAAK;EAErE,IAAI,mBAAmB;EACvB,IAAK,CAAE,kBAAmB;GACzB,IAAK,eACJ,mBAAmB;QAEnB,mBAAmB;EAErB;EAEA,IAAI;EACJ,IAAK,eAAgB;GACpB,IAAK,cAAc,SAAS,oBAC3B,kBAAkB;QAElB,kBAAkB,SACjB,2BACC,cAAc,UACd,kBACD,CAAC,CAAE,EACJ;EAEF;EAEA,OAAO;GACN,aAAa;GACb,yBAAyB,CAAC,EACzB,iBAAiB,cAAc,SAAS;GAEzC,sBAAsB,CAAC,CAAE;GACzB,yBAAyB;EAC1B;CACD,GAAG,CAAC,CAAE;CAEN,MAAM,EAAE,4BAA4B,YAAaF,KAAe;CAMhE,MAAM,cAAc,aACjB,qBAAsB;EACvB,IAAK,CAAC,CAAE,kBACP,wBACCE,QAAiB,MACjB,gBACD;CAEF,GACA,CAAE,uBAAwB,CAC3B;CAEA,OACC,oBAAC,QAAD;EAMC,eAAgB,uBAAuB,cAAc;EACrD,UAAW;EACX,cAAe;EAEf,UAAA,oBAAC,gBAAD;GAC2B;GACZ;GACS;GACG;EAC1B,CAAA;CACM,CAAA;AAEV"}
1
+ {"version":3,"file":"index.mjs","names":["componentsPrivateApis","interfaceStore","blockEditorStore","editWidgetsStore"],"sources":["../../../src/components/sidebar/index.jsx"],"sourcesContent":["import { 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';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nconst SIDEBAR_ACTIVE_BY_DEFAULT = true;\nconst BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector';\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';\nimport WidgetAreas from './widget-areas';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs: WCTabs } = unlock( componentsPrivateApis );\n\nfunction SidebarHeader( { selectedWidgetAreaBlock } ) {\n\treturn (\n\t\t<WCTabs.TabList className=\"edit-widgets-sidebar__panel-tablist\">\n\t\t\t<WCTabs.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</WCTabs.Tab>\n\t\t\t<WCTabs.Tab tabId={ BLOCK_INSPECTOR_IDENTIFIER }>\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</WCTabs.Tab>\n\t\t</WCTabs.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( WCTabs.Context );\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tclassName=\"edit-widgets-sidebar\"\n\t\t\theader={\n\t\t\t\t<WCTabs.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</WCTabs.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<WCTabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<WCTabs.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</WCTabs.TabPanel>\n\t\t\t\t<WCTabs.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</WCTabs.TabPanel>\n\t\t\t</WCTabs.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<WCTabs\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</WCTabs>\n\t);\n}\n"],"mappings":";;;;;;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ACD,oBAAC,gBAAD,CAAiB,CAAA,IAIjB,oBAAC,QAAD;KAAM,WAAU;KACb,UAAA,GAAI,oBAAqB;IACtB,CAAA;GAES,CAAA,CACO;;CACP,CAAA;AAErB;AAEA,SAAwB,UAAU;CACjC,MAAM,EACL,aACA,yBACA,sBACA,4BACG,WAAa,WAAY;EAC5B,MAAM,EAAE,kBAAkB,UAAU,+BACnC,OAAQC,OAAiB;EAC1B,MAAM,EAAE,+BAA+B,OAAQD,KAAe;EAE9D,MAAM,gBAAgB,iBAAiB;EAEvC,MAAM,aAAa,2BAA4BE,QAAiB,IAAK;EAErE,IAAI,mBAAmB;EACvB,IAAK,CAAE,kBAAmB;GACzB,IAAK,eACJ,mBAAmB;QAEnB,mBAAmB;EAErB;EAEA,IAAI;EACJ,IAAK,eAAgB;GACpB,IAAK,cAAc,SAAS,oBAC3B,kBAAkB;QAElB,kBAAkB,SACjB,2BACC,cAAc,UACd,kBACD,CAAC,CAAE,EACJ;EAEF;EAEA,OAAO;GACN,aAAa;GACb,yBAAyB,CAAC,EACzB,iBAAiB,cAAc,SAAS;GAEzC,sBAAsB,CAAC,CAAE;GACzB,yBAAyB;EAC1B;CACD,GAAG,CAAC,CAAE;CAEN,MAAM,EAAE,4BAA4B,YAAaF,KAAe;CAMhE,MAAM,cAAc,aACjB,qBAAsB;EACvB,IAAK,CAAC,CAAE,kBACP,wBACCE,QAAiB,MACjB,gBACD;CAEF,GACA,CAAE,uBAAwB,CAC3B;CAEA,OACC,oBAAC,QAAD;EAMC,eAAgB,uBAAuB,cAAc;EACrD,UAAW;EACX,cAAe;EAEf,UAAA,oBAAC,gBAAD;GAC2B;GACZ;GACS;GACG;EAC1B,CAAA;CACM,CAAA;AAEV"}
@@ -29,7 +29,11 @@ function WelcomeGuide() {
29
29
  children: __("Welcome to block Widgets")
30
30
  }), isEntirelyBlockWidgets ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("p", {
31
31
  className: "edit-widgets-welcome-guide__text",
32
- children: sprintf(_n("Your theme provides %s “block” area for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.", "Your theme provides %s different “block” areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.", numWidgetAreas), numWidgetAreas)
32
+ children: sprintf(
33
+ /** Translators: %s: Number of block areas in the current theme. */
34
+ _n("Your theme provides %s “block” area for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.", "Your theme provides %s different “block” areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.", numWidgetAreas),
35
+ numWidgetAreas
36
+ )
33
37
  }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
34
38
  className: "edit-widgets-welcome-guide__text",
35
39
  children: __("You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.")