@wordpress/edit-widgets 7.0.0 → 7.1.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 (188) hide show
  1. package/build/blocks/widget-area/edit/index.cjs +106 -116
  2. package/build/blocks/widget-area/edit/index.cjs.map +1 -7
  3. package/build/blocks/widget-area/edit/inner-blocks.cjs +44 -62
  4. package/build/blocks/widget-area/edit/inner-blocks.cjs.map +1 -7
  5. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs +41 -53
  6. package/build/blocks/widget-area/edit/use-is-dragging-within.cjs.map +1 -7
  7. package/build/blocks/widget-area/index.cjs +40 -44
  8. package/build/blocks/widget-area/index.cjs.map +1 -7
  9. package/build/components/error-boundary/index.cjs +115 -155
  10. package/build/components/error-boundary/index.cjs.map +1 -7
  11. package/build/components/header/document-tools/index.cjs +80 -115
  12. package/build/components/header/document-tools/index.cjs.map +1 -7
  13. package/build/components/header/index.cjs +72 -80
  14. package/build/components/header/index.cjs.map +1 -7
  15. package/build/components/header/undo-redo/redo.cjs +30 -52
  16. package/build/components/header/undo-redo/redo.cjs.map +1 -7
  17. package/build/components/header/undo-redo/undo.cjs +29 -51
  18. package/build/components/header/undo-redo/undo.cjs.map +1 -7
  19. package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
  20. package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
  21. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
  22. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
  23. package/build/components/keyboard-shortcut-help-modal/index.cjs +94 -161
  24. package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
  25. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +37 -75
  26. package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
  27. package/build/components/keyboard-shortcuts/index.cjs +107 -140
  28. package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
  29. package/build/components/layout/index.cjs +65 -74
  30. package/build/components/layout/index.cjs.map +1 -7
  31. package/build/components/layout/interface.cjs +82 -108
  32. package/build/components/layout/interface.cjs.map +1 -7
  33. package/build/components/layout/unsaved-changes-warning.cjs +44 -48
  34. package/build/components/layout/unsaved-changes-warning.cjs.map +1 -7
  35. package/build/components/more-menu/index.cjs +125 -191
  36. package/build/components/more-menu/index.cjs.map +1 -7
  37. package/build/components/more-menu/tools-more-menu-group.cjs +9 -29
  38. package/build/components/more-menu/tools-more-menu-group.cjs.map +1 -7
  39. package/build/components/notices/index.cjs +19 -39
  40. package/build/components/notices/index.cjs.map +1 -7
  41. package/build/components/save-button/index.cjs +31 -58
  42. package/build/components/save-button/index.cjs.map +1 -7
  43. package/build/components/secondary-sidebar/index.cjs +38 -45
  44. package/build/components/secondary-sidebar/index.cjs.map +1 -7
  45. package/build/components/secondary-sidebar/inserter-sidebar.cjs +50 -51
  46. package/build/components/secondary-sidebar/inserter-sidebar.cjs.map +1 -7
  47. package/build/components/secondary-sidebar/list-view-sidebar.cjs +51 -82
  48. package/build/components/secondary-sidebar/list-view-sidebar.cjs.map +1 -7
  49. package/build/components/sidebar/index.cjs +117 -180
  50. package/build/components/sidebar/index.cjs.map +1 -7
  51. package/build/components/sidebar/widget-areas.cjs +43 -85
  52. package/build/components/sidebar/widget-areas.cjs.map +1 -7
  53. package/build/components/welcome-guide/index.cjs +110 -186
  54. package/build/components/welcome-guide/index.cjs.map +1 -7
  55. package/build/components/widget-areas-block-editor-content/index.cjs +59 -64
  56. package/build/components/widget-areas-block-editor-content/index.cjs.map +1 -7
  57. package/build/components/widget-areas-block-editor-provider/index.cjs +105 -140
  58. package/build/components/widget-areas-block-editor-provider/index.cjs.map +1 -7
  59. package/build/constants.cjs +11 -32
  60. package/build/constants.cjs.map +1 -7
  61. package/build/filters/index.cjs +7 -4
  62. package/build/filters/move-to-widget-area.cjs +38 -53
  63. package/build/filters/move-to-widget-area.cjs.map +1 -7
  64. package/build/filters/replace-media-upload.cjs +11 -9
  65. package/build/filters/replace-media-upload.cjs.map +1 -7
  66. package/build/hooks/use-last-selected-widget-area.cjs +28 -49
  67. package/build/hooks/use-last-selected-widget-area.cjs.map +1 -7
  68. package/build/hooks/use-widget-library-insertion-point.cjs +33 -67
  69. package/build/hooks/use-widget-library-insertion-point.cjs.map +1 -7
  70. package/build/index.cjs +96 -97
  71. package/build/index.cjs.map +1 -7
  72. package/build/lock-unlock.cjs +10 -35
  73. package/build/lock-unlock.cjs.map +1 -7
  74. package/build/store/actions.cjs +269 -278
  75. package/build/store/actions.cjs.map +1 -7
  76. package/build/store/constants.cjs +12 -29
  77. package/build/store/constants.cjs.map +1 -7
  78. package/build/store/index.cjs +61 -52
  79. package/build/store/index.cjs.map +1 -7
  80. package/build/store/private-selectors.cjs +11 -32
  81. package/build/store/private-selectors.cjs.map +1 -7
  82. package/build/store/reducer.cjs +107 -88
  83. package/build/store/reducer.cjs.map +1 -7
  84. package/build/store/resolvers.cjs +60 -91
  85. package/build/store/resolvers.cjs.map +1 -7
  86. package/build/store/selectors.cjs +196 -229
  87. package/build/store/selectors.cjs.map +1 -7
  88. package/build/store/transformers.cjs +51 -82
  89. package/build/store/transformers.cjs.map +1 -7
  90. package/build/store/utils.cjs +76 -63
  91. package/build/store/utils.cjs.map +1 -7
  92. package/build-module/blocks/widget-area/edit/index.mjs +82 -94
  93. package/build-module/blocks/widget-area/edit/index.mjs.map +1 -7
  94. package/build-module/blocks/widget-area/edit/inner-blocks.mjs +19 -35
  95. package/build-module/blocks/widget-area/edit/inner-blocks.mjs.map +1 -7
  96. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs +36 -33
  97. package/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs.map +1 -7
  98. package/build-module/blocks/widget-area/index.mjs +12 -15
  99. package/build-module/blocks/widget-area/index.mjs.map +1 -7
  100. package/build-module/components/error-boundary/index.mjs +103 -128
  101. package/build-module/components/error-boundary/index.mjs.map +1 -7
  102. package/build-module/components/header/document-tools/index.mjs +51 -84
  103. package/build-module/components/header/document-tools/index.mjs.map +1 -7
  104. package/build-module/components/header/index.mjs +40 -47
  105. package/build-module/components/header/index.mjs.map +1 -7
  106. package/build-module/components/header/undo-redo/redo.mjs +20 -27
  107. package/build-module/components/header/undo-redo/redo.mjs.map +1 -7
  108. package/build-module/components/header/undo-redo/undo.mjs +19 -26
  109. package/build-module/components/header/undo-redo/undo.mjs.map +1 -7
  110. package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
  111. package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
  112. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
  113. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
  114. package/build-module/components/keyboard-shortcut-help-modal/index.mjs +67 -136
  115. package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
  116. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +31 -54
  117. package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
  118. package/build-module/components/keyboard-shortcuts/index.mjs +99 -119
  119. package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
  120. package/build-module/components/layout/index.mjs +29 -40
  121. package/build-module/components/layout/index.mjs.map +1 -7
  122. package/build-module/components/layout/interface.mjs +53 -82
  123. package/build-module/components/layout/interface.mjs.map +1 -7
  124. package/build-module/components/layout/unsaved-changes-warning.mjs +37 -26
  125. package/build-module/components/layout/unsaved-changes-warning.mjs.map +1 -7
  126. package/build-module/components/more-menu/index.mjs +95 -162
  127. package/build-module/components/more-menu/index.mjs.map +1 -7
  128. package/build-module/components/more-menu/tools-more-menu-group.mjs +5 -9
  129. package/build-module/components/more-menu/tools-more-menu-group.mjs.map +1 -7
  130. package/build-module/components/notices/index.mjs +12 -17
  131. package/build-module/components/notices/index.mjs.map +1 -7
  132. package/build-module/components/save-button/index.mjs +23 -35
  133. package/build-module/components/save-button/index.mjs.map +1 -7
  134. package/build-module/components/secondary-sidebar/index.mjs +15 -20
  135. package/build-module/components/secondary-sidebar/index.mjs.map +1 -7
  136. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs +27 -25
  137. package/build-module/components/secondary-sidebar/inserter-sidebar.mjs.map +1 -7
  138. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs +39 -55
  139. package/build-module/components/secondary-sidebar/list-view-sidebar.mjs.map +1 -7
  140. package/build-module/components/sidebar/index.mjs +96 -162
  141. package/build-module/components/sidebar/index.mjs.map +1 -7
  142. package/build-module/components/sidebar/widget-areas.mjs +30 -57
  143. package/build-module/components/sidebar/widget-areas.mjs.map +1 -7
  144. package/build-module/components/welcome-guide/index.mjs +103 -164
  145. package/build-module/components/welcome-guide/index.mjs.map +1 -7
  146. package/build-module/components/widget-areas-block-editor-content/index.mjs +34 -44
  147. package/build-module/components/widget-areas-block-editor-content/index.mjs.map +1 -7
  148. package/build-module/components/widget-areas-block-editor-provider/index.mjs +76 -109
  149. package/build-module/components/widget-areas-block-editor-provider/index.mjs.map +1 -7
  150. package/build-module/constants.mjs +5 -7
  151. package/build-module/constants.mjs.map +1 -7
  152. package/build-module/filters/index.mjs +0 -2
  153. package/build-module/filters/move-to-widget-area.mjs +28 -48
  154. package/build-module/filters/move-to-widget-area.mjs.map +1 -7
  155. package/build-module/filters/replace-media-upload.mjs +5 -8
  156. package/build-module/filters/replace-media-upload.mjs.map +1 -7
  157. package/build-module/hooks/use-last-selected-widget-area.mjs +23 -29
  158. package/build-module/hooks/use-last-selected-widget-area.mjs.map +1 -7
  159. package/build-module/hooks/use-widget-library-insertion-point.mjs +28 -47
  160. package/build-module/hooks/use-widget-library-insertion-point.mjs.map +1 -7
  161. package/build-module/index.mjs +62 -79
  162. package/build-module/index.mjs.map +1 -7
  163. package/build-module/lock-unlock.mjs +5 -10
  164. package/build-module/lock-unlock.mjs.map +1 -7
  165. package/build-module/store/actions.mjs +250 -247
  166. package/build-module/store/actions.mjs.map +1 -7
  167. package/build-module/store/constants.mjs +7 -5
  168. package/build-module/store/constants.mjs.map +1 -7
  169. package/build-module/store/index.mjs +18 -16
  170. package/build-module/store/index.mjs.map +1 -7
  171. package/build-module/store/private-selectors.mjs +5 -7
  172. package/build-module/store/private-selectors.mjs.map +1 -7
  173. package/build-module/store/reducer.mjs +95 -58
  174. package/build-module/store/reducer.mjs.map +1 -7
  175. package/build-module/store/resolvers.mjs +52 -71
  176. package/build-module/store/resolvers.mjs.map +1 -7
  177. package/build-module/store/selectors.mjs +178 -199
  178. package/build-module/store/selectors.mjs.map +1 -7
  179. package/build-module/store/transformers.mjs +44 -56
  180. package/build-module/store/transformers.mjs.map +1 -7
  181. package/build-module/store/utils.mjs +64 -32
  182. package/build-module/store/utils.mjs.map +1 -7
  183. package/package.json +33 -33
  184. package/src/components/header/index.jsx +2 -2
  185. package/src/components/sidebar/index.jsx +18 -18
  186. package/src/components/welcome-guide/index.jsx +4 -2
  187. package/build/filters/index.cjs.map +0 -7
  188. package/build-module/filters/index.mjs.map +0 -7
