@wordpress/preferences 4.34.0 → 4.35.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 (71) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/index.js +2 -0
  3. package/build/components/index.js.map +1 -1
  4. package/build/components/preference-base-option/index.js +3 -1
  5. package/build/components/preference-base-option/index.js.map +1 -1
  6. package/build/components/preference-base-option/types.js +2 -0
  7. package/build/components/preference-base-option/types.js.map +1 -1
  8. package/build/components/preference-toggle-control/index.js +3 -1
  9. package/build/components/preference-toggle-control/index.js.map +1 -1
  10. package/build/components/preference-toggle-menu-item/index.js +3 -1
  11. package/build/components/preference-toggle-menu-item/index.js.map +1 -1
  12. package/build/components/preferences-modal/index.js +3 -1
  13. package/build/components/preferences-modal/index.js.map +1 -1
  14. package/build/components/preferences-modal/types.js +2 -0
  15. package/build/components/preferences-modal/types.js.map +1 -1
  16. package/build/components/preferences-modal-section/index.js +3 -1
  17. package/build/components/preferences-modal-section/index.js.map +1 -1
  18. package/build/components/preferences-modal-tabs/index.js +5 -3
  19. package/build/components/preferences-modal-tabs/index.js.map +1 -1
  20. package/build/index.js +2 -0
  21. package/build/index.js.map +1 -1
  22. package/build/lock-unlock.js +3 -1
  23. package/build/lock-unlock.js.map +1 -1
  24. package/build/private-apis.js +3 -1
  25. package/build/private-apis.js.map +1 -1
  26. package/build/store/actions.js +2 -0
  27. package/build/store/actions.js.map +1 -1
  28. package/build/store/constants.js +3 -1
  29. package/build/store/constants.js.map +1 -1
  30. package/build/store/index.js +3 -1
  31. package/build/store/index.js.map +1 -1
  32. package/build/store/reducer.js +3 -1
  33. package/build/store/reducer.js.map +1 -1
  34. package/build/store/selectors.js +4 -2
  35. package/build/store/selectors.js.map +1 -1
  36. package/build/store/types.js +2 -0
  37. package/build/store/types.js.map +1 -1
  38. package/build-module/components/index.js +1 -0
  39. package/build-module/components/index.js.map +1 -1
  40. package/build-module/components/preference-base-option/index.js +2 -1
  41. package/build-module/components/preference-base-option/index.js.map +1 -1
  42. package/build-module/components/preference-toggle-control/index.js +2 -1
  43. package/build-module/components/preference-toggle-control/index.js.map +1 -1
  44. package/build-module/components/preference-toggle-menu-item/index.js +2 -1
  45. package/build-module/components/preference-toggle-menu-item/index.js.map +1 -1
  46. package/build-module/components/preferences-modal/index.js +2 -1
  47. package/build-module/components/preferences-modal/index.js.map +1 -1
  48. package/build-module/components/preferences-modal-section/index.js +2 -1
  49. package/build-module/components/preferences-modal-section/index.js.map +1 -1
  50. package/build-module/components/preferences-modal-tabs/index.js +4 -3
  51. package/build-module/components/preferences-modal-tabs/index.js.map +1 -1
  52. package/build-module/index.js +1 -0
  53. package/build-module/index.js.map +1 -1
  54. package/build-module/lock-unlock.js +2 -1
  55. package/build-module/lock-unlock.js.map +1 -1
  56. package/build-module/private-apis.js +2 -1
  57. package/build-module/private-apis.js.map +1 -1
  58. package/build-module/store/actions.js +1 -0
  59. package/build-module/store/actions.js.map +1 -1
  60. package/build-module/store/constants.js +2 -1
  61. package/build-module/store/constants.js.map +1 -1
  62. package/build-module/store/index.js +2 -1
  63. package/build-module/store/index.js.map +1 -1
  64. package/build-module/store/reducer.js +2 -1
  65. package/build-module/store/reducer.js.map +1 -1
  66. package/build-module/store/selectors.js +3 -2
  67. package/build-module/store/selectors.js.map +1 -1
  68. package/build-types/components/preferences-modal-section/index.d.ts.map +1 -1
  69. package/build-types/store/actions.d.ts.map +1 -1
  70. package/package.json +12 -12
  71. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.35.0 (2025-11-12)
