@wordpress/preferences-persistence 3.0.0 → 3.2.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 (82) hide show
  1. package/build/create/debounce-async.cjs +54 -58
  2. package/build/create/debounce-async.cjs.map +1 -7
  3. package/build/create/index.cjs +73 -79
  4. package/build/create/index.cjs.map +1 -7
  5. package/build/get-newest-data.cjs +50 -39
  6. package/build/get-newest-data.cjs.map +1 -7
  7. package/build/index.cjs +50 -43
  8. package/build/index.cjs.map +1 -7
  9. package/build/is-preferences-data.cjs +16 -25
  10. package/build/is-preferences-data.cjs.map +1 -7
  11. package/build/local-storage.cjs +33 -40
  12. package/build/local-storage.cjs.map +1 -7
  13. package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.cjs +48 -38
  14. package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.cjs.map +1 -7
  15. package/build/migrations/legacy-local-storage-data/index.cjs +93 -83
  16. package/build/migrations/legacy-local-storage-data/index.cjs.map +1 -7
  17. package/build/migrations/legacy-local-storage-data/move-feature-preferences.cjs +105 -77
  18. package/build/migrations/legacy-local-storage-data/move-feature-preferences.cjs.map +1 -7
  19. package/build/migrations/legacy-local-storage-data/move-individual-preference.cjs +69 -58
  20. package/build/migrations/legacy-local-storage-data/move-individual-preference.cjs.map +1 -7
  21. package/build/migrations/legacy-local-storage-data/move-interface-enable-items.cjs +92 -75
  22. package/build/migrations/legacy-local-storage-data/move-interface-enable-items.cjs.map +1 -7
  23. package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.cjs +76 -65
  24. package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.cjs.map +1 -7
  25. package/build/migrations/legacy-local-storage-data/types.cjs +4 -18
  26. package/build/migrations/preferences-package-data/convert-complementary-areas.cjs +18 -38
  27. package/build/migrations/preferences-package-data/convert-complementary-areas.cjs.map +1 -7
  28. package/build/migrations/preferences-package-data/convert-editor-settings.cjs +58 -72
  29. package/build/migrations/preferences-package-data/convert-editor-settings.cjs.map +1 -7
  30. package/build/migrations/preferences-package-data/index.cjs +27 -31
  31. package/build/migrations/preferences-package-data/index.cjs.map +1 -7
  32. package/build/types.cjs +4 -18
  33. package/build-module/create/debounce-async.mjs +50 -38
  34. package/build-module/create/debounce-async.mjs.map +1 -7
  35. package/build-module/create/index.mjs +48 -53
  36. package/build-module/create/index.mjs.map +1 -7
  37. package/build-module/get-newest-data.mjs +29 -15
  38. package/build-module/get-newest-data.mjs.map +1 -7
  39. package/build-module/index.mjs +23 -15
  40. package/build-module/index.mjs.map +1 -7
  41. package/build-module/is-preferences-data.mjs +12 -5
  42. package/build-module/is-preferences-data.mjs.map +1 -7
  43. package/build-module/local-storage.mjs +28 -15
  44. package/build-module/local-storage.mjs.map +1 -7
  45. package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.mjs +44 -18
  46. package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.mjs.map +1 -7
  47. package/build-module/migrations/legacy-local-storage-data/index.mjs +63 -51
  48. package/build-module/migrations/legacy-local-storage-data/index.mjs.map +1 -7
  49. package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.mjs +101 -57
  50. package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.mjs.map +1 -7
  51. package/build-module/migrations/legacy-local-storage-data/move-individual-preference.mjs +65 -38
  52. package/build-module/migrations/legacy-local-storage-data/move-individual-preference.mjs.map +1 -7
  53. package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.mjs +88 -55
  54. package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.mjs.map +1 -7
  55. package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.mjs +72 -45
  56. package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.mjs.map +1 -7
  57. package/build-module/migrations/legacy-local-storage-data/types.mjs +0 -1
  58. package/build-module/migrations/preferences-package-data/convert-complementary-areas.mjs +14 -18
  59. package/build-module/migrations/preferences-package-data/convert-complementary-areas.mjs.map +1 -7
  60. package/build-module/migrations/preferences-package-data/convert-editor-settings.mjs +40 -50
  61. package/build-module/migrations/preferences-package-data/convert-editor-settings.mjs.map +1 -7
  62. package/build-module/migrations/preferences-package-data/index.mjs +7 -8
  63. package/build-module/migrations/preferences-package-data/index.mjs.map +1 -7
  64. package/build-module/types.mjs +0 -1
  65. package/package.json +5 -4
  66. package/src/create/test/{debounce-async.js → debounce-async.ts} +7 -3
  67. package/src/create/test/{index.jsdom.test.js → index.jsdom.test.ts} +8 -5
  68. package/src/migrations/legacy-local-storage-data/test/{index.js → index.ts} +6 -1
  69. package/src/migrations/preferences-package-data/test/{convert-editor-settings.js → convert-editor-settings.ts} +3 -0
  70. package/src/test/{index.jsdom.test.js → index.jsdom.test.ts} +6 -4
  71. package/build/migrations/legacy-local-storage-data/types.cjs.map +0 -7
  72. package/build/types.cjs.map +0 -7
  73. package/build-module/migrations/legacy-local-storage-data/types.mjs.map +0 -7
  74. package/build-module/types.mjs.map +0 -7
  75. /package/src/migrations/legacy-local-storage-data/test/{convert-edit-post-panels.js → convert-edit-post-panels.ts} +0 -0
  76. /package/src/migrations/legacy-local-storage-data/test/{move-feature-preferences.js → move-feature-preferences.ts} +0 -0
  77. /package/src/migrations/legacy-local-storage-data/test/{move-individual-preference.js → move-individual-preference.ts} +0 -0
  78. /package/src/migrations/legacy-local-storage-data/test/{move-interface-enable-items.js → move-interface-enable-items.ts} +0 -0
  79. /package/src/migrations/legacy-local-storage-data/test/{move-third-party-feature-preferences.js → move-third-party-feature-preferences.ts} +0 -0
  80. /package/src/migrations/preferences-package-data/test/{convert-complementary-areas.js → convert-complementary-areas.ts} +0 -0
  81. /package/src/migrations/preferences-package-data/test/{index.js → index.ts} +0 -0
  82. /package/src/test/{local-storage.jsdom.test.js → local-storage.jsdom.test.ts} +0 -0