@@ -1,129 +1,109 @@
1
- // packages/edit-widgets/src/components/keyboard-shortcuts/index.js
2
1
  import { useEffect } from "@wordpress/element";
3
- import {
4
- useShortcut,
5
- store as keyboardShortcutsStore
6
- } from "@wordpress/keyboard-shortcuts";
2
+ import { store, useShortcut } from "@wordpress/keyboard-shortcuts";
7
3
  import { isAppleOS } from "@wordpress/keycodes";
8
4
  import { useDispatch } from "@wordpress/data";
9
5
  import { __ } from "@wordpress/i18n";
10
- import { store as coreStore } from "@wordpress/core-data";
11
- import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
12
- import { store as editWidgetsStore } from "../../store/index.mjs";
6
+ import { store as store$1 } from "@wordpress/core-data";
7
+ import { privateApis } from "@wordpress/block-editor";
8
+ import { store as store$2 } from "../../store/index.mjs";
13
9
  import { unlock } from "../../lock-unlock.mjs";
14
- var { usesNativeUndo } = unlock(blockEditorPrivateApis);
10
+ // packages/edit-widgets/src/components/keyboard-shortcuts/index.js
11
+ const { usesNativeUndo } = unlock(privateApis);
15
12
  function KeyboardShortcuts() {
16
- const { redo, undo } = useDispatch(coreStore);
17
- const { saveEditedWidgetAreas } = useDispatch(editWidgetsStore);
18
- useShortcut("core/edit-widgets/undo", (event) => {
19
- if (usesNativeUndo(event)) {
20
- return;
21
- }
22
- undo();
23
- event.preventDefault();
24
- });
25
- useShortcut("core/edit-widgets/redo", (event) => {
26
- if (usesNativeUndo(event)) {
27
- return;
28
- }
29
- redo();
30
- event.preventDefault();
31
- });
32
- useShortcut("core/edit-widgets/save", (event) => {
33
- event.preventDefault();
34
- saveEditedWidgetAreas();
35
- });
36
- return null;
13
+ const { redo, undo } = useDispatch(store$1);
14
+ const { saveEditedWidgetAreas } = useDispatch(store$2);
15
+ useShortcut("core/edit-widgets/undo", (event) => {
16
+ if (usesNativeUndo(event)) return;
17
+ undo();
18
+ event.preventDefault();
19
+ });
20
+ useShortcut("core/edit-widgets/redo", (event) => {
21
+ if (usesNativeUndo(event)) return;
22
+ redo();
23
+ event.preventDefault();
24
+ });
25
+ useShortcut("core/edit-widgets/save", (event) => {
26
+ event.preventDefault();
27
+ saveEditedWidgetAreas();
28
+ });
29
+ return null;
37
30
  }
