@wordpress/interface 5.15.0 → 5.17.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 (102) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/action-item/index.js +6 -14
  3. package/build/components/action-item/index.js.map +1 -1
  4. package/build/components/complementary-area/index.js +9 -28
  5. package/build/components/complementary-area/index.js.map +1 -1
  6. package/build/components/complementary-area-context/index.js +0 -3
  7. package/build/components/complementary-area-context/index.js.map +1 -1
  8. package/build/components/complementary-area-header/index.js +1 -7
  9. package/build/components/complementary-area-header/index.js.map +1 -1
  10. package/build/components/complementary-area-more-menu-item/index.js +3 -9
  11. package/build/components/complementary-area-more-menu-item/index.js.map +1 -1
  12. package/build/components/complementary-area-toggle/index.js +2 -10
  13. package/build/components/complementary-area-toggle/index.js.map +1 -1
  14. package/build/components/fullscreen-mode/index.js +3 -7
  15. package/build/components/fullscreen-mode/index.js.map +1 -1
  16. package/build/components/index.js +0 -14
  17. package/build/components/index.js.map +1 -1
  18. package/build/components/index.native.js +0 -3
  19. package/build/components/index.native.js.map +1 -1
  20. package/build/components/interface-skeleton/index.js +8 -22
  21. package/build/components/interface-skeleton/index.js.map +1 -1
  22. package/build/components/more-menu-dropdown/index.js +1 -8
  23. package/build/components/more-menu-dropdown/index.js.map +1 -1
  24. package/build/components/more-menu-feature-toggle/index.js +2 -11
  25. package/build/components/more-menu-feature-toggle/index.js.map +1 -1
  26. package/build/components/navigable-region/index.js +1 -4
  27. package/build/components/navigable-region/index.js.map +1 -1
  28. package/build/components/pinned-items/index.js +1 -7
  29. package/build/components/pinned-items/index.js.map +1 -1
  30. package/build/components/preferences-modal/index.js +1 -4
  31. package/build/components/preferences-modal/index.js.map +1 -1
  32. package/build/components/preferences-modal-base-option/index.js +1 -4
  33. package/build/components/preferences-modal-base-option/index.js.map +1 -1
  34. package/build/components/preferences-modal-section/index.js +0 -3
  35. package/build/components/preferences-modal-section/index.js.map +1 -1
  36. package/build/components/preferences-modal-tabs/index.js +6 -15
  37. package/build/components/preferences-modal-tabs/index.js.map +1 -1
  38. package/build/index.js +0 -3
  39. package/build/index.js.map +1 -1
  40. package/build/store/actions.js +15 -37
  41. package/build/store/actions.js.map +1 -1
  42. package/build/store/constants.js +0 -1
  43. package/build/store/constants.js.map +1 -1
  44. package/build/store/index.js +3 -11
  45. package/build/store/index.js.map +1 -1
  46. package/build/store/reducer.js +8 -14
  47. package/build/store/reducer.js.map +1 -1
  48. package/build/store/selectors.js +8 -15
  49. package/build/store/selectors.js.map +1 -1
  50. package/build-module/components/action-item/index.js +5 -10
  51. package/build-module/components/action-item/index.js.map +1 -1
  52. package/build-module/components/complementary-area/index.js +10 -17
  53. package/build-module/components/complementary-area/index.js.map +1 -1
  54. package/build-module/components/complementary-area-context/index.js.map +1 -1
  55. package/build-module/components/complementary-area-header/index.js +2 -5
  56. package/build-module/components/complementary-area-header/index.js.map +1 -1
  57. package/build-module/components/complementary-area-more-menu-item/index.js +3 -5
  58. package/build-module/components/complementary-area-more-menu-item/index.js.map +1 -1
  59. package/build-module/components/complementary-area-toggle/index.js +2 -5
  60. package/build-module/components/complementary-area-toggle/index.js.map +1 -1
  61. package/build-module/components/fullscreen-mode/index.js +2 -6
  62. package/build-module/components/fullscreen-mode/index.js.map +1 -1
  63. package/build-module/components/index.js.map +1 -1
  64. package/build-module/components/index.native.js.map +1 -1
  65. package/build-module/components/interface-skeleton/index.js +9 -17
  66. package/build-module/components/interface-skeleton/index.js.map +1 -1
  67. package/build-module/components/more-menu-dropdown/index.js +1 -3
  68. package/build-module/components/more-menu-dropdown/index.js.map +1 -1
  69. package/build-module/components/more-menu-feature-toggle/index.js +2 -5
  70. package/build-module/components/more-menu-feature-toggle/index.js.map +1 -1
  71. package/build-module/components/navigable-region/index.js +0 -1
  72. package/build-module/components/navigable-region/index.js.map +1 -1
  73. package/build-module/components/pinned-items/index.js +1 -5
  74. package/build-module/components/pinned-items/index.js.map +1 -1
  75. package/build-module/components/preferences-modal/index.js +0 -1
  76. package/build-module/components/preferences-modal/index.js.map +1 -1
  77. package/build-module/components/preferences-modal-base-option/index.js +0 -3
  78. package/build-module/components/preferences-modal-base-option/index.js.map +1 -1
  79. package/build-module/components/preferences-modal-section/index.js +0 -2
  80. package/build-module/components/preferences-modal-section/index.js.map +1 -1
  81. package/build-module/components/preferences-modal-tabs/index.js +5 -9
  82. package/build-module/components/preferences-modal-tabs/index.js.map +1 -1
  83. package/build-module/index.js.map +1 -1
  84. package/build-module/store/actions.js +16 -20
  85. package/build-module/store/actions.js.map +1 -1
  86. package/build-module/store/constants.js.map +1 -1
  87. package/build-module/store/index.js +5 -4
  88. package/build-module/store/index.js.map +1 -1
  89. package/build-module/store/reducer.js +7 -9
  90. package/build-module/store/reducer.js.map +1 -1
  91. package/build-module/store/selectors.js +9 -10
  92. package/build-module/store/selectors.js.map +1 -1
  93. package/build-style/style-rtl.css +14 -8
  94. package/build-style/style.css +14 -8
  95. package/package.json +13 -13
  96. package/src/components/complementary-area/README.md +1 -1
  97. package/src/components/complementary-area/index.js +18 -2
  98. package/src/components/complementary-area-toggle/index.js +1 -1
  99. package/src/components/interface-skeleton/index.js +2 -0
  100. package/src/components/interface-skeleton/style.scss +6 -0
  101. package/src/components/more-menu-feature-toggle/index.js +1 -1
  102. package/src/components/pinned-items/style.scss +12 -10
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -13,11 +12,8 @@ exports.setFeatureDefaults = setFeatureDefaults;
13
12
  exports.setFeatureValue = setFeatureValue;
