@wordpress/preferences-persistence 3.0.0 → 3.1.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.cjs +54 -58
- package/build/create/debounce-async.cjs.map +1 -7
- package/build/create/index.cjs +73 -79
- package/build/create/index.cjs.map +1 -7
- package/build/get-newest-data.cjs +50 -39
- package/build/get-newest-data.cjs.map +1 -7
- package/build/index.cjs +50 -43
- package/build/index.cjs.map +1 -7
- package/build/is-preferences-data.cjs +16 -25
- package/build/is-preferences-data.cjs.map +1 -7
- package/build/local-storage.cjs +33 -40
- package/build/local-storage.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.cjs +48 -38
- package/build/migrations/legacy-local-storage-data/convert-edit-post-panels.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/index.cjs +93 -83
- package/build/migrations/legacy-local-storage-data/index.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/move-feature-preferences.cjs +105 -77
- package/build/migrations/legacy-local-storage-data/move-feature-preferences.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/move-individual-preference.cjs +69 -58
- package/build/migrations/legacy-local-storage-data/move-individual-preference.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/move-interface-enable-items.cjs +92 -75
- package/build/migrations/legacy-local-storage-data/move-interface-enable-items.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.cjs +76 -65
- package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.cjs.map +1 -7
- package/build/migrations/legacy-local-storage-data/types.cjs +4 -18
- package/build/migrations/preferences-package-data/convert-complementary-areas.cjs +18 -38
- package/build/migrations/preferences-package-data/convert-complementary-areas.cjs.map +1 -7
- package/build/migrations/preferences-package-data/convert-editor-settings.cjs +58 -72
- package/build/migrations/preferences-package-data/convert-editor-settings.cjs.map +1 -7
- package/build/migrations/preferences-package-data/index.cjs +27 -31
- package/build/migrations/preferences-package-data/index.cjs.map +1 -7
- package/build/types.cjs +4 -18
- package/build-module/create/debounce-async.mjs +50 -38
- package/build-module/create/debounce-async.mjs.map +1 -7
- package/build-module/create/index.mjs +48 -53
- package/build-module/create/index.mjs.map +1 -7
- package/build-module/get-newest-data.mjs +29 -15
- package/build-module/get-newest-data.mjs.map +1 -7
- package/build-module/index.mjs +23 -15
- package/build-module/index.mjs.map +1 -7
- package/build-module/is-preferences-data.mjs +12 -5
- package/build-module/is-preferences-data.mjs.map +1 -7
- package/build-module/local-storage.mjs +28 -15
- package/build-module/local-storage.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.mjs +44 -18
- package/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/index.mjs +63 -51
- package/build-module/migrations/legacy-local-storage-data/index.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.mjs +101 -57
- package/build-module/migrations/legacy-local-storage-data/move-feature-preferences.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/move-individual-preference.mjs +65 -38
- package/build-module/migrations/legacy-local-storage-data/move-individual-preference.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.mjs +88 -55
- package/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.mjs +72 -45
- package/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.mjs.map +1 -7
- package/build-module/migrations/legacy-local-storage-data/types.mjs +0 -1
- package/build-module/migrations/preferences-package-data/convert-complementary-areas.mjs +14 -18
- package/build-module/migrations/preferences-package-data/convert-complementary-areas.mjs.map +1 -7
- package/build-module/migrations/preferences-package-data/convert-editor-settings.mjs +40 -50
- package/build-module/migrations/preferences-package-data/convert-editor-settings.mjs.map +1 -7
- package/build-module/migrations/preferences-package-data/index.mjs +7 -8
- package/build-module/migrations/preferences-package-data/index.mjs.map +1 -7
- package/build-module/types.mjs +0 -1
- package/package.json +5 -4
- package/src/create/test/{debounce-async.js → debounce-async.ts} +7 -3
- package/src/create/test/{index.jsdom.test.js → index.jsdom.test.ts} +8 -5
- package/src/migrations/legacy-local-storage-data/test/{index.js → index.ts} +6 -1
- package/src/migrations/preferences-package-data/test/{convert-editor-settings.js → convert-editor-settings.ts} +3 -0
- package/src/test/{index.jsdom.test.js → index.jsdom.test.ts} +6 -4
- package/build/migrations/legacy-local-storage-data/types.cjs.map +0 -7
- package/build/types.cjs.map +0 -7
- package/build-module/migrations/legacy-local-storage-data/types.mjs.map +0 -7
- package/build-module/types.mjs.map +0 -7
- /package/src/migrations/legacy-local-storage-data/test/{convert-edit-post-panels.js → convert-edit-post-panels.ts} +0 -0
- /package/src/migrations/legacy-local-storage-data/test/{move-feature-preferences.js → move-feature-preferences.ts} +0 -0
- /package/src/migrations/legacy-local-storage-data/test/{move-individual-preference.js → move-individual-preference.ts} +0 -0
- /package/src/migrations/legacy-local-storage-data/test/{move-interface-enable-items.js → move-interface-enable-items.ts} +0 -0
- /package/src/migrations/legacy-local-storage-data/test/{move-third-party-feature-preferences.js → move-third-party-feature-preferences.ts} +0 -0
- /package/src/migrations/preferences-package-data/test/{convert-complementary-areas.js → convert-complementary-areas.ts} +0 -0
- /package/src/migrations/preferences-package-data/test/{index.js → index.ts} +0 -0
- /package/src/test/{local-storage.jsdom.test.js → local-storage.jsdom.test.ts} +0 -0
|
@@ -1,69 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/preferences-persistence/src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts
|
|
21
|
-
var move_third_party_feature_preferences_exports = {};
|
|
22
|
-
__export(move_third_party_feature_preferences_exports, {
|
|
23
|
-
default: () => moveThirdPartyFeaturePreferencesToPreferences
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
// packages/preferences-persistence/src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts
|
|
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 state The local storage state
|
|
44
|
+
*
|
|
45
|
+
* @return The state with third party preferences moved to the
|
|
46
|
+
* preferences data structure.
|
|
47
|
+
*/
|
|
26
48
|
function moveThirdPartyFeaturePreferencesToPreferences(state) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
[interfaceStoreName]: {
|
|
58
|
-
...otherInterfaceState,
|
|
59
|
-
preferences: {
|
|
60
|
-
features: {
|
|
61
|
-
...otherInterfaceScopes,
|
|
62
|
-
[scope]: void 0
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}, state);
|
|
49
|
+
const interfaceStoreName = "core/interface";
|
|
50
|
+
const preferencesStoreName = "core/preferences";
|
|
51
|
+
const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features;
|
|
52
|
+
const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : [];
|
|
53
|
+
if (!interfaceScopeKeys?.length) return state;
|
|
54
|
+
return interfaceScopeKeys.reduce(function(convertedState, scope) {
|
|
55
|
+
if (scope.startsWith("core")) return convertedState;
|
|
56
|
+
const featuresToMigrate = interfaceScopes?.[scope];
|
|
57
|
+
if (!featuresToMigrate) return convertedState;
|
|
58
|
+
if (convertedState?.[preferencesStoreName]?.preferences?.[scope]) return convertedState;
|
|
59
|
+
const otherPreferencesScopes = convertedState?.[preferencesStoreName]?.preferences;
|
|
60
|
+
const otherInterfaceState = convertedState?.[interfaceStoreName];
|
|
61
|
+
const otherInterfaceScopes = convertedState?.[interfaceStoreName]?.preferences?.features;
|
|
62
|
+
return {
|
|
63
|
+
...convertedState,
|
|
64
|
+
[preferencesStoreName]: { preferences: {
|
|
65
|
+
...otherPreferencesScopes,
|
|
66
|
+
[scope]: featuresToMigrate
|
|
67
|
+
} },
|
|
68
|
+
[interfaceStoreName]: {
|
|
69
|
+
...otherInterfaceState,
|
|
70
|
+
preferences: { features: {
|
|
71
|
+
...otherInterfaceScopes,
|
|
72
|
+
[scope]: void 0
|
|
73
|
+
} }
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}, state);
|
|
68
77
|
}
|
|
69
|
-
|
|
78
|
+
exports.default = moveThirdPartyFeaturePreferencesToPreferences;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=move-third-party-feature-preferences.cjs.map
|
package/build/migrations/legacy-local-storage-data/move-third-party-feature-preferences.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts"],
|
|
4
|
-
"sourcesContent": ["import type { LegacyData } from './types';\n\n/**\n * The interface package previously had a public API that could be used by\n * plugins to set persisted boolean 'feature' preferences.\n *\n * While usage was likely non-existent or very small, this function ensures\n * those are migrated to the preferences data structure. The interface\n * package's APIs have now been deprecated and use the preferences store.\n *\n * This will convert data that looks like this:\n * ```js\n * {\n * 'core/interface': {\n * preferences: {\n * features: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * To this:\n * ```js\n * * {\n * 'core/preferences': {\n * preferences: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * ```\n *\n * @param state The local storage state\n *\n * @return The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences(\n\tstate: LegacyData\n): LegacyData {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\n\tconst interfaceScopes =\n\t\tstate?.[ interfaceStoreName ]?.preferences?.features;\n\tconst interfaceScopeKeys = interfaceScopes\n\t\t? Object.keys( interfaceScopes )\n\t\t: [];\n\n\tif ( ! interfaceScopeKeys?.length ) {\n\t\treturn state;\n\t}\n\n\treturn interfaceScopeKeys.reduce( function ( convertedState, scope ) {\n\t\tif ( scope.startsWith( 'core' ) ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst featuresToMigrate = interfaceScopes?.[ scope ];\n\t\tif ( ! featuresToMigrate ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst existingMigratedData =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences?.[ scope ];\n\n\t\tif ( existingMigratedData ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst otherPreferencesScopes =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences;\n\t\tconst otherInterfaceState = convertedState?.[ interfaceStoreName ];\n\t\tconst otherInterfaceScopes =\n\t\t\tconvertedState?.[ interfaceStoreName ]?.preferences?.features;\n\n\t\treturn {\n\t\t\t...convertedState,\n\t\t\t[ preferencesStoreName ]: {\n\t\t\t\tpreferences: {\n\t\t\t\t\t...otherPreferencesScopes,\n\t\t\t\t\t[ scope ]: featuresToMigrate,\n\t\t\t\t},\n\t\t\t},\n\t\t\t[ interfaceStoreName ]: {\n\t\t\t\t...otherInterfaceState,\n\t\t\t\tpreferences: {\n\t\t\t\t\tfeatures: {\n\t\t\t\t\t\t...otherInterfaceScopes,\n\t\t\t\t\t\t[ scope ]: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, state );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2Ce,SAAR,8CACN,OACa;AACb,QAAM,qBAAqB;AAC3B,QAAM,uBAAuB;AAE7B,QAAM,kBACL,QAAS,kBAAmB,GAAG,aAAa;AAC7C,QAAM,qBAAqB,kBACxB,OAAO,KAAM,eAAgB,IAC7B,CAAC;AAEJ,MAAK,CAAE,oBAAoB,QAAS;AACnC,WAAO;AAAA,EACR;AAEA,SAAO,mBAAmB,OAAQ,SAAW,gBAAgB,OAAQ;AACpE,QAAK,MAAM,WAAY,MAAO,GAAI;AACjC,aAAO;AAAA,IACR;AAEA,UAAM,oBAAoB,kBAAmB,KAAM;AACnD,QAAK,CAAE,mBAAoB;AAC1B,aAAO;AAAA,IACR;AAEA,UAAM,uBACL,iBAAkB,oBAAqB,GAAG,cAAe,KAAM;AAEhE,QAAK,sBAAuB;AAC3B,aAAO;AAAA,IACR;AAEA,UAAM,yBACL,iBAAkB,oBAAqB,GAAG;AAC3C,UAAM,sBAAsB,iBAAkB,kBAAmB;AACjE,UAAM,uBACL,iBAAkB,kBAAmB,GAAG,aAAa;AAEtD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,oBAAqB,GAAG;AAAA,QACzB,aAAa;AAAA,UACZ,GAAG;AAAA,UACH,CAAE,KAAM,GAAG;AAAA,QACZ;AAAA,MACD;AAAA,MACA,CAAE,kBAAmB,GAAG;AAAA,QACvB,GAAG;AAAA,QACH,aAAa;AAAA,UACZ,UAAU;AAAA,YACT,GAAG;AAAA,YACH,CAAE,KAAM,GAAG;AAAA,UACZ;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD,GAAG,KAAM;AACV;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"move-third-party-feature-preferences.cjs","names":[],"sources":["../../../src/migrations/legacy-local-storage-data/move-third-party-feature-preferences.ts"],"sourcesContent":["import type { LegacyData } from './types';\n\n/**\n * The interface package previously had a public API that could be used by\n * plugins to set persisted boolean 'feature' preferences.\n *\n * While usage was likely non-existent or very small, this function ensures\n * those are migrated to the preferences data structure. The interface\n * package's APIs have now been deprecated and use the preferences store.\n *\n * This will convert data that looks like this:\n * ```js\n * {\n * 'core/interface': {\n * preferences: {\n * features: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * To this:\n * ```js\n * * {\n * 'core/preferences': {\n * preferences: {\n * 'my-plugin': {\n * myPluginFeature: true\n * }\n * }\n * }\n * }\n * ```\n *\n * @param state The local storage state\n *\n * @return The state with third party preferences moved to the\n * preferences data structure.\n */\nexport default function moveThirdPartyFeaturePreferencesToPreferences(\n\tstate: LegacyData\n): LegacyData {\n\tconst interfaceStoreName = 'core/interface';\n\tconst preferencesStoreName = 'core/preferences';\n\n\tconst interfaceScopes =\n\t\tstate?.[ interfaceStoreName ]?.preferences?.features;\n\tconst interfaceScopeKeys = interfaceScopes\n\t\t? Object.keys( interfaceScopes )\n\t\t: [];\n\n\tif ( ! interfaceScopeKeys?.length ) {\n\t\treturn state;\n\t}\n\n\treturn interfaceScopeKeys.reduce( function ( convertedState, scope ) {\n\t\tif ( scope.startsWith( 'core' ) ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst featuresToMigrate = interfaceScopes?.[ scope ];\n\t\tif ( ! featuresToMigrate ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst existingMigratedData =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences?.[ scope ];\n\n\t\tif ( existingMigratedData ) {\n\t\t\treturn convertedState;\n\t\t}\n\n\t\tconst otherPreferencesScopes =\n\t\t\tconvertedState?.[ preferencesStoreName ]?.preferences;\n\t\tconst otherInterfaceState = convertedState?.[ interfaceStoreName ];\n\t\tconst otherInterfaceScopes =\n\t\t\tconvertedState?.[ interfaceStoreName ]?.preferences?.features;\n\n\t\treturn {\n\t\t\t...convertedState,\n\t\t\t[ preferencesStoreName ]: {\n\t\t\t\tpreferences: {\n\t\t\t\t\t...otherPreferencesScopes,\n\t\t\t\t\t[ scope ]: featuresToMigrate,\n\t\t\t\t},\n\t\t\t},\n\t\t\t[ interfaceStoreName ]: {\n\t\t\t\t...otherInterfaceState,\n\t\t\t\tpreferences: {\n\t\t\t\t\tfeatures: {\n\t\t\t\t\t\t...otherInterfaceScopes,\n\t\t\t\t\t\t[ scope ]: undefined,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, state );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAwB,8CACvB,OACa;CACb,MAAM,qBAAqB;CAC3B,MAAM,uBAAuB;CAE7B,MAAM,kBACL,QAAS,mBAAoB,EAAE,aAAa;CAC7C,MAAM,qBAAqB,kBACxB,OAAO,KAAM,eAAgB,IAC7B,CAAC;CAEJ,IAAK,CAAE,oBAAoB,QAC1B,OAAO;CAGR,OAAO,mBAAmB,OAAQ,SAAW,gBAAgB,OAAQ;EACpE,IAAK,MAAM,WAAY,MAAO,GAC7B,OAAO;EAGR,MAAM,oBAAoB,kBAAmB;EAC7C,IAAK,CAAE,mBACN,OAAO;EAMR,IAFC,iBAAkB,qBAAsB,EAAE,cAAe,QAGzD,OAAO;EAGR,MAAM,yBACL,iBAAkB,qBAAsB,EAAE;EAC3C,MAAM,sBAAsB,iBAAkB;EAC9C,MAAM,uBACL,iBAAkB,mBAAoB,EAAE,aAAa;EAEtD,OAAO;GACN,GAAG;IACD,uBAAwB,EACzB,aAAa;IACZ,GAAG;KACD,QAAS;GACZ,EACD;IACE,qBAAsB;IACvB,GAAG;IACH,aAAa,EACZ,UAAU;KACT,GAAG;MACD,QAAS,KAAA;IACZ,EACD;GACD;EACD;CACD,GAAG,KAAM;AACV"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/preferences-persistence/src/migrations/legacy-local-storage-data/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
//# sourceMappingURL=types.cjs.map
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
@@ -1,42 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// packages/preferences-persistence/src/migrations/preferences-package-data/convert-complementary-areas.ts
|
|
21
|
-
var convert_complementary_areas_exports = {};
|
|
22
|
-
__export(convert_complementary_areas_exports, {
|
|
23
|
-
default: () => convertComplementaryAreas
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
// packages/preferences-persistence/src/migrations/preferences-package-data/convert-complementary-areas.ts
|
|
26
7
|
function convertComplementaryAreas(state) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
{ ...state }
|
|
40
|
-
);
|
|
8
|
+
return Object.keys(state).reduce((stateAccumulator, scope) => {
|
|
9
|
+
const scopeData = state[scope];
|
|
10
|
+
if (scopeData?.complementaryArea) {
|
|
11
|
+
const updatedScopeData = { ...scopeData };
|
|
12
|
+
delete updatedScopeData.complementaryArea;
|
|
13
|
+
updatedScopeData.isComplementaryAreaVisible = true;
|
|
14
|
+
stateAccumulator[scope] = updatedScopeData;
|
|
15
|
+
return stateAccumulator;
|
|
16
|
+
}
|
|
17
|
+
return stateAccumulator;
|
|
18
|
+
}, { ...state });
|
|
41
19
|
}
|
|
42
|
-
|
|
20
|
+
exports.default = convertComplementaryAreas;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=convert-complementary-areas.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/migrations/preferences-package-data/convert-complementary-areas.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ScopedPreferences } from '../../types';\n\nexport default function convertComplementaryAreas( state: ScopedPreferences ) {\n\treturn Object.keys( state ).reduce(\n\t\t( stateAccumulator, scope ) => {\n\t\t\tconst scopeData = state[ scope ];\n\n\t\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\t\tif ( scopeData?.complementaryArea ) {\n\t\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\t\treturn stateAccumulator;\n\t\t\t}\n\n\t\t\treturn stateAccumulator;\n\t\t},\n\t\t{ ...state }\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEe,SAAR,0BAA4C,OAA2B;AAC7E,SAAO,OAAO,KAAM,KAAM,EAAE;AAAA,IAC3B,CAAE,kBAAkB,UAAW;AAC9B,YAAM,YAAY,MAAO,KAAM;AAG/B,UAAK,WAAW,mBAAoB;AACnC,cAAM,mBAAmB,EAAE,GAAG,UAAU;AACxC,eAAO,iBAAiB;AACxB,yBAAiB,6BAA6B;AAC9C,yBAAkB,KAAM,IAAI;AAC5B,eAAO;AAAA,MACR;AAEA,aAAO;AAAA,IACR;AAAA,IACA,EAAE,GAAG,MAAM;AAAA,EACZ;AACD;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"convert-complementary-areas.cjs","names":[],"sources":["../../../src/migrations/preferences-package-data/convert-complementary-areas.ts"],"sourcesContent":["import type { ScopedPreferences } from '../../types';\n\nexport default function convertComplementaryAreas( state: ScopedPreferences ) {\n\treturn Object.keys( state ).reduce(\n\t\t( stateAccumulator, scope ) => {\n\t\t\tconst scopeData = state[ scope ];\n\n\t\t\t// If a complementary area is truthy, convert it to the `isComplementaryAreaVisible` boolean.\n\t\t\tif ( scopeData?.complementaryArea ) {\n\t\t\t\tconst updatedScopeData = { ...scopeData };\n\t\t\t\tdelete updatedScopeData.complementaryArea;\n\t\t\t\tupdatedScopeData.isComplementaryAreaVisible = true;\n\t\t\t\tstateAccumulator[ scope ] = updatedScopeData;\n\t\t\t\treturn stateAccumulator;\n\t\t\t}\n\n\t\t\treturn stateAccumulator;\n\t\t},\n\t\t{ ...state }\n\t);\n}\n"],"mappings":";;;;;;AAEA,SAAwB,0BAA2B,OAA2B;CAC7E,OAAO,OAAO,KAAM,KAAM,CAAC,CAAC,QACzB,kBAAkB,UAAW;EAC9B,MAAM,YAAY,MAAO;EAGzB,IAAK,WAAW,mBAAoB;GACnC,MAAM,mBAAmB,EAAE,GAAG,UAAU;GACxC,OAAO,iBAAiB;GACxB,iBAAiB,6BAA6B;GAC9C,iBAAkB,SAAU;GAC5B,OAAO;EACR;EAEA,OAAO;CACR,GACA,EAAE,GAAG,MAAM,CACZ;AACD"}
|
|
@@ -1,84 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let ______is_preferences_data_ts = require("../../is-preferences-data.cjs");
|
|
28
|
+
______is_preferences_data_ts = __toESM(______is_preferences_data_ts);
|
|
30
29
|
// packages/preferences-persistence/src/migrations/preferences-package-data/convert-editor-settings.ts
|
|
31
|
-
|
|
32
|
-
__export(convert_editor_settings_exports, {
|
|
33
|
-
default: () => convertEditorSettings
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(convert_editor_settings_exports);
|
|
36
|
-
var import_is_preferences_data = __toESM(require("../../is-preferences-data.cjs"));
|
|
37
|
-
var copyScope = (scope) => (0, import_is_preferences_data.default)(scope) ? { ...scope } : void 0;
|
|
30
|
+
const copyScope = (scope) => (0, ______is_preferences_data_ts.default)(scope) ? { ...scope } : void 0;
|
|
38
31
|
function convertEditorSettings(data) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} else {
|
|
75
|
-
delete newData["core/edit-post"];
|
|
76
|
-
}
|
|
77
|
-
if (editSite && Object.keys(editSite).length > 0) {
|
|
78
|
-
newData["core/edit-site"] = editSite;
|
|
79
|
-
} else {
|
|
80
|
-
delete newData["core/edit-site"];
|
|
81
|
-
}
|
|
82
|
-
return newData;
|
|
32
|
+
const newData = { ...data };
|
|
33
|
+
const editPost = copyScope(data["core/edit-post"]);
|
|
34
|
+
const editSite = copyScope(data["core/edit-site"]);
|
|
35
|
+
[
|
|
36
|
+
"allowRightClickOverrides",
|
|
37
|
+
"distractionFree",
|
|
38
|
+
"editorMode",
|
|
39
|
+
"fixedToolbar",
|
|
40
|
+
"focusMode",
|
|
41
|
+
"hiddenBlockTypes",
|
|
42
|
+
"inactivePanels",
|
|
43
|
+
"keepCaretInsideBlock",
|
|
44
|
+
"mostUsedBlocks",
|
|
45
|
+
"openPanels",
|
|
46
|
+
"showBlockBreadcrumbs",
|
|
47
|
+
"showIconLabels",
|
|
48
|
+
"showListViewByDefault",
|
|
49
|
+
"isPublishSidebarEnabled",
|
|
50
|
+
"isComplementaryAreaVisible",
|
|
51
|
+
"pinnedItems"
|
|
52
|
+
].forEach((setting) => {
|
|
53
|
+
if (editPost?.[setting] !== void 0) {
|
|
54
|
+
newData.core = {
|
|
55
|
+
...copyScope(newData.core),
|
|
56
|
+
[setting]: editPost[setting]
|
|
57
|
+
};
|
|
58
|
+
delete editPost[setting];
|
|
59
|
+
}
|
|
60
|
+
if (editSite?.[setting] !== void 0) delete editSite[setting];
|
|
61
|
+
});
|
|
62
|
+
if (editPost && Object.keys(editPost).length > 0) newData["core/edit-post"] = editPost;
|
|
63
|
+
else delete newData["core/edit-post"];
|
|
64
|
+
if (editSite && Object.keys(editSite).length > 0) newData["core/edit-site"] = editSite;
|
|
65
|
+
else delete newData["core/edit-site"];
|
|
66
|
+
return newData;
|
|
83
67
|
}
|
|
84
|
-
|
|
68
|
+
exports.default = convertEditorSettings;
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=convert-editor-settings.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],
|
|
4
|
-
"sourcesContent": ["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA8B;AAG9B,IAAM,YAAY,CAAE,cACnB,2BAAAA,SAAmB,KAAM,IAAI,EAAE,GAAG,MAAM,IAAI;AAE9B,SAAR,sBAAwC,MAA0B;AACxE,QAAM,UAAU,EAAE,GAAG,KAAK;AAC1B,QAAM,WAAW,UAAW,KAAM,gBAAiB,CAAE;AACrD,QAAM,WAAW,UAAW,KAAM,gBAAiB,CAAE;AACrD,QAAM,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,uBAAqB,QAAS,CAAE,YAAa;AAC5C,QAAK,WAAY,OAAQ,MAAM,QAAY;AAC1C,cAAQ,OAAO;AAAA,QACd,GAAG,UAAW,QAAQ,IAAK;AAAA,QAC3B,CAAE,OAAQ,GAAG,SAAU,OAAQ;AAAA,MAChC;AACA,aAAO,SAAU,OAAQ;AAAA,IAC1B;AAEA,QAAK,WAAY,OAAQ,MAAM,QAAY;AAC1C,aAAO,SAAU,OAAQ;AAAA,IAC1B;AAAA,EACD,CAAE;AAGF,MAAK,YAAY,OAAO,KAAM,QAAS,EAAE,SAAS,GAAI;AACrD,YAAS,gBAAiB,IAAI;AAAA,EAC/B,OAAO;AACN,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,MAAK,YAAY,OAAO,KAAM,QAAS,EAAE,SAAS,GAAI;AACrD,YAAS,gBAAiB,IAAI;AAAA,EAC/B,OAAO;AACN,WAAO,QAAS,gBAAiB;AAAA,EAClC;AAEA,SAAO;AACR;",
|
|
6
|
-
"names": ["isPreferencesData"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"convert-editor-settings.cjs","names":["isPreferencesData"],"sources":["../../../src/migrations/preferences-package-data/convert-editor-settings.ts"],"sourcesContent":["import isPreferencesData from '../../is-preferences-data';\nimport type { ScopedPreferences } from '../../types';\n\nconst copyScope = ( scope: unknown ) =>\n\tisPreferencesData( scope ) ? { ...scope } : undefined;\n\nexport default function convertEditorSettings( data: ScopedPreferences ) {\n\tconst newData = { ...data };\n\tconst editPost = copyScope( data[ 'core/edit-post' ] );\n\tconst editSite = copyScope( data[ 'core/edit-site' ] );\n\tconst settingsToMoveToCore = [\n\t\t'allowRightClickOverrides',\n\t\t'distractionFree',\n\t\t'editorMode',\n\t\t'fixedToolbar',\n\t\t'focusMode',\n\t\t'hiddenBlockTypes',\n\t\t'inactivePanels',\n\t\t'keepCaretInsideBlock',\n\t\t'mostUsedBlocks',\n\t\t'openPanels',\n\t\t'showBlockBreadcrumbs',\n\t\t'showIconLabels',\n\t\t'showListViewByDefault',\n\t\t'isPublishSidebarEnabled',\n\t\t'isComplementaryAreaVisible',\n\t\t'pinnedItems',\n\t];\n\n\tsettingsToMoveToCore.forEach( ( setting ) => {\n\t\tif ( editPost?.[ setting ] !== undefined ) {\n\t\t\tnewData.core = {\n\t\t\t\t...copyScope( newData.core ),\n\t\t\t\t[ setting ]: editPost[ setting ],\n\t\t\t};\n\t\t\tdelete editPost[ setting ];\n\t\t}\n\n\t\tif ( editSite?.[ setting ] !== undefined ) {\n\t\t\tdelete editSite[ setting ];\n\t\t}\n\t} );\n\n\t// Empty and invalid scopes are removed rather than persisted.\n\tif ( editPost && Object.keys( editPost ).length > 0 ) {\n\t\tnewData[ 'core/edit-post' ] = editPost;\n\t} else {\n\t\tdelete newData[ 'core/edit-post' ];\n\t}\n\n\tif ( editSite && Object.keys( editSite ).length > 0 ) {\n\t\tnewData[ 'core/edit-site' ] = editSite;\n\t} else {\n\t\tdelete newData[ 'core/edit-site' ];\n\t}\n\n\treturn newData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,aAAc,WAAA,GACnBA,6BAAAA,QAAAA,CAAmB,KAAM,IAAI,EAAE,GAAG,MAAM,IAAI,KAAA;AAE7C,SAAwB,sBAAuB,MAA0B;CACxE,MAAM,UAAU,EAAE,GAAG,KAAK;CAC1B,MAAM,WAAW,UAAW,KAAM,iBAAmB;CACrD,MAAM,WAAW,UAAW,KAAM,iBAAmB;CAoBrD;EAlBC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGkB,CAAC,CAAC,SAAW,YAAa;EAC5C,IAAK,WAAY,aAAc,KAAA,GAAY;GAC1C,QAAQ,OAAO;IACd,GAAG,UAAW,QAAQ,IAAK;KACzB,UAAW,SAAU;GACxB;GACA,OAAO,SAAU;EAClB;EAEA,IAAK,WAAY,aAAc,KAAA,GAC9B,OAAO,SAAU;CAEnB,CAAE;CAGF,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,IAAK,YAAY,OAAO,KAAM,QAAS,CAAC,CAAC,SAAS,GACjD,QAAS,oBAAqB;MAE9B,OAAO,QAAS;CAGjB,OAAO;AACR"}
|
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let __convert_complementary_areas_ts = require("./convert-complementary-areas.cjs");
|
|
28
|
+
__convert_complementary_areas_ts = __toESM(__convert_complementary_areas_ts);
|
|
29
|
+
let __convert_editor_settings_ts = require("./convert-editor-settings.cjs");
|
|
30
|
+
__convert_editor_settings_ts = __toESM(__convert_editor_settings_ts);
|
|
30
31
|
// packages/preferences-persistence/src/migrations/preferences-package-data/index.ts
|
|
31
|
-
var preferences_package_data_exports = {};
|
|
32
|
-
__export(preferences_package_data_exports, {
|
|
33
|
-
default: () => convertPreferencesPackageData
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(preferences_package_data_exports);
|
|
36
|
-
var import_convert_complementary_areas = __toESM(require("./convert-complementary-areas.cjs"));
|
|
37
|
-
var import_convert_editor_settings = __toESM(require("./convert-editor-settings.cjs"));
|
|
38
32
|
function convertPreferencesPackageData(data) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
let newData = (0, __convert_complementary_areas_ts.default)(data);
|
|
34
|
+
newData = (0, __convert_editor_settings_ts.default)(newData);
|
|
35
|
+
return newData;
|
|
42
36
|
}
|
|
43
|
-
|
|
37
|
+
exports.default = convertPreferencesPackageData;
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/migrations/preferences-package-data/index.ts"],
|
|
4
|
-
"sourcesContent": ["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAsC;AACtC,qCAAkC;AAGnB,SAAR,8BACN,MACC;AACD,MAAI,cAAU,mCAAAA,SAA2B,IAAK;AAC9C,gBAAU,+BAAAC,SAAuB,OAAQ;AACzC,SAAO;AACR;",
|
|
6
|
-
"names": ["convertComplementaryAreas", "convertEditorSettings"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["convertComplementaryAreas","convertEditorSettings"],"sources":["../../../src/migrations/preferences-package-data/index.ts"],"sourcesContent":["import convertComplementaryAreas from './convert-complementary-areas';\nimport convertEditorSettings from './convert-editor-settings';\nimport type { ScopedPreferences } from '../../types';\n\nexport default function convertPreferencesPackageData(\n\tdata: ScopedPreferences\n) {\n\tlet newData = convertComplementaryAreas( data );\n\tnewData = convertEditorSettings( newData );\n\treturn newData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAAwB,8BACvB,MACC;CACD,IAAI,WAAA,GAAUA,iCAAAA,QAAAA,CAA2B,IAAK;CAC9C,WAAA,GAAUC,6BAAAA,QAAAA,CAAuB,OAAQ;CACzC,OAAO;AACR"}
|
package/build/types.cjs
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// packages/preferences-persistence/src/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
//# sourceMappingURL=types.cjs.map
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
@@ -1,41 +1,53 @@
|
|
|
1
1
|
// packages/preferences-persistence/src/create/debounce-async.ts
|
|
2
|
+
/**
|
|
3
|
+
* Performs a leading edge debounce of async functions.
|
|
4
|
+
*
|
|
5
|
+
* If three functions are throttled at the same time:
|
|
6
|
+
* - The first happens immediately.
|
|
7
|
+
* - The second is never called.
|
|
8
|
+
* - The third happens `delayMS` milliseconds after the first has resolved.
|
|
9
|
+
*
|
|
10
|
+
* This is distinct from `{ debounce } from @wordpress/compose` in that it
|
|
11
|
+
* waits for promise resolution.
|
|
12
|
+
*
|
|
13
|
+
* @param func A function that returns a promise.
|
|
14
|
+
* @param delayMS A delay in milliseconds.
|
|
15
|
+
*
|
|
16
|
+
* @return A function that debounce whatever function is passed
|
|
17
|
+
* to it.
|
|
18
|
+
*/
|
|
2
19
|
function debounceAsync(func, delayMS) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
34
|
-
}, delayMS);
|
|
35
|
-
});
|
|
36
|
-
};
|
|
20
|
+
let timeoutId;
|
|
21
|
+
let activePromise;
|
|
22
|
+
return async function debounced(...args) {
|
|
23
|
+
if (!activePromise && !timeoutId) return new Promise((resolve, reject) => {
|
|
24
|
+
activePromise = func(...args).then((...thenArgs) => {
|
|
25
|
+
resolve(...thenArgs);
|
|
26
|
+
}).catch((error) => {
|
|
27
|
+
reject(error);
|
|
28
|
+
}).finally(() => {
|
|
29
|
+
activePromise = null;
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
if (activePromise) await activePromise;
|
|
33
|
+
if (timeoutId) {
|
|
34
|
+
clearTimeout(timeoutId);
|
|
35
|
+
timeoutId = null;
|
|
36
|
+
}
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
timeoutId = setTimeout(() => {
|
|
39
|
+
activePromise = func(...args).then((...thenArgs) => {
|
|
40
|
+
resolve(...thenArgs);
|
|
41
|
+
}).catch((error) => {
|
|
42
|
+
reject(error);
|
|
43
|
+
}).finally(() => {
|
|
44
|
+
activePromise = null;
|
|
45
|
+
timeoutId = null;
|
|
46
|
+
});
|
|
47
|
+
}, delayMS);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
37
50
|
}
|
|
38
|
-
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=debounce-async.mjs.map
|
|
51
|
+
export { debounceAsync as default };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=debounce-async.mjs.map
|