38
31
  function KeyboardShortcutsRegister() {
39
- const { registerShortcut } = useDispatch(keyboardShortcutsStore);
40
- useEffect(() => {
41
- registerShortcut({
42
- name: "core/edit-widgets/undo",
43
- category: "global",
44
- description: __("Undo your last changes."),
45
- keyCombination: {
46
- modifier: "primary",
47
- character: "z"
48
- }
49
- });
50
- registerShortcut({
51
- name: "core/edit-widgets/redo",
52
- category: "global",
53
- description: __("Redo your last undo."),
54
- keyCombination: {
55
- modifier: "primaryShift",
56
- character: "z"
57
- },
58
- // Disable on Apple OS because it conflicts with the browser's
59
- // history shortcut. It's a fine alias for both Windows and Linux.
60
- // Since there's no conflict for Ctrl+Shift+Z on both Windows and
61
- // Linux, we keep it as the default for consistency.
62
- aliases: isAppleOS() ? [] : [
63
- {
64
- modifier: "primary",
65
- character: "y"
66
- }
67
- ]
68
- });
69
- registerShortcut({
70
- name: "core/edit-widgets/save",
71
- category: "global",
72
- description: __("Save your changes."),
73
- keyCombination: {
74
- modifier: "primary",
75
- character: "s"
76
- }
77
- });
78
- registerShortcut({
79
- name: "core/edit-widgets/keyboard-shortcuts",
80
- category: "main",
81
- description: __("Display these keyboard shortcuts."),
82
- keyCombination: {
83
- modifier: "access",
84
- character: "h"
85
- }
86
- });
87
- registerShortcut({
88
- name: "core/edit-widgets/next-region",
89
- category: "global",
90
- description: __("Navigate to the next part of the editor."),
91
- keyCombination: {
92
- modifier: "ctrl",
93
- character: "`"
94
- },
95
- aliases: [
96
- {
97
- modifier: "access",
98
- character: "n"
99
- }
100
- ]
101
- });
102
- registerShortcut({
103
- name: "core/edit-widgets/previous-region",
104
- category: "global",
105
- description: __("Navigate to the previous part of the editor."),
106
- keyCombination: {
107
- modifier: "ctrlShift",
108
- character: "`"
109
- },
110
- aliases: [
111
- {
112
- modifier: "access",
113
- character: "p"
114
- },
115
- {
116
- modifier: "ctrlShift",
117
- character: "~"
118
- }
119
- ]
120
- });
121
- }, [registerShortcut]);
122
- return null;
32
+ const { registerShortcut } = useDispatch(store);
33
+ useEffect(() => {
34
+ registerShortcut({
35
+ name: "core/edit-widgets/undo",
36
+ category: "global",
37
+ description: __("Undo your last changes."),
38
+ keyCombination: {
39
+ modifier: "primary",
40
+ character: "z"
41
+ }
42
+ });
43
+ registerShortcut({
44
+ name: "core/edit-widgets/redo",
45
+ category: "global",
46
+ description: __("Redo your last undo."),
47
+ keyCombination: {
48
+ modifier: "primaryShift",
49
+ character: "z"
50
+ },
51
+ aliases: isAppleOS() ? [] : [{
52
+ modifier: "primary",
53
+ character: "y"
54
+ }]
55
+ });
56
+ registerShortcut({
57
+ name: "core/edit-widgets/save",
58
+ category: "global",
59
+ description: __("Save your changes."),
60
+ keyCombination: {
61
+ modifier: "primary",
62
+ character: "s"
63
+ }
64
+ });
65
+ registerShortcut({
66
+ name: "core/edit-widgets/keyboard-shortcuts",
67
+ category: "main",
68
+ description: __("Display these keyboard shortcuts."),
69
+ keyCombination: {
70
+ modifier: "access",
71
+ character: "h"
72
+ }
73
+ });
74
+ registerShortcut({
75
+ name: "core/edit-widgets/next-region",
76
+ category: "global",
77
+ description: __("Navigate to the next part of the editor."),
78
+ keyCombination: {
79
+ modifier: "ctrl",
80
+ character: "`"
81
+ },
82
+ aliases: [{
83
+ modifier: "access",
84
+ character: "n"
85
+ }]
86
+ });
87
+ registerShortcut({
88
+ name: "core/edit-widgets/previous-region",
89
+ category: "global",
90
+ description: __("Navigate to the previous part of the editor."),
91
+ keyCombination: {
92
+ modifier: "ctrlShift",
93
+ character: "`"
94
+ },
95
+ aliases: [{
96
+ modifier: "access",
97
+ character: "p"
98
+ }, {
99
+ modifier: "ctrlShift",
100
+ character: "~"
101
+ }]
102
+ });
103
+ }, [registerShortcut]);
104
+ return null;
123
105
  }
