@wordpress/edit-post 8.32.0 → 8.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 (184) hide show
  1. package/build/commands/use-commands.js +54 -47
  2. package/build/commands/use-commands.js.map +7 -1
  3. package/build/components/back-button/fullscreen-mode-close.js +127 -118
  4. package/build/components/back-button/fullscreen-mode-close.js.map +7 -1
  5. package/build/components/back-button/index.js +56 -54
  6. package/build/components/back-button/index.js.map +7 -1
  7. package/build/components/browser-url/index.js +45 -44
  8. package/build/components/browser-url/index.js.map +7 -1
  9. package/build/components/editor-initialization/index.js +24 -18
  10. package/build/components/editor-initialization/index.js.map +7 -1
  11. package/build/components/editor-initialization/listener-hooks.js +42 -43
  12. package/build/components/editor-initialization/listener-hooks.js.map +7 -1
  13. package/build/components/init-pattern-modal/index.js +100 -79
  14. package/build/components/init-pattern-modal/index.js.map +7 -1
  15. package/build/components/keyboard-shortcuts/index.js +37 -33
  16. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  17. package/build/components/layout/index.js +447 -467
  18. package/build/components/layout/index.js.map +7 -1
  19. package/build/components/layout/use-padding-appender.js +66 -59
  20. package/build/components/layout/use-padding-appender.js.map +7 -1
  21. package/build/components/layout/use-should-iframe.js +36 -30
  22. package/build/components/layout/use-should-iframe.js.map +7 -1
  23. package/build/components/meta-boxes/index.js +46 -33
  24. package/build/components/meta-boxes/index.js.map +7 -1
  25. package/build/components/meta-boxes/meta-box-visibility.js +37 -22
  26. package/build/components/meta-boxes/meta-box-visibility.js.map +7 -1
  27. package/build/components/meta-boxes/meta-boxes-area/index.js +62 -53
  28. package/build/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  29. package/build/components/meta-boxes/use-meta-box-initialization.js +37 -32
  30. package/build/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  31. package/build/components/more-menu/index.js +64 -44
  32. package/build/components/more-menu/index.js.map +7 -1
  33. package/build/components/more-menu/manage-patterns-menu-item.js +39 -37
  34. package/build/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  35. package/build/components/more-menu/welcome-guide-menu-item.js +39 -21
  36. package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  37. package/build/components/preferences-modal/enable-custom-fields.js +76 -66
  38. package/build/components/preferences-modal/enable-custom-fields.js.map +7 -1
  39. package/build/components/preferences-modal/enable-panel.js +47 -43
  40. package/build/components/preferences-modal/enable-panel.js.map +7 -1
  41. package/build/components/preferences-modal/index.js +51 -39
  42. package/build/components/preferences-modal/index.js.map +7 -1
  43. package/build/components/preferences-modal/meta-boxes-section.js +65 -52
  44. package/build/components/preferences-modal/meta-boxes-section.js.map +7 -1
  45. package/build/components/welcome-guide/default.js +134 -97
  46. package/build/components/welcome-guide/default.js.map +7 -1
  47. package/build/components/welcome-guide/image.js +34 -23
  48. package/build/components/welcome-guide/image.js.map +7 -1
  49. package/build/components/welcome-guide/index.js +51 -38
  50. package/build/components/welcome-guide/index.js.map +7 -1
  51. package/build/components/welcome-guide/template.js +65 -45
  52. package/build/components/welcome-guide/template.js.map +7 -1
  53. package/build/deprecated.js +84 -110
  54. package/build/deprecated.js.map +7 -1
  55. package/build/hooks/use-navigate-to-entity-record.js +60 -78
  56. package/build/hooks/use-navigate-to-entity-record.js.map +7 -1
  57. package/build/index.js +101 -136
  58. package/build/index.js.map +7 -1
  59. package/build/lock-unlock.js +31 -15
  60. package/build/lock-unlock.js.map +7 -1
  61. package/build/store/actions.js +239 -431
  62. package/build/store/actions.js.map +7 -1
  63. package/build/store/constants.js +33 -26
  64. package/build/store/constants.js.map +7 -1
  65. package/build/store/index.js +44 -32
  66. package/build/store/index.js.map +7 -1
  67. package/build/store/reducer.js +50 -57
  68. package/build/store/reducer.js.map +7 -1
  69. package/build/store/selectors.js +288 -459
  70. package/build/store/selectors.js.map +7 -1
  71. package/build/utils/meta-boxes.js +31 -19
  72. package/build/utils/meta-boxes.js.map +7 -1
  73. package/build-module/commands/use-commands.js +35 -40
  74. package/build-module/commands/use-commands.js.map +7 -1
  75. package/build-module/components/back-button/fullscreen-mode-close.js +102 -110
  76. package/build-module/components/back-button/fullscreen-mode-close.js.map +7 -1
  77. package/build-module/components/back-button/index.js +28 -47
  78. package/build-module/components/back-button/index.js.map +7 -1
  79. package/build-module/components/browser-url/index.js +23 -38
  80. package/build-module/components/browser-url/index.js.map +7 -1
  81. package/build-module/components/editor-initialization/index.js +6 -13
  82. package/build-module/components/editor-initialization/index.js.map +7 -1
  83. package/build-module/components/editor-initialization/listener-hooks.js +20 -34
  84. package/build-module/components/editor-initialization/listener-hooks.js.map +7 -1
  85. package/build-module/components/init-pattern-modal/index.js +90 -74
  86. package/build-module/components/init-pattern-modal/index.js.map +7 -1
  87. package/build-module/components/keyboard-shortcuts/index.js +21 -26
  88. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  89. package/build-module/components/layout/index.js +439 -448
  90. package/build-module/components/layout/index.js.map +7 -1
  91. package/build-module/components/layout/use-padding-appender.js +44 -54
  92. package/build-module/components/layout/use-padding-appender.js.map +7 -1
  93. package/build-module/components/layout/use-should-iframe.js +15 -25
  94. package/build-module/components/layout/use-should-iframe.js.map +7 -1
  95. package/build-module/components/meta-boxes/index.js +18 -26
  96. package/build-module/components/meta-boxes/index.js.map +7 -1
  97. package/build-module/components/meta-boxes/meta-box-visibility.js +18 -15
  98. package/build-module/components/meta-boxes/meta-box-visibility.js.map +7 -1
  99. package/build-module/components/meta-boxes/meta-boxes-area/index.js +30 -44
  100. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  101. package/build-module/components/meta-boxes/use-meta-box-initialization.js +14 -25
  102. package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  103. package/build-module/components/more-menu/index.js +36 -37
  104. package/build-module/components/more-menu/index.js.map +7 -1
  105. package/build-module/components/more-menu/manage-patterns-menu-item.js +21 -31
  106. package/build-module/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  107. package/build-module/components/more-menu/welcome-guide-menu-item.js +22 -16
  108. package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  109. package/build-module/components/preferences-modal/enable-custom-fields.js +51 -56
  110. package/build-module/components/preferences-modal/enable-custom-fields.js.map +7 -1
  111. package/build-module/components/preferences-modal/enable-panel.js +30 -38
  112. package/build-module/components/preferences-modal/enable-panel.js.map +7 -1
  113. package/build-module/components/preferences-modal/index.js +24 -34
  114. package/build-module/components/preferences-modal/index.js.map +7 -1
  115. package/build-module/components/preferences-modal/meta-boxes-section.js +34 -45
  116. package/build-module/components/preferences-modal/meta-boxes-section.js.map +7 -1
  117. package/build-module/components/welcome-guide/default.js +107 -91
  118. package/build-module/components/welcome-guide/default.js.map +7 -1
  119. package/build-module/components/welcome-guide/image.js +16 -18
  120. package/build-module/components/welcome-guide/image.js.map +7 -1
  121. package/build-module/components/welcome-guide/index.js +23 -31
  122. package/build-module/components/welcome-guide/index.js.map +7 -1
  123. package/build-module/components/welcome-guide/template.js +38 -39
  124. package/build-module/components/welcome-guide/template.js.map +7 -1
  125. package/build-module/deprecated.js +62 -103
  126. package/build-module/deprecated.js.map +7 -1
  127. package/build-module/hooks/use-navigate-to-entity-record.js +42 -73
  128. package/build-module/hooks/use-navigate-to-entity-record.js.map +7 -1
  129. package/build-module/index.js +70 -95
  130. package/build-module/index.js.map +7 -1
  131. package/build-module/lock-unlock.js +8 -7
  132. package/build-module/lock-unlock.js.map +7 -1
  133. package/build-module/store/actions.js +158 -368
  134. package/build-module/store/actions.js.map +7 -1
  135. package/build-module/store/constants.js +9 -21
  136. package/build-module/store/constants.js.map +7 -1
  137. package/build-module/store/index.js +10 -22
  138. package/build-module/store/index.js.map +7 -1
  139. package/build-module/store/reducer.js +28 -51
  140. package/build-module/store/reducer.js.map +7 -1
  141. package/build-module/store/selectors.js +232 -442
  142. package/build-module/store/selectors.js.map +7 -1
  143. package/build-module/utils/meta-boxes.js +9 -13
  144. package/build-module/utils/meta-boxes.js.map +7 -1
  145. package/build-style/classic-rtl.css +0 -154
  146. package/build-style/classic.css +0 -154
  147. package/build-style/style-rtl.css +135 -110
  148. package/build-style/style.css +135 -110
  149. package/package.json +39 -31
  150. package/src/classic.scss +3 -0
  151. package/src/components/back-button/style.scss +3 -0
  152. package/src/components/layout/index.js +3 -2
  153. package/src/components/layout/style.scss +4 -0
  154. package/src/components/meta-boxes/meta-boxes-area/style.scss +3 -0
  155. package/src/components/welcome-guide/style.scss +3 -0
  156. package/src/style.scss +8 -4
  157. package/build/components/header/header-toolbar/index.native.js +0 -204
  158. package/build/components/header/header-toolbar/index.native.js.map +0 -1
  159. package/build/components/header/index.native.js +0 -59
  160. package/build/components/header/index.native.js.map +0 -1
  161. package/build/components/layout/index.native.js +0 -166
  162. package/build/components/layout/index.native.js.map +0 -1
  163. package/build/components/visual-editor/header.native.js +0 -63
  164. package/build/components/visual-editor/header.native.js.map +0 -1
  165. package/build/components/visual-editor/index.native.js +0 -44
  166. package/build/components/visual-editor/index.native.js.map +0 -1
  167. package/build/editor.native.js +0 -157
  168. package/build/editor.native.js.map +0 -1
  169. package/build/index.native.js +0 -58
  170. package/build/index.native.js.map +0 -1
  171. package/build-module/components/header/header-toolbar/index.native.js +0 -196
  172. package/build-module/components/header/header-toolbar/index.native.js.map +0 -1
  173. package/build-module/components/header/index.native.js +0 -50
  174. package/build-module/components/header/index.native.js.map +0 -1
  175. package/build-module/components/layout/index.native.js +0 -158
  176. package/build-module/components/layout/index.native.js.map +0 -1
  177. package/build-module/components/visual-editor/header.native.js +0 -56
  178. package/build-module/components/visual-editor/header.native.js.map +0 -1
  179. package/build-module/components/visual-editor/index.native.js +0 -35
  180. package/build-module/components/visual-editor/index.native.js.map +0 -1
  181. package/build-module/editor.native.js +0 -149
  182. package/build-module/editor.native.js.map +0 -1
  183. package/build-module/index.native.js +0 -45
  184. package/build-module/index.native.js.map +0 -1
