@wordpress/preferences-persistence 1.43.0 → 1.44.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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 1.44.0 (2024-02-21)
6
+
5
7
  ## 1.43.0 (2024-02-09)
6
8
 
7
9
  ## 1.42.0 (2024-01-24)
@@ -66,10 +66,6 @@ function convertLegacyData(data) {
66
66
  from: 'core/edit-post',
67
67
  to: 'core/edit-post'
68
68
  }, 'editorMode');
69
- data = (0, _moveIndividualPreference.default)(data, {
70
- from: 'core/edit-post',
71
- to: 'core/edit-post'
72
- }, 'preferredStyleVariations');
73
69
  data = (0, _moveIndividualPreference.default)(data, {
74
70
  from: 'core/edit-post',
75
71
  to: 'core/edit-post'
@@ -1 +1 @@
1
- {"version":3,"names":["_moveFeaturePreferences","_interopRequireDefault","require","_moveThirdPartyFeaturePreferences","_moveIndividualPreference","_moveInterfaceEnableItems","_convertEditPostPanels","getLegacyData","userId","key","unparsedData","window","localStorage","getItem","JSON","parse","convertLegacyData","data","moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveInterfaceEnableItems","moveIndividualPreference","from","to","convertEditPostPanels","preferences","convertLegacyLocalStorageData"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | null} The local storage data.\n */\nfunction getLegacyData( userId ) {\n\tconst key = `WP_DATA_USER_${ userId }`;\n\tconst unparsedData = window.localStorage.getItem( key );\n\treturn JSON.parse( unparsedData );\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param {Object | null | undefined} data The legacy data in its original format.\n *\n * @return {Object | undefined} The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData( data ) {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'preferredStyleVariations'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core/edit-post' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\treturn data?.[ 'core/preferences' ]?.preferences;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | undefined} The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData( userId ) {\n\tconst data = getLegacyData( userId );\n\treturn convertLegacyData( data );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iCAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,yBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,yBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,aAAaA,CAAEC,MAAM,EAAG;EAChC,MAAMC,GAAG,GAAI,gBAAgBD,MAAQ,EAAC;EACtC,MAAME,YAAY,GAAGC,MAAM,CAACC,YAAY,CAACC,OAAO,CAAEJ,GAAI,CAAC;EACvD,OAAOK,IAAI,CAACC,KAAK,CAAEL,YAAa,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,IAAK,CAAEA,IAAI,EAAG;IACb;EACD;;EAEA;EACA;EACAA,IAAI,GAAG,IAAAC,+BAAsB,EAAED,IAAI,EAAE,mBAAoB,CAAC;EAC1DA,IAAI,GAAG,IAAAC,+BAAsB,EAAED,IAAI,EAAE,wBAAyB,CAAC;EAC/DA,IAAI,GAAG,IAAAC,+BAAsB,EAAED,IAAI,EAAE,gBAAiB,CAAC;EACvDA,IAAI,GAAG,IAAAC,+BAAsB,EAAED,IAAI,EAAE,gBAAiB,CAAC;;EAEvD;EACA;EACAA,IAAI,GAAG,IAAAE,yCAAgC,EAAEF,IAAK,CAAC;;EAE/C;EACA;EACAA,IAAI,GAAG,IAAAG,iCAAwB,EAAEH,IAAK,CAAC;;EAEvC;EACA;EACAA,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,kBACD,CAAC;EACDN,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;EACDN,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,0BACD,CAAC;EACDN,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,QAAQ,EACRC,8BACD,CAAC;EACDP,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,aAAa;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAC7C,yBACD,CAAC;EACDN,IAAI,GAAG,IAAAI,iCAAwB,EAC9BJ,IAAI,EACJ;IAAEK,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;;EAED;EACA;EACA,OAAON,IAAI,GAAI,kBAAkB,CAAE,EAAEQ,WAAW;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,6BAA6BA,CAAElB,MAAM,EAAG;EAC/D,MAAMS,IAAI,GAAGV,aAAa,CAAEC,MAAO,CAAC;EACpC,OAAOQ,iBAAiB,CAAEC,IAAK,CAAC;AACjC"}
1
+ {"version":3,"names":["_moveFeaturePreferences","_interopRequireDefault","require","_moveThirdPartyFeaturePreferences","_moveIndividualPreference","_moveInterfaceEnableItems","_convertEditPostPanels","getLegacyData","userId","key","unparsedData","window","localStorage","getItem","JSON","parse","convertLegacyData","data","moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveInterfaceEnableItems","moveIndividualPreference","from","to","convertEditPostPanels","preferences","convertLegacyLocalStorageData"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | null} The local storage data.\n */\nfunction getLegacyData( userId ) {\n\tconst key = `WP_DATA_USER_${ userId }`;\n\tconst unparsedData = window.localStorage.getItem( key );\n\treturn JSON.parse( unparsedData );\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param {Object | null | undefined} data The legacy data in its original format.\n *\n * @return {Object | undefined} The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData( data ) {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core/edit-post' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\treturn data?.[ 'core/preferences' ]?.preferences;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | undefined} The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData( userId ) {\n\tconst data = getLegacyData( userId );\n\treturn convertLegacyData( data );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iCAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,yBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,yBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,aAAaA,CAAEC,MAAM,EAAG;EAChC,MAAMC,GAAG,GAAI,gBAAgBD,MAAQ,EAAC;EACtC,MAAME,YAAY,GAAGC,MAAM,CAACC,YAAY,CAACC,OAAO,CAAEJ,GAAI,CAAC;EACvD,OAAOK,IAAI,CAACC,KAAK,CAAEL,YAAa,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;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,CAAE,EAAEQ,WAAW;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,6BAA6BA,CAAElB,MAAM,EAAG;EAC/D,MAAMS,IAAI,GAAGV,aAAa,CAAEC,MAAO,CAAC;EACpC,OAAOQ,iBAAiB,CAAEC,IAAK,CAAC;AACjC"}
@@ -58,10 +58,6 @@ export function convertLegacyData(data) {
58
58
  from: 'core/edit-post',
59
59
  to: 'core/edit-post'
60
60
  }, 'editorMode');
61
- data = moveIndividualPreference(data, {
62
- from: 'core/edit-post',
63
- to: 'core/edit-post'
64
- }, 'preferredStyleVariations');
65
61
  data = moveIndividualPreference(data, {
66
62
  from: 'core/edit-post',
67
63
  to: 'core/edit-post'
@@ -1 +1 @@
1
- {"version":3,"names":["moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveIndividualPreference","moveInterfaceEnableItems","convertEditPostPanels","getLegacyData","userId","key","unparsedData","window","localStorage","getItem","JSON","parse","convertLegacyData","data","from","to","preferences","convertLegacyLocalStorageData"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | null} The local storage data.\n */\nfunction getLegacyData( userId ) {\n\tconst key = `WP_DATA_USER_${ userId }`;\n\tconst unparsedData = window.localStorage.getItem( key );\n\treturn JSON.parse( unparsedData );\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param {Object | null | undefined} data The legacy data in its original format.\n *\n * @return {Object | undefined} The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData( data ) {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'preferredStyleVariations'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core/edit-post' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\treturn data?.[ 'core/preferences' ]?.preferences;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | undefined} The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData( userId ) {\n\tconst data = getLegacyData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E,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,0BACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,QAAQ,EACRb,qBACD,CAAC;EACDW,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,aAAa;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAC7C,yBACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;;EAED;EACA;EACA,OAAOF,IAAI,GAAI,kBAAkB,CAAE,EAAEG,WAAW;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,6BAA6BA,CAAEb,MAAM,EAAG;EAC/D,MAAMS,IAAI,GAAGV,aAAa,CAAEC,MAAO,CAAC;EACpC,OAAOQ,iBAAiB,CAAEC,IAAK,CAAC;AACjC"}
1
+ {"version":3,"names":["moveFeaturePreferences","moveThirdPartyFeaturePreferences","moveIndividualPreference","moveInterfaceEnableItems","convertEditPostPanels","getLegacyData","userId","key","unparsedData","window","localStorage","getItem","JSON","parse","convertLegacyData","data","from","to","preferences","convertLegacyLocalStorageData"],"sources":["@wordpress/preferences-persistence/src/migrations/legacy-local-storage-data/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport moveFeaturePreferences from './move-feature-preferences';\nimport moveThirdPartyFeaturePreferences from './move-third-party-feature-preferences';\nimport moveIndividualPreference from './move-individual-preference';\nimport moveInterfaceEnableItems from './move-interface-enable-items';\nimport convertEditPostPanels from './convert-edit-post-panels';\n\n/**\n * Gets the legacy local storage data for a given user.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | null} The local storage data.\n */\nfunction getLegacyData( userId ) {\n\tconst key = `WP_DATA_USER_${ userId }`;\n\tconst unparsedData = window.localStorage.getItem( key );\n\treturn JSON.parse( unparsedData );\n}\n\n/**\n * Converts data from the old `@wordpress/data` package format.\n *\n * @param {Object | null | undefined} data The legacy data in its original format.\n *\n * @return {Object | undefined} The converted data or `undefined` if there was\n * nothing to convert.\n */\nexport function convertLegacyData( data ) {\n\tif ( ! data ) {\n\t\treturn;\n\t}\n\n\t// Move boolean feature preferences from each editor into the\n\t// preferences store data structure.\n\tdata = moveFeaturePreferences( data, 'core/edit-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/customize-widgets' );\n\tdata = moveFeaturePreferences( data, 'core/edit-post' );\n\tdata = moveFeaturePreferences( data, 'core/edit-site' );\n\n\t// Move third party boolean feature preferences from the interface package\n\t// to the preferences store data structure.\n\tdata = moveThirdPartyFeaturePreferences( data );\n\n\t// Move and convert the interface store's `enableItems` data into the\n\t// preferences data structure.\n\tdata = moveInterfaceEnableItems( data );\n\n\t// Move individual ad-hoc preferences from various packages into the\n\t// preferences store data structure.\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'hiddenBlockTypes'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'editorMode'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-post', to: 'core/edit-post' },\n\t\t'panels',\n\t\tconvertEditPostPanels\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/editor', to: 'core/edit-post' },\n\t\t'isPublishSidebarEnabled'\n\t);\n\tdata = moveIndividualPreference(\n\t\tdata,\n\t\t{ from: 'core/edit-site', to: 'core/edit-site' },\n\t\t'editorMode'\n\t);\n\n\t// The new system is only concerned with persisting\n\t// 'core/preferences' preferences reducer, so only return that.\n\treturn data?.[ 'core/preferences' ]?.preferences;\n}\n\n/**\n * Gets the legacy local storage data for the given user and returns the\n * data converted to the new format.\n *\n * @param {string | number} userId The user id.\n *\n * @return {Object | undefined} The converted data or undefined if no local\n * storage data could be found.\n */\nexport default function convertLegacyLocalStorageData( userId ) {\n\tconst data = getLegacyData( userId );\n\treturn convertLegacyData( data );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,sBAAsB,MAAM,4BAA4B;AAC/D,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,wBAAwB,MAAM,8BAA8B;AACnE,OAAOC,wBAAwB,MAAM,+BAA+B;AACpE,OAAOC,qBAAqB,MAAM,4BAA4B;;AAE9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAAEC,MAAM,EAAG;EAChC,MAAMC,GAAG,GAAI,gBAAgBD,MAAQ,EAAC;EACtC,MAAME,YAAY,GAAGC,MAAM,CAACC,YAAY,CAACC,OAAO,CAAEJ,GAAI,CAAC;EACvD,OAAOK,IAAI,CAACC,KAAK,CAAEL,YAAa,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,iBAAiBA,CAAEC,IAAI,EAAG;EACzC,IAAK,CAAEA,IAAI,EAAG;IACb;EACD;;EAEA;EACA;EACAA,IAAI,GAAGf,sBAAsB,CAAEe,IAAI,EAAE,mBAAoB,CAAC;EAC1DA,IAAI,GAAGf,sBAAsB,CAAEe,IAAI,EAAE,wBAAyB,CAAC;EAC/DA,IAAI,GAAGf,sBAAsB,CAAEe,IAAI,EAAE,gBAAiB,CAAC;EACvDA,IAAI,GAAGf,sBAAsB,CAAEe,IAAI,EAAE,gBAAiB,CAAC;;EAEvD;EACA;EACAA,IAAI,GAAGd,gCAAgC,CAAEc,IAAK,CAAC;;EAE/C;EACA;EACAA,IAAI,GAAGZ,wBAAwB,CAAEY,IAAK,CAAC;;EAEvC;EACA;EACAA,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,kBACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,QAAQ,EACRb,qBACD,CAAC;EACDW,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,aAAa;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAC7C,yBACD,CAAC;EACDF,IAAI,GAAGb,wBAAwB,CAC9Ba,IAAI,EACJ;IAAEC,IAAI,EAAE,gBAAgB;IAAEC,EAAE,EAAE;EAAiB,CAAC,EAChD,YACD,CAAC;;EAED;EACA;EACA,OAAOF,IAAI,GAAI,kBAAkB,CAAE,EAAEG,WAAW;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,6BAA6BA,CAAEb,MAAM,EAAG;EAC/D,MAAMS,IAAI,GAAGV,aAAa,CAAEC,MAAO,CAAC;EACpC,OAAOQ,iBAAiB,CAAEC,IAAK,CAAC;AACjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/preferences-persistence",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "description": "Persistence utilities for `wordpress/preferences`.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,10 +28,10 @@
28
28
  "sideEffects": false,
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.16.0",
31
- "@wordpress/api-fetch": "^6.48.0"
31
+ "@wordpress/api-fetch": "^6.49.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "eb796371e9630636a4a8837033807b0c4a06ed67"
36
+ "gitHead": "c139588f4c668b38bafbc5431f2f4e3903dbe683"
37
37
  }
@@ -60,11 +60,6 @@ export function convertLegacyData( data ) {
60
60
  { from: 'core/edit-post', to: 'core/edit-post' },
61
61
  'editorMode'
62
62
  );
63
- data = moveIndividualPreference(
64
- data,
65
- { from: 'core/edit-post', to: 'core/edit-post' },
66
- 'preferredStyleVariations'
67
- );
68
63
  data = moveIndividualPreference(
69
64
  data,
70
65
  { from: 'core/edit-post', to: 'core/edit-post' },
@@ -49,7 +49,6 @@ const legacyData = {
49
49
  },
50
50
  editorMode: 'text',
51
51
  hiddenBlockTypes: [ 'core/heading', 'core/list' ],
52
- preferredStyleVariations: { 'core/quote': 'plain' },
53
52
  localAutosaveInterval: 15,
54
53
  },
55
54
  },
@@ -114,9 +113,6 @@ const alreadyConvertedData = {
114
113
  fullscreenMode: false,
115
114
  hiddenBlockTypes: [ 'core/audio', 'core/cover' ],
116
115
  editorMode: 'visual',
117
- preferredStyleVariations: {
118
- 'core/quote': 'large',
119
- },
120
116
  inactivePanels: [],
121
117
  openPanels: [ 'post-status' ],
122
118
  complementaryArea: 'edit-post/block',
@@ -161,9 +157,6 @@ describe( 'convertLegacyData', () => {
161
157
  "pinnedItems": {
162
158
  "my-sidebar-plugin/title-sidebar": false,
163
159
  },
164
- "preferredStyleVariations": {
165
- "core/quote": "plain",
166
- },
167
160
  "welcomeGuide": false,
168
161
  },
169
162
  "core/edit-site": {
@@ -206,9 +199,6 @@ describe( 'convertLegacyData', () => {
206
199
  "pinnedItems": {
207
200
  "my-sidebar-plugin/title-sidebar": false,
208
201
  },
209
- "preferredStyleVariations": {
210
- "core/quote": "large",
211
- },
212
202
  "welcomeGuide": false,
213
203
  },
214
204
  "core/edit-site": {
@@ -20,9 +20,6 @@ const input = {
20
20
  fullscreenMode: false,
21
21
  hiddenBlockTypes: [ 'core/audio', 'core/cover' ],
22
22
  editorMode: 'visual',
23
- preferredStyleVariations: {
24
- 'core/quote': 'large',
25
- },
26
23
  inactivePanels: [],
27
24
  openPanels: [ 'post-status' ],
28
25
  pinnedItems: {
@@ -63,9 +60,6 @@ describe( 'convertPreferencesPackageData', () => {
63
60
  "pinnedItems": {
64
61
  "my-sidebar-plugin/title-sidebar": false,
65
62
  },
66
- "preferredStyleVariations": {
67
- "core/quote": "large",
68
- },
69
63
  "welcomeGuide": false,
70
64
  },
71
65
  "core/edit-site": {