124
106
  KeyboardShortcuts.Register = KeyboardShortcutsRegister;
125
- var keyboard_shortcuts_default = KeyboardShortcuts;
126
- export {
127
- keyboard_shortcuts_default as default
128
- };
129
- //# sourceMappingURL=index.mjs.map
107
+ export { KeyboardShortcuts as default };
108
+
109
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/keyboard-shortcuts/index.js"],
4
- "sourcesContent": ["import { 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';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { usesNativeUndo } = unlock( blockEditorPrivateApis );\n\nfunction KeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\tuseShortcut( 'core/edit-widgets/undo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/redo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\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\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": ";AAAA,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB;AACnC,SAAS,eAAe,8BAA8B;AACtD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,cAAc;AAEvB,IAAM,EAAE,eAAe,IAAI,OAAQ,sBAAuB;AAE1D,SAAS,oBAAoB;AAC5B,QAAM,EAAE,MAAM,KAAK,IAAI,YAAa,SAAU;AAC9C,QAAM,EAAE,sBAAsB,IAAI,YAAa,gBAAiB;AAEhE,cAAa,0BAA0B,CAAE,UAAW;AACnD,QAAK,eAAgB,KAAM,GAAI;AAC9B;AAAA,IACD;AACA,SAAK;AACL,UAAM,eAAe;AAAA,EACtB,CAAE;AAEF,cAAa,0BAA0B,CAAE,UAAW;AACnD,QAAK,eAAgB,KAAM,GAAI;AAC9B;AAAA,IACD;AACA,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;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,sBAAuB;AAAA,MACxC,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA;AAAA;AAAA;AAAA;AAAA,MAKA,SAAS,UAAU,IAChB,CAAC,IACD;AAAA,QACA;AAAA,UACC,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACH,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,oBAAqB;AAAA,MACtC,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,mCAAoC;AAAA,MACrD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,0CAA2C;AAAA,MAC5D,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,MACA,SAAS;AAAA,QACR;AAAA,UACC,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa,GAAI,8CAA+C;AAAA,MAChE,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,MACA,SAAS;AAAA,QACR;AAAA,UACC,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,QACA;AAAA,UACC,UAAU;AAAA,UACV,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AACR;AAEA,kBAAkB,WAAW;AAC7B,IAAO,6BAAQ;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":["blockEditorPrivateApis","coreStore","editWidgetsStore","keyboardShortcutsStore"],"sources":["../../../src/components/keyboard-shortcuts/index.js"],"sourcesContent":["import { 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';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { store as editWidgetsStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { usesNativeUndo } = unlock( blockEditorPrivateApis );\n\nfunction KeyboardShortcuts() {\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst { saveEditedWidgetAreas } = useDispatch( editWidgetsStore );\n\n\tuseShortcut( 'core/edit-widgets/undo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-widgets/redo', ( event ) => {\n\t\tif ( usesNativeUndo( event ) ) {\n\t\t\treturn;\n\t\t}\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\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,MAAM,EAAE,mBAAmB,OAAQA,WAAuB;AAE1D,SAAS,oBAAoB;CAC5B,MAAM,EAAE,MAAM,SAAS,YAAaC,OAAU;CAC9C,MAAM,EAAE,0BAA0B,YAAaC,OAAiB;CAEhE,YAAa,2BAA4B,UAAW;EACnD,IAAK,eAAgB,KAAM,GAC1B;EAED,KAAK;EACL,MAAM,eAAe;CACtB,CAAE;CAEF,YAAa,2BAA4B,UAAW;EACnD,IAAK,eAAgB,KAAM,GAC1B;EAED,KAAK;EACL,MAAM,eAAe;CACtB,CAAE;CAEF,YAAa,2BAA4B,UAAW;EACnD,MAAM,eAAe;EACrB,sBAAsB;CACvB,CAAE;CAEF,OAAO;AACR;AAEA,SAAS,4BAA4B;CAEpC,MAAM,EAAE,qBAAqB,YAAaC,KAAuB;CACjE,gBAAiB;EAChB,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,yBAA0B;GAC3C,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;EACD,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,sBAAuB;GACxC,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;GAKA,SAAS,UAAU,IAChB,CAAC,IACD,CACA;IACC,UAAU;IACV,WAAW;GACZ,CACD;EACH,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,oBAAqB;GACtC,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;EACD,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,mCAAoC;GACrD,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;EACD,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,0CAA2C;GAC5D,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;GACA,SAAS,CACR;IACC,UAAU;IACV,WAAW;GACZ,CACD;EACD,CAAE;EAEF,iBAAkB;GACjB,MAAM;GACN,UAAU;GACV,aAAa,GAAI,8CAA+C;GAChE,gBAAgB;IACf,UAAU;IACV,WAAW;GACZ;GACA,SAAS,CACR;IACC,UAAU;IACV,WAAW;GACZ,GACA;IACC,UAAU;IACV,WAAW;GACZ,CACD;EACD,CAAE;CACH,GAAG,CAAE,gBAAiB,CAAE;CAExB,OAAO;AACR;AAEA,kBAAkB,WAAW"}
@@ -1,11 +1,10 @@
1
- // packages/edit-widgets/src/components/layout/index.jsx
2
1
  import { getAdminThemeColors } from "@wordpress/admin-ui";
3
2
  import { __, sprintf } from "@wordpress/i18n";
4
3
  import { useMemo } from "@wordpress/element";
5
4
  import { useDispatch } from "@wordpress/data";
6
5
  import { PluginArea } from "@wordpress/plugins";
7
- import { store as noticesStore } from "@wordpress/notices";
8
- import { __unstableUseNavigateRegions as useNavigateRegions } from "@wordpress/components";
6
+ import { store } from "@wordpress/notices";
7
+ import { __unstableUseNavigateRegions } from "@wordpress/components";
9
8
  import { ThemeProvider } from "@wordpress/theme";
10
9
  import ErrorBoundary from "../error-boundary/index.mjs";
11
10
  import WidgetAreasBlockEditorProvider from "../widget-areas-block-editor-provider/index.mjs";
@@ -14,42 +13,32 @@ import Interface from "./interface.mjs";
14
13
  import UnsavedChangesWarning from "./unsaved-changes-warning.mjs";
15
14
  import WelcomeGuide from "../welcome-guide/index.mjs";
16
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
+ // packages/edit-widgets/src/components/layout/index.jsx
17
17
  function Layout({ blockEditorSettings }) {
18
- const { createErrorNotice } = useDispatch(noticesStore);
19
- function onPluginAreaError(name) {
20
- createErrorNotice(
21
- sprintf(
22
- /* translators: %s: plugin name */
23
- __(
24
- 'The "%s" plugin has encountered an error and cannot be rendered.'
25
- ),
26
- name
27
- )
28
- );
29
- }
30
- const navigateRegionsProps = useNavigateRegions();
31
- const adminPrimary = useMemo(() => getAdminThemeColors().primary, []);
32
- return /* @__PURE__ */ jsx(ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx("div", { ...navigateRegionsProps, children: /* @__PURE__ */ jsxs(
33
- WidgetAreasBlockEditorProvider,
34
- {
35
- blockEditorSettings,
36
- children: [
37
- /* @__PURE__ */ jsx(
38
- Interface,
39
- {
40
- blockEditorSettings
41
- }
42
- ),
43
- /* @__PURE__ */ jsx(Sidebar, {}),
44
- /* @__PURE__ */ jsx(PluginArea, { onError: onPluginAreaError }),
45
- /* @__PURE__ */ jsx(UnsavedChangesWarning, {}),
46
- /* @__PURE__ */ jsx(WelcomeGuide, {})
47
- ]
48
- }
49
- ) }) }) });
18
+ const { createErrorNotice } = useDispatch(store);
19
+ function onPluginAreaError(name) {
20
+ createErrorNotice(sprintf(__("The \"%s\" plugin has encountered an error and cannot be rendered."), name));
21
+ }
22
+ const navigateRegionsProps = __unstableUseNavigateRegions();
23
+ const adminPrimary = useMemo(() => getAdminThemeColors().primary, []);
24
+ return /* @__PURE__ */ jsx(ThemeProvider, {
25
+ isRoot: true,
26
+ color: { primary: adminPrimary },
27
+ children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx("div", {
28
+ ...navigateRegionsProps,
29
+ children: /* @__PURE__ */ jsxs(WidgetAreasBlockEditorProvider, {
30
+ blockEditorSettings,
31
+ children: [
32
+ /* @__PURE__ */ jsx(Interface, { blockEditorSettings }),
33
+ /* @__PURE__ */ jsx(Sidebar, {}),
34
+ /* @__PURE__ */ jsx(PluginArea, { onError: onPluginAreaError }),
35
+ /* @__PURE__ */ jsx(UnsavedChangesWarning, {}),
36
+ /* @__PURE__ */ jsx(WelcomeGuide, {})
37
+ ]
38
+ })
39
+ }) })
40
+ });
50
41
  }
