@wordpress/edit-widgets 6.32.0 → 6.32.1-next.ff1cebbba.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 (202) hide show
  1. package/build/blocks/widget-area/block.json +26 -0
  2. package/build/blocks/widget-area/edit/index.js +94 -87
  3. package/build/blocks/widget-area/edit/index.js.map +7 -1
  4. package/build/blocks/widget-area/edit/inner-blocks.js +68 -50
  5. package/build/blocks/widget-area/edit/inner-blocks.js.map +7 -1
  6. package/build/blocks/widget-area/edit/use-is-dragging-within.js +34 -40
  7. package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
  8. package/build/blocks/widget-area/index.js +49 -52
  9. package/build/blocks/widget-area/index.js.map +7 -1
  10. package/build/components/error-boundary/index.js +49 -51
  11. package/build/components/error-boundary/index.js.map +7 -1
  12. package/build/components/header/document-tools/index.js +104 -74
  13. package/build/components/header/document-tools/index.js.map +7 -1
  14. package/build/components/header/index.js +81 -62
  15. package/build/components/header/index.js.map +7 -1
  16. package/build/components/header/undo-redo/redo.js +50 -38
  17. package/build/components/header/undo-redo/redo.js.map +7 -1
  18. package/build/components/header/undo-redo/undo.js +49 -37
  19. package/build/components/header/undo-redo/undo.js.map +7 -1
  20. package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
  21. package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  22. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
  23. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  24. package/build/components/keyboard-shortcut-help-modal/index.js +154 -103
  25. package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  26. package/build/components/keyboard-shortcut-help-modal/shortcut.js +74 -56
  27. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  28. package/build/components/keyboard-shortcuts/index.js +89 -82
  29. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  30. package/build/components/layout/index.js +75 -49
  31. package/build/components/layout/index.js.map +7 -1
  32. package/build/components/layout/interface.js +89 -75
  33. package/build/components/layout/interface.js.map +7 -1
  34. package/build/components/layout/unsaved-changes-warning.js +35 -42
  35. package/build/components/layout/unsaved-changes-warning.js.map +7 -1
  36. package/build/components/more-menu/index.js +189 -108
  37. package/build/components/more-menu/index.js.map +7 -1
  38. package/build/components/more-menu/tools-more-menu-group.js +29 -23
  39. package/build/components/more-menu/tools-more-menu-group.js.map +7 -1
  40. package/build/components/notices/index.js +62 -48
  41. package/build/components/notices/index.js.map +7 -1
  42. package/build/components/save-button/index.js +55 -47
  43. package/build/components/save-button/index.js.map +7 -1
  44. package/build/components/secondary-sidebar/index.js +41 -34
  45. package/build/components/secondary-sidebar/index.js.map +7 -1
  46. package/build/components/secondary-sidebar/inserter-sidebar.js +55 -46
  47. package/build/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
  48. package/build/components/secondary-sidebar/list-view-sidebar.js +76 -67
  49. package/build/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
  50. package/build/components/sidebar/index.js +149 -138
  51. package/build/components/sidebar/index.js.map +7 -1
  52. package/build/components/sidebar/widget-areas.js +73 -57
  53. package/build/components/sidebar/widget-areas.js.map +7 -1
  54. package/build/components/welcome-guide/index.js +182 -137
  55. package/build/components/welcome-guide/index.js.map +7 -1
  56. package/build/components/widget-areas-block-editor-content/index.js +64 -43
  57. package/build/components/widget-areas-block-editor-content/index.js.map +7 -1
  58. package/build/components/widget-areas-block-editor-provider/index.js +115 -92
  59. package/build/components/widget-areas-block-editor-provider/index.js.map +7 -1
  60. package/build/constants.js +30 -8
  61. package/build/constants.js.map +7 -1
  62. package/build/filters/index.js +3 -5
  63. package/build/filters/index.js.map +7 -1
  64. package/build/filters/move-to-widget-area.js +52 -59
  65. package/build/filters/move-to-widget-area.js.map +7 -1
  66. package/build/filters/replace-media-upload.js +9 -11
  67. package/build/filters/replace-media-upload.js.map +7 -1
  68. package/build/hooks/use-last-selected-widget-area.js +38 -44
  69. package/build/hooks/use-last-selected-widget-area.js.map +7 -1
  70. package/build/hooks/use-widget-library-insertion-point.js +60 -55
  71. package/build/hooks/use-widget-library-insertion-point.js.map +7 -1
  72. package/build/index.js +86 -93
  73. package/build/index.js.map +7 -1
  74. package/build/lock-unlock.js +31 -15
  75. package/build/lock-unlock.js.map +7 -1
  76. package/build/store/actions.js +181 -313
  77. package/build/store/actions.js.map +7 -1
  78. package/build/store/constants.js +27 -10
  79. package/build/store/constants.js.map +7 -1
  80. package/build/store/index.js +51 -51
  81. package/build/store/index.js.map +7 -1
  82. package/build/store/private-selectors.js +28 -7
  83. package/build/store/private-selectors.js.map +7 -1
  84. package/build/store/reducer.js +65 -118
  85. package/build/store/reducer.js.map +7 -1
  86. package/build/store/resolvers.js +64 -63
  87. package/build/store/resolvers.js.map +7 -1
  88. package/build/store/selectors.js +194 -231
  89. package/build/store/selectors.js.map +7 -1
  90. package/build/store/transformers.js +47 -41
  91. package/build/store/transformers.js.map +7 -1
  92. package/build/store/utils.js +47 -70
  93. package/build/store/utils.js.map +7 -1
  94. package/build-module/blocks/widget-area/block.json +26 -0
  95. package/build-module/blocks/widget-area/edit/index.js +63 -75
  96. package/build-module/blocks/widget-area/edit/index.js.map +7 -1
  97. package/build-module/blocks/widget-area/edit/inner-blocks.js +38 -41
  98. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +7 -1
  99. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +14 -33
  100. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
  101. package/build-module/blocks/widget-area/index.js +14 -46
  102. package/build-module/blocks/widget-area/index.js.map +7 -1
  103. package/build-module/components/error-boundary/index.js +30 -43
  104. package/build-module/components/error-boundary/index.js.map +7 -1
  105. package/build-module/components/header/document-tools/index.js +75 -66
  106. package/build-module/components/header/document-tools/index.js.map +7 -1
  107. package/build-module/components/header/index.js +52 -54
  108. package/build-module/components/header/index.js.map +7 -1
  109. package/build-module/components/header/undo-redo/redo.js +32 -32
  110. package/build-module/components/header/undo-redo/redo.js.map +7 -1
  111. package/build-module/components/header/undo-redo/undo.js +31 -31
  112. package/build-module/components/header/undo-redo/undo.js.map +7 -1
  113. package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
  114. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  115. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
  116. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  117. package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -97
  118. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  119. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +56 -50
  120. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  121. package/build-module/components/keyboard-shortcuts/index.js +73 -75
  122. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  123. package/build-module/components/layout/index.js +46 -41
  124. package/build-module/components/layout/index.js.map +7 -1
  125. package/build-module/components/layout/interface.js +63 -66
  126. package/build-module/components/layout/interface.js.map +7 -1
  127. package/build-module/components/layout/unsaved-changes-warning.js +17 -37
  128. package/build-module/components/layout/unsaved-changes-warning.js.map +7 -1
  129. package/build-module/components/more-menu/index.js +167 -102
  130. package/build-module/components/more-menu/index.js.map +7 -1
  131. package/build-module/components/more-menu/tools-more-menu-group.js +11 -17
  132. package/build-module/components/more-menu/tools-more-menu-group.js.map +7 -1
  133. package/build-module/components/notices/index.js +43 -42
  134. package/build-module/components/notices/index.js.map +7 -1
  135. package/build-module/components/save-button/index.js +37 -41
  136. package/build-module/components/save-button/index.js.map +7 -1
  137. package/build-module/components/secondary-sidebar/index.js +14 -27
  138. package/build-module/components/secondary-sidebar/index.js.map +7 -1
  139. package/build-module/components/secondary-sidebar/inserter-sidebar.js +26 -38
  140. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
  141. package/build-module/components/secondary-sidebar/list-view-sidebar.js +57 -60
  142. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
  143. package/build-module/components/sidebar/index.js +129 -127
  144. package/build-module/components/sidebar/index.js.map +7 -1
  145. package/build-module/components/sidebar/widget-areas.js +53 -49
  146. package/build-module/components/sidebar/widget-areas.js.map +7 -1
  147. package/build-module/components/welcome-guide/index.js +165 -132
  148. package/build-module/components/welcome-guide/index.js.map +7 -1
  149. package/build-module/components/widget-areas-block-editor-content/index.js +43 -36
  150. package/build-module/components/widget-areas-block-editor-content/index.js.map +7 -1
  151. package/build-module/components/widget-areas-block-editor-provider/index.js +85 -83
  152. package/build-module/components/widget-areas-block-editor-provider/index.js.map +7 -1
  153. package/build-module/constants.js +7 -3
  154. package/build-module/constants.js.map +7 -1
  155. package/build-module/filters/index.js +3 -6
  156. package/build-module/filters/index.js.map +7 -1
  157. package/build-module/filters/move-to-widget-area.js +52 -57
  158. package/build-module/filters/move-to-widget-area.js.map +7 -1
  159. package/build-module/filters/replace-media-upload.js +8 -7
  160. package/build-module/filters/replace-media-upload.js.map +7 -1
  161. package/build-module/hooks/use-last-selected-widget-area.js +20 -39
  162. package/build-module/hooks/use-last-selected-widget-area.js.map +7 -1
  163. package/build-module/hooks/use-widget-library-insertion-point.js +42 -49
  164. package/build-module/hooks/use-widget-library-insertion-point.js.map +7 -1
  165. package/build-module/index.js +60 -72
  166. package/build-module/index.js.map +7 -1
  167. package/build-module/lock-unlock.js +8 -7
  168. package/build-module/lock-unlock.js.map +7 -1
  169. package/build-module/store/actions.js +153 -293
  170. package/build-module/store/actions.js.map +7 -1
  171. package/build-module/store/constants.js +5 -5
  172. package/build-module/store/constants.js.map +7 -1
  173. package/build-module/store/index.js +16 -40
  174. package/build-module/store/index.js.map +7 -1
  175. package/build-module/store/private-selectors.js +7 -3
  176. package/build-module/store/private-selectors.js.map +7 -1
  177. package/build-module/store/reducer.js +42 -111
  178. package/build-module/store/reducer.js.map +7 -1
  179. package/build-module/store/resolvers.js +43 -51
  180. package/build-module/store/resolvers.js.map +7 -1
  181. package/build-module/store/selectors.js +171 -224
  182. package/build-module/store/selectors.js.map +7 -1
  183. package/build-module/store/transformers.js +23 -34
  184. package/build-module/store/transformers.js.map +7 -1
  185. package/build-module/store/utils.js +22 -63
  186. package/build-module/store/utils.js.map +7 -1
  187. package/build-style/style-rtl.css +216 -88
  188. package/build-style/style.css +216 -88
  189. package/package.json +36 -29
  190. package/src/blocks/widget-area/editor.scss +3 -0
  191. package/src/components/customizer-edit-widgets-initializer/style.scss +3 -0
  192. package/src/components/error-boundary/style.scss +2 -0
  193. package/src/components/header/style.scss +5 -0
  194. package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
  195. package/src/components/layout/style.scss +3 -0
  196. package/src/components/more-menu/style.scss +2 -0
  197. package/src/components/notices/style.scss +3 -0
  198. package/src/components/secondary-sidebar/style.scss +4 -0
  199. package/src/components/sidebar/style.scss +2 -0
  200. package/src/components/welcome-guide/style.scss +2 -0
  201. package/src/components/widget-areas-block-editor-content/style.scss +2 -0
  202. package/src/style.scss +16 -13