14
13
  exports.toggleFeature = toggleFeature;
15
14
  exports.unpinItem = void 0;
16
-
17
15
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
18
-
19
16
  var _preferences = require("@wordpress/preferences");
20
-
21
17
  /**
22
18
  * WordPress dependencies
23
19
  */
@@ -35,16 +31,14 @@ const setDefaultComplementaryArea = (scope, area) => ({
35
31
  scope,
36
32
  area
37
33
  });
34
+
38
35
  /**
39
36
  * Enable the complementary area.
40
37
  *
41
38
  * @param {string} scope Complementary area scope.
42
39
  * @param {string} area Area identifier.
43
40
  */
44
-
45
-
46
41
  exports.setDefaultComplementaryArea = setDefaultComplementaryArea;
47
-
48
42
  const enableComplementaryArea = (scope, area) => ({
49
43
  registry,
50
44
  dispatch
@@ -53,37 +47,32 @@ const enableComplementaryArea = (scope, area) => ({
53
47
  if (!area) {
54
48
  return;
55
49
  }
56
-
57
50
  const isComplementaryAreaVisible = registry.select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
58
-
59
51
  if (!isComplementaryAreaVisible) {
60
52
  registry.dispatch(_preferences.store).set(scope, 'isComplementaryAreaVisible', true);
61
53
  }
62
-
63
54
  dispatch({
64
55
  type: 'ENABLE_COMPLEMENTARY_AREA',
65
56
  scope,
66
57
  area
67
58
  });
68
59
  };
60
+
69
61
  /**
70
62
  * Disable the complementary area.
71
63
  *
72
64
  * @param {string} scope Complementary area scope.
73
65
  */
74
-
75
-
76
66
  exports.enableComplementaryArea = enableComplementaryArea;
77
-
78
67
  const disableComplementaryArea = scope => ({
79
68
  registry
80
69
  }) => {
81
70
  const isComplementaryAreaVisible = registry.select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
82
-
83
71
  if (isComplementaryAreaVisible) {
84
72
  registry.dispatch(_preferences.store).set(scope, 'isComplementaryAreaVisible', false);
85
73
  }
86
74
  };
75
+
87
76
  /**
88
77
  * Pins an item.
89
78
  *
@@ -92,10 +81,7 @@ const disableComplementaryArea = scope => ({
92
81
  *
93
82
  * @return {Object} Action object.
94
83
  */
95
-
96
-
97
84
  exports.disableComplementaryArea = disableComplementaryArea;
98
-
99
85
  const pinItem = (scope, item) => ({
100
86
  registry
101
87
  }) => {
@@ -103,27 +89,25 @@ const pinItem = (scope, item) => ({
103
89
  if (!item) {
104
90
  return;
105
91
  }
92
+ const pinnedItems = registry.select(_preferences.store).get(scope, 'pinnedItems');
106
93
 
107
- const pinnedItems = registry.select(_preferences.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
108
-
94
+ // The item is already pinned, there's nothing to do.
109
95
  if (pinnedItems?.[item] === true) {
110
96
  return;
111
97
  }
112
-
113
- registry.dispatch(_preferences.store).set(scope, 'pinnedItems', { ...pinnedItems,
98
+ registry.dispatch(_preferences.store).set(scope, 'pinnedItems', {
99
+ ...pinnedItems,
114
100
  [item]: true
115
101
  });
116
102
  };
103
+
117
104
  /**
118
105
  * Unpins an item.
119
106
  *
120
107
  * @param {string} scope Item scope.
121
108
  * @param {string} item Item identifier.
122
109
  */
123
-
124
-
125
110
  exports.pinItem = pinItem;
126
-
127
111
  const unpinItem = (scope, item) => ({
128
112
  registry
129
113
  }) => {
@@ -131,22 +115,20 @@ const unpinItem = (scope, item) => ({
131
115
  if (!item) {
132
116
  return;
133
117
  }
134
-
135
118
  const pinnedItems = registry.select(_preferences.store).get(scope, 'pinnedItems');
136
- registry.dispatch(_preferences.store).set(scope, 'pinnedItems', { ...pinnedItems,
119
+ registry.dispatch(_preferences.store).set(scope, 'pinnedItems', {
120
+ ...pinnedItems,
137
121
  [item]: false
138
122
  });
139
123
  };
124
+
140
125
  /**
141
126
  * Returns an action object used in signalling that a feature should be toggled.
142
127
  *
143
128
  * @param {string} scope The feature scope (e.g. core/edit-post).
144
129
  * @param {string} featureName The feature name.
145
130
  */
146
-
147
-
148
131
  exports.unpinItem = unpinItem;
149
-
150
132
  function toggleFeature(scope, featureName) {
151
133
  return function ({
152
134
  registry
@@ -158,6 +140,7 @@ function toggleFeature(scope, featureName) {
158
140
  registry.dispatch(_preferences.store).toggle(scope, featureName);
159
141
  };
160
142
  }
143
+
161
144
  /**
162
145
  * Returns an action object used in signalling that a feature should be set to
163
146
  * a true or false value
@@ -168,8 +151,6 @@ function toggleFeature(scope, featureName) {
168
151
  *
169
152
  * @return {Object} Action object.
170
153
  */
171
-
172
-
173
154
  function setFeatureValue(scope, featureName, value) {
174
155
  return function ({
175
156
  registry
@@ -181,6 +162,7 @@ function setFeatureValue(scope, featureName, value) {
181
162
  registry.dispatch(_preferences.store).set(scope, featureName, !!value);
182
163
  };
183
164
  }
165
+
184
166
  /**
185
167
  * Returns an action object used in signalling that defaults should be set for features.
186
168
  *
@@ -189,8 +171,6 @@ function setFeatureValue(scope, featureName, value) {
189
171
  *
190
172
  * @return {Object} Action object.
191
173
  */
192
-
193
-
194
174
  function setFeatureDefaults(scope, defaults) {
195
175
  return function ({
196
176
  registry
@@ -202,6 +182,7 @@ function setFeatureDefaults(scope, defaults) {
202
182
  registry.dispatch(_preferences.store).setDefaults(scope, defaults);
203
183
  };
204
184
  }
185
+
205
186
  /**
206
187
  * Returns an action object used in signalling that the user opened a modal.
207
188
  *
@@ -209,21 +190,18 @@ function setFeatureDefaults(scope, defaults) {
209
190
  *
210
191
  * @return {Object} Action object.
211
192
  */
212
-
213
-
214
193
  function openModal(name) {
215
194
  return {
216
195
  type: 'OPEN_MODAL',
217
196
  name
218
197
  };
219
198
  }
199
+
220
200
  /**
221
201
  * Returns an action object signalling that the user closed a modal.
222
202
  *
223
203
  * @return {Object} Action object.
224
204
  */
225
-
226
-
227
205
  function closeModal() {
228
206
  return {
229
207
  type: 'CLOSE_MODAL'
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setDefaultComplementaryArea","scope","area","type","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","preferencesStore","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults","openModal","name","closeModal"],"mappings":";;;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,2BAA2B,GAAG,CAAEC,KAAF,EAASC,IAAT,M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ACA;;;AACO,SAASI,eAAT,CAA0BrB,KAA1B,EAAiCiB,WAAjC,EAA8CK,KAA9C,EAAsD;AAC5D,SAAO,UAAW;AAAElB,IAAAA;AAAF,GAAX,EAA0B;AAChC,6BAAa,8CAAb,EAA4D;AAC3Dc,MAAAA,KAAK,EAAE,KADoD;AAE3DC,MAAAA,WAAW,EAAG;AAF6C,KAA5D;AAKAf,IAAAA,QAAQ,CACNC,QADF,CACYG,kBADZ,EAEEE,GAFF,CAEOV,KAFP,EAEciB,WAFd,EAE2B,CAAC,CAAEK,KAF9B;AAGA,GATD;AAUA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAA6BvB,KAA7B,EAAoCwB,QAApC,EAA+C;AACrD,SAAO,UAAW;AAAEpB,IAAAA;AAAF,GAAX,EAA0B;AAChC,6BAAa,iDAAb,EAA+D;AAC9Dc,MAAAA,KAAK,EAAE,KADuD;AAE9DC,MAAAA,WAAW,EAAG;AAFgD,KAA/D;AAKAf,IAAAA,QAAQ,CAACC,QAAT,CAAmBG,kBAAnB,EAAsCiB,WAAtC,CAAmDzB,KAAnD,EAA0DwB,QAA1D;AACA,GAPD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,SAAT,CAAoBC,IAApB,EAA2B;AACjC,SAAO;AACNzB,IAAAA,IAAI,EAAE,YADA;AAENyB,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;;;AACO,SAASC,UAAT,GAAsB;AAC5B,SAAO;AACN1B,IAAAA,IAAI,EAAE;AADA,GAAP;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Set a default complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport const setDefaultComplementaryArea = ( scope, area ) => ( {\n\ttype: 'SET_DEFAULT_COMPLEMENTARY_AREA',\n\tscope,\n\tarea,\n} );\n\n/**\n * Enable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n */\nexport const enableComplementaryArea =\n\t( scope, area ) =>\n\t( { registry, dispatch } ) => {\n\t\t// Return early if there's no area.\n\t\tif ( ! area ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( ! isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', true );\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'ENABLE_COMPLEMENTARY_AREA',\n\t\t\tscope,\n\t\t\tarea,\n\t\t} );\n\t};\n\n/**\n * Disable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n */\nexport const disableComplementaryArea =\n\t( scope ) =>\n\t( { registry } ) => {\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', false );\n\t\t}\n\t};\n\n/**\n * Pins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nexport const pinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\t// The item is already pinned, there's nothing to do.\n\t\tif ( pinnedItems?.[ item ] === true ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: true,\n\t\t} );\n\t};\n\n/**\n * Unpins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n */\nexport const unpinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: false,\n\t\t} );\n\t};\n\n/**\n * Returns an action object used in signalling that a feature should be toggled.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n */\nexport function toggleFeature( scope, featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).toggleFeature`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).toggle`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).toggle( scope, featureName );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureValue`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).set`,\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( scope, featureName, !! value );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureDefaults`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).setDefaults`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).setDefaults( scope, defaults );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n"]}
1
+ {"version":3,"names":["_deprecated","_interopRequireDefault","require","_preferences","setDefaultComplementaryArea","scope","area","type","exports","enableComplementaryArea","registry","dispatch","isComplementaryAreaVisible","select","preferencesStore","get","set","disableComplementaryArea","pinItem","item","pinnedItems","unpinItem","toggleFeature","featureName","deprecated","since","alternative","toggle","setFeatureValue","value","setFeatureDefaults","defaults","setDefaults","openModal","name","closeModal"],"sources":["@wordpress/interface/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Set a default complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport const setDefaultComplementaryArea = ( scope, area ) => ( {\n\ttype: 'SET_DEFAULT_COMPLEMENTARY_AREA',\n\tscope,\n\tarea,\n} );\n\n/**\n * Enable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n */\nexport const enableComplementaryArea =\n\t( scope, area ) =>\n\t( { registry, dispatch } ) => {\n\t\t// Return early if there's no area.\n\t\tif ( ! area ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( ! isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', true );\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'ENABLE_COMPLEMENTARY_AREA',\n\t\t\tscope,\n\t\t\tarea,\n\t\t} );\n\t};\n\n/**\n * Disable the complementary area.\n *\n * @param {string} scope Complementary area scope.\n */\nexport const disableComplementaryArea =\n\t( scope ) =>\n\t( { registry } ) => {\n\t\tconst isComplementaryAreaVisible = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'isComplementaryAreaVisible' );\n\n\t\tif ( isComplementaryAreaVisible ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( scope, 'isComplementaryAreaVisible', false );\n\t\t}\n\t};\n\n/**\n * Pins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nexport const pinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\t// The item is already pinned, there's nothing to do.\n\t\tif ( pinnedItems?.[ item ] === true ) {\n\t\t\treturn;\n\t\t}\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: true,\n\t\t} );\n\t};\n\n/**\n * Unpins an item.\n *\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n */\nexport const unpinItem =\n\t( scope, item ) =>\n\t( { registry } ) => {\n\t\t// Return early if there's no item.\n\t\tif ( ! item ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst pinnedItems = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( scope, 'pinnedItems' );\n\n\t\tregistry.dispatch( preferencesStore ).set( scope, 'pinnedItems', {\n\t\t\t...pinnedItems,\n\t\t\t[ item ]: false,\n\t\t} );\n\t};\n\n/**\n * Returns an action object used in signalling that a feature should be toggled.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n */\nexport function toggleFeature( scope, featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).toggleFeature`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).toggle`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).toggle( scope, featureName );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureValue`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).set`,\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.set( scope, featureName, !! value );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( `dispatch( 'core/interface' ).setFeatureDefaults`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `dispatch( 'core/preferences' ).setDefaults`,\n\t\t} );\n\n\t\tregistry.dispatch( preferencesStore ).setDefaults( scope, defaults );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport function openModal( name ) {\n\treturn {\n\t\ttype: 'OPEN_MODAL',\n\t\tname,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @return {Object} Action object.\n */\nexport function closeModal() {\n\treturn {\n\t\ttype: 'CLOSE_MODAL',\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,2BAA2B,GAAGA,CAAEC,KAAK,EAAEC,IAAI,MAAQ;EAC/DC,IAAI,EAAE,gCAAgC;EACtCF,KAAK;EACLC;AACD,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACA;AALAE,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA;AAMO,MAAMK,uBAAuB,GACnCA,CAAEJ,KAAK,EAAEC,IAAI,KACb,CAAE;EAAEI,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B;EACA,IAAK,CAAEL,IAAI,EAAG;IACb;EACD;EAEA,MAAMM,0BAA0B,GAAGF,QAAQ,CACzCG,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAEV,KAAK,EAAE,4BAA6B,CAAC;EAE5C,IAAK,CAAEO,0BAA0B,EAAG;IACnCF,QAAQ,CACNC,QAAQ,CAAEG,kBAAiB,CAAC,CAC5BE,GAAG,CAAEX,KAAK,EAAE,4BAA4B,EAAE,IAAK,CAAC;EACnD;EAEAM,QAAQ,CAAE;IACTJ,IAAI,EAAE,2BAA2B;IACjCF,KAAK;IACLC;EACD,CAAE,CAAC;AACJ,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAE,OAAA,CAAAC,uBAAA,GAAAA,uBAAA;AAKO,MAAMQ,wBAAwB,GAClCZ,KAAK,IACP,CAAE;EAAEK;AAAS,CAAC,KAAM;EACnB,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;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,SAASA,CAAEC,IAAI,EAAG;EACjC,OAAO;IACN3B,IAAI,EAAE,YAAY;IAClB2B;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAAA,EAAG;EAC5B,OAAO;IACN5B,IAAI,EAAE;EACP,CAAC;AACF"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.STORE_NAME = void 0;
7
-
8
7
  /**
9
8
  * The identifier for the data store.
10
9
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/constants.js"],"names":["STORE_NAME"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,gBAAnB","sourcesContent":["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/interface';\n"]}
1
+ {"version":3,"names":["STORE_NAME","exports"],"sources":["@wordpress/interface/src/store/constants.js"],"sourcesContent":["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/interface';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,gBAAgB;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -1,26 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.store = void 0;
9
-
10
8
  var _data = require("@wordpress/data");
11
-
12
9
  var actions = _interopRequireWildcard(require("./actions"));
13
-
14
10
  var selectors = _interopRequireWildcard(require("./selectors"));
15
-
16
11
  var _reducer = _interopRequireDefault(require("./reducer"));
17
-
18
12
  var _constants = require("./constants");
19
-
20
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
15
  /**
25
16
  * WordPress dependencies
26
17
  */
@@ -40,9 +31,10 @@ const store = (0, _data.createReduxStore)(_constants.STORE_NAME, {
40
31
  reducer: _reducer.default,
41
32
  actions,
42
33
  selectors
43
- }); // Once we build a more generic persistence plugin that works across types of stores
44
- // we'd be able to replace this with a register call.
34
+ });
45
35
 
36
+ // Once we build a more generic persistence plugin that works across types of stores
37
+ // we'd be able to replace this with a register call.
46
38
  exports.store = store;
47
39
  (0, _data.register)(store);
48
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["store","STORE_NAME","reducer","actions","selectors"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG,4BAAkBC,qBAAlB,EAA8B;AAClDC,EAAAA,OAAO,EAAPA,gBADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA;AAHkD,CAA9B,CAAd,C,CAMP;AACA;;;AACA,oBAAUJ,KAAV","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport reducer from './reducer';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregister( store );\n"]}
1
+ {"version":3,"names":["_data","require","actions","_interopRequireWildcard","selectors","_reducer","_interopRequireDefault","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","store","createReduxStore","STORE_NAME","reducer","exports","register"],"sources":["@wordpress/interface/src/store/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport reducer from './reducer';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregister( store );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAD,uBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,G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KAAK,GAAG,IAAAC,sBAAgB,EAAEC,qBAAU,EAAE;EAClDC,OAAO,EAAPA,gBAAO;EACP/B,OAAO;EACPE;AACD,CAAE,CAAC;;AAEH;AACA;AAAA8B,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AACA,IAAAK,cAAQ,EAAEL,KAAM,CAAC"}
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.activeModal = activeModal;
7
7
  exports.complementaryAreas = complementaryAreas;
8
8
  exports.default = void 0;
9
-
10
9
  var _data = require("@wordpress/data");
11
-
12
10
  /**
13
11
  * WordPress dependencies
14
12
  */
13
+
15
14
  function complementaryAreas(state = {}, action) {
16
15
  switch (action.type) {
17
16
  case 'SET_DEFAULT_COMPLEMENTARY_AREA':
@@ -19,31 +18,32 @@ function complementaryAreas(state = {}, action) {
19
18
  const {
20
19
  scope,
21
20
  area
22
- } = action; // If there's already an area, don't overwrite it.
21
+ } = action;
23
22
 
23
+ // If there's already an area, don't overwrite it.
24
24
  if (state[scope]) {
25
25
  return state;
26
26
  }
27
-
28
- return { ...state,
27
+ return {
28
+ ...state,
29
29
  [scope]: area
30
30
  };
31
31
  }
32
-
33
32
  case 'ENABLE_COMPLEMENTARY_AREA':
34
33
  {
35
34
  const {
36
35
  scope,
37
36
  area
38
37
  } = action;
39
- return { ...state,
38
+ return {
39
+ ...state,
40
40
  [scope]: area
41
41
  };
42
42
  }
43
43
  }
44
-
45
44
  return state;
46
45
  }
46
+
47
47
  /**
48
48
  * Reducer for storing the name of the open modal, or null if no modal is open.
49
49
  *
@@ -52,24 +52,18 @@ function complementaryAreas(state = {}, action) {
52
52
  *
53
53
  * @return {Object} Updated state
54
54
  */
55
-
56
-
57
55
  function activeModal(state = null, action) {
58
56
  switch (action.type) {
59
57
  case 'OPEN_MODAL':
60
58
  return action.name;
61
-
62
59
  case 'CLOSE_MODAL':
63
60
  return null;
64
61
  }
65
-
66
62
  return state;
67
63
  }
68
-
69
64
  var _default = (0, _data.combineReducers)({
70
65
  complementaryAreas,
71
66
  activeModal
72
67
  });
73
-
74
68
  exports.default = _default;
75
69
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["complementaryAreas","state","action","type","scope","area","activeModal","name"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,SAASA,kBAAT,CAA6BC,KAAK,GAAG,EAArC,EAAyCC,MAAzC,EAAkD;AACxD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,gCAAL;AAAuC;AACtC,cAAM;AAAEC,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB,CADsC,CAGtC;;AACA,YAAKD,KAAK,CAAEG,KAAF,CAAV,EAAsB;AACrB,iBAAOH,KAAP;AACA;;AAED,eAAO,EACN,GAAGA,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;;AACD,SAAK,2BAAL;AAAkC;AACjC,cAAM;AAAED,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,MAAxB;AACA,eAAO,EACN,GAAGD,KADG;AAEN,WAAEG,KAAF,GAAWC;AAFL,SAAP;AAIA;AApBF;;AAuBA,SAAOJ,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,WAAT,CAAsBL,KAAK,GAAG,IAA9B,EAAoCC,MAApC,EAA6C;AACnD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,YAAL;AACC,aAAOD,MAAM,CAACK,IAAd;;AACD,SAAK,aAAL;AACC,aAAO,IAAP;AAJF;;AAOA,SAAON,KAAP;AACA;;eAEc,2BAAiB;AAC/BD,EAAAA,kBAD+B;AAE/BM,EAAAA;AAF+B,CAAjB,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function complementaryAreas( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"]}
1
+ {"version":3,"names":["_data","require","complementaryAreas","state","action","type","scope","area","activeModal","name","_default","combineReducers","exports","default"],"sources":["@wordpress/interface/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\nexport function complementaryAreas( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_DEFAULT_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\n\t\t\t// If there's already an area, don't overwrite it.\n\t\t\tif ( state[ scope ] ) {\n\t\t\t\treturn state;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t\tcase 'ENABLE_COMPLEMENTARY_AREA': {\n\t\t\tconst { scope, area } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: area,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer for storing the name of the open modal, or null if no modal is open.\n *\n * @param {Object} state Previous state.\n * @param {Object} action Action object containing the `name` of the modal\n *\n * @return {Object} Updated state\n */\nexport function activeModal( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'OPEN_MODAL':\n\t\t\treturn action.name;\n\t\tcase 'CLOSE_MODAL':\n\t\t\treturn null;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tcomplementaryAreas,\n\tactiveModal,\n} );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,SAASC,kBAAkBA,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EACxD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,gCAAgC;MAAE;QACtC,MAAM;UAAEC,KAAK;UAAEC;QAAK,CAAC,GAAGH,MAAM;;QAE9B;QACA,IAAKD,KAAK,CAAEG,KAAK,CAAE,EAAG;UACrB,OAAOH,KAAK;QACb;QAEA,OAAO;UACN,GAAGA,KAAK;UACR,CAAEG,KAAK,GAAIC;QACZ,CAAC;MACF;IACA,KAAK,2BAA2B;MAAE;QACjC,MAAM;UAAED,KAAK;UAAEC;QAAK,CAAC,GAAGH,MAAM;QAC9B,OAAO;UACN,GAAGD,KAAK;UACR,CAAEG,KAAK,GAAIC;QACZ,CAAC;MACF;EACD;EAEA,OAAOJ,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CAAEL,KAAK,GAAG,IAAI,EAAEC,MAAM,EAAG;EACnD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,YAAY;MAChB,OAAOD,MAAM,CAACK,IAAI;IACnB,KAAK,aAAa;MACjB,OAAO,IAAI;EACb;EAEA,OAAON,KAAK;AACb;AAAC,IAAAO,QAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BT,kBAAkB;EAClBM;AACD,CAAE,CAAC;AAAAI,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -1,19 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.isItemPinned = exports.isFeatureActive = exports.isComplementaryAreaLoading = exports.getActiveComplementaryArea = void 0;
9
8
  exports.isModalActive = isModalActive;
10
-
11
9
  var _data = require("@wordpress/data");
12
-
13
10
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
14
-
15
11
  var _preferences = require("@wordpress/preferences");
16
-
17
12
  /**
18
13
  * WordPress dependencies
19
14
  */
@@ -27,19 +22,19 @@ var _preferences = require("@wordpress/preferences");
27
22
  * @return {string | null | undefined} The complementary area that is active in the given scope.
28
23
  */
29
24
  const getActiveComplementaryArea = (0, _data.createRegistrySelector)(select => (state, scope) => {
30
- const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible'); // Return `undefined` to indicate that the user has never toggled
25
+ const isComplementaryAreaVisible = select(_preferences.store).get(scope, 'isComplementaryAreaVisible');
26
+
27
+ // Return `undefined` to indicate that the user has never toggled
31
28
  // visibility, this is the vanilla default. Other code relies on this
32
29
  // nuance in the return value.
33
-
34
30
  if (isComplementaryAreaVisible === undefined) {
35
31
  return undefined;
36
- } // Return `null` to indicate the user hid the complementary area.
37
-
32
+ }
38
33
 
34
+ // Return `null` to indicate the user hid the complementary area.
39
35
  if (isComplementaryAreaVisible === false) {
40
36
  return null;
41
37
  }
42
-
43
38
  return state?.complementaryAreas?.[scope];
44
39
  });
45
40
  exports.getActiveComplementaryArea = getActiveComplementaryArea;
@@ -48,6 +43,7 @@ const isComplementaryAreaLoading = (0, _data.createRegistrySelector)(select => (
48
43
  const identifier = state?.complementaryAreas?.[scope];
49
44
  return isVisible && identifier === undefined;
50
45
  });
46
+
51
47
  /**
52
48
  * Returns a boolean indicating if an item is pinned or not.
53
49
  *
@@ -57,14 +53,13 @@ const isComplementaryAreaLoading = (0, _data.createRegistrySelector)(select => (
57
53
  *
58
54
  * @return {boolean} True if the item is pinned and false otherwise.
59
55
  */
60
-
61
56
  exports.isComplementaryAreaLoading = isComplementaryAreaLoading;
62
57
  const isItemPinned = (0, _data.createRegistrySelector)(select => (state, scope, item) => {
63
58
  var _pinnedItems$item;
64
-
65
59
  const pinnedItems = select(_preferences.store).get(scope, 'pinnedItems');
66
60
  return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
67
61
  });
62
+
68
63
  /**
69
64
  * Returns a boolean indicating whether a feature is active for a particular
70
65
  * scope.
@@ -75,7 +70,6 @@ const isItemPinned = (0, _data.createRegistrySelector)(select => (state, scope,
75
70
  *
76
71
  * @return {boolean} Is the feature enabled?
77
72
  */
78
-
79
73
  exports.isItemPinned = isItemPinned;
80
74
  const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scope, featureName) => {
81
75
  (0, _deprecated.default)(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
@@ -84,6 +78,7 @@ const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scop
84
78
  });
85
79
  return !!select(_preferences.store).get(scope, featureName);
86
80
  });
81
+
87
82
  /**
88
83
  * Returns true if a modal is active, or false otherwise.
89
84
  *
@@ -92,9 +87,7 @@ const isFeatureActive = (0, _data.createRegistrySelector)(select => (state, scop
92
87
  *
93
88
  * @return {boolean} Whether the modal is active.
94
89
  */
95
-
96
90
  exports.isFeatureActive = isFeatureActive;
97
-
98
91
  function isModalActive(state, modalName) {
99
92
  return state.activeModal === modalName;
100
93
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getActiveComplementaryArea","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","pinnedItems","isFeatureActive","featureName","since","alternative","isModalActive","modalName","activeModal"],"mappings":";;;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,0BAA0B,GAAG,kCACvCC,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMC,0BAA0B,GAAGH,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAClCH,KADkC,EAElC,4BAFkC,CAAnC,CADiC,CAMjC;AACA;AACA;;AACA,MAAKC,0BAA0B,KAAKG,SAApC,EAAgD;AAC/C,WAAOA,SAAP;AACA,GAXgC,CAajC;;;AACA,MAAKH,0BAA0B,KAAK,KAApC,EAA4C;AAC3C,WAAO,IAAP;AACA;;AAED,SAAOF,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAP;AACA,CApBwC,CAAnC;;AAuBA,MAAMM,0BAA0B,GAAG,kCACvCR,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,KAAoB;AACjC,QAAMO,SAAS,GAAGT,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACjBH,KADiB,EAEjB,4BAFiB,CAAlB;AAIA,QAAMQ,UAAU,GAAGT,KAAK,EAAEM,kBAAP,GAA6BL,KAA7B,CAAnB;AAEA,SAAOO,SAAS,IAAIC,UAAU,KAAKJ,SAAnC;AACA,CATwC,CAAnC;AAYP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMK,YAAY,GAAG,kCACzBX,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBU,IAAhB,KAA0B;AAAA;;AACvC,QAAMC,WAAW,GAAGb,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CACnBH,KADmB,EAEnB,aAFmB,CAApB;AAIA,8BAAOW,WAAW,GAAID,IAAJ,CAAlB,iEAAgC,IAAhC;AACA,CAP0B,CAArB;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAME,eAAe,GAAG,kCAC5Bd,MAAF,IAAc,CAAEC,KAAF,EAASC,KAAT,EAAgBa,WAAhB,KAAiC;AAC9C,2BACE,kEADF,EAEC;AACCC,IAAAA,KAAK,EAAE,KADR;AAECC,IAAAA,WAAW,EAAG;AAFf,GAFD;AAQA,SAAO,CAAC,CAAEjB,MAAM,CAAEI,kBAAF,CAAN,CAA2BC,GAA3B,CAAgCH,KAAhC,EAAuCa,WAAvC,CAAV;AACA,CAX6B,CAAxB;AAcP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,aAAT,CAAwBjB,KAAxB,EAA+BkB,SAA/B,EAA2C;AACjD,SAAOlB,KAAK,CAACmB,WAAN,KAAsBD,SAA7B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string | null | undefined} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isComplementaryAreaVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\n\t\t// Return `undefined` to indicate that the user has never toggled\n\t\t// visibility, this is the vanilla default. Other code relies on this\n\t\t// nuance in the return value.\n\t\tif ( isComplementaryAreaVisible === undefined ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Return `null` to indicate the user hid the complementary area.\n\t\tif ( isComplementaryAreaVisible === false ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\n\t}\n);\n\nexport const isComplementaryAreaLoading = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\t\tconst identifier = state?.complementaryAreas?.[ scope ];\n\n\t\treturn isVisible && identifier === undefined;\n\t}\n);\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport const isItemPinned = createRegistrySelector(\n\t( select ) => ( state, scope, item ) => {\n\t\tconst pinnedItems = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'pinnedItems'\n\t\t);\n\t\treturn pinnedItems?.[ item ] ?? true;\n\t}\n);\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, scope, featureName ) => {\n\t\tdeprecated(\n\t\t\t`select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `select( 'core/preferences' ).get( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n"]}
1
+ {"version":3,"names":["_data","require","_deprecated","_interopRequireDefault","_preferences","getActiveComplementaryArea","createRegistrySelector","select","state","scope","isComplementaryAreaVisible","preferencesStore","get","undefined","complementaryAreas","exports","isComplementaryAreaLoading","isVisible","identifier","isItemPinned","item","_pinnedItems$item","pinnedItems","isFeatureActive","featureName","deprecated","since","alternative","isModalActive","modalName","activeModal"],"sources":["@wordpress/interface/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string | null | undefined} The complementary area that is active in the given scope.\n */\nexport const getActiveComplementaryArea = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isComplementaryAreaVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\n\t\t// Return `undefined` to indicate that the user has never toggled\n\t\t// visibility, this is the vanilla default. Other code relies on this\n\t\t// nuance in the return value.\n\t\tif ( isComplementaryAreaVisible === undefined ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Return `null` to indicate the user hid the complementary area.\n\t\tif ( isComplementaryAreaVisible === false ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn state?.complementaryAreas?.[ scope ];\n\t}\n);\n\nexport const isComplementaryAreaLoading = createRegistrySelector(\n\t( select ) => ( state, scope ) => {\n\t\tconst isVisible = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'isComplementaryAreaVisible'\n\t\t);\n\t\tconst identifier = state?.complementaryAreas?.[ scope ];\n\n\t\treturn isVisible && identifier === undefined;\n\t}\n);\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport const isItemPinned = createRegistrySelector(\n\t( select ) => ( state, scope, item ) => {\n\t\tconst pinnedItems = select( preferencesStore ).get(\n\t\t\tscope,\n\t\t\t'pinnedItems'\n\t\t);\n\t\treturn pinnedItems?.[ item ] ?? true;\n\t}\n);\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( state, scope, featureName ) => {\n\t\tdeprecated(\n\t\t\t`select( 'core/interface' ).isFeatureActive( scope, featureName )`,\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative: `select( 'core/preferences' ).get( scope, featureName )`,\n\t\t\t}\n\t\t);\n\n\t\treturn !! select( preferencesStore ).get( scope, featureName );\n\t}\n);\n\n/**\n * Returns true if a modal is active, or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} modalName A string that uniquely identifies the modal.\n *\n * @return {boolean} Whether the modal is active.\n */\nexport function isModalActive( state, modalName ) {\n\treturn state.activeModal === modalName;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,0BAA0B,GAAG,IAAAC,4BAAsB,EAC7DC,MAAM,IAAM,CAAEC,KAAK,EAAEC,KAAK,KAAM;EACjC,MAAMC,0BAA0B,GAAGH,MAAM,CAAEI,kBAAiB,CAAC,CAACC,GAAG,CAChEH,KAAK,EACL,4BACD,CAAC;;EAED;EACA;EACA;EACA,IAAKC,0BAA0B,KAAKG,SAAS,EAAG;IAC/C,OAAOA,SAAS;EACjB;;EAEA;EACA,IAAKH,0BAA0B,KAAK,KAAK,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,OAAOF,KAAK,EAAEM,kBAAkB,GAAIL,KAAK,CAAE;AAC5C,CACD,CAAC;AAACM,OAAA,CAAAV,0BAAA,GAAAA,0BAAA;AAEK,MAAMW,0BAA0B,GAAG,IAAAV,4BAAsB,EAC7DC,MAAM,IAAM,CAAEC,KAAK,EAAEC,KAAK,KAAM;EACjC,MAAMQ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}
@@ -1,13 +1,10 @@
1
1
  import { createElement } from "@wordpress/element";
2
-
3
2
  /**
4
3
  * WordPress dependencies
5
4
  */
6
5
  import { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';
7
6
  import { Children } from '@wordpress/element';
8
-
9
7
  const noop = () => {};
10
-
11
8
  function ActionItemSlot({
12
9
  name,
13
10
  as: Component = ButtonGroup,
@@ -22,13 +19,13 @@ function ActionItemSlot({
22
19
  }, fills => {
23
20
  if (!Children.toArray(fills).length) {
24
21
  return null;
25
- } // Special handling exists for backward compatibility.
22
+ }
23
+
24
+ // Special handling exists for backward compatibility.
26
25
  // It ensures that menu items created by plugin authors aren't
27
26
  // duplicated with automatically injected menu items coming
28
27
  // from pinnable plugin sidebars.
29
28
  // @see https://github.com/WordPress/gutenberg/issues/14457
30
-
31
-
32
29
  const initializedByPlugins = [];
33
30
  Children.forEach(fills, ({
34
31
  props: {
@@ -44,14 +41,13 @@ function ActionItemSlot({
44
41
  if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
45
42
  return null;
46
43
  }
47
-
48
44
  return child;
49
45
  });
50
- return createElement(Component, { ...props
46
+ return createElement(Component, {
47
+ ...props
51
48
  }, children);
52
49
  });
53
50
  }
54
-
55
51
  function ActionItem({
56
52
  name,
57
53
  as: Component = Button,
@@ -72,7 +68,6 @@ function ActionItem({
72
68
  });
73
69
  });
74
70
  }
75
-
76
71
  ActionItem.Slot = ActionItemSlot;
77
72
  export default ActionItem;
78
73
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/action-item/index.js"],"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","args","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,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SAASI,UAAT,CAAqB;AAAElB,EAAAA,IAAF;AAAQC,EAAAA,EAAE,EAAEC,SAAS,GAAGR,MAAxB;AAAgCyB,EAAAA,OAAhC;AAAyC,KAAGd;AAA5C,CAArB,EAA2E;AAC1E,SACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGL;AAAb,KACG,CAAE;AAAEmB,IAAAA,OAAO,EAAEC;AAAX,GAAF,KAA8B;AAC/B,WACC,cAAC,SAAD;AACC,MAAA,OAAO,EACND,OAAO,IAAIC,SAAX,GACG,CAAE,GAAGC,IAAL,KAAe;AACf,SAAEF,OAAO,IAAIrB,IAAb,EAAqB,GAAGuB,IAAxB;AACA,SAAED,SAAS,IAAItB,IAAf,EAAuB,GAAGuB,IAA1B;AACC,OAJJ,GAKGC,SAPL;AAAA,SASMjB;AATN,MADD;AAaA,GAfF,CADD;AAmBA;;AAEDa,UAAU,CAACvB,IAAX,GAAkBI,cAAlB;AAEA,eAAemB,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = ButtonGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"]}
1
+ {"version":3,"names":["ButtonGroup","Button","Slot","Fill","Children","noop","ActionItemSlot","name","as","Component","fillProps","bubblesVirtually","props","createElement","fills","toArray","length","initializedByPlugins","forEach","__unstableExplicitMenuItem","__unstableTarget","push","children","map","child","includes","ActionItem","onClick","fpOnClick","args","undefined"],"sources":["@wordpress/interface/src/components/action-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ButtonGroup, Button, Slot, Fill } from '@wordpress/components';\nimport { Children } from '@wordpress/element';\n\nconst noop = () => {};\n\nfunction ActionItemSlot( {\n\tname,\n\tas: Component = ButtonGroup,\n\tfillProps = {},\n\tbubblesVirtually,\n\t...props\n} ) {\n\treturn (\n\t\t<Slot\n\t\t\tname={ name }\n\t\t\tbubblesVirtually={ bubblesVirtually }\n\t\t\tfillProps={ fillProps }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! Children.toArray( fills ).length ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Special handling exists for backward compatibility.\n\t\t\t\t// It ensures that menu items created by plugin authors aren't\n\t\t\t\t// duplicated with automatically injected menu items coming\n\t\t\t\t// from pinnable plugin sidebars.\n\t\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t\tconst initializedByPlugins = [];\n\t\t\t\tChildren.forEach(\n\t\t\t\t\tfills,\n\t\t\t\t\t( {\n\t\t\t\t\t\tprops: { __unstableExplicitMenuItem, __unstableTarget },\n\t\t\t\t\t} ) => {\n\t\t\t\t\t\tif ( __unstableTarget && __unstableExplicitMenuItem ) {\n\t\t\t\t\t\t\tinitializedByPlugins.push( __unstableTarget );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst children = Children.map( fills, ( child ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t! child.props.__unstableExplicitMenuItem &&\n\t\t\t\t\t\tinitializedByPlugins.includes(\n\t\t\t\t\t\t\tchild.props.__unstableTarget\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t} );\n\n\t\t\t\treturn <Component { ...props }>{ children }</Component>;\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nfunction ActionItem( { name, as: Component = Button, onClick, ...props } ) {\n\treturn (\n\t\t<Fill name={ name }>\n\t\t\t{ ( { onClick: fpOnClick } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tonClick || fpOnClick\n\t\t\t\t\t\t\t\t? ( ...args ) => {\n\t\t\t\t\t\t\t\t\t\t( onClick || noop )( ...args );\n\t\t\t\t\t\t\t\t\t\t( fpOnClick || noop )( ...args );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Fill>\n\t);\n}\n\nActionItem.Slot = ActionItemSlot;\n\nexport default ActionItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,MAAM,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;AACvE,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,SAASC,cAAcA,CAAE;EACxBC,IAAI;EACJC,EAAE,EAAEC,SAAS,GAAGT,WAAW;EAC3BU,SAAS,GAAG,CAAC,CAAC;EACdC,gBAAgB;EAChB,GAAGC;AACJ,CAAC,EAAG;EACH,OACCC,aAAA,CAACX,IAAI;IACJK,IAAI,EAAGA,IAAM;IACbI,gBAAgB,EAAGA,gBAAkB;IACrCD,SAAS,EAAGA;EAAW,GAEnBI,KAAK,IAAM;IACd,IAAK,CAAEV,QAAQ,CAACW,OAAO,CAAED,KAAM,CAAC,CAACE,MAAM,EAAG;MACzC,OAAO,IAAI;IACZ;;IAEA;IACA;IACA;IACA;IACA;IACA,MAAMC,oBAAoB,GAAG,EAAE;IAC/Bb,QAAQ,CAACc,OAAO,CACfJ,KAAK,EACL,CAAE;MACDF,KAAK,EAAE;QAAE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