51
- var layout_default = Layout;
52
- export {
53
- layout_default as default
54
- };
55
- //# sourceMappingURL=index.mjs.map
42
+ export { Layout as default };
43
+
44
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/layout/index.jsx"],
4
- "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"],
5
- "mappings": ";AAAA,SAAS,2BAA2B;AACpC,SAAS,IAAI,eAAe;AAC5B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,oBAAoB;AACtC,SAAS,gCAAgC,0BAA0B;AACnE,SAAS,qBAAqB;AAC9B,OAAO,mBAAmB;AAC1B,OAAO,oCAAoC;AAC3C,OAAO,aAAa;AACpB,OAAO,eAAe;AACtB,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AAwBpB,SAGC,KAHD;AAtBL,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;AAChD,QAAM,eAAe,QAAS,MAAM,oBAAoB,EAAE,SAAS,CAAC,CAAE;AAEtE,SACC,oBAAC,iBAAc,QAAM,MAAC,OAAQ,EAAE,SAAS,aAAa,GACrD,8BAAC,iBACA,8BAAC,SAAM,GAAG,sBACT;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACA;AAAA;AAAA,QACD;AAAA,QACA,oBAAC,WAAQ;AAAA,QACT,oBAAC,cAAW,SAAU,mBAAoB;AAAA,QAC1C,oBAAC,yBAAsB;AAAA,QACvB,oBAAC,gBAAa;AAAA;AAAA;AAAA,EACf,GACD,GACD,GACD;AAEF;AAEA,IAAO,iBAAQ;",
6
- "names": []
7
- }
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,94 +1,65 @@
1
- // packages/edit-widgets/src/components/layout/interface.jsx
2
1
  import { useViewportMatch } from "@wordpress/compose";