@@ -1 +1,7 @@
1
- {"version":3,"names":["useEffect","useShortcut","store","keyboardShortcutsStore","isAppleOS","useDispatch","__","coreStore","editWidgetsStore","KeyboardShortcuts","redo","undo","saveEditedWidgetAreas","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character","aliases","Register"],"sources":["@wordpress/edit-widgets/src/components/keyboard-shortcuts/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\tuseShortcut( 'core/edit-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsaveEditedWidgetAreas();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,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E;MACZ,CAAC;IAEH,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEN,gBAAgB,CAAG,CAAC;EAEzB,OAAO,IAAI;AACZ;AAEAP,iBAAiB,CAACe,QAAQ,GAAGT,yBAAyB;AACtD,eAAeN,iBAAiB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/keyboard-shortcuts/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { isAppleOS } from '@wordpress/keycodes';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nfunction KeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\tuseShortcut( 'core/edit-widgets/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/save', ( event ) => {\n\t\tevent.preventDefault();\n\t\tsaveEditedWidgetAreas();\n\t} );\n\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t\t// Disable on Apple OS because it conflicts with the browser's\n\t\t\t// history shortcut. It's a fine alias for both Windows and Linux.\n\t\t\t// Since there's no conflict for Ctrl+Shift+Z on both Windows and\n\t\t\t// Linux, we keep it as the default for consistency.\n\t\t\taliases: isAppleOS()\n\t\t\t\t? []\n\t\t\t\t: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmodifier: 'primary',\n\t\t\t\t\t\t\tcharacter: 'y',\n\t\t\t\t\t\t},\n\t\t\t\t ],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/keyboard-shortcuts',\n\t\t\tcategory: 'main',\n\t\t\tdescription: __( 'Display these keyboard shortcuts.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/next-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the next part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrl',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'n',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-widgets/previous-region',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the previous part of the editor.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\tcharacter: '`',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'access',\n\t\t\t\t\tcharacter: 'p',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmodifier: 'ctrlShift',\n\t\t\t\t\tcharacter: '~',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"],
5
+ "mappings": "AAGA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB;AAKnC,SAAS,SAAS,wBAAwB;AAE1C,SAAS,oBAAoB;AAC5B,QAAM,EAAE,MAAM,KAAK,IAAI,YAAa,SAAU;AAC9C,QAAM,EAAE,sBAAsB,IAAI,YAAa,gBAAiB;AAEhE,cAAa,0BAA0B,CAAE,UAAW;AACnD,SAAK;AACL,UAAM,eAAe;AAAA,EACtB,CAAE;AAEF,cAAa,0BAA0B,CAAE,UAAW;AACnD,SAAK;AACL,UAAM,eAAe;AAAA,EACtB,CAAE;AAEF,cAAa,0BAA0B,CAAE,UAAW;AACnD,UAAM,eAAe;AACrB,0BAAsB;AAAA,EACvB,CAAE;AAEF,SAAO;AACR;AAEA,SAAS,4BAA4B;AAEpC,QAAM,EAAE,iBAAiB,IAAI,YAAa,sBAAuB;AACjE,YAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,yBAA0B;AAAA,MAC3C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AA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BAAQ;",
6
+ "names": []
7
+ }
@@ -1,48 +1,53 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __, sprintf } from '@wordpress/i18n';
5
- import { useDispatch } from '@wordpress/data';
6
- import { PluginArea } from '@wordpress/plugins';
7
- import { store as noticesStore } from '@wordpress/notices';
8
- import { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import ErrorBoundary from '../error-boundary';
14
- import WidgetAreasBlockEditorProvider from '../widget-areas-block-editor-provider';
15
- import Sidebar from '../sidebar';
16
- import Interface from './interface';
17
- import UnsavedChangesWarning from './unsaved-changes-warning';
18
- import WelcomeGuide from '../welcome-guide';
19
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
- function Layout({
21
- blockEditorSettings
22
- }) {
23
- const {
24
- createErrorNotice
25
- } = useDispatch(noticesStore);
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { __, sprintf } from "@wordpress/i18n";
3
+ import { useDispatch } from "@wordpress/data";
4
+ import { PluginArea } from "@wordpress/plugins";
5
+ import { store as noticesStore } from "@wordpress/notices";
6
+ import { __unstableUseNavigateRegions as useNavigateRegions } from "@wordpress/components";
7
+ import ErrorBoundary from "../error-boundary";
8
+ import WidgetAreasBlockEditorProvider from "../widget-areas-block-editor-provider";
9
+ import Sidebar from "../sidebar";
10
+ import Interface from "./interface";
11
+ import UnsavedChangesWarning from "./unsaved-changes-warning";
12
+ import WelcomeGuide from "../welcome-guide";
13
+ function Layout({ blockEditorSettings }) {
14
+ const { createErrorNotice } = useDispatch(noticesStore);
26
15
  function onPluginAreaError(name) {
27
- createErrorNotice(sprintf(/* translators: %s: plugin name */
28
- __('The "%s" plugin has encountered an error and cannot be rendered.'), name));
16
+ createErrorNotice(
17
+ sprintf(
18
+ /* translators: %s: plugin name */
19
+ __(
20
+ 'The "%s" plugin has encountered an error and cannot be rendered.'
21
+ ),
22
+ name
23
+ )
24
+ );
29
25
  }
30
26
  const navigateRegionsProps = useNavigateRegions();
31
- return /*#__PURE__*/_jsx(ErrorBoundary, {
32
- children: /*#__PURE__*/_jsx("div", {
27
+ return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(
28
+ "div",
29
+ {
33
30
  className: navigateRegionsProps.className,
34
31
  ...navigateRegionsProps,
35
32
  ref: navigateRegionsProps.ref,
36
- children: /*#__PURE__*/_jsxs(WidgetAreasBlockEditorProvider, {
37
- blockEditorSettings: blockEditorSettings,
38
- children: [/*#__PURE__*/_jsx(Interface, {
39
- blockEditorSettings: blockEditorSettings
40
- }), /*#__PURE__*/_jsx(Sidebar, {}), /*#__PURE__*/_jsx(PluginArea, {
41
- onError: onPluginAreaError
42
- }), /*#__PURE__*/_jsx(UnsavedChangesWarning, {}), /*#__PURE__*/_jsx(WelcomeGuide, {})]
43
- })
44
- })
45
- });
33
+ children: /* @__PURE__ */ jsxs(
34
+ WidgetAreasBlockEditorProvider,
35
+ {
36
+ blockEditorSettings,
37
+ children: [
38
+ /* @__PURE__ */ jsx(Interface, { blockEditorSettings }),
39
+ /* @__PURE__ */ jsx(Sidebar, {}),
40
+ /* @__PURE__ */ jsx(PluginArea, { onError: onPluginAreaError }),
41
+ /* @__PURE__ */ jsx(UnsavedChangesWarning, {}),
42
+ /* @__PURE__ */ jsx(WelcomeGuide, {})
43
+ ]
44
+ }
45
+ )
46
+ }
47
+ ) });
46
48
  }