@@ -1,48 +1,75 @@
1
1
  // packages/preferences-persistence/src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts
2
+ /**
3
+ * The interface package previously had a public API that could be used by
4
+ * plugins to set persisted boolean 'feature' preferences.
5
+ *
6
+ * While usage was likely non-existent or very small, this function ensures
7
+ * those are migrated to the preferences data structure. The interface
8
+ * package's APIs have now been deprecated and use the preferences store.
9
+ *
10
+ * This will convert data that looks like this:
11
+ * ```js
12
+ * {
13
+ * 'core/interface': {
14
+ * preferences: {
15
+ * features: {
16
+ * 'my-plugin': {
17
+ * myPluginFeature: true
18
+ * }
19
+ * }
20
+ * }
21
+ * }
22
+ * }
23
+ * ```
24
+ *
25
+ * To this:
26
+ * ```js
27
+ * * {
28
+ * 'core/preferences': {
29
+ * preferences: {
30
+ * 'my-plugin': {
31
+ * myPluginFeature: true
32
+ * }
33
+ * }
34
+ * }
35
+ * }
36
+ * ```
37
+ *
38
+ * @param state The local storage state
39
+ *
40
+ * @return The state with third party preferences moved to the
41
+ * preferences data structure.
42
+ */
2
43
  function moveThirdPartyFeaturePreferencesToPreferences(state) {
3
- const interfaceStoreName = "core/interface";
4
- const preferencesStoreName = "core/preferences";
5
- const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
6
- const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
7
- if (!interfaceScopeKeys?.length) {
8
- return state;
9
- }
10
- return interfaceScopeKeys.reduce(function(convertedState, scope) {
11
- if (scope.startsWith("core")) {
12
- return convertedState;
13
- }
14
- const featuresToMigrate = interfaceScopes?.[scope];
15
- if (!featuresToMigrate) {
16
- return convertedState;
17
- }
18
- const existingMigratedData = convertedState?.[preferencesStoreName]?.preferences?.[scope];
19
- if (existingMigratedData) {
20
- return convertedState;
21
- }
22
- const otherPreferencesScopes = convertedState?.[preferencesStoreName]?.preferences;
23
- const otherInterfaceState = convertedState?.[interfaceStoreName];
24
- const otherInterfaceScopes = convertedState?.[interfaceStoreName]?.preferences?.features;
25
- return {
26
- ...convertedState,
27
- [preferencesStoreName]: {
28
- preferences: {
29
- ...otherPreferencesScopes,
30
- [scope]: featuresToMigrate
31
- }
32
- },
33
- [interfaceStoreName]: {
34
- ...otherInterfaceState,
35
- preferences: {
36
- features: {
37
- ...otherInterfaceScopes,
38
- [scope]: void 0
39
- }
40
- }
41
- }
42
- };
43
- }, state);
44
+ const interfaceStoreName = "core/interface";
45
+ const preferencesStoreName = "core/preferences";
46
+ const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
47
+ const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
48
+ if (!interfaceScopeKeys?.length) return state;
49
+ return interfaceScopeKeys.reduce(function(convertedState, scope) {
50
+ if (scope.startsWith("core")) return convertedState;
51
+ const featuresToMigrate = interfaceScopes?.[scope];
52
+ if (!featuresToMigrate) return convertedState;
53
+ if (convertedState?.[preferencesStoreName]?.preferences?.[scope]) return convertedState;
54
+ const otherPreferencesScopes = convertedState?.[preferencesStoreName]?.preferences;
55
+ const otherInterfaceState = convertedState?.[interfaceStoreName];
56
+ const otherInterfaceScopes = convertedState?.[interfaceStoreName]?.preferences?.features;
57
+ return {
58
+ ...convertedState,
59
+ [preferencesStoreName]: { preferences: {
60
+ ...otherPreferencesScopes,
61
+ [scope]: featuresToMigrate
62
+ } },
63
+ [interfaceStoreName]: {
64
+ ...otherInterfaceState,
65
+ preferences: { features: {
66
+ ...otherInterfaceScopes,
67
+ [scope]: void 0
68
+ } }
69
+ }
70
+ };
71
+ }, state);
44
72
  }