3
2
  import { BlockBreadcrumb } from "@wordpress/block-editor";
4
3
  import { useEffect } from "@wordpress/element";
5
4
  import { useDispatch, useSelect } from "@wordpress/data";
6
- import {
7
- InterfaceSkeleton,
8
- ComplementaryArea,
9
- store as interfaceStore
10
- } from "@wordpress/interface";
5
+ import { ComplementaryArea, InterfaceSkeleton, store } from "@wordpress/interface";
11
6
  import { __ } from "@wordpress/i18n";
12
- import { store as preferencesStore } from "@wordpress/preferences";
7
+ import { store as store$1 } from "@wordpress/preferences";
13
8
  import Header from "../header/index.mjs";
14
9
  import WidgetAreasBlockEditorContent from "../widget-areas-block-editor-content/index.mjs";
15
- import { store as editWidgetsStore } from "../../store/index.mjs";
10
+ import { store as store$2 } from "../../store/index.mjs";
16
11
  import SecondarySidebar from "../secondary-sidebar/index.mjs";
17
12
  import { Fragment, jsx } from "react/jsx-runtime";
18
- var interfaceLabels = {
19
- /* translators: accessibility text for the widgets screen top bar landmark region. */
20
- header: __("Widgets top bar"),
21
- /* translators: accessibility text for the widgets screen content landmark region. */
22
- body: __("Widgets and blocks"),
23
- /* translators: accessibility text for the widgets screen settings landmark region. */
24
- sidebar: __("Widgets settings"),
25
- /* translators: accessibility text for the widgets screen footer landmark region. */
26
- footer: __("Widgets footer")
13
+ // packages/edit-widgets/src/components/layout/interface.jsx
14
+ const interfaceLabels = {
15
+ header: __("Widgets top bar"),
16
+ body: __("Widgets and blocks"),
17
+ sidebar: __("Widgets settings"),
18
+ footer: __("Widgets footer")
27
19
  };
28
20
  function Interface({ blockEditorSettings }) {
29
- const isMobileViewport = useViewportMatch("medium", "<");
30
- const isHugeViewport = useViewportMatch("huge", ">=");
31
- const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } = useDispatch(editWidgetsStore);
32
- const {
33
- hasBlockBreadCrumbsEnabled,
34
- hasSidebarEnabled,
35
- isInserterOpened,
36
- isListViewOpened
37
- } = useSelect(
38
- (select) => ({
39
- hasSidebarEnabled: !!select(
40
- interfaceStore
41
- ).getActiveComplementaryArea(editWidgetsStore.name),
42
- isInserterOpened: !!select(editWidgetsStore).isInserterOpened(),
43
- isListViewOpened: !!select(editWidgetsStore).isListViewOpened(),
44
- hasBlockBreadCrumbsEnabled: !!select(preferencesStore).get(
45
- "core/edit-widgets",
46
- "showBlockBreadcrumbs"
47
- )
48
- }),
49
- []
50
- );
51
- useEffect(() => {
52
- if (hasSidebarEnabled && !isHugeViewport) {
53
- setIsInserterOpened(false);
54
- setIsListViewOpened(false);
55
- }
56
- }, [hasSidebarEnabled, isHugeViewport]);
57
- useEffect(() => {
58
- if ((isInserterOpened || isListViewOpened) && !isHugeViewport) {
59
- closeGeneralSidebar();
60
- }
61
- }, [isInserterOpened, isListViewOpened, isHugeViewport]);
62
- const secondarySidebarLabel = isListViewOpened ? __("List View") : __("Block Library");
63
- const hasSecondarySidebar = isListViewOpened || isInserterOpened;
64
- return /* @__PURE__ */ jsx(
65
- InterfaceSkeleton,
66
- {
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, { scope: "core/edit-widgets" }),
74
- content: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
75
- WidgetAreasBlockEditorContent,
76
- {
77
- blockEditorSettings
78
- }
79
- ) }),
80
- footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ jsx("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ jsx(
81
- BlockBreadcrumb,
82
- {
83
- className: "edit-widgets-layout__breadcrumbs",
84
- rootLabelText: __("Widgets")
85
- }
86
- ) })
87
- }
88
- );
21
+ const isMobileViewport = useViewportMatch("medium", "<");
22
+ const isHugeViewport = useViewportMatch("huge", ">=");
23
+ const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } = useDispatch(store$2);
24
+ const { hasBlockBreadCrumbsEnabled, hasSidebarEnabled, isInserterOpened, isListViewOpened } = useSelect((select) => ({
25
+ hasSidebarEnabled: !!select(store).getActiveComplementaryArea(store$2.name),
26
+ isInserterOpened: !!select(store$2).isInserterOpened(),
27
+ isListViewOpened: !!select(store$2).isListViewOpened(),
28
+ hasBlockBreadCrumbsEnabled: !!select(store$1).get("core/edit-widgets", "showBlockBreadcrumbs")
29
+ }), []);
30
+ useEffect(() => {
31
+ if (hasSidebarEnabled && !isHugeViewport) {
32
+ setIsInserterOpened(false);
33
+ setIsListViewOpened(false);
34
+ }
35
+ }, [hasSidebarEnabled, isHugeViewport]);
36
+ useEffect(() => {
37
+ if ((isInserterOpened || isListViewOpened) && !isHugeViewport) closeGeneralSidebar();
38
+ }, [
39
+ isInserterOpened,
40
+ isListViewOpened,
41
+ isHugeViewport
42
+ ]);
43
+ const secondarySidebarLabel = isListViewOpened ? __("List View") : __("Block Library");
44
+ const hasSecondarySidebar = isListViewOpened || isInserterOpened;
45
+ return /* @__PURE__ */ jsx(InterfaceSkeleton, {
46
+ labels: {
47
+ ...interfaceLabels,
48
+ secondarySidebar: secondarySidebarLabel
49
+ },
50
+ header: /* @__PURE__ */ jsx(Header, {}),
51
+ secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ jsx(SecondarySidebar, {}),
52
+ sidebar: /* @__PURE__ */ jsx(ComplementaryArea.Slot, { scope: "core/edit-widgets" }),
53
+ content: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(WidgetAreasBlockEditorContent, { blockEditorSettings }) }),
54
+ footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ jsx("div", {
55
+ className: "edit-widgets-layout__footer",
56
+ children: /* @__PURE__ */ jsx(BlockBreadcrumb, {
57
+ className: "edit-widgets-layout__breadcrumbs",
58
+ rootLabelText: __("Widgets")
59
+ })
60
+ })
61
+ });
89
62
  }