47
- export default Layout;
48
- //# sourceMappingURL=index.js.map
49
+ var layout_default = Layout;
50
+ export {
51
+ layout_default as default
52
+ };
53
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["__","sprintf","useDispatch","PluginArea","store","noticesStore","__unstableUseNavigateRegions","useNavigateRegions","ErrorBoundary","WidgetAreasBlockEditorProvider","Sidebar","Interface","UnsavedChangesWarning","WelcomeGuide","jsx","_jsx","jsxs","_jsxs","Layout","blockEditorSettings","createErrorNotice","onPluginAreaError","name","navigateRegionsProps","children","className","ref","onError"],"sources":["@wordpress/edit-widgets/src/components/layout/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\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\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<div\n\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t>\n\t\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t>\n\t\t\t\t\t<Interface blockEditorSettings={ blockEditorSettings } />\n\t\t\t\t\t<Sidebar />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t\t</div>\n\t\t</ErrorBoundary>\n\t);\n}\n\nexport default Layout;\n"],"mappings":"AAAA;AACA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,eAC5CN,IAAA,CAACH,qBAAqB,IAAE,CAAC,eACzBG,IAAA,CAACF,YAAY,IAAE,CAAC;MAAA,CACe;IAAC,CAC7B;EAAC,CACQ,CAAC;AAElB;AAEA,eAAeK,MAAM","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/layout/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { PluginArea } from '@wordpress/plugins';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\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\n\treturn (\n\t\t<ErrorBoundary>\n\t\t\t<div\n\t\t\t\tclassName={ navigateRegionsProps.className }\n\t\t\t\t{ ...navigateRegionsProps }\n\t\t\t\tref={ navigateRegionsProps.ref }\n\t\t\t>\n\t\t\t\t<WidgetAreasBlockEditorProvider\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t>\n\t\t\t\t\t<Interface blockEditorSettings={ blockEditorSettings } />\n\t\t\t\t\t<Sidebar />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t\t<WelcomeGuide />\n\t\t\t\t</WidgetAreasBlockEditorProvider>\n\t\t\t</div>\n\t\t</ErrorBoundary>\n\t);\n}\n\nexport default Layout;\n"],
5
+ "mappings": "AA2CI,SAGC,KAHD;AAxCJ,SAAS,IAAI,eAAe;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,oBAAoB;AACtC,SAAS,gCAAgC,0BAA0B;AAKnE,OAAO,mBAAmB;AAC1B,OAAO,oCAAoC;AAC3C,OAAO,aAAa;AACpB,OAAO,eAAe;AACtB,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AAEzB,SAAS,OAAQ,EAAE,oBAAoB,GAAI;AAC1C,QAAM,EAAE,kBAAkB,IAAI,YAAa,YAAa;AAExD,WAAS,kBAAmB,MAAO;AAClC;AAAA,MACC;AAAA;AAAA,QAEC;AAAA,UACC;AAAA,QACD;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,QAAM,uBAAuB,mBAAmB;AAEhD,SACC,oBAAC,iBACA;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,qBAAqB;AAAA,MAC/B,GAAG;AAAA,MACL,KAAM,qBAAqB;AAAA,MAE3B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UAEA;AAAA,gCAAC,aAAU,qBAA4C;AAAA,YACvD,oBAAC,WAAQ;AAAA,YACT,oBAAC,cAAW,SAAU,mBAAoB;AAAA,YAC1C,oBAAC,yBAAsB;AAAA,YACvB,oBAAC,gBAAa;AAAA;AAAA;AAAA,MACf;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
6
+ "names": []
7
+ }
@@ -1,55 +1,52 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useViewportMatch } from '@wordpress/compose';
5
- import { BlockBreadcrumb } from '@wordpress/block-editor';
6
- import { useEffect } from '@wordpress/element';
7
- import { useDispatch, useSelect } from '@wordpress/data';
8
- import { InterfaceSkeleton, ComplementaryArea, store as interfaceStore } from '@wordpress/interface';
9
- import { __ } from '@wordpress/i18n';
10
- import { store as preferencesStore } from '@wordpress/preferences';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import Header from '../header';
16
- import WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';
17
- import { store as editWidgetsStore } from '../../store';
18
- import SecondarySidebar from '../secondary-sidebar';
19
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { useViewportMatch } from "@wordpress/compose";
3
+ import { BlockBreadcrumb } from "@wordpress/block-editor";
4
+ import { useEffect } from "@wordpress/element";
5
+ import { useDispatch, useSelect } from "@wordpress/data";
6
+ import {
7
+ InterfaceSkeleton,
8
+ ComplementaryArea,
9
+ store as interfaceStore
10
+ } from "@wordpress/interface";
11
+ import { __ } from "@wordpress/i18n";
12
+ import { store as preferencesStore } from "@wordpress/preferences";
13
+ import Header from "../header";
14
+ import WidgetAreasBlockEditorContent from "../widget-areas-block-editor-content";
15
+ import { store as editWidgetsStore } from "../../store";
16
+ import SecondarySidebar from "../secondary-sidebar";
20
17
  const interfaceLabels = {
21
18
  /* translators: accessibility text for the widgets screen top bar landmark region. */
22
- header: __('Widgets top bar'),
19
+ header: __("Widgets top bar"),
23
20
  /* translators: accessibility text for the widgets screen content landmark region. */
24
- body: __('Widgets and blocks'),
21
+ body: __("Widgets and blocks"),
25
22
  /* translators: accessibility text for the widgets screen settings landmark region. */
26
- sidebar: __('Widgets settings'),
23
+ sidebar: __("Widgets settings"),
27
24
  /* translators: accessibility text for the widgets screen footer landmark region. */
28
- footer: __('Widgets footer')
25
+ footer: __("Widgets footer")
29
26
  };