6
+
5
7
  ## 4.34.0 (2025-10-29)
6
8
 
7
9
  ### Internal
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/preferences/src/components/index.ts
29
31
  var components_exports = {};
30
32
  __export(components_exports, {
31
33
  PreferenceToggleMenuItem: () => import_preference_toggle_menu_item.default
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
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
  }
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/components/preference-base-option/index.tsx
19
21
  var preference_base_option_exports = {};
20
22
  __export(preference_base_option_exports, {
21
23
  default: () => preference_base_option_default
22
24
  });
23
25
  module.exports = __toCommonJS(preference_base_option_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_components = require("@wordpress/components");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
26
28
  function BaseOption({
27
29
  help,
28
30
  label,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preference-base-option/index.tsx"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAc5B;AARF,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
  }
@@ -12,6 +12,8 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/preferences/src/components/preference-base-option/types.ts
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
17
19
  //# sourceMappingURL=types.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preference-base-option/types.ts"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -26,15 +26,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/preferences/src/components/preference-toggle-control/index.tsx
29
31
  var preference_toggle_control_exports = {};
30
32
  __export(preference_toggle_control_exports, {
31
33
  default: () => preference_toggle_control_default
32
34
  });
33
35
  module.exports = __toCommonJS(preference_toggle_control_exports);
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
36
  var import_data = require("@wordpress/data");
36
37
  var import_store = require("../../store");
37
38
  var import_preference_base_option = __toESM(require("../preference-base-option"));
39
+ var import_jsx_runtime = require("react/jsx-runtime");
38
40
  function PreferenceToggleControl(props) {
39
41
  const {
40
42
  scope,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preference-toggle-control/index.tsx"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AAKvC,mBAA0C;AAE1C,oCAAiC;AA0B/B;AAlBF,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
  }
@@ -16,18 +16,20 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/components/preference-toggle-menu-item/index.tsx
19
21
  var preference_toggle_menu_item_exports = {};
20
22
  __export(preference_toggle_menu_item_exports, {
21
23
  default: () => PreferenceToggleMenuItem
22
24
  });
23
25
  module.exports = __toCommonJS(preference_toggle_menu_item_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_data = require("@wordpress/data");
26
27
  var import_components = require("@wordpress/components");
27
28
  var import_i18n = require("@wordpress/i18n");
28
29
  var import_icons = require("@wordpress/icons");
29
30
  var import_a11y = require("@wordpress/a11y");
30
31
  var import_store = require("../../store");
32
+ var import_jsx_runtime = require("react/jsx-runtime");
31
33
  function PreferenceToggleMenuItem({
32
34
  scope,
33
35
  name,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preference-toggle-menu-item/index.tsx"],
4
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=\"menuitem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;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,wBAAyB;AACzB,kBAA4B;AAC5B,mBAAsB;AACtB,kBAAsB;AAKtB,mBAA0C;AAsDxC;AAxCa,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
  }
@@ -16,14 +16,16 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/components/preferences-modal/index.tsx
19
21
  var preferences_modal_exports = {};
20
22
  __export(preferences_modal_exports, {
21
23
  default: () => PreferencesModal
22
24
  });
23
25
  module.exports = __toCommonJS(preferences_modal_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_components = require("@wordpress/components");
26
27
  var import_i18n = require("@wordpress/i18n");
28
+ var import_jsx_runtime = require("react/jsx-runtime");
27
29
  function PreferencesModal({
28
30
  closeModal,
29
31
  children
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/index.tsx"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAsB;AACtB,kBAAmB;AAWjB;AALa,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
  }
@@ -12,6 +12,8 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/preferences/src/components/preferences-modal/types.ts
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
17
19
  //# sourceMappingURL=types.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal/types.ts"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -16,13 +16,15 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/components/preferences-modal-section/index.tsx
19
21
  var preferences_modal_section_exports = {};
20
22
  __export(preferences_modal_section_exports, {
21
23
  default: () => preferences_modal_section_default
22
24
  });
23
25
  module.exports = __toCommonJS(preferences_modal_section_exports);
24
26
  var import_jsx_runtime = require("react/jsx-runtime");
25
- const Section = ({ description, title, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { className: "preferences-modal__section", children: [
27
+ var Section = ({ description, title, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", { className: "preferences-modal__section", children: [
26
28
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("legend", { className: "preferences-modal__section-legend", children: [
27
29
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "preferences-modal__section-title", children: title }),
28
30
  description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "preferences-modal__section-description", children: description })
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal-section/index.tsx"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQE;AAFF,IAAM,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
  }
@@ -16,20 +16,22 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/components/preferences-modal-tabs/index.tsx
19
21
  var preferences_modal_tabs_exports = {};
20
22
  __export(preferences_modal_tabs_exports, {
21
23
  default: () => PreferencesModalTabs
22
24
  });
23
25
  module.exports = __toCommonJS(preferences_modal_tabs_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_compose = require("@wordpress/compose");
26
27
  var import_components = require("@wordpress/components");
27
28
  var import_element = require("@wordpress/element");
28
29
  var import_icons = require("@wordpress/icons");
29
30
  var import_i18n = require("@wordpress/i18n");
30
31
  var import_lock_unlock = require("../../lock-unlock");
31
- const { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
32
- const PREFERENCES_MENU = "preferences-menu";
32
+ var import_jsx_runtime = require("react/jsx-runtime");
33
+ var { Tabs } = (0, import_lock_unlock.unlock)(import_components.privateApis);
34
+ var PREFERENCES_MENU = "preferences-menu";
33
35
  function PreferencesModalTabs({
34
36
  sections
35
37
  }) {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preferences-modal-tabs/index.tsx"],
4
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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwEI;AArEJ,qBAAiC;AACjC,wBAYO;AACP,qBAAkC;AAClC,mBAAgD;AAChD,kBAA0B;AAK1B,yBAAuB;AAEvB,MAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,MAAM,mBAAmB;AAKV,SAAR,qBAAuC;AAAA,EAC7C;AACD,GAA+B;AAC9B,QAAM,sBAAkB,iCAAkB,QAAS;AAInD,QAAM,CAAE,YAAY,aAAc,QAAI,yBAAU,gBAAiB;AAMjE,QAAM,EAAE,MAAM,mBAAmB,QAAI,wBAAS,MAA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AA,oBACpB;AAAA,oBACA,4CAAC,kBAAAC,oBAAA,EAAK,MAAK,MACR,kBAAQ,UACX;AAAA;AAAA;AAAA,cACD;AAAA,cACA,4CAAC,8BAAW,kBAAQ,SAAS;AAAA,eAC9B;AAAA;AAAA,UAxBM,GAAI,QAAQ,IAAK;AAAA,QAyBxB;AAAA,MAEF,CAAE;AAAA,OACJ;AAAA,EAEF;AAEA,SAAO;AACR;",
6
6
  "names": ["componentsPrivateApis", "ItemGroup", "Item", "HStack", "Truncate", "Text"]
7
7
  }
package/build/index.js CHANGED
@@ -17,6 +17,8 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // packages/preferences/src/index.ts
20
22
  var index_exports = {};
21
23
  __export(index_exports, {
22
24
  store: () => import_store.store
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
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
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/lock-unlock.ts
19
21
  var lock_unlock_exports = {};
20
22
  __export(lock_unlock_exports, {
21
23
  lock: () => lock,
@@ -23,7 +25,7 @@ __export(lock_unlock_exports, {
23
25
  });
24
26
  module.exports = __toCommonJS(lock_unlock_exports);
25
27
  var import_private_apis = require("@wordpress/private-apis");
26
- const { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
28
+ var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
27
29
  "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
28
30
  "@wordpress/preferences"
29
31
  );
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
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,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/preferences/src/private-apis.ts
29
31
  var private_apis_exports = {};
30
32
  __export(private_apis_exports, {
31
33
  privateApis: () => privateApis
@@ -37,7 +39,7 @@ var import_preferences_modal = __toESM(require("./components/preferences-modal")
37
39
  var import_preferences_modal_section = __toESM(require("./components/preferences-modal-section"));
38
40
  var import_preferences_modal_tabs = __toESM(require("./components/preferences-modal-tabs"));
39
41
  var import_lock_unlock = require("./lock-unlock");
40
- const privateApis = {};
42
+ var privateApis = {};
41
43
  (0, import_lock_unlock.lock)(privateApis, {
42
44
  PreferenceBaseOption: import_preference_base_option.default,
43
45
  PreferenceToggleControl: import_preference_toggle_control.default,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
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,IAAM,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
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/store/actions.ts
19
21
  var actions_exports = {};
20
22
  __export(actions_exports, {
21
23
  set: () => set,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/actions.ts"],
4
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;",
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
  }
@@ -16,12 +16,14 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/store/constants.ts
19
21
  var constants_exports = {};
20
22
  __export(constants_exports, {
21
23
  STORE_NAME: () => STORE_NAME
22
24
  });
23
25
  module.exports = __toCommonJS(constants_exports);
24
- const STORE_NAME = "core/preferences";
26
+ var STORE_NAME = "core/preferences";
25
27
  // Annotate the CommonJS export names for ESM import in node:
26
28
  0 && (module.exports = {
27
29
  STORE_NAME
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/constants.ts"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,IAAM,aAAa;",
6
6
  "names": []
7
7
  }
@@ -26,6 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/preferences/src/store/index.ts
29
31
  var store_exports = {};
30
32
  __export(store_exports, {
31
33
  store: () => store
@@ -36,7 +38,7 @@ var import_reducer = __toESM(require("./reducer"));
36
38
  var actions = __toESM(require("./actions"));
37
39
  var selectors = __toESM(require("./selectors"));
38
40
  var import_constants = require("./constants");
39
- const store = (0, import_data.createReduxStore)(import_constants.STORE_NAME, {
41
+ var store = (0, import_data.createReduxStore)(import_constants.STORE_NAME, {
40
42
  reducer: import_reducer.default,
41
43
  actions,
42
44
  selectors
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/index.ts"],
4
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;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,cAAyB;AACzB,gBAA2B;AAC3B,uBAA2B;AAQpB,IAAM,YAAQ,8BAIlB,6BAAY;AAAA,EACd,wBAAAA;AAAA,EACA;AAAA,EACA;AACD,CAAE;AAAA,IAEF,sBAAU,KAAM;",
6
6
  "names": ["reducer"]
7
7
  }
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/preferences/src/store/reducer.ts
19
21
  var reducer_exports = {};
20
22
  __export(reducer_exports, {
21
23
  default: () => reducer_default,
@@ -52,7 +54,7 @@ function withPersistenceLayer(reducer) {
52
54
  return nextState;
53
55
  };
54
56
  }
55
- const preferences = withPersistenceLayer((state = {}, action) => {
57
+ var preferences = withPersistenceLayer((state = {}, action) => {
56
58
  if (action.type === "SET_PREFERENCE_VALUE") {
57
59
  const { scope, name, value } = action;
58
60
  return {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/reducer.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n/**\n * Internal dependencies\n */\nimport type { StoreState, WPPreferencesPersistenceLayer } from './types';\nimport type { AvailableActions } from './actions';\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param state Current state.\n * @param action Dispatched action.\n *\n * @return Updated state.\n */\nexport function defaults(\n\tstate: StoreState[ 'defaults' ] = {},\n\taction: AvailableActions\n): StoreState[ 'defaults' ] {\n\tif ( action.type === 'SET_PREFERENCE_DEFAULTS' ) {\n\t\tconst { scope, defaults: values } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t...values,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n}\n\ntype PreferencesReducer = (\n\tstate: StoreState[ 'preferences' ],\n\taction: AvailableActions\n) => StoreState[ 'preferences' ];\n\n/**\n * Higher order reducer that does the following:\n * - Merges any data from the persistence layer into the state when the\n * `SET_PERSISTENCE_LAYER` action is received.\n * - Passes any preferences changes to the persistence layer.\n *\n * @param reducer The preferences reducer.\n *\n * @return The enhanced reducer.\n */\nfunction withPersistenceLayer( reducer: PreferencesReducer ) {\n\tlet persistenceLayer: WPPreferencesPersistenceLayer< any >;\n\n\treturn ( state: StoreState[ 'preferences' ], action: AvailableActions ) => {\n\t\t// Set up the persistence layer, and return the persisted data\n\t\t// as the state.\n\t\tif ( action.type === 'SET_PERSISTENCE_LAYER' ) {\n\t\t\tconst { persistenceLayer: persistence, persistedData } = action;\n\t\t\tpersistenceLayer = persistence;\n\t\t\treturn persistedData;\n\t\t}\n\n\t\tconst nextState = reducer( state, action );\n\t\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\t\tpersistenceLayer?.set( nextState );\n\t\t}\n\n\t\treturn nextState;\n\t};\n}\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = withPersistenceLayer( ( state = {}, action ) => {\n\tif ( action.type === 'SET_PREFERENCE_VALUE' ) {\n\t\tconst { scope, name, value } = action;\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ scope ]: {\n\t\t\t\t...state[ scope ],\n\t\t\t\t[ name ]: value,\n\t\t\t},\n\t\t};\n\t}\n\n\treturn state;\n} );\n\nexport default combineReducers( {\n\tdefaults,\n\tpreferences,\n} );\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAgC;AAkBzB,SAAS,SACf,QAAkC,CAAC,GACnC,QAC2B;AAC3B,MAAK,OAAO,SAAS,2BAA4B;AAChD,UAAM,EAAE,OAAO,UAAU,OAAO,IAAI;AACpC,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAiBA,SAAS,qBAAsB,SAA8B;AAC5D,MAAI;AAEJ,SAAO,CAAE,OAAoC,WAA8B;AAG1E,QAAK,OAAO,SAAS,yBAA0B;AAC9C,YAAM,EAAE,kBAAkB,aAAa,cAAc,IAAI;AACzD,yBAAmB;AACnB,aAAO;AAAA,IACR;AAEA,UAAM,YAAY,QAAS,OAAO,MAAO;AACzC,QAAK,OAAO,SAAS,wBAAyB;AAC7C,wBAAkB,IAAK,SAAU;AAAA,IAClC;AAEA,WAAO;AAAA,EACR;AACD;AAUO,MAAM,cAAc,qBAAsB,CAAE,QAAQ,CAAC,GAAG,WAAY;AAC1E,MAAK,OAAO,SAAS,wBAAyB;AAC7C,UAAM,EAAE,OAAO,MAAM,MAAM,IAAI;AAC/B,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,CAAE,IAAK,GAAG;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR,CAAE;AAEF,IAAO,sBAAQ,6BAAiB;AAAA,EAC/B;AAAA,EACA;AACD,CAAE;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAgC;AAkBzB,SAAS,SACf,QAAkC,CAAC,GACnC,QAC2B;AAC3B,MAAK,OAAO,SAAS,2BAA4B;AAChD,UAAM,EAAE,OAAO,UAAU,OAAO,IAAI;AACpC,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;AAiBA,SAAS,qBAAsB,SAA8B;AAC5D,MAAI;AAEJ,SAAO,CAAE,OAAoC,WAA8B;AAG1E,QAAK,OAAO,SAAS,yBAA0B;AAC9C,YAAM,EAAE,kBAAkB,aAAa,cAAc,IAAI;AACzD,yBAAmB;AACnB,aAAO;AAAA,IACR;AAEA,UAAM,YAAY,QAAS,OAAO,MAAO;AACzC,QAAK,OAAO,SAAS,wBAAyB;AAC7C,wBAAkB,IAAK,SAAU;AAAA,IAClC;AAEA,WAAO;AAAA,EACR;AACD;AAUO,IAAM,cAAc,qBAAsB,CAAE,QAAQ,CAAC,GAAG,WAAY;AAC1E,MAAK,OAAO,SAAS,wBAAyB;AAC7C,UAAM,EAAE,OAAO,MAAM,MAAM,IAAI;AAC/B,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,MAAO,KAAM;AAAA,QAChB,CAAE,IAAK,GAAG;AAAA,MACX;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR,CAAE;AAEF,IAAO,sBAAQ,6BAAiB;AAAA,EAC/B;AAAA,EACA;AACD,CAAE;",
6
6
  "names": []
7
7
  }
@@ -26,13 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // packages/preferences/src/store/selectors.ts
29
31
  var selectors_exports = {};
30
32
  __export(selectors_exports, {
31
33
  get: () => get
32
34
  });
33
35
  module.exports = __toCommonJS(selectors_exports);
34
36
  var import_deprecated = __toESM(require("@wordpress/deprecated"));
35
- const withDeprecatedKeys = (originalGet) => (state, scope, name) => {
37
+ var withDeprecatedKeys = (originalGet) => (state, scope, name) => {
36
38
  const settingsToMoveToCore = [
37
39
  "allowRightClickOverrides",
38
40
  "distractionFree",
@@ -63,7 +65,7 @@ const withDeprecatedKeys = (originalGet) => (state, scope, name) => {
63
65
  }
64
66
  return originalGet(state, scope, name);
65
67
  };
66
- const get = withDeprecatedKeys(
68
+ var get = withDeprecatedKeys(
67
69
  (state, scope, name) => {
68
70
  const value = state.preferences[scope]?.[name];
69
71
  return value !== void 0 ? value : state.defaults[scope]?.[name];
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/selectors.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n/**\n * Internal dependencies\n */\nimport type { StoreState } from './types';\n\nconst withDeprecatedKeys =\n\t(\n\t\toriginalGet: ( state: StoreState, scope: string, name: string ) => any\n\t) =>\n\t( state: StoreState, scope: string, name: string ) => {\n\t\tconst settingsToMoveToCore = [\n\t\t\t'allowRightClickOverrides',\n\t\t\t'distractionFree',\n\t\t\t'editorMode',\n\t\t\t'fixedToolbar',\n\t\t\t'focusMode',\n\t\t\t'hiddenBlockTypes',\n\t\t\t'inactivePanels',\n\t\t\t'keepCaretInsideBlock',\n\t\t\t'mostUsedBlocks',\n\t\t\t'openPanels',\n\t\t\t'showBlockBreadcrumbs',\n\t\t\t'showIconLabels',\n\t\t\t'showListViewByDefault',\n\t\t\t'isPublishSidebarEnabled',\n\t\t\t'isComplementaryAreaVisible',\n\t\t\t'pinnedItems',\n\t\t];\n\n\t\tif (\n\t\t\tsettingsToMoveToCore.includes( name ) &&\n\t\t\t[ 'core/edit-post', 'core/edit-site' ].includes( scope )\n\t\t) {\n\t\t\tdeprecated(\n\t\t\t\t`wp.data.select( 'core/preferences' ).get( '${ scope }', '${ name }' )`,\n\t\t\t\t{\n\t\t\t\t\tsince: '6.5',\n\t\t\t\t\talternative: `wp.data.select( 'core/preferences' ).get( 'core', '${ name }' )`,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\treturn originalGet( state, 'core', name );\n\t\t}\n\n\t\treturn originalGet( state, scope, name );\n\t};\n\n/**\n * Returns a boolean indicating whether a prefer is active for a particular\n * scope.\n *\n * @param {StoreState} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} name The name of the feature.\n *\n * @return {*} Is the feature enabled?\n */\nexport const get = withDeprecatedKeys(\n\t( state: StoreState, scope: string, name: string ) => {\n\t\tconst value = state.preferences[ scope ]?.[ name ];\n\t\treturn value !== undefined ? value : state.defaults[ scope ]?.[ name ];\n\t}\n);\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AAMvB,MAAM,qBACL,CACC,gBAED,CAAE,OAAmB,OAAe,SAAkB;AACrD,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,MACC,qBAAqB,SAAU,IAAK,KACpC,CAAE,kBAAkB,gBAAiB,EAAE,SAAU,KAAM,GACtD;AACD,0BAAAA;AAAA,MACC,8CAA+C,KAAM,OAAQ,IAAK;AAAA,MAClE;AAAA,QACC,OAAO;AAAA,QACP,aAAa,sDAAuD,IAAK;AAAA,MAC1E;AAAA,IACD;AAEA,WAAO,YAAa,OAAO,QAAQ,IAAK;AAAA,EACzC;AAEA,SAAO,YAAa,OAAO,OAAO,IAAK;AACxC;AAYM,MAAM,MAAM;AAAA,EAClB,CAAE,OAAmB,OAAe,SAAkB;AACrD,UAAM,QAAQ,MAAM,YAAa,KAAM,IAAK,IAAK;AACjD,WAAO,UAAU,SAAY,QAAQ,MAAM,SAAU,KAAM,IAAK,IAAK;AAAA,EACtE;AACD;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuB;AAMvB,IAAM,qBACL,CACC,gBAED,CAAE,OAAmB,OAAe,SAAkB;AACrD,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,MACC,qBAAqB,SAAU,IAAK,KACpC,CAAE,kBAAkB,gBAAiB,EAAE,SAAU,KAAM,GACtD;AACD,0BAAAA;AAAA,MACC,8CAA+C,KAAM,OAAQ,IAAK;AAAA,MAClE;AAAA,QACC,OAAO;AAAA,QACP,aAAa,sDAAuD,IAAK;AAAA,MAC1E;AAAA,IACD;AAEA,WAAO,YAAa,OAAO,QAAQ,IAAK;AAAA,EACzC;AAEA,SAAO,YAAa,OAAO,OAAO,IAAK;AACxC;AAYM,IAAM,MAAM;AAAA,EAClB,CAAE,OAAmB,OAAe,SAAkB;AACrD,UAAM,QAAQ,MAAM,YAAa,KAAM,IAAK,IAAK;AACjD,WAAO,UAAU,SAAY,QAAQ,MAAM,SAAU,KAAM,IAAK,IAAK;AAAA,EACtE;AACD;",
6
6
  "names": ["deprecated"]
7
7
  }
@@ -12,6 +12,8 @@ var __copyProps = (to, from, except, desc) => {
12
12
  return to;
13
13
  };
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/preferences/src/store/types.ts
15
17
  var types_exports = {};
16
18
  module.exports = __toCommonJS(types_exports);
17
19
  //# sourceMappingURL=types.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/store/types.ts"],
4
4
  "sourcesContent": ["export type StoreState = {\n\tpreferences: { [ k in string ]: { [ p in string ]: any } };\n\tdefaults: { [ k in string ]: { [ p in string ]: any } };\n};\n\nexport type OmitFirstArg< F > = F extends (\n\tx: any,\n\t...args: infer P\n) => infer R\n\t? ( ...args: P ) => R\n\t: never;\n\nexport interface WPPreferencesPersistenceLayer< D extends Object > {\n\t/**\n\t * An async function that gets data from the persistence layer.\n\t */\n\tget: () => Promise< D >;\n\t/**\n\t * A function that sets data in the persistence layer.\n\t */\n\tset: ( value: D ) => void;\n}\n\nexport type ActionObject<\n\tT extends string,\n\tD extends Record< Exclude< string, 'type' >, any > = {},\n> = {\n\ttype: T;\n} & D;\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/preferences/src/components/index.ts
1
2
  import { default as default2 } from "./preference-toggle-menu-item";
2
3
  export {
3
4
  default2 as PreferenceToggleMenuItem
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/components/index.ts"],
4
4
  "sourcesContent": ["export { default as PreferenceToggleMenuItem } from './preference-toggle-menu-item';\n"],
5
- "mappings": "AAAA,SAAoB,WAAXA,gBAA2C;",
5
+ "mappings": ";AAAA,SAAoB,WAAXA,gBAA2C;",
6
6
  "names": ["default"]
7
7
  }
@@ -1,5 +1,6 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // packages/preferences/src/components/preference-base-option/index.tsx
2
2
  import { ToggleControl } from "@wordpress/components";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
3
4
  function BaseOption({
4
5
  help,
5
6
  label,
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/preference-base-option/index.tsx"],
4
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": "AAiBE,SACC,KADD;AAdF,SAAS,qBAAqB;AAM9B,SAAS,WAAY;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAqB;AACpB,SACC,qBAAC,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;",
5
+ "mappings": ";AAGA,SAAS,qBAAqB;AAc5B,SACC,KADD;AARF,SAAS,WAAY;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAqB;AACpB,SACC,qBAAC,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
  }
@@ -1,7 +1,8 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ // packages/preferences/src/components/preference-toggle-control/index.tsx
2
2
  import { useSelect, useDispatch } from "@wordpress/data";
3
3
  import { store as preferencesStore } from "../../store";
4
4
  import PreferenceBaseOption from "../preference-base-option";
5
+ import { jsx } from "react/jsx-runtime";
5
6
  function PreferenceToggleControl(props) {
6
7
  const {
7
8
  scope,