90
- var interface_default = Interface;
91
- export {
92
- interface_default as default
93
- };
94
- //# sourceMappingURL=interface.mjs.map
63
+ export { Interface as default };
64
+
65
+ //# sourceMappingURL=interface.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/layout/interface.jsx"],
4
- "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"],
5
- "mappings": ";AAAA,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;AAC1C,OAAO,YAAY;AACnB,OAAO,mCAAmC;AAC1C,SAAS,SAAS,wBAAwB;AAC1C,OAAO,sBAAsB;AAgEjB,SAIR,UAJQ;AA9DZ,IAAM,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;AAC7C,QAAM,mBAAmB,iBAAkB,UAAU,GAAI;AACzD,QAAM,iBAAiB,iBAAkB,QAAQ,IAAK;AACtD,QAAM,EAAE,qBAAqB,qBAAqB,oBAAoB,IACrE,YAAa,gBAAiB;AAC/B,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAAA,IACH,CAAE,YAAc;AAAA,MACf,mBAAmB,CAAC,CAAE;AAAA,QACrB;AAAA,MACD,EAAE,2BAA4B,iBAAiB,IAAK;AAAA,MACpD,kBAAkB,CAAC,CAAE,OAAQ,gBAAiB,EAAE,iBAAiB;AAAA,MACjE,kBAAkB,CAAC,CAAE,OAAQ,gBAAiB,EAAE,iBAAiB;AAAA,MACjE,4BAA4B,CAAC,CAAE,OAAQ,gBAAiB,EAAE;AAAA,QACzD;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC;AAAA,EACF;AAGA,YAAW,MAAM;AAChB,QAAK,qBAAqB,CAAE,gBAAiB;AAC5C,0BAAqB,KAAM;AAC3B,0BAAqB,KAAM;AAAA,IAC5B;AAAA,EACD,GAAG,CAAE,mBAAmB,cAAe,CAAE;AAEzC,YAAW,MAAM;AAChB,SAAO,oBAAoB,qBAAsB,CAAE,gBAAiB;AACnE,0BAAoB;AAAA,IACrB;AAAA,EACD,GAAG,CAAE,kBAAkB,kBAAkB,cAAe,CAAE;AAE1D,QAAM,wBAAwB,mBAC3B,GAAI,WAAY,IAChB,GAAI,eAAgB;AAEvB,QAAM,sBAAsB,oBAAoB;AAEhD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,QAAS;AAAA,QACR,GAAG;AAAA,QACH,kBAAkB;AAAA,MACnB;AAAA,MACA,QAAS,oBAAC,UAAO;AAAA,MACjB,kBAAmB,uBAAuB,oBAAC,oBAAiB;AAAA,MAC5D,SAAU,oBAAC,kBAAkB,MAAlB,EAAuB,OAAM,qBAAoB;AAAA,MAC5D,SACC,gCACC;AAAA,QAAC;AAAA;AAAA,UACA;AAAA;AAAA,MACD,GACD;AAAA,MAED,QACC,8BACA,CAAE,oBACD,oBAAC,SAAI,WAAU,+BACd;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,eAAgB,GAAI,SAAU;AAAA;AAAA,MAC/B,GACD;AAAA;AAAA,EAGH;AAEF;AAEA,IAAO,oBAAQ;",
6
- "names": []
7
- }
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,31 +1,42 @@
1
- // packages/edit-widgets/src/components/layout/unsaved-changes-warning.js
2
1
  import { __ } from "@wordpress/i18n";