45
- export {
46
- moveThirdPartyFeaturePreferencesToPreferences as default
47
- };
48
- //# sourceMappingURL=move-third-party-feature-preferences.mjs.map
73
+ export { moveThirdPartyFeaturePreferencesToPreferences as default };
74
+
75
+ //# sourceMappingURL=move-third-party-feature-preferences.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts"],
4
- "sourcesContent": ["import type { LegacyData } from './types';\n\n/**\n * The interface package previously had a public API that could be used by\n * plugins to set persisted boolean 'feature' preferences.\n *\n * While usage was likely non-existent or very small, this function ensures\n * those are migrated to the preferences data structure. The interface\n * package's APIs have now been deprecated and use the preferences store.\n *\n * This will convert data that looks like this:\n * ```js\n * {\n * 'core/interface': {\n * preferences: {\n * features: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * To this:\n * ```js\n * * {\n * 'core/preferences': {\n * preferences: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * ```\n *\n * @param state The local storage state\n *\n * @return The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences(\n\tstate: LegacyData\n): LegacyData {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\n\tconst interfaceScopes =\n\t\tstate?.[ interfaceStoreName ]?.preferences?.features;\n\tconst interfaceScopeKeys = interfaceScopes\n\t\t? Object.keys( interfaceScopes )\n\t\t: [];\n\n\tif ( ! interfaceScopeKeys?.length ) {\n\t\treturn state;\n\t}\n\n\treturn interfaceScopeKeys.reduce( function ( convertedState, scope ) {\n\t\tif ( scope.startsWith( 'core' ) ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst featuresToMigrate = interfaceScopes?.[ scope ];\n\t\tif ( ! featuresToMigrate ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst existingMigratedData =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences?.[ scope ];\n\n\t\tif ( existingMigratedData ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst otherPreferencesScopes =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences;\n\t\tconst otherInterfaceState = convertedState?.[ interfaceStoreName ];\n\t\tconst otherInterfaceScopes =\n\t\t\tconvertedState?.[ interfaceStoreName ]?.preferences?.features;\n\n\t\treturn {\n\t\t\t...convertedState,\n\t\t\t[ preferencesStoreName ]: {\n\t\t\t\tpreferences: {\n\t\t\t\t\t...otherPreferencesScopes,\n\t\t\t\t\t[ scope ]: featuresToMigrate,\n\t\t\t\t},\n\t\t\t},\n\t\t\t[ interfaceStoreName ]: {\n\t\t\t\t...otherInterfaceState,\n\t\t\t\tpreferences: {\n\t\t\t\t\tfeatures: {\n\t\t\t\t\t\t...otherInterfaceScopes,\n\t\t\t\t\t\t[ scope ]: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, state );\n}\n"],
5
- "mappings": ";AA2Ce,SAAR,8CACN,OACa;AACb,QAAM,qBAAqB;AAC3B,QAAM,uBAAuB;AAE7B,QAAM,kBACL,QAAS,kBAAmB,GAAG,aAAa;AAC7C,QAAM,qBAAqB,kBACxB,OAAO,KAAM,eAAgB,IAC7B,CAAC;AAEJ,MAAK,CAAE,oBAAoB,QAAS;AACnC,WAAO;AAAA,EACR;AAEA,SAAO,mBAAmB,OAAQ,SAAW,gBAAgB,OAAQ;AACpE,QAAK,MAAM,WAAY,MAAO,GAAI;AACjC,aAAO;AAAA,IACR;AAEA,UAAM,oBAAoB,kBAAmB,KAAM;AACnD,QAAK,CAAE,mBAAoB;AAC1B,aAAO;AAAA,IACR;AAEA,UAAM,uBACL,iBAAkB,oBAAqB,GAAG,cAAe,KAAM;AAEhE,QAAK,sBAAuB;AAC3B,aAAO;AAAA,IACR;AAEA,UAAM,yBACL,iBAAkB,oBAAqB,GAAG;AAC3C,UAAM,sBAAsB,iBAAkB,kBAAmB;AACjE,UAAM,uBACL,iBAAkB,kBAAmB,GAAG,aAAa;AAEtD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,oBAAqB,GAAG;AAAA,QACzB,aAAa;AAAA,UACZ,GAAG;AAAA,UACH,CAAE,KAAM,GAAG;AAAA,QACZ;AAAA,MACD;AAAA,MACA,CAAE,kBAAmB,GAAG;AAAA,QACvB,GAAG;AAAA,QACH,aAAa;AAAA,UACZ,UAAU;AAAA,YACT,GAAG;AAAA,YACH,CAAE,KAAM,GAAG;AAAA,UACZ;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD,GAAG,KAAM;AACV;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"move-third-party-feature-preferences.mjs","names":[],"sources":["../../../src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts"],"sourcesContent":["import type { LegacyData } from './types';\n\n/**\n * The interface package previously had a public API that could be used by\n * plugins to set persisted boolean 'feature' preferences.\n *\n * While usage was likely non-existent or very small, this function ensures\n * those are migrated to the preferences data structure. The interface\n * package's APIs have now been deprecated and use the preferences store.\n *\n * This will convert data that looks like this:\n * ```js\n * {\n * 'core/interface': {\n * preferences: {\n * features: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * To this:\n * ```js\n * * {\n * 'core/preferences': {\n * preferences: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * ```\n *\n * @param state The local storage state\n *\n * @return The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences(\n\tstate: LegacyData\n): LegacyData {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\n\tconst interfaceScopes =\n\t\tstate?.[ interfaceStoreName ]?.preferences?.features;\n\tconst interfaceScopeKeys = interfaceScopes\n\t\t? Object.keys( interfaceScopes )\n\t\t: [];\n\n\tif ( ! interfaceScopeKeys?.length ) {\n\t\treturn state;\n\t}\n\n\treturn interfaceScopeKeys.reduce( function ( convertedState, scope ) {\n\t\tif ( scope.startsWith( 'core' ) ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst featuresToMigrate = interfaceScopes?.[ scope ];\n\t\tif ( ! featuresToMigrate ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst existingMigratedData =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences?.[ scope ];\n\n\t\tif ( existingMigratedData ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst otherPreferencesScopes =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences;\n\t\tconst otherInterfaceState = convertedState?.[ interfaceStoreName ];\n\t\tconst otherInterfaceScopes =\n\t\t\tconvertedState?.[ interfaceStoreName ]?.preferences?.features;\n\n\t\treturn {\n\t\t\t...convertedState,\n\t\t\t[ preferencesStoreName ]: {\n\t\t\t\tpreferences: {\n\t\t\t\t\t...otherPreferencesScopes,\n\t\t\t\t\t[ scope ]: featuresToMigrate,\n\t\t\t\t},\n\t\t\t},\n\t\t\t[ interfaceStoreName ]: {\n\t\t\t\t...otherInterfaceState,\n\t\t\t\tpreferences: {\n\t\t\t\t\tfeatures: {\n\t\t\t\t\t\t...otherInterfaceScopes,\n\t\t\t\t\t\t[ scope ]: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, state );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAwB,8CACvB,OACa;CACb,MAAM,qBAAqB;CAC3B,MAAM,uBAAuB;CAE7B,MAAM,kBACL,QAAS,mBAAoB,EAAE,aAAa;CAC7C,MAAM,qBAAqB,kBACxB,OAAO,KAAM,eAAgB,IAC7B,CAAC;CAEJ,IAAK,CAAE,oBAAoB,QAC1B,OAAO;CAGR,OAAO,mBAAmB,OAAQ,SAAW,gBAAgB,OAAQ;EACpE,IAAK,MAAM,WAAY,MAAO,GAC7B,OAAO;EAGR,MAAM,oBAAoB,kBAAmB;EAC7C,IAAK,CAAE,mBACN,OAAO;EAMR,IAFC,iBAAkB,qBAAsB,EAAE,cAAe,QAGzD,OAAO;EAGR,MAAM,yBACL,iBAAkB,qBAAsB,EAAE;EAC3C,MAAM,sBAAsB,iBAAkB;EAC9C,MAAM,uBACL,iBAAkB,mBAAoB,EAAE,aAAa;EAEtD,OAAO;GACN,GAAG;IACD,uBAAwB,EACzB,aAAa;IACZ,GAAG;KACD,QAAS;GACZ,EACD;IACE,qBAAsB;IACvB,GAAG;IACH,aAAa,EACZ,UAAU;KACT,GAAG;MACD,QAAS,KAAA;IACZ,EACD;GACD;EACD;CACD,GAAG,KAAM;AACV"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.mjs.map
@@ -1,21 +1,17 @@
1
1
  // packages/preferences-persistence/src/migrations/preferences-package-data/convert-complementary-areas.ts
2
2
  function convertComplementaryAreas(state) {
3
- return Object.keys(state).reduce(
4
- (stateAccumulator, scope) => {
5
- const scopeData = state[scope];
6
- if (scopeData?.complementaryArea) {
7
- const updatedScopeData = { ...scopeData };
8
- delete updatedScopeData.complementaryArea;
9
- updatedScopeData.isComplementaryAreaVisible = true;
10
- stateAccumulator[scope] = updatedScopeData;
11
- return stateAccumulator;
12
- }
13
- return stateAccumulator;
14
- },
15
- { ...state }
16
- );
3
+ return Object.keys(state).reduce((stateAccumulator, scope) => {
4
+ const scopeData = state[scope];
5
+ if (scopeData?.complementaryArea) {
6
+ const updatedScopeData = { ...scopeData };
7
+ delete updatedScopeData.complementaryArea;
8
+ updatedScopeData.isComplementaryAreaVisible = true;
9
+ stateAccumulator[scope] = updatedScopeData;
10
+ return stateAccumulator;
11
+ }
12
+ return stateAccumulator;
13
+ }, { ...state });
17
14
  }
18
- export {
19
- convertComplementaryAreas as default
20
- };
21
- //# sourceMappingURL=convert-complementary-areas.mjs.map
15
+ export { convertComplementaryAreas as default };
16
+
17
+ //# sourceMappingURL=convert-complementary-areas.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migrations/preferences-package-data/convert-complementary-areas.ts"],
4
- "sourcesContent": ["import type { ScopedPreferences } from '../../types';\n\nexport default function convertComplementaryAreas( state: ScopedPreferences ) {\n\treturn Object.keys( state ).reduce(\n\t\t( stateAccumulator, scope ) => {\n\t\t\tconst scopeData = state[ scope ];\n\n\t\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\t\tif ( scopeData?.complementaryArea ) {\n\t\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\t\treturn stateAccumulator;\n\t\t\t}\n\n\t\t\treturn stateAccumulator;\n\t\t},\n\t\t{ ...state }\n\t);\n}\n"],
5
- "mappings": ";AAEe,SAAR,0BAA4C,OAA2B;AAC7E,SAAO,OAAO,KAAM,KAAM,EAAE;AAAA,IAC3B,CAAE,kBAAkB,UAAW;AAC9B,YAAM,YAAY,MAAO,KAAM;AAG/B,UAAK,WAAW,mBAAoB;AACnC,cAAM,mBAAmB,EAAE,GAAG,UAAU;AACxC,eAAO,iBAAiB;AACxB,yBAAiB,6BAA6B;AAC9C,yBAAkB,KAAM,IAAI;AAC5B,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,IACR;AAAA,IACA,EAAE,GAAG,MAAM;AAAA,EACZ;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"convert-complementary-areas.mjs","names":[],"sources":["../../../src/migrations/preferences-package-data/convert-complementary-areas.ts"],"sourcesContent":["import type { ScopedPreferences } from '../../types';\n\nexport default function convertComplementaryAreas( state: ScopedPreferences ) {\n\treturn Object.keys( state ).reduce(\n\t\t( stateAccumulator, scope ) => {\n\t\t\tconst scopeData = state[ scope ];\n\n\t\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\t\tif ( scopeData?.complementaryArea ) {\n\t\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\t\treturn stateAccumulator;\n\t\t\t}\n\n\t\t\treturn stateAccumulator;\n\t\t},\n\t\t{ ...state }\n\t);\n}\n"],"mappings":";AAEA,SAAwB,0BAA2B,OAA2B;CAC7E,OAAO,OAAO,KAAM,KAAM,CAAC,CAAC,QACzB,kBAAkB,UAAW;EAC9B,MAAM,YAAY,MAAO;EAGzB,IAAK,WAAW,mBAAoB;GACnC,MAAM,mBAAmB,EAAE,GAAG,UAAU;GACxC,OAAO,iBAAiB;GACxB,iBAAiB,6BAA6B;GAC9C,iBAAkB,SAAU;GAC5B,OAAO;EACR;EAEA,OAAO;CACR,GACA,EAAE,GAAG,MAAM,CACZ;AACD"}
@@ -1,53 +1,43 @@
1
- // packages/preferences-persistence/src/migrations/preferences-package-data/convert-editor-settings.ts
2
1
  import isPreferencesData from "../../is-preferences-data.mjs";
3
- var copyScope = (scope) => isPreferencesData(scope) ? { ...scope } : void 0;
2
+ // packages/preferences-persistence/src/migrations/preferences-package-data/convert-editor-settings.ts
3
+ const copyScope = (scope) => isPreferencesData(scope) ? { ...scope } : void 0;
4
4
  function convertEditorSettings(data) {
5
- const newData = { ...data };
6
- const editPost = copyScope(data["core/edit-post"]);
7
- const editSite = copyScope(data["core/edit-site"]);
8
- const settingsToMoveToCore = [
9
- "allowRightClickOverrides",
10
- "distractionFree",
11
- "editorMode",
12
- "fixedToolbar",
13
- "focusMode",
14
- "hiddenBlockTypes",
15
- "inactivePanels",
16
- "keepCaretInsideBlock",
17
- "mostUsedBlocks",
18
- "openPanels",
19
- "showBlockBreadcrumbs",
20
- "showIconLabels",
21
- "showListViewByDefault",
22
- "isPublishSidebarEnabled",
23
- "isComplementaryAreaVisible",
24
- "pinnedItems"
25
- ];
26
- settingsToMoveToCore.forEach((setting) => {
27
- if (editPost?.[setting] !== void 0) {
28
- newData.core = {
29
- ...copyScope(newData.core),
30
- [setting]: editPost[setting]
31
- };
32
- delete editPost[setting];
33
- }
34
- if (editSite?.[setting] !== void 0) {
35
- delete editSite[setting];
36
- }
37
- });
38
- if (editPost && Object.keys(editPost).length > 0) {
39
- newData["core/edit-post"] = editPost;
40
- } else {
41
- delete newData["core/edit-post"];
42
- }
43
- if (editSite && Object.keys(editSite).length > 0) {
44
- newData["core/edit-site"] = editSite;
45
- } else {
46
- delete newData["core/edit-site"];
47
- }
48
- return newData;
5
+ const newData = { ...data };
6
+ const editPost = copyScope(data["core/edit-post"]);
7
+ const editSite = copyScope(data["core/edit-site"]);
8
+ [
9
+ "allowRightClickOverrides",
10
+ "distractionFree",
11
+ "editorMode",
12
+ "fixedToolbar",
13
+ "focusMode",
14
+ "hiddenBlockTypes",
15
+ "inactivePanels",
16
+ "keepCaretInsideBlock",
17
+ "mostUsedBlocks",
18
+ "openPanels",
19
+ "showBlockBreadcrumbs",
20
+ "showIconLabels",
21
+ "showListViewByDefault",
22
+ "isPublishSidebarEnabled",
23
+ "isComplementaryAreaVisible",
24
+ "pinnedItems"
25
+ ].forEach((setting) => {
26
+ if (editPost?.[setting] !== void 0) {
27
+ newData.core = {
28
+ ...copyScope(newData.core),
29
+ [setting]: editPost[setting]
30
+ };
31
+ delete editPost[setting];
32
+ }
33
+ if (editSite?.[setting] !== void 0) delete editSite[setting];
34
+ });
35
+ if (editPost && Object.keys(editPost).length > 0) newData["core/edit-post"] = editPost;
36
+ else delete newData["core/edit-post"];
37
+ if (editSite && Object.keys(editSite).length > 0) newData["core/edit-site"] = editSite;
38
+ else delete newData["core/edit-site"];
39
+ return newData;
49
40
  }
50
- export {
51
- convertEditorSettings as default
52
- };
53
- //# sourceMappingURL=convert-editor-settings.mjs.map
41
+ export { convertEditorSettings as default };
42
+
43
+ //# sourceMappingURL=convert-editor-settings.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],
4
- "sourcesContent": ["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],
5
- "mappings": ";AAAA,OAAO,uBAAuB;AAG9B,IAAM,YAAY,CAAE,UACnB,kBAAmB,KAAM,IAAI,EAAE,GAAG,MAAM,IAAI;AAE9B,SAAR,sBAAwC,MAA0B;AACxE,QAAM,UAAU,EAAE,GAAG,KAAK;AAC1B,QAAM,WAAW,UAAW,KAAM,gBAAiB,CAAE;AACrD,QAAM,WAAW,UAAW,KAAM,gBAAiB,CAAE;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,uBAAqB,QAAS,CAAE,YAAa;AAC5C,QAAK,WAAY,OAAQ,MAAM,QAAY;AAC1C,cAAQ,OAAO;AAAA,QACd,GAAG,UAAW,QAAQ,IAAK;AAAA,QAC3B,CAAE,OAAQ,GAAG,SAAU,OAAQ;AAAA,MAChC;AACA,aAAO,SAAU,OAAQ;AAAA,IAC1B;AAEA,QAAK,WAAY,OAAQ,MAAM,QAAY;AAC1C,aAAO,SAAU,OAAQ;AAAA,IAC1B;AAAA,EACD,CAAE;AAGF,MAAK,YAAY,OAAO,KAAM,QAAS,EAAE,SAAS,GAAI;AACrD,YAAS,gBAAiB,IAAI;AAAA,EAC/B,OAAO;AACN,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,MAAK,YAAY,OAAO,KAAM,QAAS,EAAE,SAAS,GAAI;AACrD,YAAS,gBAAiB,IAAI;AAAA,EAC/B,OAAO;AACN,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"convert-editor-settings.mjs","names":[],"sources":["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],"sourcesContent":["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],"mappings":";;AAGA,MAAM,aAAc,UACnB,kBAAmB,KAAM,IAAI,EAAE,GAAG,MAAM,IAAI,KAAA;AAE7C,SAAwB,sBAAuB,MAA0B;CACxE,MAAM,UAAU,EAAE,GAAG,KAAK;CAC1B,MAAM,WAAW,UAAW,KAAM,iBAAmB;CACrD,MAAM,WAAW,UAAW,KAAM,iBAAmB;CAoBrD;EAlBC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGkB,CAAC,CAAC,SAAW,YAAa;EAC5C,IAAK,WAAY,aAAc,KAAA,GAAY;GAC1C,QAAQ,OAAO;IACd,GAAG,UAAW,QAAQ,IAAK;KACzB,UAAW,SAAU;GACxB;GACA,OAAO,SAAU;EAClB;EAEA,IAAK,WAAY,aAAc,KAAA,GAC9B,OAAO,SAAU;CAEnB,CAAE;CAGF,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,OAAO;AACR"}
@@ -1,12 +1,11 @@
1
- // packages/preferences-persistence/src/migrations/preferences-package-data/index.ts
2
1
  import convertComplementaryAreas from "./convert-complementary-areas.mjs";
3
2
  import convertEditorSettings from "./convert-editor-settings.mjs";
3
+ // packages/preferences-persistence/src/migrations/preferences-package-data/index.ts
4
4
  function convertPreferencesPackageData(data) {
5
- let newData = convertComplementaryAreas(data);
6
- newData = convertEditorSettings(newData);
7
- return newData;
5
+ let newData = convertComplementaryAreas(data);
6
+ newData = convertEditorSettings(newData);
7
+ return newData;
8
8
  }
9
- export {
10
- convertPreferencesPackageData as default
11
- };
12
- //# sourceMappingURL=index.mjs.map
9
+ export { convertPreferencesPackageData as default };
10
+
11
+ //# sourceMappingURL=index.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migrations/preferences-package-data/index.ts"],
4
- "sourcesContent": ["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],
5
- "mappings": ";AAAA,OAAO,+BAA+B;AACtC,OAAO,2BAA2B;AAGnB,SAAR,8BACN,MACC;AACD,MAAI,UAAU,0BAA2B,IAAK;AAC9C,YAAU,sBAAuB,OAAQ;AACzC,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/migrations/preferences-package-data/index.ts"],"sourcesContent":["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],"mappings":";;;AAIA,SAAwB,8BACvB,MACC;CACD,IAAI,UAAU,0BAA2B,IAAK;CAC9C,UAAU,sBAAuB,OAAQ;CACzC,OAAO;AACR"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/preferences-persistence",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Persistence utilities for `wordpress/preferences`.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -42,13 +42,14 @@
42
42
  "types": "build-types",
43
43
  "sideEffects": false,
44
44
  "dependencies": {
45
- "@wordpress/api-fetch": "^8.0.0"
45
+ "@wordpress/api-fetch": "^8.2.0"
46
46
  },
47
47
  "devDependencies": {
48
- "vitest": "^5.0.3"
48
+ "@types/node": "^24.13.3",
49
+ "vitest": "^5.1.0"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public"
52
53
  },
53
- "gitHead": "8d30f92cbbde3ddf781c8799443c649befbbcb88"
54
+ "gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
54
55
  }
@@ -8,8 +8,10 @@ function flushPromises() {
8
8
  }
9
9
 
10
10
  // Promisify a timeout for use with vi.fn.
11
- function timeout( milliseconds ) {
12
- return new Promise( ( resolve ) => setTimeout( resolve, milliseconds ) );
11
+ function timeout( milliseconds: number ) {
12
+ return new Promise< void >( ( resolve ) =>
13
+ setTimeout( resolve, milliseconds )
14
+ );
13
15
  }
14
16
 
15
17
  describe( 'debounceAsync', () => {
@@ -23,7 +25,9 @@ describe( 'debounceAsync', () => {
23
25
  it( 'calls the function on the leading edge and then once on the trailing edge when there are multiple calls', async () => {
24
26
  vi.useFakeTimers( { toFake: [ 'setTimeout', 'clearTimeout' ] } );
25
27
  try {
26
- const fn = vi.fn( async () => {} );
28
+ const fn = vi.fn< ( value: string ) => Promise< void > >(
29
+ async () => {}
30
+ );
27
31
  const debounced = debounceAsync( fn, 20 );
28
32
 
29
33
  debounced( 'A' );
@@ -2,11 +2,11 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
2
2
  import apiFetch from '@wordpress/api-fetch';
3
3
  import create from '..';
4
4
 
5
- vi.mock( import( '@wordpress/api-fetch' ), () => ( {
6
- default: vi.fn(),
7
- } ) );
5
+ vi.mock( import( '@wordpress/api-fetch' ) );
8
6
 
9
- const mockedApiFetch = vi.mocked( apiFetch );
7
+ const mockedApiFetch = vi.mocked(
8
+ apiFetch< { meta: { persisted_preferences: unknown } } | void >
9
+ );
10
10
 
11
11
  describe( 'create', () => {
12
12
  afterEach( () => {
@@ -180,7 +180,10 @@ describe( 'create', () => {
180
180
  },
181
181
  } );
182
182
 
183
- const { get } = create( { preloadedData: [] } );
183
+ const { get } = create( {
184
+ // @ts-expect-error [] is not a PreferencesData object; invalid preloaded data triggers a fetch.
185
+ preloadedData: [],
186
+ } );
184
187
  expect( await get() ).toEqual( { core: { fixedToolbar: true } } );
185
188
  expect( mockedApiFetch ).toHaveBeenCalled();
186
189
  } );
@@ -217,7 +217,12 @@ describe( 'convertLegacyData', () => {
217
217
 
218
218
  it( 'ignores legacy preferences that are not an object', () => {
219
219
  expect(
220
- convertLegacyData( { 'core/preferences': { preferences: [] } } )
220
+ convertLegacyData( {
221
+ 'core/preferences': {
222
+ // @ts-expect-error [] is not a preferences object; non-object legacy data is ignored.
223
+ preferences: [],
224
+ },
225
+ } )
221
226
  ).toBeUndefined();
222
227
  } );
223
228
  } );
@@ -37,7 +37,9 @@ describe( 'convertEditorSettings', () => {
37
37
  ( scope ) => {
38
38
  expect(
39
39
  convertEditorSettings( {
40
+ // @ts-expect-error String, array, and null are not valid ScopePreferences objects; invalid scopes are removed.
40
41
  'core/edit-post': scope,
42
+ // @ts-expect-error String, array, and null are not valid ScopePreferences objects; invalid scopes are removed.
41
43
  'core/edit-site': scope,
42
44
  } )
43
45
  ).toEqual( {} );
@@ -47,6 +49,7 @@ describe( 'convertEditorSettings', () => {
47
49
  it( 'replaces a `core` scope that is not an object', () => {
48
50
  expect(
49
51
  convertEditorSettings( {
52
+ // @ts-expect-error 'abc' is not a ScopePreferences object; an invalid core scope is replaced.
50
53
  core: 'abc',
51
54
  'core/edit-post': { fixedToolbar: true },
52
55
  } )
@@ -1,12 +1,14 @@
1
- import { afterEach, describe, expect, it, vi } from 'vitest';
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
  import apiFetch from '@wordpress/api-fetch';
3
3
  import { __unstableCreatePersistenceLayer } from '..';
4
4
 
5
- vi.mock( import( '@wordpress/api-fetch' ), () => ( {
6
- default: vi.fn( () => Promise.resolve() ),
7
- } ) );
5
+ vi.mock( import( '@wordpress/api-fetch' ) );
8
6
 
9
7
  describe( '__unstableCreatePersistenceLayer', () => {
8
+ beforeEach( () => {
9
+ vi.mocked( apiFetch ).mockResolvedValue( undefined );
10
+ } );
11
+
10
12
  afterEach( () => {
11
13
  vi.mocked( apiFetch ).mockClear();
12
14
  vi.restoreAllMocks();
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migrations/legacy-local-storage-data/types.ts"],
4
- "sourcesContent": ["import type { ScopedPreferences } from '../../types';\n\n/**\n * Boolean 'feature' preferences, keyed by feature name.\n */\nexport type FeaturePreferences = Record< string, boolean | undefined >;\n\n/**\n * Persisted state of a package's store, such as `core/edit-post`.\n */\nexport interface LegacyStoreState {\n\tpreferences?: Record< string, unknown >;\n\t[ key: string ]: unknown;\n}\n\n/**\n * Persisted state of the `core/interface` store.\n */\nexport interface LegacyInterfaceStoreState {\n\tpreferences?: {\n\t\tfeatures?: Record< string, FeaturePreferences | undefined >;\n\t\t[ key: string ]: unknown;\n\t};\n\tenableItems?: {\n\t\tsingleEnableItems?: {\n\t\t\tcomplementaryArea?: Record< string, string >;\n\t\t};\n\t\tmultipleEnableItems?: {\n\t\t\tpinnedItems?: Record< string, Record< string, boolean > >;\n\t\t};\n\t};\n\t[ key: string ]: unknown;\n}\n\n/**\n * Persisted state of the `core/preferences` store.\n */\nexport interface LegacyPreferencesStoreState {\n\tpreferences?: ScopedPreferences;\n\t[ key: string ]: unknown;\n}\n\n/**\n * Local storage data in the legacy `@wordpress/data` format, keyed by store name.\n */\nexport interface LegacyData {\n\t'core/interface'?: LegacyInterfaceStoreState;\n\t'core/preferences'?: LegacyPreferencesStoreState;\n\t[ storeName: string ]: LegacyStoreState | undefined;\n}\n\n/**\n * The post editor's panels state in the legacy format.\n */\nexport interface LegacyEditPostPanel {\n\tenabled?: boolean;\n\topened?: boolean;\n}\n\n/**\n * The post editor's panels state in the preferences format.\n */\nexport interface EditPostPanels {\n\tinactivePanels: string[];\n\topenPanels: string[];\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/types.ts"],
4
- "sourcesContent": ["/**\n * Preferences of a single scope, such as `core/edit-post`.\n */\nexport type ScopePreferences = Record< string, unknown >;\n\n/**\n * Preferences store data, keyed by scope.\n */\nexport type ScopedPreferences = Record< string, ScopePreferences | undefined >;\n\n/**\n * Persisted preferences data, keyed by scope.\n */\nexport interface PreferencesData {\n\t/**\n\t * When the data was last modified, as an ISO 8601 date string.\n\t */\n\t_modified?: string;\n\t[ scope: string ]: unknown;\n}\n\nexport interface CreateOptions {\n\t/**\n\t * Any persisted preferences data that should be preloaded.\n\t * When set, the persistence layer will avoid fetching data from the REST API.\n\t */\n\tpreloadedData?: PreferencesData | null;\n\t/**\n\t * The key to use for restoring the localStorage backup, used when the\n\t * persistence layer calls `localStorage.getItem` or `localStorage.setItem`.\n\t */\n\tlocalStorageRestoreKey?: string;\n\t/**\n\t * Debounce requests to the API so that they only occur at minimum every\n\t * `requestDebounceMS` milliseconds, and don't swamp the server. Defaults to 2500ms.\n\t */\n\trequestDebounceMS?: number;\n}\n\nexport interface PersistenceLayer {\n\tget: () => Promise< PreferencesData >;\n\tset: ( newData: PreferencesData ) => void;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }