@wordpress/preferences-persistence 2.32.0 → 2.32.1-next.47f435fc9.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 (49) hide show
  1. package/build/create/debounce-async.js +24 -39
  2. package/build/create/debounce-async.js.map +7 -1
  3. package/build/create/index.js +50 -61
  4. package/build/create/index.js.map +7 -1
  5. package/build/index.js +47 -42
  6. package/build/index.js.map +7 -1
  7. package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.js +36 -52
  8. package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.js.map +7 -1
  9. package/build/migrations/legacy-local-storage-data/index.js +80 -89
  10. package/build/migrations/legacy-local-storage-data/index.js.map +7 -1
  11. package/build/migrations/legacy-local-storage-data/move-feature-preferences.js +26 -78
  12. package/build/migrations/legacy-local-storage-data/move-feature-preferences.js.map +7 -1
  13. package/build/migrations/legacy-local-storage-data/move-individual-preference.js +28 -60
  14. package/build/migrations/legacy-local-storage-data/move-individual-preference.js.map +7 -1
  15. package/build/migrations/legacy-local-storage-data/move-interface-enable-items.js +46 -85
  16. package/build/migrations/legacy-local-storage-data/move-interface-enable-items.js.map +7 -1
  17. package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js +27 -52
  18. package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js.map +7 -1
  19. package/build/migrations/preferences-package-data/convert-complementary-areas.js +23 -11
  20. package/build/migrations/preferences-package-data/convert-complementary-areas.js.map +7 -1
  21. package/build/migrations/preferences-package-data/convert-editor-settings.js +50 -22
  22. package/build/migrations/preferences-package-data/convert-editor-settings.js.map +7 -1
  23. package/build/migrations/preferences-package-data/index.js +36 -15
  24. package/build/migrations/preferences-package-data/index.js.map +7 -1
  25. package/build-module/create/debounce-async.js +7 -35
  26. package/build-module/create/debounce-async.js.map +7 -1
  27. package/build-module/create/index.js +21 -53
  28. package/build-module/create/index.js.map +7 -1
  29. package/build-module/index.js +12 -29
  30. package/build-module/index.js.map +7 -1
  31. package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.js +19 -48
  32. package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.js.map +7 -1
  33. package/build-module/migrations/legacy-local-storage-data/index.js +48 -82
  34. package/build-module/migrations/legacy-local-storage-data/index.js.map +7 -1
  35. package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.js +9 -74
  36. package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.js.map +7 -1
  37. package/build-module/migrations/legacy-local-storage-data/move-individual-preference.js +10 -55
  38. package/build-module/migrations/legacy-local-storage-data/move-individual-preference.js.map +7 -1
  39. package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js +29 -81
  40. package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js.map +7 -1
  41. package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js +10 -48
  42. package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js.map +7 -1
  43. package/build-module/migrations/preferences-package-data/convert-complementary-areas.js +6 -7
  44. package/build-module/migrations/preferences-package-data/convert-complementary-areas.js.map +7 -1
  45. package/build-module/migrations/preferences-package-data/convert-editor-settings.js +33 -18
  46. package/build-module/migrations/preferences-package-data/convert-editor-settings.js.map +7 -1
  47. package/build-module/migrations/preferences-package-data/index.js +7 -7
  48. package/build-module/migrations/preferences-package-data/index.js.map +7 -1
  49. package/package.json +11 -4
@@ -1,76 +1,38 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var move_interface_enable_items_exports = {};
19
+ __export(move_interface_enable_items_exports, {
20
+ default: () => moveInterfaceEnableItems
5
21
  });