30
- function Interface({
31
- blockEditorSettings
32
- }) {
33
- const isMobileViewport = useViewportMatch('medium', '<');
34
- const isHugeViewport = useViewportMatch('huge', '>=');
35
- const {
36
- setIsInserterOpened,
37
- setIsListViewOpened,
38
- closeGeneralSidebar
39
- } = useDispatch(editWidgetsStore);
27
+ function Interface({ blockEditorSettings }) {
28
+ const isMobileViewport = useViewportMatch("medium", "<");
29
+ const isHugeViewport = useViewportMatch("huge", ">=");
30
+ const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } = useDispatch(editWidgetsStore);
40
31
  const {
41
32
  hasBlockBreadCrumbsEnabled,
42
33
  hasSidebarEnabled,
43
34
  isInserterOpened,
44
35
  isListViewOpened
45
- } = useSelect(select => ({
46
- hasSidebarEnabled: !!select(interfaceStore).getActiveComplementaryArea(editWidgetsStore.name),
47
- isInserterOpened: !!select(editWidgetsStore).isInserterOpened(),
48
- isListViewOpened: !!select(editWidgetsStore).isListViewOpened(),
49
- hasBlockBreadCrumbsEnabled: !!select(preferencesStore).get('core/edit-widgets', 'showBlockBreadcrumbs')
50
- }), []);
51
-
52
- // Inserter and Sidebars are mutually exclusive
36
+ } = useSelect(
37
+ (select) => ({
38
+ hasSidebarEnabled: !!select(
39
+ interfaceStore
40
+ ).getActiveComplementaryArea(editWidgetsStore.name),
41
+ isInserterOpened: !!select(editWidgetsStore).isInserterOpened(),
42
+ isListViewOpened: !!select(editWidgetsStore).isListViewOpened(),
43
+ hasBlockBreadCrumbsEnabled: !!select(preferencesStore).get(
44
+ "core/edit-widgets",
45
+ "showBlockBreadcrumbs"
46
+ )
47
+ }),
48
+ []
49
+ );
53
50
  useEffect(() => {
54
51
  if (hasSidebarEnabled && !isHugeViewport) {
55
52
  setIsInserterOpened(false);
@@ -61,30 +58,30 @@ function Interface({
61
58
  closeGeneralSidebar();
62
59
  }
63
60
  }, [isInserterOpened, isListViewOpened, isHugeViewport]);
64
- const secondarySidebarLabel = isListViewOpened ? __('List View') : __('Block Library');
61
+ const secondarySidebarLabel = isListViewOpened ? __("List View") : __("Block Library");
65
62
  const hasSecondarySidebar = isListViewOpened || isInserterOpened;
66
- return /*#__PURE__*/_jsx(InterfaceSkeleton, {
67
- labels: {
68
- ...interfaceLabels,
69
- secondarySidebar: secondarySidebarLabel
70
- },
71
- header: /*#__PURE__*/_jsx(Header, {}),
72
- secondarySidebar: hasSecondarySidebar && /*#__PURE__*/_jsx(SecondarySidebar, {}),
73
- sidebar: /*#__PURE__*/_jsx(ComplementaryArea.Slot, {
74
- scope: "core/edit-widgets"
75
- }),
76
- content: /*#__PURE__*/_jsx(_Fragment, {
77
- children: /*#__PURE__*/_jsx(WidgetAreasBlockEditorContent, {
78
- blockEditorSettings: blockEditorSettings
79
- })
80
- }),
81
- footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /*#__PURE__*/_jsx("div", {
82
- className: "edit-widgets-layout__footer",
83
- children: /*#__PURE__*/_jsx(BlockBreadcrumb, {
84
- rootLabelText: __('Widgets')
85
- })
86
- })
87
- });
63
+ return /* @__PURE__ */ jsx(
64
+ InterfaceSkeleton,
65
+ {
66
+ labels: {
67
+ ...interfaceLabels,
68
+ secondarySidebar: secondarySidebarLabel
69
+ },
70
+ header: /* @__PURE__ */ jsx(Header, {}),
71
+ secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ jsx(SecondarySidebar, {}),
72
+ sidebar: /* @__PURE__ */ jsx(ComplementaryArea.Slot, { scope: "core/edit-widgets" }),
73
+ content: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
74
+ WidgetAreasBlockEditorContent,
75
+ {
76
+ blockEditorSettings
77
+ }
78
+ ) }),
79
+ footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ jsx("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ jsx(BlockBreadcrumb, { rootLabelText: __("Widgets") }) })
80
+ }
81
+ );
88
82
  }