@@ -1,109 +1,49 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSelector, createRegistrySelector } from '@wordpress/data';
5
- import { store as preferencesStore } from '@wordpress/preferences';
6
- import { store as coreStore } from '@wordpress/core-data';
7
- import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
8
- import deprecated from '@wordpress/deprecated';
9
-
10
- /**
11
- * Internal dependencies
12
- */
13
- import { unlock } from '../lock-unlock';
14
- const {
15
- interfaceStore
16
- } = unlock(editorPrivateApis);
1
+ import { createSelector, createRegistrySelector } from "@wordpress/data";
2
+ import { store as preferencesStore } from "@wordpress/preferences";
3
+ import { store as coreStore } from "@wordpress/core-data";
4
+ import {
5
+ store as editorStore,
6
+ privateApis as editorPrivateApis
7
+ } from "@wordpress/editor";
8
+ import deprecated from "@wordpress/deprecated";
9
+ import { unlock } from "../lock-unlock";
10
+ const { interfaceStore } = unlock(editorPrivateApis);
17
11
  const EMPTY_ARRAY = [];
18
12
  const EMPTY_OBJECT = {};
19
-
20
- /**
21
- * Returns the current editing mode.
22
- *
23
- * @param {Object} state Global application state.
24
- *
25
- * @return {string} Editing mode.
26
- */
27
- export const getEditorMode = createRegistrySelector(select => () => {
28
- var _select$get;
29
- return (_select$get = select(preferencesStore).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
30
- });
31
-
32
- /**
33
- * Returns true if the editor sidebar is opened.
34
- *
35
- * @param {Object} state Global application state
36
- *
37
- * @return {boolean} Whether the editor sidebar is opened.
38
- */
39
- export const isEditorSidebarOpened = createRegistrySelector(select => () => {
40
- const activeGeneralSidebar = select(interfaceStore).getActiveComplementaryArea('core');
41
- return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
42
- });
43
-
44
- /**
45
- * Returns true if the plugin sidebar is opened.
46
- *
47
- * @param {Object} state Global application state.
48
- *
49
- * @return {boolean} Whether the plugin sidebar is opened.
50
- */
51
- export const isPluginSidebarOpened = createRegistrySelector(select => () => {
52
- const activeGeneralSidebar = select(interfaceStore).getActiveComplementaryArea('core');
53
- return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar);
54
- });
55
-
56
- /**
57
- * Returns the current active general sidebar name, or null if there is no
58
- * general sidebar active. The active general sidebar is a unique name to
59
- * identify either an editor or plugin sidebar.
60
- *
61
- * Examples:
62
- *
63
- * - `edit-post/document`
64
- * - `my-plugin/insert-image-sidebar`
65
- *
66
- * @param {Object} state Global application state.
67
- *
68
- * @return {?string} Active general sidebar name.
69
- */
70
- export const getActiveGeneralSidebarName = createRegistrySelector(select => () => {
71
- return select(interfaceStore).getActiveComplementaryArea('core');
72
- });
73
-
74
- /**
75
- * Converts panels from the new preferences store format to the old format
76
- * that the post editor previously used.
77
- *
78
- * The resultant converted data should look like this:
79
- * {
80
- * panelName: {
81
- * enabled: false,
82
- * opened: true,
83
- * },
84
- * anotherPanelName: {
85
- * opened: true
86
- * },
87
- * }
88
- *
89
- * @param {string[] | undefined} inactivePanels An array of inactive panel names.
90
- * @param {string[] | undefined} openPanels An array of open panel names.
91
- *
92
- * @return {Object} The converted panel data.
93
- */
13
+ const getEditorMode = createRegistrySelector(
14
+ (select) => () => select(preferencesStore).get("core", "editorMode") ?? "visual"
15
+ );
16
+ const isEditorSidebarOpened = createRegistrySelector(
17
+ (select) => () => {
18
+ const activeGeneralSidebar = select(interfaceStore).getActiveComplementaryArea("core");
19
+ return ["edit-post/document", "edit-post/block"].includes(
20
+ activeGeneralSidebar
21
+ );
22
+ }
23
+ );
24
+ const isPluginSidebarOpened = createRegistrySelector(
25
+ (select) => () => {
26
+ const activeGeneralSidebar = select(interfaceStore).getActiveComplementaryArea("core");
27
+ return !!activeGeneralSidebar && !["edit-post/document", "edit-post/block"].includes(
28
+ activeGeneralSidebar
29
+ );
30
+ }
31
+ );
32
+ const getActiveGeneralSidebarName = createRegistrySelector(
33
+ (select) => () => {
34
+ return select(interfaceStore).getActiveComplementaryArea("core");
35
+ }
36
+ );
94
37
  function convertPanelsToOldFormat(inactivePanels, openPanels) {
95
- var _ref;
96
- // First reduce the inactive panels.
97
- const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({
98
- ...accumulatedPanels,
99
- [panelName]: {
100
- enabled: false
101
- }
102
- }), {});
103
-
104
- // Then reduce the open panels, passing in the result of the previous
105
- // reduction as the initial value so that both open and inactive
106
- // panel state is combined.
38
+ const panelsWithEnabledState = inactivePanels?.reduce(
39
+ (accumulatedPanels, panelName) => ({
40
+ ...accumulatedPanels,
41
+ [panelName]: {
42
+ enabled: false
43
+ }
44
+ }),
45
+ {}
46
+ );
107
47
  const panels = openPanels?.reduce((accumulatedPanels, panelName) => {
108
48
  const currentPanelState = accumulatedPanels?.[panelName];
109
49
  return {
@@ -113,385 +53,235 @@ function convertPanelsToOldFormat(inactivePanels, openPanels) {
113
53
  opened: true
114
54
  }
115
55
  };
116
- }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {});
117
-
118
- // The panels variable will only be set if openPanels wasn't `undefined`.
119
- // If it isn't set just return `panelsWithEnabledState`, and if that isn't
120
- // set return an empty object.
121
- return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT;
56
+ }, panelsWithEnabledState ?? {});
57
+ return panels ?? panelsWithEnabledState ?? EMPTY_OBJECT;
122
58
  }