3
2
  import { useEffect } from "@wordpress/element";
4
3
  import { useSelect } from "@wordpress/data";
5
- import { store as editWidgetsStore } from "../../store/index.mjs";
4
+ import { store } from "../../store/index.mjs";
5
+ // packages/edit-widgets/src/components/layout/unsaved-changes-warning.js
6
+ /**
7
+ * Warns the user if there are unsaved changes before leaving the editor.
8
+ *
9
+ * This is a duplicate of the component implemented in the editor package.
10
+ * Duplicated here as edit-widgets doesn't depend on editor.
11
+ *
12
+ * @return {Component} The component.
13
+ */
6
14
  function UnsavedChangesWarning() {
7
- const isDirty = useSelect((select) => {
8
- const { getEditedWidgetAreas } = select(editWidgetsStore);
9
- const editedWidgetAreas = getEditedWidgetAreas();
10
- return editedWidgetAreas?.length > 0;
11
- }, []);
12
- useEffect(() => {
13
- const warnIfUnsavedChanges = (event) => {
14
- if (isDirty) {
15
- event.returnValue = __(
16
- "You have unsaved changes. If you proceed, they will be lost."
17
- );
18
- return event.returnValue;
19
- }
20
- };
21
- window.addEventListener("beforeunload", warnIfUnsavedChanges);
22
- return () => {
23
- window.removeEventListener("beforeunload", warnIfUnsavedChanges);
24
- };
25
- }, [isDirty]);
26
- return null;
15
+ const isDirty = useSelect((select) => {
16
+ const { getEditedWidgetAreas } = select(store);
17
+ return getEditedWidgetAreas()?.length > 0;
18
+ }, []);
19
+ useEffect(() => {
20
+ /**
21
+ * Warns the user if there are unsaved changes before leaving the editor.
22
+ *
23
+ * @param {Event} event `beforeunload` event.
24
+ *
25
+ * @return {string | undefined} Warning prompt message, if unsaved changes exist.
26
+ */
27
+ const warnIfUnsavedChanges = (event) => {
28
+ if (isDirty) {
29
+ event.returnValue = __("You have unsaved changes. If you proceed, they will be lost.");
30
+ return event.returnValue;
31
+ }
32
+ };
33
+ window.addEventListener("beforeunload", warnIfUnsavedChanges);
34
+ return () => {
35
+ window.removeEventListener("beforeunload", warnIfUnsavedChanges);
36
+ };
37
+ }, [isDirty]);
38
+ return null;
27
39
  }
28
- export {
29
- UnsavedChangesWarning as default
30
- };
31
- //# sourceMappingURL=unsaved-changes-warning.mjs.map
40
+ export { UnsavedChangesWarning as default };
41
+
42
+ //# sourceMappingURL=unsaved-changes-warning.mjs.map