@wordpress/preferences 4.33.1 → 4.34.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 (126) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +10 -10
  3. package/build/components/index.js +1 -0
  4. package/build/components/index.js.map +2 -2
  5. package/build/components/preference-base-option/index.js +8 -1
  6. package/build/components/preference-base-option/index.js.map +3 -3
  7. package/build/components/preference-base-option/types.js +17 -0
  8. package/build/components/preference-base-option/types.js.map +7 -0
  9. package/build/components/preference-toggle-control/index.js +3 -2
  10. package/build/components/preference-toggle-control/index.js.map +3 -3
  11. package/build/components/preference-toggle-menu-item/index.js +2 -1
  12. package/build/components/preference-toggle-menu-item/index.js.map +3 -3
  13. package/build/components/preferences-modal/index.js +5 -1
  14. package/build/components/preferences-modal/index.js.map +3 -3
  15. package/build/components/preferences-modal/types.js +17 -0
  16. package/build/components/preferences-modal/types.js.map +7 -0
  17. package/build/components/preferences-modal-section/index.js +1 -0
  18. package/build/components/preferences-modal-section/index.js.map +3 -3
  19. package/build/components/preferences-modal-tabs/index.js +25 -18
  20. package/build/components/preferences-modal-tabs/index.js.map +3 -3
  21. package/build/index.js +1 -0
  22. package/build/index.js.map +2 -2
  23. package/build/lock-unlock.js +1 -0
  24. package/build/lock-unlock.js.map +2 -2
  25. package/build/private-apis.js +1 -0
  26. package/build/private-apis.js.map +2 -2
  27. package/build/store/actions.js +1 -0
  28. package/build/store/actions.js.map +3 -3
  29. package/build/store/constants.js +1 -0
  30. package/build/store/constants.js.map +3 -3
  31. package/build/store/index.js +1 -0
  32. package/build/store/index.js.map +3 -3
  33. package/build/store/reducer.js +1 -0
  34. package/build/store/reducer.js.map +3 -3
  35. package/build/store/selectors.js +7 -4
  36. package/build/store/selectors.js.map +3 -3
  37. package/build/store/types.js +17 -0
  38. package/build/store/types.js.map +7 -0
  39. package/build-module/components/index.js.map +1 -1
  40. package/build-module/components/preference-base-option/index.js +7 -1
  41. package/build-module/components/preference-base-option/index.js.map +3 -3
  42. package/build-module/components/preference-base-option/types.js +1 -0
  43. package/build-module/components/preference-base-option/types.js.map +7 -0
  44. package/build-module/components/preference-toggle-control/index.js +2 -2
  45. package/build-module/components/preference-toggle-control/index.js.map +3 -3
  46. package/build-module/components/preference-toggle-menu-item/index.js +1 -1
  47. package/build-module/components/preference-toggle-menu-item/index.js.map +3 -3
  48. package/build-module/components/preferences-modal/index.js +4 -1
  49. package/build-module/components/preferences-modal/index.js.map +3 -3
  50. package/build-module/components/preferences-modal/types.js +1 -0
  51. package/build-module/components/preferences-modal/types.js.map +7 -0
  52. package/build-module/components/preferences-modal-section/index.js.map +3 -3
  53. package/build-module/components/preferences-modal-tabs/index.js +24 -18
  54. package/build-module/components/preferences-modal-tabs/index.js.map +3 -3
  55. package/build-module/index.js.map +1 -1
  56. package/build-module/lock-unlock.js.map +1 -1
  57. package/build-module/private-apis.js.map +1 -1
  58. package/build-module/store/actions.js.map +3 -3
  59. package/build-module/store/constants.js.map +3 -3
  60. package/build-module/store/index.js.map +3 -3
  61. package/build-module/store/reducer.js.map +3 -3
  62. package/build-module/store/selectors.js +6 -4
  63. package/build-module/store/selectors.js.map +3 -3
  64. package/build-module/store/types.js +1 -0
  65. package/build-module/store/types.js.map +7 -0
  66. package/build-types/components/index.d.ts +2 -0
  67. package/build-types/components/index.d.ts.map +1 -0
  68. package/build-types/components/preference-base-option/index.d.ts +7 -0
  69. package/build-types/components/preference-base-option/index.d.ts.map +1 -0
  70. package/build-types/components/preference-base-option/types.d.ts +11 -0
  71. package/build-types/components/preference-base-option/types.d.ts.map +1 -0
  72. package/build-types/components/preference-toggle-control/index.d.ts +9 -0
  73. package/build-types/components/preference-toggle-control/index.d.ts.map +1 -0
  74. package/build-types/components/preference-toggle-menu-item/index.d.ts +18 -0
  75. package/build-types/components/preference-toggle-menu-item/index.d.ts.map +1 -0
  76. package/build-types/components/preferences-modal/index.d.ts +6 -0
  77. package/build-types/components/preferences-modal/index.d.ts.map +1 -0
  78. package/build-types/components/preferences-modal/types.d.ts +11 -0
  79. package/build-types/components/preferences-modal/types.d.ts.map +1 -0
  80. package/build-types/components/preferences-modal-section/index.d.ts +8 -0
  81. package/build-types/components/preferences-modal-section/index.d.ts.map +1 -0
  82. package/build-types/components/preferences-modal-tabs/index.d.ts +9 -0
  83. package/build-types/components/preferences-modal-tabs/index.d.ts.map +1 -0
  84. package/build-types/index.d.ts +4 -0
  85. package/build-types/index.d.ts.map +1 -0
  86. package/build-types/lock-unlock.d.ts +2 -0
  87. package/build-types/lock-unlock.d.ts.map +1 -0
  88. package/build-types/private-apis.d.ts +2 -0
  89. package/build-types/private-apis.d.ts.map +1 -0
  90. package/build-types/store/actions.d.ts +69 -0
  91. package/build-types/store/actions.d.ts.map +1 -0
  92. package/build-types/store/constants.d.ts +5 -0
  93. package/build-types/store/constants.d.ts.map +1 -0
  94. package/build-types/store/index.d.ts +10 -0
  95. package/build-types/store/index.d.ts.map +1 -0
  96. package/build-types/store/reducer.d.ts +39 -0
  97. package/build-types/store/reducer.d.ts.map +1 -0
  98. package/build-types/store/selectors.d.ts +16 -0
  99. package/build-types/store/selectors.d.ts.map +1 -0
  100. package/build-types/store/types.d.ts +27 -0
  101. package/build-types/store/types.d.ts.map +1 -0
  102. package/package.json +16 -12
  103. package/src/components/preference-base-option/{index.js → index.tsx} +11 -1
  104. package/src/components/preference-base-option/types.ts +10 -0
  105. package/src/components/preference-toggle-control/{index.js → index.tsx} +9 -2
  106. package/src/components/preference-toggle-menu-item/{index.js → index.tsx} +14 -2
  107. package/src/components/preferences-modal/{index.js → index.tsx} +8 -1
  108. package/src/components/preferences-modal/types.ts +11 -0
  109. package/src/components/preferences-modal-section/{index.js → index.tsx} +7 -1
  110. package/src/components/preferences-modal-tabs/{index.js → index.tsx} +13 -3
  111. package/src/store/{actions.js → actions.ts} +48 -18
  112. package/src/store/{constants.js → constants.ts} +0 -2
  113. package/src/store/{index.js → index.ts} +6 -3
  114. package/src/store/{reducer.js → reducer.ts} +23 -10
  115. package/src/store/selectors.ts +67 -0
  116. package/src/store/types.ts +29 -0
  117. package/tsconfig.json +16 -0
  118. package/tsconfig.tsbuildinfo +1 -0
  119. package/src/store/selectors.js +0 -57
  120. /package/src/components/{index.js → index.ts} +0 -0
  121. /package/src/{index.js → index.ts} +0 -0
  122. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
  123. /package/src/{private-apis.js → private-apis.ts} +0 -0
  124. /package/src/store/test/{actions.js → actions.ts} +0 -0
  125. /package/src/store/test/{reducer.js → reducer.ts} +0 -0
  126. /package/src/store/test/{selectors.js → selectors.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.34.0 (2025-10-29)
6
+
7
+ ### Internal
8
+
9
+ - TypeScript conversion
10
+
5
11
  ## 4.33.0 (2025-10-17)
6
12
 
7
13
  ## 4.32.0 (2025-10-01)
package/README.md CHANGED
@@ -165,7 +165,7 @@ function MyEditorMenu() {
165
165
 
166
166
  The following set of dispatching action creators are available on the object returned by `wp.data.dispatch( 'core/preferences' )`:
167
167
 
168
- <!-- START TOKEN(Autogenerated actions|src/store/actions.js) -->
168
+ <!-- START TOKEN(Autogenerated actions|src/store/actions.ts) -->
169
169
 
170
170
  #### set
171
171
 
@@ -179,7 +179,7 @@ _Parameters_
179
179
 
180
180
  _Returns_
181
181
 
182
- - `Object`: Action object.
182
+ - `SetAction`: Action object.
183
183
 
184
184
  #### setDefaults
185
185
 
@@ -188,11 +188,11 @@ Returns an action object used in signalling that preference defaults should be s
188
188
  _Parameters_
189
189
 
190
190
  - _scope_ `string`: The preference scope (e.g. core/edit-post).
191
- - _defaults_ `Object<string, *>`: A key/value map of preference names to values.
191
+ - _defaults_ `ScopedDefaults`: A key/value map of preference names to values.
192
192
 
193
193
  _Returns_
194
194
 
195
- - `Object`: Action object.
195
+ - `SetDefaultsAction`: Action object.
196
196
 
197
197
  #### setPersistenceLayer
198
198
 
@@ -207,11 +207,11 @@ When a persistence layer is set, the preferences store will:
207
207
 
208
208
  _Parameters_
209
209
 
210
- - _persistenceLayer_ `WPPreferencesPersistenceLayer`: The persistence layer.
210
+ - _persistenceLayer_ `WPPreferencesPersistenceLayer< D >`: The persistence layer.
211
211
 
212
212
  _Returns_
213
213
 
214
- - `Object`: Action object.
214
+ - `Promise< SetPersistenceLayerAction< D > >`: Action object.
215
215
 
216
216
  #### toggle
217
217
 
@@ -222,13 +222,13 @@ _Parameters_
222
222
  - _scope_ `string`: The preference scope (e.g. core/edit-post).
223
223
  - _name_ `string`: The preference name.
224
224
 
225
- <!-- END TOKEN(Autogenerated actions|src/store/actions.js) -->
225
+ <!-- END TOKEN(Autogenerated actions|src/store/actions.ts) -->
226
226
 
227
227
  ### Selectors
228
228
 
229
229
  The following selectors are available on the object returned by `wp.data.select( 'core/preferences' )`:
230
230
 
231
- <!-- START TOKEN(Autogenerated selectors|src/store/selectors.js) -->
231
+ <!-- START TOKEN(Autogenerated selectors|src/store/selectors.ts) -->
232
232
 
233
233
  #### get
234
234
 
@@ -236,7 +236,7 @@ Returns a boolean indicating whether a prefer is active for a particular scope.
236
236
 
237
237
  _Parameters_
238
238
 
239
- - _state_ `Object`: The store state.
239
+ - _state_ `StoreState`: The store state.
240
240
  - _scope_ `string`: The scope of the feature (e.g. core/edit-post).
241
241
  - _name_ `string`: The name of the feature.
242
242
 
@@ -244,7 +244,7 @@ _Returns_
244
244
 
245
245
  - `*`: Is the feature enabled?
246
246
 
247
- <!-- END TOKEN(Autogenerated selectors|src/store/selectors.js) -->
247
+ <!-- END TOKEN(Autogenerated selectors|src/store/selectors.ts) -->
248
248
 
249
249
  ## Contributing to this package
250
250
 
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/components/index.js"],
3
+ "sources": ["../../src/components/index.ts"],
4
4
  "sourcesContent": ["export { default as PreferenceToggleMenuItem } from './preference-toggle-menu-item';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAoD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAoD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -22,7 +23,13 @@ __export(preference_base_option_exports, {
22
23
  module.exports = __toCommonJS(preference_base_option_exports);
23
24
  var import_jsx_runtime = require("react/jsx-runtime");
24
25
  var import_components = require("@wordpress/components");
25
- function BaseOption({ help, label, isChecked, onChange, children }) {
26
+ function BaseOption({
27
+ help,
28
+ label,
29
+ isChecked,
30
+ onChange,
31
+ children
32
+ }) {
26
33
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "preference-base-option", children: [
27
34
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
28
35
  import_components.ToggleControl,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preference-base-option/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n\nfunction BaseOption( { help, label, isChecked, onChange, children } ) {\n\treturn (\n\t\t<div className=\"preference-base-option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOE;AAJF,wBAA8B;AAE9B,SAAS,WAAY,EAAE,MAAM,OAAO,WAAW,UAAU,SAAS,GAAI;AACrE,SACC,6CAAC,SAAI,WAAU,0BACd;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB;AAAA,QACA;AAAA,QACA,SAAU;AAAA,QACV;AAAA;AAAA,IACD;AAAA,IACE;AAAA,KACH;AAEF;AAEA,IAAO,iCAAQ;",
3
+ "sources": ["../../../src/components/preference-base-option/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToggleControl } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport type { BaseOptionProps } from './types';\n\nfunction BaseOption( {\n\thelp,\n\tlabel,\n\tisChecked,\n\tonChange,\n\tchildren,\n}: BaseOptionProps ) {\n\treturn (\n\t\t<div className=\"preference-base-option\">\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\thelp={ help }\n\t\t\t\tlabel={ label }\n\t\t\t\tchecked={ isChecked }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t\t{ children }\n\t\t</div>\n\t);\n}\n\nexport default BaseOption;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBE;AAdF,wBAA8B;AAM9B,SAAS,WAAY;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAqB;AACpB,SACC,6CAAC,SAAI,WAAU,0BACd;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,yBAAuB;AAAA,QACvB;AAAA,QACA;AAAA,QACA,SAAU;AAAA,QACV;AAAA;AAAA,IACD;AAAA,IACE;AAAA,KACH;AAEF;AAEA,IAAO,iCAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/preference-base-option/types.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { ToggleControl } from '@wordpress/components';\n\ntype ToggleControlProps = Parameters< typeof ToggleControl >[ 0 ];\nexport type BaseOptionProps = Pick<\n\tToggleControlProps,\n\t'help' | 'label' | 'onChange'\n> & { isChecked?: ToggleControlProps[ 'checked' ]; children?: React.ReactNode };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -54,9 +55,9 @@ function PreferenceToggleControl(props) {
54
55
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
55
56
  import_preference_base_option.default,
56
57
  {
58
+ ...remainingProps,
57
59
  onChange,
58
- isChecked,
59
- ...remainingProps
60
+ isChecked
60
61
  }
61
62
  );
62
63
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preference-toggle-control/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\nimport PreferenceBaseOption from '../preference-base-option';\n\nfunction PreferenceToggleControl( props ) {\n\tconst {\n\t\tscope,\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n\nexport default PreferenceToggleControl;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BE;AA1BF,kBAAuC;AAKvC,mBAA0C;AAC1C,oCAAiC;AAEjC,SAAS,wBAAyB,OAAQ;AACzC,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,GAAG;AAAA,EACJ,IAAI;AACJ,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,WAAY;AAAA,IACpE,CAAE,OAAO,WAAY;AAAA,EACtB;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,WAAW,MAAM;AACtB,aAAS;AACT,WAAQ,OAAO,WAAY;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC,8BAAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA;AAAA,MACE,GAAG;AAAA;AAAA,EACN;AAEF;AAEA,IAAO,oCAAQ;",
3
+ "sources": ["../../../src/components/preference-toggle-control/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\nimport type { BaseOptionProps } from '../preference-base-option/types';\nimport PreferenceBaseOption from '../preference-base-option';\n\nexport type PreferenceToggleControlProps = {\n\tscope: string;\n\tfeatureName: string;\n\tonToggle: () => void;\n} & Omit< BaseOptionProps, 'onChange' | 'isChecked' >;\n\nfunction PreferenceToggleControl( props: PreferenceToggleControlProps ) {\n\tconst {\n\t\tscope,\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\t{ ...remainingProps }\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t/>\n\t);\n}\n\nexport default PreferenceToggleControl;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCE;AAjCF,kBAAuC;AAKvC,mBAA0C;AAE1C,oCAAiC;AAQjC,SAAS,wBAAyB,OAAsC;AACvE,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,WAAW,MAAM;AAAA,IAAC;AAAA,IAClB,GAAG;AAAA,EACJ,IAAI;AACJ,QAAM,gBAAY;AAAA,IACjB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,WAAY;AAAA,IACpE,CAAE,OAAO,WAAY;AAAA,EACtB;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,WAAW,MAAM;AACtB,aAAS;AACT,WAAQ,OAAO,WAAY;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC,8BAAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACL;AAAA,MACA;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,oCAAQ;",
6
6
  "names": ["preferencesStore", "PreferenceBaseOption"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -64,7 +65,7 @@ function PreferenceToggleMenuItem({
64
65
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
66
  import_components.MenuItem,
66
67
  {
67
- icon: isActive && import_icons.check,
68
+ icon: isActive ? import_icons.check : null,
68
69
  isSelected: isActive,
69
70
  onClick: () => {
70
71
  onToggle();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preference-toggle-menu-item/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\n\nexport default function PreferenceToggleMenuItem( {\n\tscope,\n\tname,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\thandleToggling = true,\n\tonToggle = () => null,\n\tdisabled = false,\n} ) {\n\tconst isActive = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, name ),\n\t\t[ scope, name ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tconst message =\n\t\t\t\tmessageDeactivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference deactivated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t} else {\n\t\t\tconst message =\n\t\t\t\tmessageActivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference activated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\tonToggle();\n\t\t\t\tif ( handleToggling ) {\n\t\t\t\t\ttoggle( scope, name );\n\t\t\t\t}\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDE;AAnDF,kBAAuC;AACvC,wBAAyB;AACzB,kBAA4B;AAC5B,mBAAsB;AACtB,kBAAsB;AAKtB,mBAA0C;AAE3B,SAAR,yBAA2C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB,WAAW;AACZ,GAAI;AACH,QAAM,eAAW;AAAA,IAChB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,IAAK;AAAA,IAC7D,CAAE,OAAO,IAAK;AAAA,EACf;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,eAAe,MAAM;AAC1B,QAAK,UAAW;AACf,YAAM,UACL,0BACA;AAAA;AAAA,YAEC,gBAAI,6BAA8B;AAAA,QAClC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB,OAAO;AACN,YAAM,UACL,wBACA;AAAA;AAAA,YAEC,gBAAI,2BAA4B;AAAA,QAChC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,YAAY;AAAA,MACnB,YAAa;AAAA,MACb,SAAU,MAAM;AACf,iBAAS;AACT,YAAK,gBAAiB;AACrB,iBAAQ,OAAO,IAAK;AAAA,QACrB;AACA,qBAAa;AAAA,MACd;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;",
3
+ "sources": ["../../../src/components/preference-toggle-menu-item/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as preferencesStore } from '../../store';\n\ntype PreferenceToggleMenuItemProps = {\n\tscope: string;\n\tname: string;\n\tlabel: string;\n\tinfo?: string;\n\tmessageActivated?: string;\n\tmessageDeactivated?: string;\n\tshortcut?: string | { display: string; ariaLabel: string };\n\thandleToggling?: boolean;\n\tonToggle?: () => void;\n\tdisabled?: boolean;\n};\nexport default function PreferenceToggleMenuItem( {\n\tscope,\n\tname,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\thandleToggling = true,\n\tonToggle = () => null,\n\tdisabled = false,\n}: PreferenceToggleMenuItemProps ) {\n\tconst isActive = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, name ),\n\t\t[ scope, name ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tconst message =\n\t\t\t\tmessageDeactivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference deactivated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t} else {\n\t\t\tconst message =\n\t\t\t\tmessageActivated ||\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: preference name, e.g. 'Fullscreen mode' */\n\t\t\t\t\t__( 'Preference activated - %s' ),\n\t\t\t\t\tlabel\n\t\t\t\t);\n\t\t\tspeak( message );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive ? check : null }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\tonToggle();\n\t\t\t\tif ( handleToggling ) {\n\t\t\t\t\ttoggle( scope, name );\n\t\t\t\t}\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t\tdisabled={ disabled }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkEE;AA/DF,kBAAuC;AACvC,wBAAyB;AACzB,kBAA4B;AAC5B,mBAAsB;AACtB,kBAAsB;AAKtB,mBAA0C;AAc3B,SAAR,yBAA2C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB,WAAW;AACZ,GAAmC;AAClC,QAAM,eAAW;AAAA,IAChB,CAAE,WAAY,CAAC,CAAE,OAAQ,aAAAA,KAAiB,EAAE,IAAK,OAAO,IAAK;AAAA,IAC7D,CAAE,OAAO,IAAK;AAAA,EACf;AACA,QAAM,EAAE,OAAO,QAAI,yBAAa,aAAAA,KAAiB;AACjD,QAAM,eAAe,MAAM;AAC1B,QAAK,UAAW;AACf,YAAM,UACL,0BACA;AAAA;AAAA,YAEC,gBAAI,6BAA8B;AAAA,QAClC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB,OAAO;AACN,YAAM,UACL,wBACA;AAAA;AAAA,YAEC,gBAAI,2BAA4B;AAAA,QAChC;AAAA,MACD;AACD,6BAAO,OAAQ;AAAA,IAChB;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO,WAAW,qBAAQ;AAAA,MAC1B,YAAa;AAAA,MACb,SAAU,MAAM;AACf,iBAAS;AACT,YAAK,gBAAiB;AACrB,iBAAQ,OAAO,IAAK;AAAA,QACrB;AACA,qBAAa;AAAA,MACd;AAAA,MACA,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;",
6
6
  "names": ["preferencesStore"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -23,7 +24,10 @@ module.exports = __toCommonJS(preferences_modal_exports);
23
24
  var import_jsx_runtime = require("react/jsx-runtime");
24
25
  var import_components = require("@wordpress/components");
25
26
  var import_i18n = require("@wordpress/i18n");
26
- function PreferencesModal({ closeModal, children }) {
27
+ function PreferencesModal({
28
+ closeModal,
29
+ children
30
+ }) {
27
31
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
28
32
  import_components.Modal,
29
33
  {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preferences-modal/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function PreferencesModal( { closeModal, children } ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AALF,wBAAsB;AACtB,kBAAmB;AAEJ,SAAR,iBAAmC,EAAE,YAAY,SAAS,GAAI;AACpE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,aAAc;AAAA,MAC1B,gBAAiB;AAAA,MAEf;AAAA;AAAA,EACH;AAEF;",
3
+ "sources": ["../../../src/components/preferences-modal/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport type { PreferencesModalProps } from './types';\n\nexport default function PreferencesModal( {\n\tcloseModal,\n\tchildren,\n}: PreferencesModalProps ) {\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ children }\n\t\t</Modal>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeE;AAZF,wBAAsB;AACtB,kBAAmB;AAMJ,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AACD,GAA2B;AAC1B,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,aAAc;AAAA,MAC1B,gBAAiB;AAAA,MAEf;AAAA;AAAA,EACH;AAEF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/preferences-modal/types.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Modal } from '@wordpress/components';\n\ntype ModalProps = Parameters< typeof Modal >[ 0 ];\n\nexport type PreferencesModalProps = {\n\tcloseModal: ModalProps[ 'onRequestClose' ];\n\tchildren: React.ReactNode;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preferences-modal-section/index.js"],
4
- "sourcesContent": ["const Section = ( { description, title, children } ) => (\n\t<fieldset className=\"preferences-modal__section\">\n\t\t<legend className=\"preferences-modal__section-legend\">\n\t\t\t<h2 className=\"preferences-modal__section-title\">{ title }</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"preferences-modal__section-content\">{ children }</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEE;AAFF,MAAM,UAAU,CAAE,EAAE,aAAa,OAAO,SAAS,MAChD,6CAAC,cAAS,WAAU,8BACnB;AAAA,+CAAC,YAAO,WAAU,qCACjB;AAAA,gDAAC,QAAG,WAAU,oCAAqC,iBAAO;AAAA,IACxD,eACD,4CAAC,OAAE,WAAU,0CACV,uBACH;AAAA,KAEF;AAAA,EACA,4CAAC,SAAI,WAAU,sCAAuC,UAAU;AAAA,GACjE;AAGD,IAAO,oCAAQ;",
3
+ "sources": ["../../../src/components/preferences-modal-section/index.tsx"],
4
+ "sourcesContent": ["export type SectionProps = {\n\tdescription?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tchildren?: React.ReactNode;\n};\n\nconst Section = ( { description, title, children }: SectionProps ) => (\n\t<fieldset className=\"preferences-modal__section\">\n\t\t<legend className=\"preferences-modal__section-legend\">\n\t\t\t<h2 className=\"preferences-modal__section-title\">{ title }</h2>\n\t\t\t{ description && (\n\t\t\t\t<p className=\"preferences-modal__section-description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</legend>\n\t\t<div className=\"preferences-modal__section-content\">{ children }</div>\n\t</fieldset>\n);\n\nexport default Section;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AAFF,MAAM,UAAU,CAAE,EAAE,aAAa,OAAO,SAAS,MAChD,6CAAC,cAAS,WAAU,8BACnB;AAAA,+CAAC,YAAO,WAAU,qCACjB;AAAA,gDAAC,QAAG,WAAU,oCAAqC,iBAAO;AAAA,IACxD,eACD,4CAAC,OAAE,WAAU,0CACV,uBACH;AAAA,KAEF;AAAA,EACA,4CAAC,SAAI,WAAU,sCAAuC,UAAU;AAAA,GACjE;AAGD,IAAO,oCAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -29,7 +30,9 @@ var import_i18n = require("@wordpress/i18n");
29
30
  var import_lock_unlock = require("../../lock-unlock");
30
31
  const { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
31
32
  const PREFERENCES_MENU = "preferences-menu";
32
- function PreferencesModalTabs({ sections }) {
33
+ function PreferencesModalTabs({
34
+ sections
35
+ }) {
33
36
  const isLargeViewport = (0, import_compose.useViewportMatch)("medium");
34
37
  const [activeMenu, setActiveMenu] = (0, import_element.useState)(PREFERENCES_MENU);
35
38
  const { tabs, sectionsContentMap } = (0, import_element.useMemo)(() => {
@@ -83,23 +86,26 @@ function PreferencesModalTabs({ sections }) {
83
86
  } else {
84
87
  modalContent = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.Navigator, { initialPath: "/", className: "preferences__provider", children: [
85
88
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Navigator.Screen, { path: "/", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Card, { isBorderless: true, size: "small", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalItemGroup, { children: tabs.map((tab) => {
86
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
87
- import_components.Navigator.Button,
88
- {
89
- path: `/${tab.name}`,
90
- as: import_components.__experimentalItem,
91
- isAction: true,
92
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { justify: "space-between", children: [
93
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: tab.title }) }),
94
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
- import_icons.Icon,
96
- {
97
- icon: (0, import_i18n.isRTL)() ? import_icons.chevronLeft : import_icons.chevronRight
98
- }
99
- ) })
100
- ] })
101
- },
102
- tab.name
89
+ return (
90
+ // @ts-expect-error: Navigator.Button is currently typed in a way that prevents Item from being passed in
91
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ import_components.Navigator.Button,
93
+ {
94
+ path: `/${tab.name}`,
95
+ as: import_components.__experimentalItem,
96
+ isAction: true,
97
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_components.__experimentalHStack, { justify: "space-between", children: [
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalTruncate, { children: tab.title }) }),
99
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.FlexItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
100
+ import_icons.Icon,
101
+ {
102
+ icon: (0, import_i18n.isRTL)() ? import_icons.chevronLeft : import_icons.chevronRight
103
+ }
104
+ ) })
105
+ ] })
106
+ },
107
+ tab.name
108
+ )
103
109
  );
104
110
  }) }) }) }) }),
105
111
  sections.length && sections.map((section) => {
@@ -115,6 +121,7 @@ function PreferencesModalTabs({ sections }) {
115
121
  justify: "left",
116
122
  size: "small",
117
123
  gap: "6",
124
+ as: "div",
118
125
  children: [
119
126
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
120
127
  import_components.Navigator.BackButton,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/components/preferences-modal-tabs/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tNavigator,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tCard,\n\tCardHeader,\n\tCardBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport default function PreferencesModalTabs( { sections } ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `Tabs` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<div className=\"preferences__tabs\">\n\t\t\t\t<Tabs\n\t\t\t\t\tdefaultTabId={\n\t\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.TabList className=\"preferences__tabs-tablist\">\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\tclassName=\"preferences__tabs-tab\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tclassName=\"preferences__tabs-tabpanel\"\n\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sectionsContentMap[ tab.name ] || null }\n\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<Navigator initialPath=\"/\" className=\"preferences__provider\">\n\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<Navigator.Button\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ `/${ tab.name }` }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</Navigator.Button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</Navigator.Screen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Navigator.Screen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ `/${ section.name }` }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Navigator.BackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</Navigator>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],
5
- "mappings": "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",
3
+ "sources": ["../../../src/components/preferences-modal-tabs/index.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tNavigator,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tCard,\n\tCardHeader,\n\tCardBody,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useMemo, useState } from '@wordpress/element';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst PREFERENCES_MENU = 'preferences-menu';\n\nexport type PreferencesModalTabsProps = {\n\tsections: { name: string; tabLabel: string; content: React.ReactNode }[];\n};\nexport default function PreferencesModalTabs( {\n\tsections,\n}: PreferencesModalTabsProps ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `Tabs` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo( () => {\n\t\tlet mappedTabs: {\n\t\t\ttabs: { name: string; title: string }[];\n\t\t\tsectionsContentMap: Record< string, React.ReactNode >;\n\t\t} = {\n\t\t\ttabs: [],\n\t\t\tsectionsContentMap: {},\n\t\t};\n\t\tif ( sections.length ) {\n\t\t\tmappedTabs = sections.reduce< typeof mappedTabs >(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t);\n\t\t}\n\t\treturn mappedTabs;\n\t}, [ sections ] );\n\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<div className=\"preferences__tabs\">\n\t\t\t\t<Tabs\n\t\t\t\t\tdefaultTabId={\n\t\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\t\torientation=\"vertical\"\n\t\t\t\t>\n\t\t\t\t\t<Tabs.TabList className=\"preferences__tabs-tablist\">\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab\n\t\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\tclassName=\"preferences__tabs-tab\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\t\ttabId={ tab.name }\n\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\tclassName=\"preferences__tabs-tabpanel\"\n\t\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sectionsContentMap[ tab.name ] || null }\n\t\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t\t) ) }\n\t\t\t\t</Tabs>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<Navigator initialPath=\"/\" className=\"preferences__provider\">\n\t\t\t\t<Navigator.Screen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t// @ts-expect-error: Navigator.Button is currently typed in a way that prevents Item from being passed in\n\t\t\t\t\t\t\t\t\t\t<Navigator.Button\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ `/${ tab.name }` }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</Navigator.Button>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</Navigator.Screen>\n\t\t\t\t{ sections.length &&\n\t\t\t\t\tsections.map( ( section ) => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Navigator.Screen\n\t\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\t\tpath={ `/${ section.name }` }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t\t\tas=\"div\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Navigator.BackButton\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Text size=\"16\">\n\t\t\t\t\t\t\t\t\t\t\t{ section.tabLabel }\n\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t</Navigator.Screen>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t</Navigator>\n\t\t);\n\t}\n\n\treturn modalContent;\n}\n"],
5
+ "mappings": "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",
6
6
  "names": ["componentsPrivateApis", "ItemGroup", "Item", "HStack", "Truncate", "Text"]
7
7
  }
package/build/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.js"],
3
+ "sources": ["../src/index.ts"],
4
4
  "sourcesContent": ["export * from './components';\nexport { store } from './store';\nexport * from './private-apis';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,yBAAd;AACA,mBAAsB;AACtB,0BAAc,2BAFd;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,yBAAd;AACA,mBAAsB;AACtB,0BAAc,2BAFd;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/lock-unlock.js"],
3
+ "sources": ["../src/lock-unlock.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/preferences'\n\t);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAC1D,MAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAC1D,MAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/private-apis.js"],
3
+ "sources": ["../src/private-apis.ts"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport PreferenceBaseOption from './components/preference-base-option';\nimport PreferenceToggleControl from './components/preference-toggle-control';\nimport PreferencesModal from './components/preferences-modal';\nimport PreferencesModalSection from './components/preferences-modal-section';\nimport PreferencesModalTabs from './components/preferences-modal-tabs';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tPreferenceBaseOption,\n\tPreferenceToggleControl,\n\tPreferencesModal,\n\tPreferencesModalSection,\n\tPreferencesModalTabs,\n} );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oCAAiC;AACjC,uCAAoC;AACpC,+BAA6B;AAC7B,uCAAoC;AACpC,oCAAiC;AACjC,yBAAqB;AAEd,MAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB,oDAAAA;AAAA,EACA,0DAAAC;AAAA,EACA,2CAAAC;AAAA,EACA,0DAAAC;AAAA,EACA,oDAAAC;AACD,CAAE;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oCAAiC;AACjC,uCAAoC;AACpC,+BAA6B;AAC7B,uCAAoC;AACpC,oCAAiC;AACjC,yBAAqB;AAEd,MAAM,cAAc,CAAC;AAAA,IAC5B,yBAAM,aAAa;AAAA,EAClB,oDAAAA;AAAA,EACA,0DAAAC;AAAA,EACA,2CAAAC;AAAA,EACA,0DAAAC;AAAA,EACA,oDAAAC;AACD,CAAE;",
6
6
  "names": ["PreferenceBaseOption", "PreferenceToggleControl", "PreferencesModal", "PreferencesModalSection", "PreferencesModalTabs"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/store/actions.js"],
4
- "sourcesContent": ["/**\n * Returns an action object used in signalling that a preference should be\n * toggled.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n */\nexport function toggle( scope, name ) {\n\treturn function ( { select, dispatch } ) {\n\t\tconst currentValue = select.get( scope, name );\n\t\tdispatch.set( scope, name, ! currentValue );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a preference should be set\n * to a value\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n * @param {*} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function set( scope, name, value ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_VALUE',\n\t\tscope,\n\t\tname,\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that preference defaults should\n * be set.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {Object<string, *>} defaults A key/value map of preference names to values.\n *\n * @return {Object} Action object.\n */\nexport function setDefaults( scope, defaults ) {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n\n/** @typedef {() => Promise<Object>} WPPreferencesPersistenceLayerGet */\n/** @typedef {(Object) => void} WPPreferencesPersistenceLayerSet */\n/**\n * @typedef WPPreferencesPersistenceLayer\n *\n * @property {WPPreferencesPersistenceLayerGet} get An async function that gets data from the persistence layer.\n * @property {WPPreferencesPersistenceLayerSet} set A function that sets data in the persistence layer.\n */\n\n/**\n * Sets the persistence layer.\n *\n * When a persistence layer is set, the preferences store will:\n * - call `get` immediately and update the store state to the value returned.\n * - call `set` with all preferences whenever a preference changes value.\n *\n * `setPersistenceLayer` should ideally be dispatched at the start of an\n * application's lifecycle, before any other actions have been dispatched to\n * the preferences store.\n *\n * @param {WPPreferencesPersistenceLayer} persistenceLayer The persistence layer.\n *\n * @return {Object} Action object.\n */\nexport async function setPersistenceLayer( persistenceLayer ) {\n\tconst persistedData = await persistenceLayer.get();\n\treturn {\n\t\ttype: 'SET_PERSISTENCE_LAYER',\n\t\tpersistenceLayer,\n\t\tpersistedData,\n\t};\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,SAAS,OAAQ,OAAO,MAAO;AACrC,SAAO,SAAW,EAAE,QAAQ,SAAS,GAAI;AACxC,UAAM,eAAe,OAAO,IAAK,OAAO,IAAK;AAC7C,aAAS,IAAK,OAAO,MAAM,CAAE,YAAa;AAAA,EAC3C;AACD;AAYO,SAAS,IAAK,OAAO,MAAM,OAAQ;AACzC,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAWO,SAAS,YAAa,OAAO,UAAW;AAC9C,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AA0BA,eAAsB,oBAAqB,kBAAmB;AAC7D,QAAM,gBAAgB,MAAM,iBAAiB,IAAI;AACjD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
3
+ "sources": ["../../src/store/actions.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport type {\n\tActionObject,\n\tStoreState,\n\tWPPreferencesPersistenceLayer,\n} from './types';\n\n/**\n * Returns an action object used in signalling that a preference should be\n * toggled.\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n */\nexport function toggle( scope: string, name: string ) {\n\t// @ts-expect-error We cannot properly type this until we have a fully-typed datastore\n\treturn function ( { select, dispatch } ) {\n\t\tconst currentValue = select.get( scope, name );\n\t\tdispatch.set( scope, name, ! currentValue );\n\t};\n}\n\ntype SetAction = ActionObject<\n\t'SET_PREFERENCE_VALUE',\n\t{ scope: string; name: string; value: any }\n>;\n\n/**\n * Returns an action object used in signalling that a preference should be set\n * to a value\n *\n * @param {string} scope The preference scope (e.g. core/edit-post).\n * @param {string} name The preference name.\n * @param {*} value The value to set.\n *\n * @return {SetAction} Action object.\n */\nexport function set( scope: string, name: string, value: any ): SetAction {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_VALUE',\n\t\tscope,\n\t\tname,\n\t\tvalue,\n\t};\n}\n\ntype ScopedDefaults = StoreState[ 'defaults' ][ string ];\ntype SetDefaultsAction = ActionObject<\n\t'SET_PREFERENCE_DEFAULTS',\n\t{ scope: string; defaults: ScopedDefaults }\n>;\n\n/**\n * Returns an action object used in signalling that preference defaults should\n * be set.\n *\n * @param scope The preference scope (e.g. core/edit-post).\n * @param defaults A key/value map of preference names to values.\n *\n * @return Action object.\n */\nexport function setDefaults(\n\tscope: string,\n\tdefaults: ScopedDefaults\n): SetDefaultsAction {\n\treturn {\n\t\ttype: 'SET_PREFERENCE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n\ntype SetPersistenceLayerAction< D extends Object > = ActionObject<\n\t'SET_PERSISTENCE_LAYER',\n\t{\n\t\tpersistenceLayer: WPPreferencesPersistenceLayer< D >;\n\t\tpersistedData: D;\n\t}\n>;\n\n/**\n * Sets the persistence layer.\n *\n * When a persistence layer is set, the preferences store will:\n * - call `get` immediately and update the store state to the value returned.\n * - call `set` with all preferences whenever a preference changes value.\n *\n * `setPersistenceLayer` should ideally be dispatched at the start of an\n * application's lifecycle, before any other actions have been dispatched to\n * the preferences store.\n *\n * @param persistenceLayer The persistence layer.\n *\n * @return Action object.\n */\nexport async function setPersistenceLayer< D extends Object >(\n\tpersistenceLayer: WPPreferencesPersistenceLayer< D >\n): Promise< SetPersistenceLayerAction< D > > {\n\tconst persistedData = await persistenceLayer.get();\n\treturn {\n\t\ttype: 'SET_PERSISTENCE_LAYER',\n\t\tpersistenceLayer,\n\t\tpersistedData,\n\t};\n}\n\nexport type AvailableActions =\n\t| SetAction\n\t| SetDefaultsAction\n\t| SetPersistenceLayerAction< any >;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,SAAS,OAAQ,OAAe,MAAe;AAErD,SAAO,SAAW,EAAE,QAAQ,SAAS,GAAI;AACxC,UAAM,eAAe,OAAO,IAAK,OAAO,IAAK;AAC7C,aAAS,IAAK,OAAO,MAAM,CAAE,YAAa;AAAA,EAC3C;AACD;AAiBO,SAAS,IAAK,OAAe,MAAc,OAAwB;AACzE,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;AAiBO,SAAS,YACf,OACA,UACoB;AACpB,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;AAyBA,eAAsB,oBACrB,kBAC4C;AAC5C,QAAM,gBAAgB,MAAM,iBAAiB,IAAI;AACjD,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/store/constants.js"],
4
- "sourcesContent": ["/**\n * The identifier for the data store.\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core/preferences';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,MAAM,aAAa;",
3
+ "sources": ["../../src/store/constants.ts"],
4
+ "sourcesContent": ["/**\n * The identifier for the data store.\n */\nexport const STORE_NAME = 'core/preferences';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/store/index.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the preferences 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\nregister( store );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAC3B,uBAA2B;AASpB,MAAM,YAAQ,8BAAkB,6BAAY;AAAA,EAClD,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
3
+ "sources": ["../../src/store/index.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\nimport type { StoreState } from './types';\n\n/**\n * Store definition for the preferences namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore<\n\tStoreState,\n\ttypeof actions,\n\ttypeof selectors\n>( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n} );\n\nregister( store );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAC3B,uBAA2B;AAQpB,MAAM,YAAQ,8BAIlB,6BAAY;AAAA,EACd,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
6
6
  "names": ["reducer"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;