123
-
124
- /**
125
- * Returns the preferences (these preferences are persisted locally).
126
- *
127
- * @param {Object} state Global application state.
128
- *
129
- * @return {Object} Preferences Object.
130
- */
131
- export const getPreferences = createRegistrySelector(select => () => {
59
+ const getPreferences = createRegistrySelector((select) => () => {
132
60
  deprecated(`select( 'core/edit-post' ).getPreferences`, {
133
- since: '6.0',
61
+ since: "6.0",
134
62
  alternative: `select( 'core/preferences' ).get`
135
63
  });
136
- const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => {
137
- const value = select(preferencesStore).get('core', preferenceKey);
138
- return {
139
- ...accumulatedPrefs,
140
- [preferenceKey]: value
141
- };
142
- }, {});
143
-
144
- // Panels were a preference, but the data structure changed when the state
145
- // was migrated to the preferences store. They need to be converted from
146
- // the new preferences store format to old format to ensure no breaking
147
- // changes for plugins.
148
- const inactivePanels = select(preferencesStore).get('core', 'inactivePanels');
149
- const openPanels = select(preferencesStore).get('core', 'openPanels');
64
+ const corePreferences = ["editorMode", "hiddenBlockTypes"].reduce(
65
+ (accumulatedPrefs, preferenceKey) => {
66
+ const value = select(preferencesStore).get(
67
+ "core",
68
+ preferenceKey
69
+ );
70
+ return {
71
+ ...accumulatedPrefs,
72
+ [preferenceKey]: value
73
+ };
74
+ },
75
+ {}
76
+ );
77
+ const inactivePanels = select(preferencesStore).get(
78
+ "core",
79
+ "inactivePanels"
80
+ );
81
+ const openPanels = select(preferencesStore).get("core", "openPanels");
150
82
  const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
151
83
  return {
152
84
  ...corePreferences,
153
85
  panels
154
86
  };
155
87
  });
156
-
157
- /**
158
- *
159
- * @param {Object} state Global application state.
160
- * @param {string} preferenceKey Preference Key.
161
- * @param {*} defaultValue Default Value.
162
- *
163
- * @return {*} Preference Value.
164
- */
165
- export function getPreference(state, preferenceKey, defaultValue) {
88
+ function getPreference(state, preferenceKey, defaultValue) {
166
89
  deprecated(`select( 'core/edit-post' ).getPreference`, {
167
- since: '6.0',
90
+ since: "6.0",
168
91
  alternative: `select( 'core/preferences' ).get`
169
92
  });
170
-
171
- // Avoid using the `getPreferences` registry selector where possible.
172
93
  const preferences = getPreferences(state);
173
94
  const value = preferences[preferenceKey];
174
- return value === undefined ? defaultValue : value;
95
+ return value === void 0 ? defaultValue : value;
175
96
  }
176
-
177
- /**
178
- * Returns an array of blocks that are hidden.
179
- *
180
- * @return {Array} A list of the hidden block types
181
- */
182
- export const getHiddenBlockTypes = createRegistrySelector(select => () => {
183
- var _select$get2;
184
- return (_select$get2 = select(preferencesStore).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
185
- });
186
-
187
- /**
188
- * Returns true if the publish sidebar is opened.
189
- *
190
- * @deprecated
191
- *
192
- * @param {Object} state Global application state
193
- *
194
- * @return {boolean} Whether the publish sidebar is open.
195
- */
196
- export const isPublishSidebarOpened = createRegistrySelector(select => () => {
197
- deprecated(`select( 'core/edit-post' ).isPublishSidebarOpened`, {
198
- since: '6.6',
199
- alternative: `select( 'core/editor' ).isPublishSidebarOpened`
200
- });
201
- return select(editorStore).isPublishSidebarOpened();
202
- });
203
-
204
- /**
205
- * Returns true if the given panel was programmatically removed, or false otherwise.
206
- * All panels are not removed by default.
207
- *
208
- * @deprecated
209
- *
210
- * @param {Object} state Global application state.
211
- * @param {string} panelName A string that identifies the panel.
212
- *
213
- * @return {boolean} Whether or not the panel is removed.
214
- */
215
- export const isEditorPanelRemoved = createRegistrySelector(select => (state, panelName) => {
216
- deprecated(`select( 'core/edit-post' ).isEditorPanelRemoved`, {
217
- since: '6.5',
218
- alternative: `select( 'core/editor' ).isEditorPanelRemoved`
219
- });
220
- return select(editorStore).isEditorPanelRemoved(panelName);
221
- });
222
-
223
- /**
224
- * Returns true if the given panel is enabled, or false otherwise. Panels are
225
- * enabled by default.
226
- *
227
- * @deprecated
228
- *
229
- * @param {Object} state Global application state.
230
- * @param {string} panelName A string that identifies the panel.
231
- *
232
- * @return {boolean} Whether or not the panel is enabled.
233
- */
234
- export const isEditorPanelEnabled = createRegistrySelector(select => (state, panelName) => {
235
- deprecated(`select( 'core/edit-post' ).isEditorPanelEnabled`, {
236
- since: '6.5',
237
- alternative: `select( 'core/editor' ).isEditorPanelEnabled`
238
- });
239
- return select(editorStore).isEditorPanelEnabled(panelName);
240
- });
241
-
242
- /**
243
- * Returns true if the given panel is open, or false otherwise. Panels are
244
- * closed by default.
245
- *
246
- * @deprecated
247
- *
248
- * @param {Object} state Global application state.
249
- * @param {string} panelName A string that identifies the panel.
250
- *
251
- * @return {boolean} Whether or not the panel is open.
252
- */
253
- export const isEditorPanelOpened = createRegistrySelector(select => (state, panelName) => {
254
- deprecated(`select( 'core/edit-post' ).isEditorPanelOpened`, {
255
- since: '6.5',
256
- alternative: `select( 'core/editor' ).isEditorPanelOpened`
257
- });
258
- return select(editorStore).isEditorPanelOpened(panelName);
259
- });
260
-
261
- /**
262
- * Returns true if a modal is active, or false otherwise.
263
- *
264
- * @deprecated since WP 6.3 use `core/interface` store's selector with the same name instead.
265
- *
266
- * @param {Object} state Global application state.
267
- * @param {string} modalName A string that uniquely identifies the modal.
268
- *
269
- * @return {boolean} Whether the modal is active.
270
- */
271
- export const isModalActive = createRegistrySelector(select => (state, modalName) => {
272
- deprecated(`select( 'core/edit-post' ).isModalActive`, {
273
- since: '6.3',
274
- alternative: `select( 'core/interface' ).isModalActive`
275
- });
276
- return !!select(interfaceStore).isModalActive(modalName);
97
+ const getHiddenBlockTypes = createRegistrySelector((select) => () => {
98
+ return select(preferencesStore).get("core", "hiddenBlockTypes") ?? EMPTY_ARRAY;
277
99
  });
278
-
279
- /**
280
- * Returns whether the given feature is enabled or not.
281
- *
282
- * @param {Object} state Global application state.
283
- * @param {string} feature Feature slug.
284
- *
285
- * @return {boolean} Is active.
286
- */
287
- export const isFeatureActive = createRegistrySelector(select => (state, feature) => {
288
- return !!select(preferencesStore).get('core/edit-post', feature);
289
- });
290
-
291
- /**
292
- * Returns true if the plugin item is pinned to the header.
293
- * When the value is not set it defaults to true.
294
- *
295
- * @param {Object} state Global application state.
296
- * @param {string} pluginName Plugin item name.
297
- *
298
- * @return {boolean} Whether the plugin item is pinned.
299
- */
300
- export const isPluginItemPinned = createRegistrySelector(select => (state, pluginName) => {
301
- return select(interfaceStore).isItemPinned('core', pluginName);
302
- });
303
-
304
- /**
305
- * Returns an array of active meta box locations.
306
- *
307
- * @param {Object} state Post editor state.
308
- *
309
- * @return {string[]} Active meta box locations.
310
- */
311
- export const getActiveMetaBoxLocations = createSelector(state => {
312
- return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location));
313
- }, state => [state.metaBoxes.locations]);
314
-
315
- /**
316
- * Returns true if a metabox location is active and visible
317
- *
318
- * @param {Object} state Post editor state.
319
- * @param {string} location Meta box location to test.
320
- *
321
- * @return {boolean} Whether the meta box location is active and visible.
322
- */
323
- export const isMetaBoxLocationVisible = createRegistrySelector(select => (state, location) => {
324
- return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({
325
- id
326
- }) => {
327
- return select(editorStore).isEditorPanelEnabled(`meta-box-${id}`);
328
- });
329
- });
330
-
331
- /**
332
- * Returns true if there is an active meta box in the given location, or false
333
- * otherwise.
334
- *
335
- * @param {Object} state Post editor state.
336
- * @param {string} location Meta box location to test.
337
- *
338
- * @return {boolean} Whether the meta box location is active.
339
- */
340
- export function isMetaBoxLocationActive(state, location) {
100
+ const isPublishSidebarOpened = createRegistrySelector(
101
+ (select) => () => {
102
+ deprecated(`select( 'core/edit-post' ).isPublishSidebarOpened`, {
103
+ since: "6.6",
104
+ alternative: `select( 'core/editor' ).isPublishSidebarOpened`
105
+ });
106
+ return select(editorStore).isPublishSidebarOpened();
107
+ }
108
+ );
109
+ const isEditorPanelRemoved = createRegistrySelector(
110
+ (select) => (state, panelName) => {
111
+ deprecated(`select( 'core/edit-post' ).isEditorPanelRemoved`, {
112
+ since: "6.5",
113
+ alternative: `select( 'core/editor' ).isEditorPanelRemoved`
114
+ });
115
+ return select(editorStore).isEditorPanelRemoved(panelName);
116
+ }
117
+ );
118
+ const isEditorPanelEnabled = createRegistrySelector(
119
+ (select) => (state, panelName) => {
120
+ deprecated(`select( 'core/edit-post' ).isEditorPanelEnabled`, {
121
+ since: "6.5",
122
+ alternative: `select( 'core/editor' ).isEditorPanelEnabled`
123
+ });
124
+ return select(editorStore).isEditorPanelEnabled(panelName);
125
+ }
126
+ );
127
+ const isEditorPanelOpened = createRegistrySelector(
128
+ (select) => (state, panelName) => {
129
+ deprecated(`select( 'core/edit-post' ).isEditorPanelOpened`, {
130
+ since: "6.5",
131
+ alternative: `select( 'core/editor' ).isEditorPanelOpened`
132
+ });
133
+ return select(editorStore).isEditorPanelOpened(panelName);
134
+ }
135
+ );
136
+ const isModalActive = createRegistrySelector(
137
+ (select) => (state, modalName) => {
138
+ deprecated(`select( 'core/edit-post' ).isModalActive`, {
139
+ since: "6.3",
140
+ alternative: `select( 'core/interface' ).isModalActive`
141
+ });
142
+ return !!select(interfaceStore).isModalActive(modalName);
143
+ }
144
+ );
145
+ const isFeatureActive = createRegistrySelector(
146
+ (select) => (state, feature) => {
147
+ return !!select(preferencesStore).get("core/edit-post", feature);
148
+ }
149
+ );
150
+ const isPluginItemPinned = createRegistrySelector(
151
+ (select) => (state, pluginName) => {
152
+ return select(interfaceStore).isItemPinned("core", pluginName);
153
+ }
154
+ );
155
+ const getActiveMetaBoxLocations = createSelector(
156
+ (state) => {
157
+ return Object.keys(state.metaBoxes.locations).filter(
158
+ (location) => isMetaBoxLocationActive(state, location)
159
+ );
160
+ },
161
+ (state) => [state.metaBoxes.locations]
162
+ );
163
+ const isMetaBoxLocationVisible = createRegistrySelector(
164
+ (select) => (state, location) => {
165
+ return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => {
166
+ return select(editorStore).isEditorPanelEnabled(
167
+ `meta-box-${id}`
168
+ );
169
+ });
170
+ }
171
+ );
172
+ function isMetaBoxLocationActive(state, location) {
341
173
  const metaBoxes = getMetaBoxesPerLocation(state, location);
342
174
  return !!metaBoxes && metaBoxes.length !== 0;
343
175
  }
344
-
345
- /**
346
- * Returns the list of all the available meta boxes for a given location.
347
- *
348
- * @param {Object} state Global application state.
349
- * @param {string} location Meta box location to test.
350
- *
351
- * @return {?Array} List of meta boxes.
352
- */
353
- export function getMetaBoxesPerLocation(state, location) {
176
+ function getMetaBoxesPerLocation(state, location) {
354
177
  return state.metaBoxes.locations[location];
355
178
  }
356
-
357
- /**
358
- * Returns the list of all the available meta boxes.
359
- *
360
- * @param {Object} state Global application state.
361
- *
362
- * @return {Array} List of meta boxes.
363
- */
364
- export const getAllMetaBoxes = createSelector(state => {
365
- return Object.values(state.metaBoxes.locations).flat();
366
- }, state => [state.metaBoxes.locations]);
367
-
368
- /**
369
- * Returns true if the post is using Meta Boxes
370
- *
371
- * @param {Object} state Global application state
372
- *
373
- * @return {boolean} Whether there are metaboxes or not.
374
- */
375
- export function hasMetaBoxes(state) {
179
+ const getAllMetaBoxes = createSelector(
180
+ (state) => {
181
+ return Object.values(state.metaBoxes.locations).flat();
182
+ },
183
+ (state) => [state.metaBoxes.locations]
184
+ );
185
+ function hasMetaBoxes(state) {
376
186
  return getActiveMetaBoxLocations(state).length > 0;
377
187
  }
378
-
379
- /**
380
- * Returns true if the Meta Boxes are being saved.
381
- *
382
- * @param {Object} state Global application state.
383
- *
384
- * @return {boolean} Whether the metaboxes are being saved.
385
- */
386
- export function isSavingMetaBoxes(state) {
188
+ function isSavingMetaBoxes(state) {
387
189
  return state.metaBoxes.isSaving;
388
190
  }
389
-
390
- /**
391
- * Returns the current editing canvas device type.
392
- *
393
- * @deprecated
394
- *
395
- * @param {Object} state Global application state.
396
- *
397
- * @return {string} Device type.
398
- */
399
- export const __experimentalGetPreviewDeviceType = createRegistrySelector(select => () => {
400
- deprecated(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, {
401
- since: '6.5',
402
- version: '6.7',
403
- alternative: `select( 'core/editor' ).getDeviceType`
404
- });
405
- return select(editorStore).getDeviceType();
406
- });
407
-
408
- /**
409
- * Returns true if the inserter is opened.
410
- *
411
- * @deprecated
412
- *
413
- * @param {Object} state Global application state.
414
- *
415
- * @return {boolean} Whether the inserter is opened.
416
- */
417
- export const isInserterOpened = createRegistrySelector(select => () => {
191
+ const __experimentalGetPreviewDeviceType = createRegistrySelector(
192
+ (select) => () => {
193
+ deprecated(
194
+ `select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,
195
+ {
196
+ since: "6.5",
197
+ version: "6.7",
198
+ alternative: `select( 'core/editor' ).getDeviceType`
199
+ }
200
+ );
201
+ return select(editorStore).getDeviceType();
202
+ }
203
+ );
204
+ const isInserterOpened = createRegistrySelector((select) => () => {
418
205
  deprecated(`select( 'core/edit-post' ).isInserterOpened`, {
419
- since: '6.5',
206
+ since: "6.5",
420
207
  alternative: `select( 'core/editor' ).isInserterOpened`
421
208
  });
422
209
  return select(editorStore).isInserterOpened();
423
210
  });
424
-
425
- /**
426
- * Get the insertion point for the inserter.
427
- *
428
- * @deprecated
429
- *
430
- * @param {Object} state Global application state.
431
- *
432
- * @return {Object} The root client ID, index to insert at and starting filter value.
433
- */
434
- export const __experimentalGetInsertionPoint = createRegistrySelector(select => () => {
435
- deprecated(`select( 'core/edit-post' ).__experimentalGetInsertionPoint`, {
436
- since: '6.5',
437
- version: '6.7'
438
- });
439
- return unlock(select(editorStore)).getInserter();
440
- });
441
-
442
- /**
443
- * Returns true if the list view is opened.
444
- *
445
- * @param {Object} state Global application state.
446
- *
447
- * @return {boolean} Whether the list view is opened.
448
- */
449
- export const isListViewOpened = createRegistrySelector(select => () => {
211
+ const __experimentalGetInsertionPoint = createRegistrySelector(
212
+ (select) => () => {
213
+ deprecated(
214
+ `select( 'core/edit-post' ).__experimentalGetInsertionPoint`,
215
+ {
216
+ since: "6.5",
217
+ version: "6.7"
218
+ }
219
+ );
220
+ return unlock(select(editorStore)).getInserter();
221
+ }
222
+ );
223
+ const isListViewOpened = createRegistrySelector((select) => () => {
450
224
  deprecated(`select( 'core/edit-post' ).isListViewOpened`, {
451
- since: '6.5',
225
+ since: "6.5",
452
226
  alternative: `select( 'core/editor' ).isListViewOpened`
453
227
  });
454
228
  return select(editorStore).isListViewOpened();
455
229
  });
456
-
457
- /**
458
- * Returns true if the template editing mode is enabled.
459
- *
460
- * @deprecated
461
- */
462
- export const isEditingTemplate = createRegistrySelector(select => () => {
230
+ const isEditingTemplate = createRegistrySelector((select) => () => {
463
231
  deprecated(`select( 'core/edit-post' ).isEditingTemplate`, {
464
- since: '6.5',
232
+ since: "6.5",
465
233
  alternative: `select( 'core/editor' ).getRenderingMode`
466
234
  });
467
- return select(editorStore).getCurrentPostType() === 'wp_template';
235
+ return select(editorStore).getCurrentPostType() === "wp_template";
468
236
  });
469
-
470
- /**
471
- * Returns true if meta boxes are initialized.
472
- *
473
- * @param {Object} state Global application state.
474
- *
475
- * @return {boolean} Whether meta boxes are initialized.
476
- */
477
- export function areMetaBoxesInitialized(state) {
237
+ function areMetaBoxesInitialized(state) {
478
238
  return state.metaBoxes.initialized;
479
239
  }
480
-
481
- /**
482
- * Retrieves the template of the currently edited post.
483
- *
484
- * @return {?Object} Post Template.
485
- */
486
- export const getEditedPostTemplate = createRegistrySelector(select => () => {
487
- const {
488
- id: postId,
489
- type: postType
490
- } = select(editorStore).getCurrentPost();
491
- const templateId = unlock(select(coreStore)).getTemplateId(postType, postId);
492
- if (!templateId) {
493
- return undefined;
240
+ const getEditedPostTemplate = createRegistrySelector(
241
+ (select) => () => {
242
+ const { id: postId, type: postType } = select(editorStore).getCurrentPost();
243
+ const templateId = unlock(select(coreStore)).getTemplateId(
244
+ postType,
245
+ postId
246
+ );
247
+ if (!templateId) {
248
+ return void 0;
249
+ }
250
+ return select(coreStore).getEditedEntityRecord(
251
+ "postType",
252
+ "wp_template",
253
+ templateId
254
+ );
494
255
  }
495
- return select(coreStore).getEditedEntityRecord('postType', 'wp_template', templateId);
496
- });
497
- //# sourceMappingURL=selectors.js.map
256
+ );
257
+ export {
258
+ __experimentalGetInsertionPoint,
259
+ __experimentalGetPreviewDeviceType,
260
+ areMetaBoxesInitialized,
261
+ getActiveGeneralSidebarName,
262
+ getActiveMetaBoxLocations,
263
+ getAllMetaBoxes,
264
+ getEditedPostTemplate,
265
+ getEditorMode,
266
+ getHiddenBlockTypes,
267
+ getMetaBoxesPerLocation,
268
+ getPreference,
269
+ getPreferences,
270
+ hasMetaBoxes,
271
+ isEditingTemplate,
272
+ isEditorPanelEnabled,
273
+ isEditorPanelOpened,
274
+ isEditorPanelRemoved,
275
+ isEditorSidebarOpened,
276
+ isFeatureActive,
277
+ isInserterOpened,
278
+ isListViewOpened,
279
+ isMetaBoxLocationActive,
280
+ isMetaBoxLocationVisible,
281
+ isModalActive,
282
+ isPluginItemPinned,
283
+ isPluginSidebarOpened,
284
+ isPublishSidebarOpened,
285
+ isSavingMetaBoxes
286
+ };
287
+ //# sourceMappingURL=selectors.js.map