@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.
- package/build/create/debounce-async.js +24 -39
- package/build/create/debounce-async.js.map +7 -1
- package/build/create/index.js +50 -61
- package/build/create/index.js.map +7 -1
- package/build/index.js +47 -42
- package/build/index.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.js +36 -52
- package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/index.js +80 -89
- package/build/migrations/legacy-local-storage-data/index.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/move-feature-preferences.js +26 -78
- package/build/migrations/legacy-local-storage-data/move-feature-preferences.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/move-individual-preference.js +28 -60
- package/build/migrations/legacy-local-storage-data/move-individual-preference.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/move-interface-enable-items.js +46 -85
- package/build/migrations/legacy-local-storage-data/move-interface-enable-items.js.map +7 -1
- package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js +27 -52
- package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js.map +7 -1
- package/build/migrations/preferences-package-data/convert-complementary-areas.js +23 -11
- package/build/migrations/preferences-package-data/convert-complementary-areas.js.map +7 -1
- package/build/migrations/preferences-package-data/convert-editor-settings.js +50 -22
- package/build/migrations/preferences-package-data/convert-editor-settings.js.map +7 -1
- package/build/migrations/preferences-package-data/index.js +36 -15
- package/build/migrations/preferences-package-data/index.js.map +7 -1
- package/build-module/create/debounce-async.js +7 -35
- package/build-module/create/debounce-async.js.map +7 -1
- package/build-module/create/index.js +21 -53
- package/build-module/create/index.js.map +7 -1
- package/build-module/index.js +12 -29
- package/build-module/index.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.js +19 -48
- package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/index.js +48 -82
- package/build-module/migrations/legacy-local-storage-data/index.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.js +9 -74
- package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/move-individual-preference.js +10 -55
- package/build-module/migrations/legacy-local-storage-data/move-individual-preference.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js +29 -81
- package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js.map +7 -1
- package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js +10 -48
- package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js.map +7 -1
- package/build-module/migrations/preferences-package-data/convert-complementary-areas.js +6 -7
- package/build-module/migrations/preferences-package-data/convert-complementary-areas.js.map +7 -1
- package/build-module/migrations/preferences-package-data/convert-editor-settings.js +33 -18
- package/build-module/migrations/preferences-package-data/convert-editor-settings.js.map +7 -1
- package/build-module/migrations/preferences-package-data/index.js +7 -7
- package/build-module/migrations/preferences-package-data/index.js.map +7 -1
- package/package.json +11 -4
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/migrations/legacy-local-storage-data/move-feature-preferences.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Move the 'features' object in local storage from the sourceStoreName to the\n * preferences store data structure.\n *\n * Previously, editors used a data structure like this for feature preferences:\n * ```js\n * {\n * 'core/edit-post': {\n * preferences: {\n * features; {\n * topToolbar: true,\n * // ... other boolean 'feature' preferences\n * },\n * },\n * },\n * }\n * ```\n *\n * And for a while these feature preferences lived in the interface package:\n * ```js\n * {\n * 'core/interface': {\n * preferences: {\n * features: {\n * 'core/edit-post': {\n * topToolbar: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * In the preferences store, 'features' aren't considered special, they're\n * merged to the root level of the scope along with other preferences:\n * ```js\n * {\n * 'core/preferences': {\n * preferences: {\n * 'core/edit-post': {\n * topToolbar: true,\n * // ... any other preferences.\n * }\n * }\n * }\n * }\n * ```\n *\n * This function handles moving from either the source store or the interface\n * store to the preferences data structure.\n *\n * @param {Object} state The state before migration.\n * @param {string} sourceStoreName The name of the store that has persisted\n * preferences to migrate to the preferences\n * package.\n * @return {Object} The migrated state\n */\nexport default function moveFeaturePreferences( state, sourceStoreName ) {\n\tconst preferencesStoreName = 'core/preferences';\n\tconst interfaceStoreName = 'core/interface';\n\n\t// Features most recently (and briefly) lived in the interface package.\n\t// If data exists there, prioritize using that for the migration. If not\n\t// also check the original package as the user may have updated from an\n\t// older block editor version.\n\tconst interfaceFeatures =\n\t\tstate?.[ interfaceStoreName ]?.preferences?.features?.[\n\t\t\tsourceStoreName\n\t\t];\n\tconst sourceFeatures = state?.[ sourceStoreName ]?.preferences?.features;\n\tconst featuresToMigrate = interfaceFeatures\n\t\t? interfaceFeatures\n\t\t: sourceFeatures;\n\n\tif ( ! featuresToMigrate ) {\n\t\treturn state;\n\t}\n\n\tconst existingPreferences = state?.[ preferencesStoreName ]?.preferences;\n\n\t// Avoid migrating features again if they've previously been migrated.\n\tif ( existingPreferences?.[ sourceStoreName ] ) {\n\t\treturn state;\n\t}\n\n\tlet updatedInterfaceState;\n\tif ( interfaceFeatures ) {\n\t\tconst otherInterfaceState = state?.[ interfaceStoreName ];\n\t\tconst otherInterfaceScopes =\n\t\t\tstate?.[ interfaceStoreName ]?.preferences?.features;\n\n\t\tupdatedInterfaceState = {\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[ sourceStoreName ]: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\tlet updatedSourceState;\n\tif ( sourceFeatures ) {\n\t\tconst otherSourceState = state?.[ sourceStoreName ];\n\t\tconst sourcePreferences = state?.[ sourceStoreName ]?.preferences;\n\n\t\tupdatedSourceState = {\n\t\t\t[ sourceStoreName ]: {\n\t\t\t\t...otherSourceState,\n\t\t\t\tpreferences: {\n\t\t\t\t\t...sourcePreferences,\n\t\t\t\t\tfeatures: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\t// Set the feature values in the interface store, the features\n\t// object is keyed by 'scope', which matches the store name for\n\t// the source.\n\treturn {\n\t\t...state,\n\t\t[ preferencesStoreName ]: {\n\t\t\tpreferences: {\n\t\t\t\t...existingPreferences,\n\t\t\t\t[ sourceStoreName ]: featuresToMigrate,\n\t\t\t},\n\t\t},\n\t\t...updatedInterfaceState,\n\t\t...updatedSourceState,\n\t};\n}\n"],
|
|
5
|
+
"mappings": "AAyDe,SAAR,uBAAyC,OAAO,iBAAkB;AACxE,QAAM,uBAAuB;AAC7B,QAAM,qBAAqB;AAM3B,QAAM,oBACL,QAAS,kBAAmB,GAAG,aAAa,WAC3C,eACD;AACD,QAAM,iBAAiB,QAAS,eAAgB,GAAG,aAAa;AAChE,QAAM,oBAAoB,oBACvB,oBACA;AAEH,MAAK,CAAE,mBAAoB;AAC1B,WAAO;AAAA,EACR;AAEA,QAAM,sBAAsB,QAAS,oBAAqB,GAAG;AAG7D,MAAK,sBAAuB,eAAgB,GAAI;AAC/C,WAAO;AAAA,EACR;AAEA,MAAI;AACJ,MAAK,mBAAoB;AACxB,UAAM,sBAAsB,QAAS,kBAAmB;AACxD,UAAM,uBACL,QAAS,kBAAmB,GAAG,aAAa;AAE7C,4BAAwB;AAAA,MACvB,CAAE,kBAAmB,GAAG;AAAA,QACvB,GAAG;AAAA,QACH,aAAa;AAAA,UACZ,UAAU;AAAA,YACT,GAAG;AAAA,YACH,CAAE,eAAgB,GAAG;AAAA,UACtB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAEA,MAAI;AACJ,MAAK,gBAAiB;AACrB,UAAM,mBAAmB,QAAS,eAAgB;AAClD,UAAM,oBAAoB,QAAS,eAAgB,GAAG;AAEtD,yBAAqB;AAAA,MACpB,CAAE,eAAgB,GAAG;AAAA,QACpB,GAAG;AAAA,QACH,aAAa;AAAA,UACZ,GAAG;AAAA,UACH,UAAU;AAAA,QACX;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAKA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,oBAAqB,GAAG;AAAA,MACzB,aAAa;AAAA,QACZ,GAAG;AAAA,QACH,CAAE,eAAgB,GAAG;AAAA,MACtB;AAAA,IACD;AAAA,IACA,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,54 +1,11 @@
|
|
|
1
|
-
const identity = arg => arg;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Migrates an individual item inside the `preferences` object for a package's store.
|
|
5
|
-
*
|
|
6
|
-
* Previously, some packages had individual 'preferences' of any data type, and many used
|
|
7
|
-
* complex nested data structures. For example:
|
|
8
|
-
* ```js
|
|
9
|
-
* {
|
|
10
|
-
* 'core/edit-post': {
|
|
11
|
-
* preferences: {
|
|
12
|
-
* panels: {
|
|
13
|
-
* publish: {
|
|
14
|
-
* opened: true,
|
|
15
|
-
* enabled: true,
|
|
16
|
-
* }
|
|
17
|
-
* },
|
|
18
|
-
* // ...other preferences.
|
|
19
|
-
* },
|
|
20
|
-
* },
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* This function supports moving an individual preference like 'panels' above into the
|
|
24
|
-
* preferences package data structure.
|
|
25
|
-
*
|
|
26
|
-
* It supports moving a preference to a particular scope in the preferences store and
|
|
27
|
-
* optionally converting the data using a `convert` function.
|
|
28
|
-
*
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @param {Object} state The original state.
|
|
32
|
-
* @param {Object} migrate An options object that contains details of the migration.
|
|
33
|
-
* @param {string} migrate.from The name of the store to migrate from.
|
|
34
|
-
* @param {string} migrate.to The scope in the preferences store to migrate to.
|
|
35
|
-
* @param {string} key The key in the preferences object to migrate.
|
|
36
|
-
* @param {?Function} convert A function that converts preferences from one format to another.
|
|
37
|
-
*/
|
|
38
|
-
export default function moveIndividualPreferenceToPreferences(state, {
|
|
39
|
-
from: sourceStoreName,
|
|
40
|
-
to: scope
|
|
41
|
-
}, key, convert = identity) {
|
|
42
|
-
const preferencesStoreName = 'core/preferences';
|
|
1
|
+
const identity = (arg) => arg;
|
|
2
|
+
function moveIndividualPreferenceToPreferences(state, { from: sourceStoreName, to: scope }, key, convert = identity) {
|
|
3
|
+
const preferencesStoreName = "core/preferences";
|
|
43
4
|
const sourcePreference = state?.[sourceStoreName]?.preferences?.[key];
|
|
44
|
-
|
|
45
|
-
// There's nothing to migrate, exit early.
|
|
46
|
-
if (sourcePreference === undefined) {
|
|
5
|
+
if (sourcePreference === void 0) {
|
|
47
6
|
return state;
|
|
48
7
|
}
|
|
49
8
|
const targetPreference = state?.[preferencesStoreName]?.preferences?.[scope]?.[key];
|
|
50
|
-
|
|
51
|
-
// There's existing data at the target, so don't overwrite it, exit early.
|
|
52
9
|
if (targetPreference) {
|
|
53
10
|
return state;
|
|
54
11
|
}
|
|
@@ -56,12 +13,7 @@ export default function moveIndividualPreferenceToPreferences(state, {
|
|
|
56
13
|
const otherPreferences = state?.[preferencesStoreName]?.preferences?.[scope];
|
|
57
14
|
const otherSourceState = state?.[sourceStoreName];
|
|
58
15
|
const allSourcePreferences = state?.[sourceStoreName]?.preferences;
|
|
59
|
-
|
|
60
|
-
// Pass an object with the key and value as this allows the convert
|
|
61
|
-
// function to convert to a data structure that has different keys.
|
|
62
|
-
const convertedPreferences = convert({
|
|
63
|
-
[key]: sourcePreference
|
|
64
|
-
});
|
|
16
|
+
const convertedPreferences = convert({ [key]: sourcePreference });
|
|
65
17
|
return {
|
|
66
18
|
...state,
|
|
67
19
|
[preferencesStoreName]: {
|
|
@@ -77,9 +29,12 @@ export default function moveIndividualPreferenceToPreferences(state, {
|
|
|
77
29
|
...otherSourceState,
|
|
78
30
|
preferences: {
|
|
79
31
|
...allSourcePreferences,
|
|
80
|
-
[key]:
|
|
32
|
+
[key]: void 0
|
|
81
33
|
}
|
|
82
34
|
}
|
|
83
35
|
};
|
|
84
36
|
}
|
|
85
|
-
|
|
37
|
+
export {
|
|
38
|
+
moveIndividualPreferenceToPreferences as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=move-individual-preference.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/migrations/legacy-local-storage-data/move-individual-preference.js"],
|
|
4
|
+
"sourcesContent": ["const identity = ( arg ) => arg;\n\n/**\n * Migrates an individual item inside the `preferences` object for a package's store.\n *\n * Previously, some packages had individual 'preferences' of any data type, and many used\n * complex nested data structures. For example:\n * ```js\n * {\n * 'core/edit-post': {\n * preferences: {\n * panels: {\n * publish: {\n * opened: true,\n * enabled: true,\n * }\n * },\n * // ...other preferences.\n * },\n * },\n * }\n *\n * This function supports moving an individual preference like 'panels' above into the\n * preferences package data structure.\n *\n * It supports moving a preference to a particular scope in the preferences store and\n * optionally converting the data using a `convert` function.\n *\n * ```\n *\n * @param {Object} state The original state.\n * @param {Object} migrate An options object that contains details of the migration.\n * @param {string} migrate.from The name of the store to migrate from.\n * @param {string} migrate.to The scope in the preferences store to migrate to.\n * @param {string} key The key in the preferences object to migrate.\n * @param {?Function} convert A function that converts preferences from one format to another.\n */\nexport default function moveIndividualPreferenceToPreferences(\n\tstate,\n\t{ from: sourceStoreName, to: scope },\n\tkey,\n\tconvert = identity\n) {\n\tconst preferencesStoreName = 'core/preferences';\n\tconst sourcePreference = state?.[ sourceStoreName ]?.preferences?.[ key ];\n\n\t// There's nothing to migrate, exit early.\n\tif ( sourcePreference === undefined ) {\n\t\treturn state;\n\t}\n\n\tconst targetPreference =\n\t\tstate?.[ preferencesStoreName ]?.preferences?.[ scope ]?.[ key ];\n\n\t// There's existing data at the target, so don't overwrite it, exit early.\n\tif ( targetPreference ) {\n\t\treturn state;\n\t}\n\n\tconst otherScopes = state?.[ preferencesStoreName ]?.preferences;\n\tconst otherPreferences =\n\t\tstate?.[ preferencesStoreName ]?.preferences?.[ scope ];\n\n\tconst otherSourceState = state?.[ sourceStoreName ];\n\tconst allSourcePreferences = state?.[ sourceStoreName ]?.preferences;\n\n\t// Pass an object with the key and value as this allows the convert\n\t// function to convert to a data structure that has different keys.\n\tconst convertedPreferences = convert( { [ key ]: sourcePreference } );\n\n\treturn {\n\t\t...state,\n\t\t[ preferencesStoreName ]: {\n\t\t\tpreferences: {\n\t\t\t\t...otherScopes,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...otherPreferences,\n\t\t\t\t\t...convertedPreferences,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t[ sourceStoreName ]: {\n\t\t\t...otherSourceState,\n\t\t\tpreferences: {\n\t\t\t\t...allSourcePreferences,\n\t\t\t\t[ key ]: undefined,\n\t\t\t},\n\t\t},\n\t};\n}\n"],
|
|
5
|
+
"mappings": "AAAA,MAAM,WAAW,CAAE,QAAS;AAqCb,SAAR,sCACN,OACA,EAAE,MAAM,iBAAiB,IAAI,MAAM,GACnC,KACA,UAAU,UACT;AACD,QAAM,uBAAuB;AAC7B,QAAM,mBAAmB,QAAS,eAAgB,GAAG,cAAe,GAAI;AAGxE,MAAK,qBAAqB,QAAY;AACrC,WAAO;AAAA,EACR;AAEA,QAAM,mBACL,QAAS,oBAAqB,GAAG,cAAe,KAAM,IAAK,GAAI;AAGhE,MAAK,kBAAmB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,cAAc,QAAS,oBAAqB,GAAG;AACrD,QAAM,mBACL,QAAS,oBAAqB,GAAG,cAAe,KAAM;AAEvD,QAAM,mBAAmB,QAAS,eAAgB;AAClD,QAAM,uBAAuB,QAAS,eAAgB,GAAG;AAIzD,QAAM,uBAAuB,QAAS,EAAE,CAAE,GAAI,GAAG,iBAAiB,CAAE;AAEpE,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,oBAAqB,GAAG;AAAA,MACzB,aAAa;AAAA,QACZ,GAAG;AAAA,QACH,CAAE,KAAM,GAAG;AAAA,UACV,GAAG;AAAA,UACH,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,eAAgB,GAAG;AAAA,MACpB,GAAG;AAAA,MACH,aAAa;AAAA,QACZ,GAAG;AAAA,QACH,CAAE,GAAI,GAAG;AAAA,MACV;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,70 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The interface package stores this data in this format:
|
|
5
|
-
* ```js
|
|
6
|
-
* {
|
|
7
|
-
* enableItems: {
|
|
8
|
-
* singleEnableItems: {
|
|
9
|
-
* complementaryArea: {
|
|
10
|
-
* 'core/edit-post': 'edit-post/document',
|
|
11
|
-
* 'core/edit-site': 'edit-site/global-styles',
|
|
12
|
-
* }
|
|
13
|
-
* },
|
|
14
|
-
* multipleEnableItems: {
|
|
15
|
-
* pinnedItems: {
|
|
16
|
-
* 'core/edit-post': {
|
|
17
|
-
* 'plugin-1': true,
|
|
18
|
-
* },
|
|
19
|
-
* 'core/edit-site': {
|
|
20
|
-
* 'plugin-2': true,
|
|
21
|
-
* },
|
|
22
|
-
* },
|
|
23
|
-
* }
|
|
24
|
-
* }
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* and it should be converted it to:
|
|
29
|
-
* ```js
|
|
30
|
-
* {
|
|
31
|
-
* 'core/edit-post': {
|
|
32
|
-
* complementaryArea: 'edit-post/document',
|
|
33
|
-
* pinnedItems: {
|
|
34
|
-
* 'plugin-1': true,
|
|
35
|
-
* },
|
|
36
|
-
* },
|
|
37
|
-
* 'core/edit-site': {
|
|
38
|
-
* complementaryArea: 'edit-site/global-styles',
|
|
39
|
-
* pinnedItems: {
|
|
40
|
-
* 'plugin-2': true,
|
|
41
|
-
* },
|
|
42
|
-
* },
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} state The local storage state.
|
|
47
|
-
*/
|
|
48
|
-
export default function moveInterfaceEnableItems(state) {
|
|
49
|
-
var _state$preferencesSto, _sourceEnableItems$si, _sourceEnableItems$mu;
|
|
50
|
-
const interfaceStoreName = 'core/interface';
|
|
51
|
-
const preferencesStoreName = 'core/preferences';
|
|
1
|
+
function moveInterfaceEnableItems(state) {
|
|
2
|
+
const interfaceStoreName = "core/interface";
|
|
3
|
+
const preferencesStoreName = "core/preferences";
|
|
52
4
|
const sourceEnableItems = state?.[interfaceStoreName]?.enableItems;
|
|
53
|
-
|
|
54
|
-
// There's nothing to migrate, exit early.
|
|
55
5
|
if (!sourceEnableItems) {
|
|
56
6
|
return state;
|
|
57
7
|
}
|
|
58
|
-
const allPreferences =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const sourceComplementaryAreas = (_sourceEnableItems$si = sourceEnableItems?.singleEnableItems?.complementaryArea) !== null && _sourceEnableItems$si !== void 0 ? _sourceEnableItems$si : {};
|
|
64
|
-
const preferencesWithConvertedComplementaryAreas = Object.keys(sourceComplementaryAreas).reduce((accumulator, scope) => {
|
|
8
|
+
const allPreferences = state?.[preferencesStoreName]?.preferences ?? {};
|
|
9
|
+
const sourceComplementaryAreas = sourceEnableItems?.singleEnableItems?.complementaryArea ?? {};
|
|
10
|
+
const preferencesWithConvertedComplementaryAreas = Object.keys(
|
|
11
|
+
sourceComplementaryAreas
|
|
12
|
+
).reduce((accumulator, scope) => {
|
|
65
13
|
const data = sourceComplementaryAreas[scope];
|
|
66
|
-
|
|
67
|
-
// Don't overwrite any existing data in the preferences store.
|
|
68
14
|
if (accumulator?.[scope]?.complementaryArea) {
|
|
69
15
|
return accumulator;
|
|
70
16
|
}
|
|
@@ -76,24 +22,23 @@ export default function moveInterfaceEnableItems(state) {
|
|
|
76
22
|
}
|
|
77
23
|
};
|
|
78
24
|
}, allPreferences);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// Don't overwrite any existing data in the preferences store.
|
|
86
|
-
if (accumulator?.[scope]?.pinnedItems) {
|
|
87
|
-
return accumulator;
|
|
88
|
-
}
|
|
89
|
-
return {
|
|
90
|
-
...accumulator,
|
|
91
|
-
[scope]: {
|
|
92
|
-
...accumulator[scope],
|
|
93
|
-
pinnedItems: data
|
|
25
|
+
const sourcePinnedItems = sourceEnableItems?.multipleEnableItems?.pinnedItems ?? {};
|
|
26
|
+
const allConvertedData = Object.keys(sourcePinnedItems).reduce(
|
|
27
|
+
(accumulator, scope) => {
|
|
28
|
+
const data = sourcePinnedItems[scope];
|
|
29
|
+
if (accumulator?.[scope]?.pinnedItems) {
|
|
30
|
+
return accumulator;
|
|
94
31
|
}
|
|
95
|
-
|
|
96
|
-
|
|
32
|
+
return {
|
|
33
|
+
...accumulator,
|
|
34
|
+
[scope]: {
|
|
35
|
+
...accumulator[scope],
|
|
36
|
+
pinnedItems: data
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
preferencesWithConvertedComplementaryAreas
|
|
41
|
+
);
|
|
97
42
|
const otherInterfaceItems = state[interfaceStoreName];
|
|
98
43
|
return {
|
|
99
44
|
...state,
|
|
@@ -102,8 +47,11 @@ export default function moveInterfaceEnableItems(state) {
|
|
|
102
47
|
},
|
|
103
48
|
[interfaceStoreName]: {
|
|
104
49
|
...otherInterfaceItems,
|
|
105
|
-
enableItems:
|
|
50
|
+
enableItems: void 0
|
|
106
51
|
}
|
|
107
52
|
};
|
|
108
53
|
}
|
|
109
|
-
|
|
54
|
+
export {
|
|
55
|
+
moveInterfaceEnableItems as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=move-interface-enable-items.js.map
|
package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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": "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
|
+
}
|
package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js
CHANGED
|
@@ -1,54 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* While usage was likely non-existent or very small, this function ensures
|
|
6
|
-
* those are migrated to the preferences data structure. The interface
|
|
7
|
-
* package's APIs have now been deprecated and use the preferences store.
|
|
8
|
-
*
|
|
9
|
-
* This will convert data that looks like this:
|
|
10
|
-
* ```js
|
|
11
|
-
* {
|
|
12
|
-
* 'core/interface': {
|
|
13
|
-
* preferences: {
|
|
14
|
-
* features: {
|
|
15
|
-
* 'my-plugin': {
|
|
16
|
-
* myPluginFeature: true
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* To this:
|
|
25
|
-
* ```js
|
|
26
|
-
* * {
|
|
27
|
-
* 'core/preferences': {
|
|
28
|
-
* preferences: {
|
|
29
|
-
* 'my-plugin': {
|
|
30
|
-
* myPluginFeature: true
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @param {Object} state The local storage state
|
|
38
|
-
*
|
|
39
|
-
* @return {Object} The state with third party preferences moved to the
|
|
40
|
-
* preferences data structure.
|
|
41
|
-
*/
|
|
42
|
-
export default function moveThirdPartyFeaturePreferencesToPreferences(state) {
|
|
43
|
-
const interfaceStoreName = 'core/interface';
|
|
44
|
-
const preferencesStoreName = 'core/preferences';
|
|
1
|
+
function moveThirdPartyFeaturePreferencesToPreferences(state) {
|
|
2
|
+
const interfaceStoreName = "core/interface";
|
|
3
|
+
const preferencesStoreName = "core/preferences";
|
|
45
4
|
const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
|
|
46
5
|
const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
|
|
47
6
|
if (!interfaceScopeKeys?.length) {
|
|
48
7
|
return state;
|
|
49
8
|
}
|
|
50
|
-
return interfaceScopeKeys.reduce(function
|
|
51
|
-
if (scope.startsWith(
|
|
9
|
+
return interfaceScopeKeys.reduce(function(convertedState, scope) {
|
|
10
|
+
if (scope.startsWith("core")) {
|
|
52
11
|
return convertedState;
|
|
53
12
|
}
|
|
54
13
|
const featuresToMigrate = interfaceScopes?.[scope];
|
|
@@ -75,11 +34,14 @@ export default function moveThirdPartyFeaturePreferencesToPreferences(state) {
|
|
|
75
34
|
preferences: {
|
|
76
35
|
features: {
|
|
77
36
|
...otherInterfaceScopes,
|
|
78
|
-
[scope]:
|
|
37
|
+
[scope]: void 0
|
|
79
38
|
}
|
|
80
39
|
}
|
|
81
40
|
}
|
|
82
41
|
};
|
|
83
42
|
}, state);
|
|
84
43
|
}
|
|
85
|
-
|
|
44
|
+
export {
|
|
45
|
+
moveThirdPartyFeaturePreferencesToPreferences as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=move-third-party-feature-preferences.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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": "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,12 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
function convertComplementaryAreas(state) {
|
|
2
2
|
return Object.keys(state).reduce((stateAccumulator, scope) => {
|
|
3
3
|
const scopeData = state[scope];
|
|
4
|
-
|
|
5
|
-
// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.
|
|
6
4
|
if (scopeData?.complementaryArea) {
|
|
7
|
-
const updatedScopeData = {
|
|
8
|
-
...scopeData
|
|
9
|
-
};
|
|
5
|
+
const updatedScopeData = { ...scopeData };
|
|
10
6
|
delete updatedScopeData.complementaryArea;
|
|
11
7
|
updatedScopeData.isComplementaryAreaVisible = true;
|
|
12
8
|
stateAccumulator[scope] = updatedScopeData;
|
|
@@ -15,4 +11,7 @@ export default function convertComplementaryAreas(state) {
|
|
|
15
11
|
return stateAccumulator;
|
|
16
12
|
}, state);
|
|
17
13
|
}
|
|
18
|
-
|
|
14
|
+
export {
|
|
15
|
+
convertComplementaryAreas as default
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=convert-complementary-areas.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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": "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,32 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export default function convertEditorSettings(data) {
|
|
6
|
-
var _newData$coreEditPo, _newData$coreEditSi;
|
|
1
|
+
function convertEditorSettings(data) {
|
|
7
2
|
let newData = data;
|
|
8
|
-
const settingsToMoveToCore = [
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const settingsToMoveToCore = [
|
|
4
|
+
"allowRightClickOverrides",
|
|
5
|
+
"distractionFree",
|
|
6
|
+
"editorMode",
|
|
7
|
+
"fixedToolbar",
|
|
8
|
+
"focusMode",
|
|
9
|
+
"hiddenBlockTypes",
|
|
10
|
+
"inactivePanels",
|
|
11
|
+
"keepCaretInsideBlock",
|
|
12
|
+
"mostUsedBlocks",
|
|
13
|
+
"openPanels",
|
|
14
|
+
"showBlockBreadcrumbs",
|
|
15
|
+
"showIconLabels",
|
|
16
|
+
"showListViewByDefault",
|
|
17
|
+
"isPublishSidebarEnabled",
|
|
18
|
+
"isComplementaryAreaVisible",
|
|
19
|
+
"pinnedItems"
|
|
20
|
+
];
|
|
21
|
+
settingsToMoveToCore.forEach((setting) => {
|
|
22
|
+
if (data?.["core/edit-post"]?.[setting] !== void 0) {
|
|
11
23
|
newData = {
|
|
12
24
|
...newData,
|
|
13
25
|
core: {
|
|
14
26
|
...newData?.core,
|
|
15
|
-
[setting]: data[
|
|
27
|
+
[setting]: data["core/edit-post"][setting]
|
|
16
28
|
}
|
|
17
29
|
};
|
|
18
|
-
delete newData[
|
|
30
|
+
delete newData["core/edit-post"][setting];
|
|
19
31
|
}
|
|
20
|
-
if (data?.[
|
|
21
|
-
delete newData[
|
|
32
|
+
if (data?.["core/edit-site"]?.[setting] !== void 0) {
|
|
33
|
+
delete newData["core/edit-site"][setting];
|
|
22
34
|
}
|
|
23
35
|
});
|
|
24
|
-
if (Object.keys(
|
|
25
|
-
delete newData[
|
|
36
|
+
if (Object.keys(newData?.["core/edit-post"] ?? {})?.length === 0) {
|
|
37
|
+
delete newData["core/edit-post"];
|
|
26
38
|
}
|
|
27
|
-
if (Object.keys(
|
|
28
|
-
delete newData[
|
|
39
|
+
if (Object.keys(newData?.["core/edit-site"] ?? {})?.length === 0) {
|
|
40
|
+
delete newData["core/edit-site"];
|
|
29
41
|
}
|
|
30
42
|
return newData;
|
|
31
43
|
}
|
|
32
|
-
|
|
44
|
+
export {
|
|
45
|
+
convertEditorSettings as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=convert-editor-settings.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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": "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,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import convertComplementaryAreas from './convert-complementary-areas';
|
|
5
|
-
import convertEditorSettings from './convert-editor-settings';
|
|
6
|
-
export default function convertPreferencesPackageData(data) {
|
|
1
|
+
import convertComplementaryAreas from "./convert-complementary-areas";
|
|
2
|
+
import convertEditorSettings from "./convert-editor-settings";
|
|
3
|
+
function convertPreferencesPackageData(data) {
|
|
7
4
|
let newData = convertComplementaryAreas(data);
|
|
8
5
|
newData = convertEditorSettings(newData);
|
|
9
6
|
return newData;
|
|
10
7
|
}
|
|
11
|
-
|
|
8
|
+
export {
|
|
9
|
+
convertPreferencesPackageData as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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": "AAGA,OAAO,+BAA+B;AACtC,OAAO,2BAA2B;AAEnB,SAAR,8BAAgD,MAAO;AAC7D,MAAI,UAAU,0BAA2B,IAAK;AAC9C,YAAU,sBAAuB,OAAQ;AACzC,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/preferences-persistence",
|
|
3
|
-
"version": "2.32.0",
|
|
3
|
+
"version": "2.32.1-next.47f435fc9.0",
|
|
4
4
|
"description": "Persistence utilities for `wordpress/preferences`.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -25,15 +25,22 @@
|
|
|
25
25
|
},
|
|
26
26
|
"main": "build/index.js",
|
|
27
27
|
"module": "build-module/index.js",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./build-types/index.d.ts",
|
|
31
|
+
"import": "./build-module/index.js",
|
|
32
|
+
"require": "./build/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
28
36
|
"react-native": "src/index",
|
|
29
37
|
"wpScript": true,
|
|
30
38
|
"sideEffects": false,
|
|
31
39
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@wordpress/api-fetch": "^7.32.0"
|
|
40
|
+
"@wordpress/api-fetch": "^7.32.1-next.47f435fc9.0"
|
|
34
41
|
},
|
|
35
42
|
"publishConfig": {
|
|
36
43
|
"access": "public"
|
|
37
44
|
},
|
|
38
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "9720f22c138771d2ed1a0522725c3cdf1c242953"
|
|
39
46
|
}
|