89
- export default Interface;
90
- //# sourceMappingURL=interface.js.map
83
+ var interface_default = Interface;
84
+ export {
85
+ interface_default as default
86
+ };
87
+ //# sourceMappingURL=interface.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useViewportMatch","BlockBreadcrumb","useEffect","useDispatch","useSelect","InterfaceSkeleton","ComplementaryArea","store","interfaceStore","__","preferencesStore","Header","WidgetAreasBlockEditorContent","editWidgetsStore","SecondarySidebar","jsx","_jsx","Fragment","_Fragment","interfaceLabels","header","body","sidebar","footer","Interface","blockEditorSettings","isMobileViewport","isHugeViewport","setIsInserterOpened","setIsListViewOpened","closeGeneralSidebar","hasBlockBreadCrumbsEnabled","hasSidebarEnabled","isInserterOpened","isListViewOpened","select","getActiveComplementaryArea","name","get","secondarySidebarLabel","hasSecondarySidebar","labels","secondarySidebar","Slot","scope","content","children","className","rootLabelText"],"sources":["@wordpress/edit-widgets/src/components/layout/interface.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t} = 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 rootLabelText={ __( 'Widgets' ) } />\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":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBC,KAAK,IAAIC,cAAc,QACjB,sBAAsB;AAC7B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,6BAA6B,MAAM,sCAAsC;AAChF,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,gBAAgB,MAAM,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAEpD,MAAMC,eAAe,GAAG;EACvB;EACAC,MAAM,EAAEX,EAAE,CAAE,iBAAkB,CAAC;EAC/B;EACAY,IAAI,EAAEZ,EAAE,CAAE,oBAAqB,CAAC;EAChC;EACAa,OAAO,EAAEb,EAAE,CAAE,kBAAmB,CAAC;EACjC;EACAc,MAAM,EAAEd,EAAE,CAAE,gBAAiB;AAC9B,CAAC;AAED,SAASe,SAASA,CAAE;EAAEC;AAAoB,CAAC,EAAG;EAC7C,MAAMC,gBAAgB,GAAG1B,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EAC1D,MAAM2B,cAAc,GAAG3B,gBAAgB,C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BAAgB,IAAID,gBAAgB;EAEhE,oBACCjB,IAAA,CAACX,iBAAiB;IACjBoC,MAAM,EAAG;MACR,GAAGtB,eAAe;MAClBuB,gBAAgB,EAAEH;IACnB,CAAG;IACHnB,MAAM,eAAGJ,IAAA,CAACL,MAAM,IAAE,CAAG;IACrB+B,gBAAgB,EAAGF,mBAAmB,iBAAIxB,IAAA,CAACF,gBAAgB,IAAE,CAAG;IAChEQ,OAAO,eAAGN,IAAA,CAACV,iBAAiB,CAACqC,IAAI;MAACC,KAAK,EAAC;IAAmB,CAAE,CAAG;IAChEC,OAAO,eACN7B,IAAA,CAAAE,SAAA;MAAA4B,QAAA,eACC9B,IAAA,CAACJ,6BAA6B;QAC7Ba,mBAAmB,EAAGA;MAAqB,CAC3C;IAAC,CACD,CACF;IACDF,MAAM,EACLQ,0BAA0B,IAC1B,CAAEL,gBAAgB,iBACjBV,IAAA;MAAK+B,SAAS,EAAC,6BAA6B;MAAAD,QAAA,eAC3C9B,IAAA,CAACf,eAAe;QAAC+C,aAAa,EAAGvC,EAAE,CAAE,SAAU;MAAG,CAAE;IAAC,CACjD;EAEN,CACD,CAAC;AAEJ;AAEA,eAAee,SAAS","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/layout/interface.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockBreadcrumb } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { __ } from '@wordpress/i18n';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Header from '../header';\nimport WidgetAreasBlockEditorContent from '../widget-areas-block-editor-content';\nimport { store as editWidgetsStore } from '../../store';\nimport SecondarySidebar from '../secondary-sidebar';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the widgets screen top bar landmark region. */\n\theader: __( 'Widgets top bar' ),\n\t/* translators: accessibility text for the widgets screen content landmark region. */\n\tbody: __( 'Widgets and blocks' ),\n\t/* translators: accessibility text for the widgets screen settings landmark region. */\n\tsidebar: __( 'Widgets settings' ),\n\t/* translators: accessibility text for the widgets screen footer landmark region. */\n\tfooter: __( 'Widgets footer' ),\n};\n\nfunction Interface( { blockEditorSettings } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =\n\t\tuseDispatch( editWidgetsStore );\n\tconst {\n\t\thasBlockBreadCrumbsEnabled,\n\t\thasSidebarEnabled,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t} = 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 rootLabelText={ __( 'Widgets' ) } />\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"],
5
+ "mappings": "AAqFY,SAIR,UAJQ;AAlFZ,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAChC,SAAS,iBAAiB;AAC1B,SAAS,aAAa,iBAAiB;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,UAAU;AACnB,SAAS,SAAS,wBAAwB;AAK1C,OAAO,YAAY;AACnB,OAAO,mCAAmC;AAC1C,SAAS,SAAS,wBAAwB;AAC1C,OAAO,sBAAsB;AAE7B,MAAM,kBAAkB;AAAA;AAAA,EAEvB,QAAQ,GAAI,iBAAkB;AAAA;AAAA,EAE9B,MAAM,GAAI,oBAAqB;AAAA;AAAA,EAE/B,SAAS,GAAI,kBAAmB;AAAA;AAAA,EAEhC,QAAQ,GAAI,gBAAiB;AAC9B;AAEA,SAAS,UAAW,EAAE,oBAAoB,GAAI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C;AAAA;AAAA,UACA;AAAA;AAAA,MACD,GACD;AAAA,MAED,QACC,8BACA,CAAE,oBACD,oBAAC,SAAI,WAAU,+BACd,8BAAC,mBAAgB,eAAgB,GAAI,SAAU,GAAI,GACpD;AAAA;AAAA,EAGH;AAEF;AAEA,IAAO,oBAAQ;",
6
+ "names": []
7
+ }
@@ -1,50 +1,30 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { useEffect } from '@wordpress/element';
6
- import { useSelect } from '@wordpress/data';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import { store as editWidgetsStore } from '../../store';
12
-
13
- /**
14
- * Warns the user if there are unsaved changes before leaving the editor.
15
- *
16
- * This is a duplicate of the component implemented in the editor package.
17
- * Duplicated here as edit-widgets doesn't depend on editor.
18
- *
19
- * @return {Component} The component.
20
- */
21
- export default function UnsavedChangesWarning() {
22
- const isDirty = useSelect(select => {
23
- const {
24
- getEditedWidgetAreas
25
- } = select(editWidgetsStore);
1
+ import { __ } from "@wordpress/i18n";
2
+ import { useEffect } from "@wordpress/element";
3
+ import { useSelect } from "@wordpress/data";
4
+ import { store as editWidgetsStore } from "../../store";
5
+ function UnsavedChangesWarning() {
6
+ const isDirty = useSelect((select) => {
7
+ const { getEditedWidgetAreas } = select(editWidgetsStore);
26
8
  const editedWidgetAreas = getEditedWidgetAreas();
27
9
  return editedWidgetAreas?.length > 0;
28
10
  }, []);
29
11
  useEffect(() => {
30
- /**
31
- * Warns the user if there are unsaved changes before leaving the editor.
32
- *
33
- * @param {Event} event `beforeunload` event.
34
- *
35
- * @return {string | undefined} Warning prompt message, if unsaved changes exist.
36
- */
37
- const warnIfUnsavedChanges = event => {
12
+ const warnIfUnsavedChanges = (event) => {
38
13
  if (isDirty) {
39
- event.returnValue = __('You have unsaved changes. If you proceed, they will be lost.');
14
+ event.returnValue = __(
15
+ "You have unsaved changes. If you proceed, they will be lost."
16
+ );
40
17
  return event.returnValue;
41
18
  }
42
19
  };
43
- window.addEventListener('beforeunload', warnIfUnsavedChanges);
20
+ window.addEventListener("beforeunload", warnIfUnsavedChanges);
44
21
  return () => {
45
- window.removeEventListener('beforeunload', warnIfUnsavedChanges);
22
+ window.removeEventListener("beforeunload", warnIfUnsavedChanges);
46
23
  };
47
24
  }, [isDirty]);
48
25
  return null;
49
26
  }
50
- //# sourceMappingURL=unsaved-changes-warning.js.map
27
+ export {
28
+ UnsavedChangesWarning as default
29
+ };
30
+ //# sourceMappingURL=unsaved-changes-warning.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["__","useEffect","useSelect","store","editWidgetsStore","UnsavedChangesWarning","isDirty","select","getEditedWidgetAreas","editedWidgetAreas","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"sources":["@wordpress/edit-widgets/src/components/layout/unsaved-changes-warning.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n *\n * This is a duplicate of the component implemented in the editor package.\n * Duplicated here as edit-widgets doesn't depend on editor.\n *\n * @return {Component} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas } = select( editWidgetsStore );\n\t\tconst editedWidgetAreas = getEditedWidgetAreas();\n\n\t\treturn editedWidgetAreas?.length > 0;\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\tif ( isDirty ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ isDirty ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAA,EAAG;EAC/C,MAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IACxC,MAAM;MAAEC;IAAqB,CAAC,GAAGD,MAAM,CAAEH,gBAAiB,CAAC;IAC3D,MAAMK,iBAAiB,GAAGD,oBAAoB,CAAC,CAAC;IAEhD,OAAOC,iBAAiB,EAAEC,MAAM,GAAG,CAAC;EACrC,CAAC,EAAE,EAAG,CAAC;EAEPT,SAAS,CAAE,MAAM;IAChB;AACF;AACA;AACA;AACA;AACA;AACA;IACE,MAAMU,oBAAoB,GAAKC,KAAK,IAAM;MACzC,IAAKN,OAAO,EAAG;QACdM,KAAK,CAACC,WAAW,GAAGb,EAAE,CACrB,8DACD,CAAC;QACD,OAAOY,KAAK,CAACC,WAAW;MACzB;IACD,CAAC;IAEDC,MAAM,CAACC,gBAAgB,CAAE,cAAc,EAAEJ,oBAAqB,CAAC;IAE/D,OAAO,MAAM;MACZG,MAAM,CAACE,mBAAmB,CAAE,cAAc,EAAEL,oBAAqB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,CAAEL,OAAO,CAAG,CAAC;EAEhB,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/layout/unsaved-changes-warning.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n *\n * This is a duplicate of the component implemented in the editor package.\n * Duplicated here as edit-widgets doesn't depend on editor.\n *\n * @return {Component} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\tconst { getEditedWidgetAreas } = select( editWidgetsStore );\n\t\tconst editedWidgetAreas = getEditedWidgetAreas();\n\n\t\treturn editedWidgetAreas?.length > 0;\n\t}, [] );\n\n\tuseEffect( () => {\n\t\t/**\n\t\t * Warns the user if there are unsaved changes before leaving the editor.\n\t\t *\n\t\t * @param {Event} event `beforeunload` event.\n\t\t *\n\t\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t\t */\n\t\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t\tif ( isDirty ) {\n\t\t\t\tevent.returnValue = __(\n\t\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t\t);\n\t\t\t\treturn event.returnValue;\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [ isDirty ] );\n\n\treturn null;\n}\n"],
5
+ "mappings": "AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAK1B,SAAS,SAAS,wBAAwB;AAU3B,SAAR,wBAAyC;AAC/C,QAAM,UAAU,UAAW,CAAE,WAAY;AACxC,UAAM,EAAE,qBAAqB,IAAI,OAAQ,gBAAiB;AAC1D,UAAM,oBAAoB,qBAAqB;AAE/C,WAAO,mBAAmB,SAAS;AAAA,EACpC,GAAG,CAAC,CAAE;AAEN,YAAW,MAAM;AAQhB,UAAM,uBAAuB,CAAE,UAAW;AACzC,UAAK,SAAU;AACd,cAAM,cAAc;AAAA,UACnB;AAAA,QACD;AACA,eAAO,MAAM;AAAA,MACd;AAAA,IACD;AAEA,WAAO,iBAAkB,gBAAgB,oBAAqB;AAE9D,WAAO,MAAM;AACZ,aAAO,oBAAqB,gBAAgB,oBAAqB;AAAA,IAClE;AAAA,EACD,GAAG,CAAE,OAAQ,CAAE;AAEf,SAAO;AACR;",
6
+ "names": []
7
+ }