6
- exports.default = moveInterfaceEnableItems;
7
- /**
8
- * Migrates interface 'enableItems' data to the preferences store.
9
- *
10
- * The interface package stores this data in this format:
11
- * ```js
12
- * {
13
- * enableItems: {
14
- * singleEnableItems: {
15
- * complementaryArea: {
16
- * 'core/edit-post': 'edit-post/document',
17
- * 'core/edit-site': 'edit-site/global-styles',
18
- * }
19
- * },
20
- * multipleEnableItems: {
21
- * pinnedItems: {
22
- * 'core/edit-post': {
23
- * 'plugin-1': true,
24
- * },
25
- * 'core/edit-site': {
26
- * 'plugin-2': true,
27
- * },
28
- * },
29
- * }
30
- * }
31
- * }
32
- * ```
33
- *
34
- * and it should be converted it to:
35
- * ```js
36
- * {
37
- * 'core/edit-post': {
38
- * complementaryArea: 'edit-post/document',
39
- * pinnedItems: {
40
- * 'plugin-1': true,
41
- * },
42
- * },
43
- * 'core/edit-site': {
44
- * complementaryArea: 'edit-site/global-styles',
45
- * pinnedItems: {
46
- * 'plugin-2': true,
47
- * },
48
- * },
49
- * }
50
- * ```
51
- *
52
- * @param {Object} state The local storage state.
53
- */
22
+ module.exports = __toCommonJS(move_interface_enable_items_exports);
54
23
  function moveInterfaceEnableItems(state) {
55
- var _state$preferencesSto, _sourceEnableItems$si, _sourceEnableItems$mu;
56
- const interfaceStoreName = 'core/interface';
57
- const preferencesStoreName = 'core/preferences';
24
+ const interfaceStoreName = "core/interface";
25
+ const preferencesStoreName = "core/preferences";
58
26
  const sourceEnableItems = state?.[interfaceStoreName]?.enableItems;
59
-
60
- // There's nothing to migrate, exit early.
61
27
  if (!sourceEnableItems) {
62
28
  return state;
63
29
  }
64
- const allPreferences = (_state$preferencesSto = state?.[preferencesStoreName]?.preferences) !== null && _state$preferencesSto !== void 0 ? _state$preferencesSto : {};
65
-
66
- // First convert complementaryAreas into the right format.
67
- // Use the existing preferences as the accumulator so that the data is
68
- // merged.
69
- const sourceComplementaryAreas = (_sourceEnableItems$si = sourceEnableItems?.singleEnableItems?.complementaryArea) !== null && _sourceEnableItems$si !== void 0 ? _sourceEnableItems$si : {};
70
- const preferencesWithConvertedComplementaryAreas = Object.keys(sourceComplementaryAreas).reduce((accumulator, scope) => {
30
+ const allPreferences = state?.[preferencesStoreName]?.preferences ?? {};
31
+ const sourceComplementaryAreas = sourceEnableItems?.singleEnableItems?.complementaryArea ?? {};
32
+ const preferencesWithConvertedComplementaryAreas = Object.keys(
33
+ sourceComplementaryAreas
34
+ ).reduce((accumulator, scope) => {
71
35
  const data = sourceComplementaryAreas[scope];
72
-
73
- // Don't overwrite any existing data in the preferences store.
74
36
  if (accumulator?.[scope]?.complementaryArea) {
75
37
  return accumulator;
76
38
  }
@@ -82,24 +44,23 @@ function moveInterfaceEnableItems(state) {
82
44
  }
83
45
  };
84
46
  }, allPreferences);
85
-
86
- // Next feed the converted complementary areas back into a reducer that
87
- // converts the pinned items, resulting in the fully migrated data.
88
- const sourcePinnedItems = (_sourceEnableItems$mu = sourceEnableItems?.multipleEnableItems?.pinnedItems) !== null && _sourceEnableItems$mu !== void 0 ? _sourceEnableItems$mu : {};
89
- const allConvertedData = Object.keys(sourcePinnedItems).reduce((accumulator, scope) => {
90
- const data = sourcePinnedItems[scope];
91
- // Don't overwrite any existing data in the preferences store.
92
- if (accumulator?.[scope]?.pinnedItems) {
93
- return accumulator;
94
- }
95
- return {
96
- ...accumulator,
97
- [scope]: {
98
- ...accumulator[scope],
99
- pinnedItems: data
47
+ const sourcePinnedItems = sourceEnableItems?.multipleEnableItems?.pinnedItems ?? {};
48
+ const allConvertedData = Object.keys(sourcePinnedItems).reduce(
49
+ (accumulator, scope) => {
50
+ const data = sourcePinnedItems[scope];
51
+ if (accumulator?.[scope]?.pinnedItems) {
52
+ return accumulator;
100
53
  }
101
- };
102
- }, preferencesWithConvertedComplementaryAreas);
54
+ return {
55
+ ...accumulator,
56
+ [scope]: {
57
+ ...accumulator[scope],
58
+ pinnedItems: data
59
+ }
60
+ };
61
+ },
62
+ preferencesWithConvertedComplementaryAreas
63
+ );
103
64
  const otherInterfaceItems = state[interfaceStoreName];
104
65
  return {
105
66
  ...state,
@@ -108,8 +69,8 @@ function moveInterfaceEnableItems(state) {
108
69
  },
109
70
  [interfaceStoreName]: {
110
71
  ...otherInterfaceItems,
111
- enableItems: undefined
72
+ enableItems: void 0
112
73
  }
113
74
  };
114
75
  }
115
- //# sourceMappingURL=move-interface-enable-items.js.map
76
+ //# sourceMappingURL=move-interface-enable-items.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["moveInterfaceEnableItems","state","_state$preferencesSto","_sourceEnableItems$si","_sourceEnableItems$mu","interfaceStoreName","preferencesStoreName","sourceEnableItems","enableItems","allPreferences","preferences","sourceComplementaryAreas","singleEnableItems","complementaryArea","preferencesWithConvertedComplementaryAreas","Object","keys","reduce","accumulator","scope","data","sourcePinnedItems","multipleEnableItems","pinnedItems","allConvertedData","otherInterfaceItems","undefined"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/move-interface-enable-items.js"],"sourcesContent":["/**\n * Migrates interface 'enableItems' data to the preferences store.\n *\n * The interface package stores this data in this format:\n * ```js\n * {\n * enableItems: {\n * singleEnableItems: {\n * \t complementaryArea: {\n * 'core/edit-post': 'edit-post/document',\n * 'core/edit-site': 'edit-site/global-styles',\n * }\n * },\n * multipleEnableItems: {\n * pinnedItems: {\n * 'core/edit-post': {\n * 'plugin-1': true,\n * },\n * 'core/edit-site': {\n * 'plugin-2': true,\n * },\n * },\n * }\n * }\n * }\n * ```\n *\n * and it should be converted it to:\n * ```js\n * {\n * 'core/edit-post': {\n * complementaryArea: 'edit-post/document',\n * pinnedItems: {\n * 'plugin-1': true,\n * },\n * },\n * 'core/edit-site': {\n * complementaryArea: 'edit-site/global-styles',\n * pinnedItems: {\n * 'plugin-2': true,\n * },\n * },\n * }\n * ```\n *\n * @param {Object} state The local storage state.\n */\nexport default function moveInterfaceEnableItems( state ) {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\tconst sourceEnableItems = state?.[ interfaceStoreName ]?.enableItems;\n\n\t// There's nothing to migrate, exit early.\n\tif ( ! sourceEnableItems ) {\n\t\treturn state;\n\t}\n\n\tconst allPreferences = state?.[ preferencesStoreName ]?.preferences ?? {};\n\n\t// First convert complementaryAreas into the right format.\n\t// Use the existing preferences as the accumulator so that the data is\n\t// merged.\n\tconst sourceComplementaryAreas =\n\t\tsourceEnableItems?.singleEnableItems?.complementaryArea ?? {};\n\n\tconst preferencesWithConvertedComplementaryAreas = Object.keys(\n\t\tsourceComplementaryAreas\n\t).reduce( ( accumulator, scope ) => {\n\t\tconst data = sourceComplementaryAreas[ scope ];\n\n\t\t// Don't overwrite any existing data in the preferences store.\n\t\tif ( accumulator?.[ scope ]?.complementaryArea ) {\n\t\t\treturn accumulator;\n\t\t}\n\n\t\treturn {\n\t\t\t...accumulator,\n\t\t\t[ scope ]: {\n\t\t\t\t...accumulator[ scope ],\n\t\t\t\tcomplementaryArea: data,\n\t\t\t},\n\t\t};\n\t}, allPreferences );\n\n\t// Next feed the converted complementary areas back into a reducer that\n\t// converts the pinned items, resulting in the fully migrated data.\n\tconst sourcePinnedItems =\n\t\tsourceEnableItems?.multipleEnableItems?.pinnedItems ?? {};\n\tconst allConvertedData = Object.keys( sourcePinnedItems ).reduce(\n\t\t( accumulator, scope ) => {\n\t\t\tconst data = sourcePinnedItems[ scope ];\n\t\t\t// Don't overwrite any existing data in the preferences store.\n\t\t\tif ( accumulator?.[ scope ]?.pinnedItems ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...accumulator,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...accumulator[ scope ],\n\t\t\t\t\tpinnedItems: data,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\tpreferencesWithConvertedComplementaryAreas\n\t);\n\n\tconst otherInterfaceItems = state[ interfaceStoreName ];\n\n\treturn {\n\t\t...state,\n\t\t[ preferencesStoreName ]: {\n\t\t\tpreferences: allConvertedData,\n\t\t},\n\t\t[ interfaceStoreName ]: {\n\t\t\t...otherInterfaceItems,\n\t\t\tenableItems: undefined,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,wBAAwBA,CAAEC,KAAK,EAAG;EAAA,IAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EACzD,MAAMC,kBAAkB,GAAG,gBAAgB;EAC3C,MAAMC,oBAAoB,GAAG,kBAAkB;EAC/C,MAAMC,iBAAiB,GAAGN,KAAK,GAAII,kBAAkB,CAAE,EAAEG,WAAW;;EAEpE;EACA,IAAK,CAAED,iBAAiB,EAAG;IAC1B,OAAON,KAAK;EACb;EAEA,MAAMQ,cAAc,IAAAP,qBAAA,GAAGD,KAAK,GAAIK,oBAAoB,CAAE,EAAEI,WAAW,cAAAR,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;;EAEzE;EACA;EACA;EACA,MAAMS,wBAAwB,IAAAR,qBAAA,GAC7BI,iBAAiB,EAAEK,iBAAiB,EAAEC,iBAAiB,cAAAV,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;EAE9D,MAAMW,0CAA0C,GAAGC,MAAM,CAACC,IAAI,CAC7DL,wBACD,CAAC,CAACM,MAAM,CAAE,CAAEC,WAAW,EAAEC,KAAK,KAAM;IACnC,MAAMC,IAAI,GAAGT,wBAAwB,CAAEQ,KAAK,CAAE;;IAE9C;IACA,IAAKD,WAAW,GAAIC,KAAK,CAAE,EAAEN,iBAAiB,EAAG;MAChD,OAAOK,WAAW;IACnB;IAEA,OAAO;MACN,GAAGA,WAAW;MACd,CAAEC,KAAK,GAAI;QACV,GAAGD,WAAW,CAAEC,KAAK,CAAE;QACvBN,iBAAiB,EAAEO;MACpB;IACD,CAAC;EACF,CAAC,EAAEX,cAAe,CAAC;;EAEnB;EACA;EACA,MAAMY,iBAAiB,IAAAjB,qBAAA,GACtBG,iBAAiB,EAAEe,mBAAmB,EAAEC,WAAW,cAAAnB,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;EAC1D,MAAMoB,gBAAgB,GAAGT,MAAM,CAACC,IAAI,CAAEK,iBAAkB,CAAC,CAACJ,MAAM,CAC/D,CAAEC,WAAW,EAAEC,KAAK,KAAM;IACzB,MAAMC,IAAI,GAAGC,iBAAiB,CAAEF,KAAK,CAAE;IACvC;IACA,IAAKD,WAAW,GAAIC,KAAK,CAAE,EAAEI,WAAW,EAAG;MAC1C,OAAOL,WAAW;IACnB;IAEA,OAAO;MACN,GAAGA,WAAW;MACd,CAAEC,KAAK,GAAI;QACV,GAAGD,WAAW,CAAEC,KAAK,CAAE;QACvBI,WAAW,EAAEH;MACd;IACD,CAAC;EACF,CAAC,EACDN,0CACD,CAAC;EAED,MAAMW,mBAAmB,GAAGxB,KAAK,CAAEI,kBAAkB,CAAE;EAEvD,OAAO;IACN,GAAGJ,KAAK;IACR,CAAEK,oBAAoB,GAAI;MACzBI,WAAW,EAAEc;IACd,CAAC;IACD,CAAEnB,kBAAkB,GAAI;MACvB,GAAGoB,mBAAmB;MACtBjB,WAAW,EAAEkB;IACd;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/migrations/legacy-local-storage-data/move-interface-enable-items.js"],
4
+ "sourcesContent": ["/**\n * Migrates interface 'enableItems' data to the preferences store.\n *\n * The interface package stores this data in this format:\n * ```js\n * {\n * enableItems: {\n * singleEnableItems: {\n * \t complementaryArea: {\n * 'core/edit-post': 'edit-post/document',\n * 'core/edit-site': 'edit-site/global-styles',\n * }\n * },\n * multipleEnableItems: {\n * pinnedItems: {\n * 'core/edit-post': {\n * 'plugin-1': true,\n * },\n * 'core/edit-site': {\n * 'plugin-2': true,\n * },\n * },\n * }\n * }\n * }\n * ```\n *\n * and it should be converted it to:\n * ```js\n * {\n * 'core/edit-post': {\n * complementaryArea: 'edit-post/document',\n * pinnedItems: {\n * 'plugin-1': true,\n * },\n * },\n * 'core/edit-site': {\n * complementaryArea: 'edit-site/global-styles',\n * pinnedItems: {\n * 'plugin-2': true,\n * },\n * },\n * }\n * ```\n *\n * @param {Object} state The local storage state.\n */\nexport default function moveInterfaceEnableItems( state ) {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\tconst sourceEnableItems = state?.[ interfaceStoreName ]?.enableItems;\n\n\t// There's nothing to migrate, exit early.\n\tif ( ! sourceEnableItems ) {\n\t\treturn state;\n\t}\n\n\tconst allPreferences = state?.[ preferencesStoreName ]?.preferences ?? {};\n\n\t// First convert complementaryAreas into the right format.\n\t// Use the existing preferences as the accumulator so that the data is\n\t// merged.\n\tconst sourceComplementaryAreas =\n\t\tsourceEnableItems?.singleEnableItems?.complementaryArea ?? {};\n\n\tconst preferencesWithConvertedComplementaryAreas = Object.keys(\n\t\tsourceComplementaryAreas\n\t).reduce( ( accumulator, scope ) => {\n\t\tconst data = sourceComplementaryAreas[ scope ];\n\n\t\t// Don't overwrite any existing data in the preferences store.\n\t\tif ( accumulator?.[ scope ]?.complementaryArea ) {\n\t\t\treturn accumulator;\n\t\t}\n\n\t\treturn {\n\t\t\t...accumulator,\n\t\t\t[ scope ]: {\n\t\t\t\t...accumulator[ scope ],\n\t\t\t\tcomplementaryArea: data,\n\t\t\t},\n\t\t};\n\t}, allPreferences );\n\n\t// Next feed the converted complementary areas back into a reducer that\n\t// converts the pinned items, resulting in the fully migrated data.\n\tconst sourcePinnedItems =\n\t\tsourceEnableItems?.multipleEnableItems?.pinnedItems ?? {};\n\tconst allConvertedData = Object.keys( sourcePinnedItems ).reduce(\n\t\t( accumulator, scope ) => {\n\t\t\tconst data = sourcePinnedItems[ scope ];\n\t\t\t// Don't overwrite any existing data in the preferences store.\n\t\t\tif ( accumulator?.[ scope ]?.pinnedItems ) {\n\t\t\t\treturn accumulator;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...accumulator,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...accumulator[ scope ],\n\t\t\t\t\tpinnedItems: data,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t\tpreferencesWithConvertedComplementaryAreas\n\t);\n\n\tconst otherInterfaceItems = state[ interfaceStoreName ];\n\n\treturn {\n\t\t...state,\n\t\t[ preferencesStoreName ]: {\n\t\t\tpreferences: allConvertedData,\n\t\t},\n\t\t[ interfaceStoreName ]: {\n\t\t\t...otherInterfaceItems,\n\t\t\tenableItems: undefined,\n\t\t},\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+Ce,SAAR,yBAA2C,OAAQ;AACzD,QAAM,qBAAqB;AAC3B,QAAM,uBAAuB;AAC7B,QAAM,oBAAoB,QAAS,kBAAmB,GAAG;AAGzD,MAAK,CAAE,mBAAoB;AAC1B,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,QAAS,oBAAqB,GAAG,eAAe,CAAC;AAKxE,QAAM,2BACL,mBAAmB,mBAAmB,qBAAqB,CAAC;AAE7D,QAAM,6CAA6C,OAAO;AAAA,IACzD;AAAA,EACD,EAAE,OAAQ,CAAE,aAAa,UAAW;AACnC,UAAM,OAAO,yBAA0B,KAAM;AAG7C,QAAK,cAAe,KAAM,GAAG,mBAAoB;AAChD,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,KAAM,GAAG;AAAA,QACV,GAAG,YAAa,KAAM;AAAA,QACtB,mBAAmB;AAAA,MACpB;AAAA,IACD;AAAA,EACD,GAAG,cAAe;AAIlB,QAAM,oBACL,mBAAmB,qBAAqB,eAAe,CAAC;AACzD,QAAM,mBAAmB,OAAO,KAAM,iBAAkB,EAAE;AAAA,IACzD,CAAE,aAAa,UAAW;AACzB,YAAM,OAAO,kBAAmB,KAAM;AAEtC,UAAK,cAAe,KAAM,GAAG,aAAc;AAC1C,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,QACN,GAAG;AAAA,QACH,CAAE,KAAM,GAAG;AAAA,UACV,GAAG,YAAa,KAAM;AAAA,UACtB,aAAa;AAAA,QACd;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,EACD;AAEA,QAAM,sBAAsB,MAAO,kBAAmB;AAEtD,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,oBAAqB,GAAG;AAAA,MACzB,aAAa;AAAA,IACd;AAAA,IACA,CAAE,kBAAmB,GAAG;AAAA,MACvB,GAAG;AAAA,MACH,aAAa;AAAA,IACd;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,60 +1,35 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var move_third_party_feature_preferences_exports = {};
19
+ __export(move_third_party_feature_preferences_exports, {
20
+ default: () => moveThirdPartyFeaturePreferencesToPreferences
5
21
  });
6
- exports.default = moveThirdPartyFeaturePreferencesToPreferences;
7
- /**
8
- * The interface package previously had a public API that could be used by
9
- * plugins to set persisted boolean 'feature' preferences.
10
- *
11
- * While usage was likely non-existent or very small, this function ensures
12
- * those are migrated to the preferences data structure. The interface
13
- * package's APIs have now been deprecated and use the preferences store.
14
- *
15
- * This will convert data that looks like this:
16
- * ```js
17
- * {
18
- * 'core/interface': {
19
- * preferences: {
20
- * features: {
21
- * 'my-plugin': {
22
- * myPluginFeature: true
23
- * }
24
- * }
25
- * }
26
- * }
27
- * }
28
- * ```
29
- *
30
- * To this:
31
- * ```js
32
- * * {
33
- * 'core/preferences': {
34
- * preferences: {
35
- * 'my-plugin': {
36
- * myPluginFeature: true
37
- * }
38
- * }
39
- * }
40
- * }
41
- * ```
42
- *
43
- * @param {Object} state The local storage state
44
- *
45
- * @return {Object} The state with third party preferences moved to the
46
- * preferences data structure.
47
- */
22
+ module.exports = __toCommonJS(move_third_party_feature_preferences_exports);
48
23
  function moveThirdPartyFeaturePreferencesToPreferences(state) {
49
- const interfaceStoreName = 'core/interface';
50
- const preferencesStoreName = 'core/preferences';
24
+ const interfaceStoreName = "core/interface";
25
+ const preferencesStoreName = "core/preferences";
51
26
  const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
52
27
  const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
53
28
  if (!interfaceScopeKeys?.length) {
54
29
  return state;
55
30
  }
56
- return interfaceScopeKeys.reduce(function (convertedState, scope) {
57
- if (scope.startsWith('core')) {
31
+ return interfaceScopeKeys.reduce(function(convertedState, scope) {
32
+ if (scope.startsWith("core")) {
58
33
  return convertedState;
59
34
  }
60
35
  const featuresToMigrate = interfaceScopes?.[scope];
@@ -81,11 +56,11 @@ function moveThirdPartyFeaturePreferencesToPreferences(state) {
81
56
  preferences: {
82
57
  features: {
83
58
  ...otherInterfaceScopes,
84
- [scope]: undefined
59
+ [scope]: void 0
85
60
  }
86
61
  }
87
62
  }
88
63
  };
89
64
  }, state);
90
65
  }
91
- //# sourceMappingURL=move-third-party-feature-preferences.js.map
66
+ //# sourceMappingURL=move-third-party-feature-preferences.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["moveThirdPartyFeaturePreferencesToPreferences","state","interfaceStoreName","preferencesStoreName","interfaceScopes","preferences","features","interfaceScopeKeys","Object","keys","length","reduce","convertedState","scope","startsWith","featuresToMigrate","existingMigratedData","otherPreferencesScopes","otherInterfaceState","otherInterfaceScopes","undefined"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js"],"sourcesContent":["/**\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 {Object} state The local storage state\n *\n * @return {Object} The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences( state ) {\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":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,6CAA6CA,CAAEC,KAAK,EAAG;EAC9E,MAAMC,kBAAkB,GAAG,gBAAgB;EAC3C,MAAMC,oBAAoB,GAAG,kBAAkB;EAE/C,MAAMC,eAAe,GACpBH,KAAK,GAAIC,kBAAkB,CAAE,EAAEG,WAAW,EAAEC,QAAQ;EACrD,MAAMC,kBAAkB,GAAGH,eAAe,GACvCI,MAAM,CAACC,IAAI,CAAEL,eAAgB,CAAC,GAC9B,EAAE;EAEL,IAAK,CAAEG,kBAAkB,EAAEG,MAAM,EAAG;IACnC,OAAOT,KAAK;EACb;EAEA,OAAOM,kBAAkB,CAACI,MAAM,CAAE,UAAWC,cAAc,EAAEC,KAAK,EAAG;IACpE,IAAKA,KAAK,CAACC,UAAU,CAAE,MAAO,CAAC,EAAG;MACjC,OAAOF,cAAc;IACtB;IAEA,MAAMG,iBAAiB,GAAGX,eAAe,GAAIS,KAAK,CAAE;IACpD,IAAK,CAAEE,iBAAiB,EAAG;MAC1B,OAAOH,cAAc;IACtB;IAEA,MAAMI,oBAAoB,GACzBJ,cAAc,GAAIT,oBAAoB,CAAE,EAAEE,WAAW,GAAIQ,KAAK,CAAE;IAEjE,IAAKG,oBAAoB,EAAG;MAC3B,OAAOJ,cAAc;IACtB;IAEA,MAAMK,sBAAsB,GAC3BL,cAAc,GAAIT,oBAAoB,CAAE,EAAEE,WAAW;IACtD,MAAMa,mBAAmB,GAAGN,cAAc,GAAIV,kBAAkB,CAAE;IAClE,MAAMiB,oBAAoB,GACzBP,cAAc,GAAIV,kBAAkB,CAAE,EAAEG,WAAW,EAAEC,QAAQ;IAE9D,OAAO;MACN,GAAGM,cAAc;MACjB,CAAET,oBAAoB,GAAI;QACzBE,WAAW,EAAE;UACZ,GAAGY,sBAAsB;UACzB,CAAEJ,KAAK,GAAIE;QACZ;MACD,CAAC;MACD,CAAEb,kBAAkB,GAAI;QACvB,GAAGgB,mBAAmB;QACtBb,WAAW,EAAE;UACZC,QAAQ,EAAE;YACT,GAAGa,oBAAoB;YACvB,CAAEN,KAAK,GAAIO;UACZ;QACD;MACD;IACD,CAAC;EACF,CAAC,EAAEnB,KAAM,CAAC;AACX","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js"],
4
+ "sourcesContent": ["/**\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 {Object} state The local storage state\n *\n * @return {Object} The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences( state ) {\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": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyCe,SAAR,8CAAgE,OAAQ;AAC9E,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,18 +1,30 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var convert_complementary_areas_exports = {};
19
+ __export(convert_complementary_areas_exports, {
20
+ default: () => convertComplementaryAreas
5
21
  });
6
- exports.default = convertComplementaryAreas;
22
+ module.exports = __toCommonJS(convert_complementary_areas_exports);
7
23
  function convertComplementaryAreas(state) {
8
24
  return Object.keys(state).reduce((stateAccumulator, scope) => {
9
25
  const scopeData = state[scope];
10
-
11
- // If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.
12
26
  if (scopeData?.complementaryArea) {
13
- const updatedScopeData = {
14
- ...scopeData
15
- };
27
+ const updatedScopeData = { ...scopeData };
16
28
  delete updatedScopeData.complementaryArea;
17
29
  updatedScopeData.isComplementaryAreaVisible = true;
18
30
  stateAccumulator[scope] = updatedScopeData;
@@ -21,4 +33,4 @@ function convertComplementaryAreas(state) {
21
33
  return stateAccumulator;
22
34
  }, state);
23
35
  }
24
- //# sourceMappingURL=convert-complementary-areas.js.map
36
+ //# sourceMappingURL=convert-complementary-areas.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["convertComplementaryAreas","state","Object","keys","reduce","stateAccumulator","scope","scopeData","complementaryArea","updatedScopeData","isComplementaryAreaVisible"],"sources":["@wordpress/preferences-persistence/src/migrations/preferences-package-data/convert-complementary-areas.js"],"sourcesContent":["export default function convertComplementaryAreas( state ) {\n\treturn Object.keys( state ).reduce( ( stateAccumulator, scope ) => {\n\t\tconst scopeData = state[ scope ];\n\n\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\tif ( scopeData?.complementaryArea ) {\n\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\treturn stateAccumulator;\n\t\t}\n\n\t\treturn stateAccumulator;\n\t}, state );\n}\n"],"mappings":";;;;;;AAAe,SAASA,yBAAyBA,CAAEC,KAAK,EAAG;EAC1D,OAAOC,MAAM,CAACC,IAAI,CAAEF,KAAM,CAAC,CAACG,MAAM,CAAE,CAAEC,gBAAgB,EAAEC,KAAK,KAAM;IAClE,MAAMC,SAAS,GAAGN,KAAK,CAAEK,KAAK,CAAE;;IAEhC;IACA,IAAKC,SAAS,EAAEC,iBAAiB,EAAG;MACnC,MAAMC,gBAAgB,GAAG;QAAE,GAAGF;MAAU,CAAC;MACzC,OAAOE,gBAAgB,CAACD,iBAAiB;MACzCC,gBAAgB,CAACC,0BAA0B,GAAG,IAAI;MAClDL,gBAAgB,CAAEC,KAAK,CAAE,GAAGG,gBAAgB;MAC5C,OAAOJ,gBAAgB;IACxB;IAEA,OAAOA,gBAAgB;EACxB,CAAC,EAAEJ,KAAM,CAAC;AACX","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/migrations/preferences-package-data/convert-complementary-areas.js"],
4
+ "sourcesContent": ["export default function convertComplementaryAreas( state ) {\n\treturn Object.keys( state ).reduce( ( stateAccumulator, scope ) => {\n\t\tconst scopeData = state[ scope ];\n\n\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\tif ( scopeData?.complementaryArea ) {\n\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\treturn stateAccumulator;\n\t\t}\n\n\t\treturn stateAccumulator;\n\t}, state );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAe,SAAR,0BAA4C,OAAQ;AAC1D,SAAO,OAAO,KAAM,KAAM,EAAE,OAAQ,CAAE,kBAAkB,UAAW;AAClE,UAAM,YAAY,MAAO,KAAM;AAG/B,QAAK,WAAW,mBAAoB;AACnC,YAAM,mBAAmB,EAAE,GAAG,UAAU;AACxC,aAAO,iBAAiB;AACxB,uBAAiB,6BAA6B;AAC9C,uBAAkB,KAAM,IAAI;AAC5B,aAAO;AAAA,IACR;AAEA,WAAO;AAAA,EACR,GAAG,KAAM;AACV;",
6
+ "names": []
7
+ }
@@ -1,38 +1,66 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var convert_editor_settings_exports = {};
19
+ __export(convert_editor_settings_exports, {
20
+ default: () => convertEditorSettings
5
21
  });
6
- exports.default = convertEditorSettings;
7
- /**
8
- * Internal dependencies
9
- */
10
-
22
+ module.exports = __toCommonJS(convert_editor_settings_exports);
11
23
  function convertEditorSettings(data) {
12
- var _newData$coreEditPo, _newData$coreEditSi;
13
24
  let newData = data;
14
- const settingsToMoveToCore = ['allowRightClickOverrides', 'distractionFree', 'editorMode', 'fixedToolbar', 'focusMode', 'hiddenBlockTypes', 'inactivePanels', 'keepCaretInsideBlock', 'mostUsedBlocks', 'openPanels', 'showBlockBreadcrumbs', 'showIconLabels', 'showListViewByDefault', 'isPublishSidebarEnabled', 'isComplementaryAreaVisible', 'pinnedItems'];
15
- settingsToMoveToCore.forEach(setting => {
16
- if (data?.['core/edit-post']?.[setting] !== undefined) {
25
+ const settingsToMoveToCore = [
26
+ "allowRightClickOverrides",
27
+ "distractionFree",
28
+ "editorMode",
29
+ "fixedToolbar",
30
+ "focusMode",
31
+ "hiddenBlockTypes",
32
+ "inactivePanels",
33
+ "keepCaretInsideBlock",
34
+ "mostUsedBlocks",
35
+ "openPanels",
36
+ "showBlockBreadcrumbs",
37
+ "showIconLabels",
38
+ "showListViewByDefault",
39
+ "isPublishSidebarEnabled",
40
+ "isComplementaryAreaVisible",
41
+ "pinnedItems"
42
+ ];
43
+ settingsToMoveToCore.forEach((setting) => {
44
+ if (data?.["core/edit-post"]?.[setting] !== void 0) {
17
45
  newData = {
18
46
  ...newData,
19
47
  core: {
20
48
  ...newData?.core,
21
- [setting]: data['core/edit-post'][setting]
49
+ [setting]: data["core/edit-post"][setting]
22
50
  }
23
51
  };
24
- delete newData['core/edit-post'][setting];
52
+ delete newData["core/edit-post"][setting];
25
53
  }
26
- if (data?.['core/edit-site']?.[setting] !== undefined) {
27
- delete newData['core/edit-site'][setting];
54
+ if (data?.["core/edit-site"]?.[setting] !== void 0) {
55
+ delete newData["core/edit-site"][setting];
28
56
  }
29
57
  });
30
- if (Object.keys((_newData$coreEditPo = newData?.['core/edit-post']) !== null && _newData$coreEditPo !== void 0 ? _newData$coreEditPo : {})?.length === 0) {
31
- delete newData['core/edit-post'];
58
+ if (Object.keys(newData?.["core/edit-post"] ?? {})?.length === 0) {
59
+ delete newData["core/edit-post"];
32
60
  }
33
- if (Object.keys((_newData$coreEditSi = newData?.['core/edit-site']) !== null && _newData$coreEditSi !== void 0 ? _newData$coreEditSi : {})?.length === 0) {
34
- delete newData['core/edit-site'];
61
+ if (Object.keys(newData?.["core/edit-site"] ?? {})?.length === 0) {
62
+ delete newData["core/edit-site"];
35
63
  }
36
64
  return newData;
37
65
  }
38
- //# sourceMappingURL=convert-editor-settings.js.map
66
+ //# sourceMappingURL=convert-editor-settings.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["convertEditorSettings","data","_newData$coreEditPo","_newData$coreEditSi","newData","settingsToMoveToCore","forEach","setting","undefined","core","Object","keys","length"],"sources":["@wordpress/preferences-persistence/src/migrations/preferences-package-data/convert-editor-settings.js"],"sourcesContent":["/**\n * Internal dependencies\n */\n\nexport default function convertEditorSettings( data ) {\n\tlet newData = data;\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 ( data?.[ 'core/edit-post' ]?.[ setting ] !== undefined ) {\n\t\t\tnewData = {\n\t\t\t\t...newData,\n\t\t\t\tcore: {\n\t\t\t\t\t...newData?.core,\n\t\t\t\t\t[ setting ]: data[ 'core/edit-post' ][ setting ],\n\t\t\t\t},\n\t\t\t};\n\t\t\tdelete newData[ 'core/edit-post' ][ setting ];\n\t\t}\n\n\t\tif ( data?.[ 'core/edit-site' ]?.[ setting ] !== undefined ) {\n\t\t\tdelete newData[ 'core/edit-site' ][ setting ];\n\t\t}\n\t} );\n\n\tif ( Object.keys( newData?.[ 'core/edit-post' ] ?? {} )?.length === 0 ) {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( Object.keys( newData?.[ 'core/edit-site' ] ?? {} )?.length === 0 ) {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEe,SAASA,qBAAqBA,CAAEC,IAAI,EAAG;EAAA,IAAAC,mBAAA,EAAAC,mBAAA;EACrD,IAAIC,OAAO,GAAGH,IAAI;EAClB,MAAMI,oBAAoB,GAAG,CAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,aAAa,CACb;EAEDA,oBAAoB,CAACC,OAAO,CAAIC,OAAO,IAAM;IAC5C,IAAKN,IAAI,GAAI,gBAAgB,CAAE,GAAIM,OAAO,CAAE,KAAKC,SAAS,EAAG;MAC5DJ,OAAO,GAAG;QACT,GAAGA,OAAO;QACVK,IAAI,EAAE;UACL,GAAGL,OAAO,EAAEK,IAAI;UAChB,CAAEF,OAAO,GAAIN,IAAI,CAAE,gBAAgB,CAAE,CAAEM,OAAO;QAC/C;MACD,CAAC;MACD,OAAOH,OAAO,CAAE,gBAAgB,CAAE,CAAEG,OAAO,CAAE;IAC9C;IAEA,IAAKN,IAAI,GAAI,gBAAgB,CAAE,GAAIM,OAAO,CAAE,KAAKC,SAAS,EAAG;MAC5D,OAAOJ,OAAO,CAAE,gBAAgB,CAAE,CAAEG,OAAO,CAAE;IAC9C;EACD,CAAE,CAAC;EAEH,IAAKG,MAAM,CAACC,IAAI,EAAAT,mBAAA,GAAEE,OAAO,GAAI,gBAAgB,CAAE,cAAAF,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAE,CAAC,EAAEU,MAAM,KAAK,CAAC,EAAG;IACvE,OAAOR,OAAO,CAAE,gBAAgB,CAAE;EACnC;EAEA,IAAKM,MAAM,CAACC,IAAI,EAAAR,mBAAA,GAAEC,OAAO,GAAI,gBAAgB,CAAE,cAAAD,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAE,CAAC,EAAES,MAAM,KAAK,CAAC,EAAG;IACvE,OAAOR,OAAO,CAAE,gBAAgB,CAAE;EACnC;EAEA,OAAOA,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/migrations/preferences-package-data/convert-editor-settings.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\n\nexport default function convertEditorSettings( data ) {\n\tlet newData = data;\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 ( data?.[ 'core/edit-post' ]?.[ setting ] !== undefined ) {\n\t\t\tnewData = {\n\t\t\t\t...newData,\n\t\t\t\tcore: {\n\t\t\t\t\t...newData?.core,\n\t\t\t\t\t[ setting ]: data[ 'core/edit-post' ][ setting ],\n\t\t\t\t},\n\t\t\t};\n\t\t\tdelete newData[ 'core/edit-post' ][ setting ];\n\t\t}\n\n\t\tif ( data?.[ 'core/edit-site' ]?.[ setting ] !== undefined ) {\n\t\t\tdelete newData[ 'core/edit-site' ][ setting ];\n\t\t}\n\t} );\n\n\tif ( Object.keys( newData?.[ 'core/edit-post' ] ?? {} )?.length === 0 ) {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( Object.keys( newData?.[ 'core/edit-site' ] ?? {} )?.length === 0 ) {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,sBAAwC,MAAO;AACrD,MAAI,UAAU;AACd,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,OAAQ,gBAAiB,IAAK,OAAQ,MAAM,QAAY;AAC5D,gBAAU;AAAA,QACT,GAAG;AAAA,QACH,MAAM;AAAA,UACL,GAAG,SAAS;AAAA,UACZ,CAAE,OAAQ,GAAG,KAAM,gBAAiB,EAAG,OAAQ;AAAA,QAChD;AAAA,MACD;AACA,aAAO,QAAS,gBAAiB,EAAG,OAAQ;AAAA,IAC7C;AAEA,QAAK,OAAQ,gBAAiB,IAAK,OAAQ,MAAM,QAAY;AAC5D,aAAO,QAAS,gBAAiB,EAAG,OAAQ;AAAA,IAC7C;AAAA,EACD,CAAE;AAEF,MAAK,OAAO,KAAM,UAAW,gBAAiB,KAAK,CAAC,CAAE,GAAG,WAAW,GAAI;AACvE,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,MAAK,OAAO,KAAM,UAAW,gBAAiB,KAAK,CAAC,CAAE,GAAG,WAAW,GAAI;AACvE,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,19 +1,40 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var preferences_package_data_exports = {};
29
+ __export(preferences_package_data_exports, {
30
+ default: () => convertPreferencesPackageData
6
31
  });
7
- exports.default = convertPreferencesPackageData;
8
- var _convertComplementaryAreas = _interopRequireDefault(require("./convert-complementary-areas"));
9
- var _convertEditorSettings = _interopRequireDefault(require("./convert-editor-settings"));
10
- /**
11
- * Internal dependencies
12
- */
13
-
32
+ module.exports = __toCommonJS(preferences_package_data_exports);
33
+ var import_convert_complementary_areas = __toESM(require("./convert-complementary-areas"));
34
+ var import_convert_editor_settings = __toESM(require("./convert-editor-settings"));
14
35
  function convertPreferencesPackageData(data) {
15
- let newData = (0, _convertComplementaryAreas.default)(data);
16
- newData = (0, _convertEditorSettings.default)(newData);
36
+ let newData = (0, import_convert_complementary_areas.default)(data);
37
+ newData = (0, import_convert_editor_settings.default)(newData);
17
38
  return newData;
18
39
  }
19
- //# sourceMappingURL=index.js.map
40
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_convertComplementaryAreas","_interopRequireDefault","require","_convertEditorSettings","convertPreferencesPackageData","data","newData","convertComplementaryAreas","convertEditorSettings"],"sources":["@wordpress/preferences-persistence/src/migrations/preferences-package-data/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\n\nexport default function convertPreferencesPackageData( data ) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,6BAA6BA,CAAEC,IAAI,EAAG;EAC7D,IAAIC,OAAO,GAAG,IAAAC,kCAAyB,EAAEF,IAAK,CAAC;EAC/CC,OAAO,GAAG,IAAAE,8BAAqB,EAAEF,OAAQ,CAAC;EAC1C,OAAOA,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/migrations/preferences-package-data/index.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\n\nexport default function convertPreferencesPackageData( data ) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yCAAsC;AACtC,qCAAkC;AAEnB,SAAR,8BAAgD,MAAO;AAC7D,MAAI,cAAU,mCAAAA,SAA2B,IAAK;AAC9C,gBAAU,+BAAAC,SAAuB,OAAQ;AACzC,SAAO;AACR;",
6
+ "names": ["convertComplementaryAreas", "convertEditorSettings"]
7
+ }
@@ -1,63 +1,32 @@
1
- /**
2
- * Performs a leading edge debounce of async functions.
3
- *
4
- * If three functions are throttled at the same time:
5
- * - The first happens immediately.
6
- * - The second is never called.
7
- * - The third happens `delayMS` milliseconds after the first has resolved.
8
- *
9
- * This is distinct from `{ debounce } from @wordpress/compose` in that it
10
- * waits for promise resolution.
11
- *
12
- * @param {Function} func A function that returns a promise.
13
- * @param {number} delayMS A delay in milliseconds.
14
- *
15
- * @return {Function} A function that debounce whatever function is passed
16
- * to it.
17
- */
18
- export default function debounceAsync(func, delayMS) {
1
+ function debounceAsync(func, delayMS) {
19
2
  let timeoutId;
20
3
  let activePromise;
21
4
  return async function debounced(...args) {
22
- // This is a leading edge debounce. If there's no promise or timeout
23
- // in progress, call the debounced function immediately.
24
5
  if (!activePromise && !timeoutId) {
25
6
  return new Promise((resolve, reject) => {
26
- // Keep a reference to the promise.
27
7
  activePromise = func(...args).then((...thenArgs) => {
28
8
  resolve(...thenArgs);
29
- }).catch(error => {
9
+ }).catch((error) => {
30
10
  reject(error);
31
11
  }).finally(() => {
32
- // As soon this promise is complete, clear the way for the
33
- // next one to happen immediately.
34
12
  activePromise = null;
35
13
  });
36
14
  });
37
15
  }
38
16
  if (activePromise) {
39
- // Let any active promises finish before queuing the next request.
40
17
  await activePromise;
41
18
  }
42
-
43
- // Clear any active timeouts, abandoning any requests that have
44
- // been queued but not been made.
45
19
  if (timeoutId) {
46
20
  clearTimeout(timeoutId);
47
21
  timeoutId = null;
48
22
  }
49
-
50
- // Trigger any trailing edge calls to the function.
51
23
  return new Promise((resolve, reject) => {
52
- // Schedule the next request but with a delay.
53
24
  timeoutId = setTimeout(() => {
54
25
  activePromise = func(...args).then((...thenArgs) => {
55
26
  resolve(...thenArgs);
56
- }).catch(error => {
27
+ }).catch((error) => {
57
28
  reject(error);
58
29
  }).finally(() => {
59
- // As soon this promise is complete, clear the way for the
60
- // next one to happen immediately.
61
30
  activePromise = null;
62
31
  timeoutId = null;
63
32
  });
@@ -65,4 +34,7 @@ export default function debounceAsync(func, delayMS) {
65
34
  });
66
35
  };
67
36
  }
68
- //# sourceMappingURL=debounce-async.js.map
37
+ export {
38
+ debounceAsync as default
39
+ };
40
+ //# sourceMappingURL=debounce-async.js.map