@wordpress/edit-widgets 4.0.2 → 4.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/index.js +1 -1
  3. package/build/components/header/index.js.map +1 -1
  4. package/build/components/keyboard-shortcuts/index.js +1 -1
  5. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  6. package/build/components/layout/interface.js +3 -1
  7. package/build/components/layout/interface.js.map +1 -1
  8. package/build/components/more-menu/index.js +12 -10
  9. package/build/components/more-menu/index.js.map +1 -1
  10. package/build/components/welcome-guide/index.js +5 -5
  11. package/build/components/welcome-guide/index.js.map +1 -1
  12. package/build/components/widget-areas-block-editor-content/index.js +2 -2
  13. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  14. package/build/components/widget-areas-block-editor-provider/index.js +4 -4
  15. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  16. package/build/index.js +2 -2
  17. package/build/index.js.map +1 -1
  18. package/build/store/actions.js +1 -1
  19. package/build/store/actions.js.map +1 -1
  20. package/build/store/index.js +3 -5
  21. package/build/store/index.js.map +1 -1
  22. package/build-module/components/header/index.js +1 -1
  23. package/build-module/components/header/index.js.map +1 -1
  24. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  25. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  26. package/build-module/components/layout/interface.js +2 -1
  27. package/build-module/components/layout/interface.js.map +1 -1
  28. package/build-module/components/more-menu/index.js +12 -11
  29. package/build-module/components/more-menu/index.js.map +1 -1
  30. package/build-module/components/welcome-guide/index.js +5 -5
  31. package/build-module/components/welcome-guide/index.js.map +1 -1
  32. package/build-module/components/widget-areas-block-editor-content/index.js +2 -2
  33. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  34. package/build-module/components/widget-areas-block-editor-provider/index.js +3 -3
  35. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  36. package/build-module/index.js +2 -2
  37. package/build-module/index.js.map +1 -1
  38. package/build-module/store/actions.js +1 -1
  39. package/build-module/store/actions.js.map +1 -1
  40. package/build-module/store/index.js +4 -6
  41. package/build-module/store/index.js.map +1 -1
  42. package/build-style/style-rtl.css +90 -34
  43. package/build-style/style.css +90 -34
  44. package/package.json +29 -24
  45. package/src/components/header/index.js +1 -1
  46. package/src/components/keyboard-shortcuts/index.js +1 -1
  47. package/src/components/layout/interface.js +5 -3
  48. package/src/components/more-menu/index.js +12 -11
  49. package/src/components/welcome-guide/index.js +4 -6
  50. package/src/components/widget-areas-block-editor-content/index.js +2 -2
  51. package/src/components/widget-areas-block-editor-provider/index.js +3 -3
  52. package/src/index.js +2 -2
  53. package/src/store/actions.js +1 -1
  54. package/src/store/index.js +3 -6
  55. package/src/style.scss +0 -1
  56. package/src/components/more-menu/style.scss +0 -35
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["defaultTo","SlotFillProvider","uploadMedia","useDispatch","useSelect","useMemo","BlockEditorProvider","BlockEditorKeyboardShortcuts","CopyHandler","ReusableBlocksMenuItems","store","interfaceStore","ShortcutProvider","KeyboardShortcuts","useEntityBlockEditor","coreStore","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","editWidgetsStore","ALLOW_REUSABLE_BLOCKS","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","hasUploadPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","canUser","widgetAreas","getWidgetAreas","widgets","getWidgets","getEntityRecords","isFeatureActive","setIsInserterOpened","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;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,QAAM,CAAEiC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgCxC,oBAAoB,CACzDG,IADyD,EAEzDC,SAFyD,EAGzD;AAAEqC,IAAAA,EAAE,EAAEvC,sBAAsB;AAA5B,GAHyD,CAA1D;AAMA,SACC,cAAC,gBAAD,QACC,cAAC,4BAAD,CAA8B,QAA9B,OADD,EAEC,cAAC,iBAAD,CAAmB,QAAnB,OAFD,EAGC,cAAC,gBAAD,QACC,cAAC,mBAAD;AACC,IAAA,KAAK,EAAGoC,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGf,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMd,KANN,GAQC,cAAC,WAAD,QAAeD,QAAf,CARD,EASC,cAAC,uBAAD;AAAyB,IAAA,YAAY,EAAG2B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport { defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorProvider,\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n} from '@wordpress/block-editor';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst {\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? select( coreStore ).getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: [],\n\t\t\tisFixedToolbarActive: select( interfaceStore ).isFeatureActive(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: select( interfaceStore ).isFeatureActive(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<SlotFillProvider>\n\t\t\t\t<BlockEditorProvider\n\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<CopyHandler>{ children }</CopyHandler>\n\t\t\t\t\t<ReusableBlocksMenuItems rootClientId={ widgetAreaId } />\n\t\t\t\t</BlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["defaultTo","SlotFillProvider","uploadMedia","useDispatch","useSelect","useMemo","BlockEditorProvider","BlockEditorKeyboardShortcuts","CopyHandler","ReusableBlocksMenuItems","ShortcutProvider","store","preferencesStore","KeyboardShortcuts","useEntityBlockEditor","coreStore","buildWidgetAreasPostId","KIND","POST_TYPE","useLastSelectedWidgetArea","editWidgetsStore","ALLOW_REUSABLE_BLOCKS","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","hasUploadPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","canUser","widgetAreas","getWidgetAreas","widgets","getWidgets","getEntityRecords","get","setIsInserterOpened","settings","mediaUploadBlockEditor","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,uBAAjC;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,mBADD,EAECC,4BAFD,EAGCC,WAHD,QAIO,yBAJP;AAKA,SAASC,uBAAT,QAAwC,4BAAxC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,oBAAT,EAA+BH,KAAK,IAAII,SAAxC,QAAyD,sBAAzD;AACA,SAASC,sBAAT,EAAiCC,IAAjC,EAAuCC,SAAvC,QAAwD,mBAAxD;AACA,OAAOC,yBAAP,MAAsC,2CAAtC;AACA,SAASR,KAAK,IAAIS,gBAAlB,QAA0C,aAA1C;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AAEA,eAAe,SAASC,8BAAT,OAIX;AAAA,MAJoD;AACvDC,IAAAA,mBADuD;AAEvDC,IAAAA,QAFuD;AAGvD,OAAGC;AAHoD,GAIpD;AACH,QAAM;AACLC,IAAAA,oBADK;AAELC,IAAAA,cAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA;AAJK,MAKFzB,SAAS,CACV0B,MAAF,KAAgB;AACfJ,IAAAA,oBAAoB,EAAE1B,SAAS,CAC9B8B,MAAM,CAAEf,SAAF,CAAN,CAAoBgB,OAApB,CAA6B,QAA7B,EAAuC,OAAvC,CAD8B,EAE9B,IAF8B,CADhB;AAKfC,IAAAA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AAA,YAAY,EAAE,KANR;AAONC,MAAAA,iCAAiC,EAAEZ;AAP7B,KAAP;AASA,GApBuB,EAoBrB,CACFf,mBADE,EAEFK,oBAFE,EAGFC,oBAHE,EAIFH,oBAJE,EAKFC,cALE,EAMFW,mBANE,CApBqB,CAAxB;AA6BA,QAAMa,YAAY,GAAGhC,yBAAyB,EAA9C;AAEA,QAAM,CAAEiC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgCxC,oBAAoB,CACzDG,IADyD,EAEzDC,SAFyD,EAGzD;AAAEqC,IAAAA,EAAE,EAAEvC,sBAAsB;AAA5B,GAHyD,CAA1D;AAMA,SACC,cAAC,gBAAD,QACC,cAAC,4BAAD,CAA8B,QAA9B,OADD,EAEC,cAAC,iBAAD,CAAmB,QAAnB,OAFD,EAGC,cAAC,gBAAD,QACC,cAAC,mBAAD;AACC,IAAA,KAAK,EAAGoC,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGf,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMd,KANN,GAQC,cAAC,WAAD,QAAeD,QAAf,CARD,EASC,cAAC,uBAAD;AAAyB,IAAA,YAAY,EAAG2B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport { defaultTo } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorProvider,\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n} from '@wordpress/block-editor';\nimport { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils';\nimport useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area';\nimport { store as editWidgetsStore } from '../../store';\nimport { ALLOW_REUSABLE_BLOCKS } from '../../constants';\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst {\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\thasUploadPermissions: defaultTo(\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ),\n\t\t\t\ttrue\n\t\t\t),\n\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t? select( coreStore ).getEntityRecords( 'postType', 'wp_block' )\n\t\t\t\t: [],\n\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\thasFixedToolbar: isFixedToolbarActive,\n\t\t\tkeepCaretInsideBlock,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\ttemplateLock: 'all',\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t};\n\t}, [\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\thasUploadPermissions,\n\t\treusableBlocks,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tconst widgetAreaId = useLastSelectedWidgetArea();\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\tKIND,\n\t\tPOST_TYPE,\n\t\t{ id: buildWidgetAreasPostId() }\n\t);\n\n\treturn (\n\t\t<ShortcutProvider>\n\t\t\t<BlockEditorKeyboardShortcuts.Register />\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<SlotFillProvider>\n\t\t\t\t<BlockEditorProvider\n\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<CopyHandler>{ children }</CopyHandler>\n\t\t\t\t\t<ReusableBlocksMenuItems rootClientId={ widgetAreaId } />\n\t\t\t\t</BlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -10,7 +10,7 @@ import { render, unmountComponentAtNode } from '@wordpress/element';
10
10
  import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
11
11
  import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';
12
12
  import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
13
- import { store as interfaceStore } from '@wordpress/interface';
13
+ import { store as preferencesStore } from '@wordpress/preferences';
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
@@ -53,7 +53,7 @@ export function initialize(id, settings) {
53
53
  return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
54
54
  });
55
55
 
56
- dispatch(interfaceStore).setFeatureDefaults('core/edit-widgets', {
56
+ dispatch(preferencesStore).setDefaults('core/edit-widgets', {
57
57
  fixedToolbar: false,
58
58
  welcomeGuide: true,
59
59
  showBlockBreadcrumbs: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","render","unmountComponentAtNode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","interfaceStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","setFeatureDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","registerBlock","search","searchOptions","metadata"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,6CAFD,EAEgD;AAC/CC,6BAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC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ELF,MAFK,CAAN;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMwB,aAAa,GAAKd,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEiB,IAAAA,QAAF;AAAY1B,IAAAA,QAAZ;AAAsBW,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAKiB,QAAL,EAAgB;AACfjD,IAAAA,6CAA6C,CAAE;AAAE,OAAEkC,IAAF,GAAUe;AAAZ,KAAF,CAA7C;AACA;;AACDlD,EAAAA,iBAAiB,CAAEmC,IAAF,EAAQX,QAAR,CAAjB;AACA,CATD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\n\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initialize( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( interfaceStore ).setFeatureDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/index.js"],"names":["registerBlockType","unstable__bootstrapServerSideBlockDefinitions","setFreeformContentHandlerName","store","blocksStore","dispatch","render","unmountComponentAtNode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","preferencesStore","widgetArea","Layout","ALLOW_REUSABLE_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","disabledBlocks","reinitializeEditor","target","settings","reboot","bind","initialize","id","document","getElementById","coreBlocks","filter","block","includes","name","startsWith","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","registerBlock","search","searchOptions","metadata"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iBADD,EAECC,6CAFD,EAEgD;AAC/CC,6BAHD,EAICC,KAAK,IAAIC,WAJV,QAKO,mBALP;AAMA,SAASC,QAAT,QAAyB,iBAAzB;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,sB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B,aAAa,GAAKd,KAAF,IAAa;AAClC,MAAK,CAAEA,KAAP,EAAe;AACd;AACA;;AACD,QAAM;AAAEiB,IAAAA,QAAF;AAAY1B,IAAAA,QAAZ;AAAsBW,IAAAA;AAAtB,MAA+BF,KAArC;;AACA,MAAKiB,QAAL,EAAgB;AACfjD,IAAAA,6CAA6C,CAAE;AAAE,OAAEkC,IAAF,GAAUe;AAAZ,KAAF,CAA7C;AACA;;AACDlD,EAAAA,iBAAiB,CAAEmC,IAAF,EAAQX,QAAR,CAAjB;AACA,CATD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tregisterBlockType,\n\tunstable__bootstrapServerSideBlockDefinitions, // eslint-disable-line camelcase\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport './store';\nimport './filters';\nimport * as widgetArea from './blocks/widget-area';\n\nimport Layout from './components/layout';\nimport {\n\tALLOW_REUSABLE_BLOCKS,\n\tENABLE_EXPERIMENTAL_FSE_BLOCKS,\n} from './constants';\n\nconst disabledBlocks = [\n\t'core/more',\n\t'core/freeform',\n\t'core/template-part',\n\t...( ALLOW_REUSABLE_BLOCKS ? [] : [ 'core/block' ] ),\n];\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the block editor in the widgets screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Block editor settings.\n */\nexport function initialize( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tdisabledBlocks.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t\tshowBlockBreadcrumbs: true,\n\t\tthemeStyles: true,\n\t} );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( settings );\n\tregisterBlock( widgetArea );\n\tregisterWidgetGroupBlock();\n\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\trender(\n\t\t<Layout blockEditorSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\n *\n */\nconst registerBlock = ( block ) => {\n\tif ( ! block ) {\n\t\treturn;\n\t}\n\tconst { metadata, settings, name } = block;\n\tif ( metadata ) {\n\t\tunstable__bootstrapServerSideBlockDefinitions( { [ name ]: metadata } );\n\t}\n\tregisterBlockType( name, settings );\n};\n"]}
@@ -86,7 +86,7 @@ export const saveWidgetAreas = widgetAreas => async _ref3 => {
86
86
  await dispatch.saveWidgetArea(widgetArea.id);
87
87
  }
88
88
  } finally {
89
- // saveEditedEntityRecord resets the resolution status, let's fix it manually
89
+ // saveEditedEntityRecord resets the resolution status, let's fix it manually.
90
90
  await registry.dispatch(coreStore).finishResolution('getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery());
91
91
  }
92
92
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/store/actions.js"],"names":["__","sprintf","store","noticesStore","interfaceStore","getWidgetIdFromBlock","coreStore","blockEditorStore","transformBlockToWidget","buildWidgetAreaPostId","buildWidgetAreasQuery","createStubPost","KIND","POST_TYPE","WIDGET_AREA_ENTITY_TYPE","STORE_NAME","editWidgetsStoreName","persistStubPost","id","blocks","registry","stubPost","dispatch","receiveEntityRecords","saveEditedWidgetAreas","select","editedWidgetAreas","getEditedWidgetAreas","length","saveWidgetAreas","createSuccessNotice","type","e","createErrorNotice","message","widgetAreas","widgetArea","saveWidgetArea","finishResolution","widgetAreaId","widgets","getWidgets","post","getEditedEntityRecord","areaWidgets","Object","values","filter","sidebar","usedReferenceWidgets","widgetsBlocks","block","attributes","name","includes","push","deletedWidgets","widget","widgetsNewArea","getWidgetAreaForWidgetId","batchMeta","batchTasks","sidebarWidgetsIds","i","widgetId","oldWidget","editEntityRecord","undoIgnore","hasEdits","hasEditsForEntityRecord","saveEditedEntityRecord","saveEntityRecord","position","clientId","deleteEntityRecord","force","records","__experimentalBatch","preservedRecords","record","hasOwnProperty","failedWidgetNames","__internalWidgetId","error","getLastEntitySaveError","Error","join","trySaveWidgetArea","undefined","saveErrorBefore","saveErrorAfter","setWidgetIdForClientId","setWidgetAreasOpenState","widgetAreasOpenState","setIsWidgetAreaOpen","isOpen","setIsInserterOpened","value","setIsListViewOpened","closeGeneralSidebar","disableComplementaryArea","moveBlockToWidgetArea","sourceRootClientId","getBlockRootClientId","getBlocks","destinationWidgetAreaBlock","find","destinationRootClientId","destinationInnerBlocksClientIds","getBlockOrder","destinationIndex","isDestinationWidgetAreaOpen","getIsWidgetAreaOpen","moveBlocksToPosition"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AACA,SAASC,oBAAT,QAAqC,oBAArC;AACA,SAASH,KAAK,IAAII,SAAlB,QAAmC,sBAAnC;AACA,SAASJ,KAAK,IAAIK,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,gBAAvC;AACA,SACCC,qBADD,EAECC,qBAFD,EAGCC,cAHD,EAICC,IAJD,EAKCC,SALD,EAMCC,uBAND,QAOO,SAPP;AAQA,SAASC,UAAU,IAAIC,oBAAvB,QAAmD,aAAnD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAG,CAAEC,EAAF,EAAMC,MAAN,KAAkB,QAAoB;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AACpE,QAAMC,QAAQ,GAAGV,cAAc,CAAEO,EAAF,EAAMC,MAAN,CAA/B;AACAC,EAAAA,QAAQ,CACNE,QADF,CACYhB,SADZ,EAEEiB,oBAFF,CAGEX,IAHF,EAIEC,SAJF,EAKEQ,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GA,QAAMG,gBAAgB,GAAGF,+BAA+B,CAAChF,MAAzD,CAlBM,CAoBN;;AACA,QAAMmF,2BAA2B,GAAGtF,MAAM,CAACuF,mBAAP,CACnCL,uBADmC,CAApC;;AAIA,MAAK,CAAEI,2BAAP,EAAqC;AACpCzF,IAAAA,QAAQ,CAACwE,mBAAT,CAA8Ba,uBAA9B,EAAuD,IAAvD;AACA,GA3BK,CA6BN;;;AACAvF,EAAAA,QAAQ,CACNE,QADF,CACYf,gBADZ,EAEE0G,oBAFF,CAGE,CAAExC,QAAF,CAHF,EAIE6B,kBAJF,EAKEK,uBALF,EAMEG,gBANF;AAQA,CA1CM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { transformBlockToWidget } from './transformers';\nimport {\n\tbuildWidgetAreaPostId,\n\tbuildWidgetAreasQuery,\n\tcreateStubPost,\n\tKIND,\n\tPOST_TYPE,\n\tWIDGET_AREA_ENTITY_TYPE,\n} from './utils';\nimport { STORE_NAME as editWidgetsStoreName } from './constants';\n\n/**\n * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and\n * shouldn't be saved via the API.\n *\n * @param {string} id Post ID.\n * @param {Array} blocks Blocks the post should consist of.\n * @return {Object} The post object.\n */\nexport const persistStubPost = ( id, blocks ) => ( { registry } ) => {\n\tconst stubPost = createStubPost( id, blocks );\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.receiveEntityRecords(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tstubPost,\n\t\t\t{ id: stubPost.id },\n\t\t\tfalse\n\t\t);\n\treturn stubPost;\n};\n\n/**\n * Converts all the blocks from edited widget areas into widgets,\n * and submits a batch request to save everything at once.\n *\n * Creates a snackbar notice on either success or error.\n *\n * @return {Function} An action creator.\n */\nexport const saveEditedWidgetAreas = () => async ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tconst editedWidgetAreas = select.getEditedWidgetAreas();\n\tif ( ! editedWidgetAreas?.length ) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait dispatch.saveWidgetAreas( editedWidgetAreas );\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice( __( 'Widgets saved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t} catch ( e ) {\n\t\tregistry.dispatch( noticesStore ).createErrorNotice(\n\t\t\t/* translators: %s: The error message. */\n\t\t\tsprintf( __( 'There was an error. %s' ), e.message ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}\n};\n\n/**\n * Converts all the blocks from specified widget areas into widgets,\n * and submits a batch request to save everything at once.\n *\n * @param {Object[]} widgetAreas Widget areas to save.\n * @return {Function} An action creator.\n */\nexport const saveWidgetAreas = ( widgetAreas ) => async ( {\n\tdispatch,\n\tregistry,\n} ) => {\n\ttry {\n\t\tfor ( const widgetArea of widgetAreas ) {\n\t\t\tawait dispatch.saveWidgetArea( widgetArea.id );\n\t\t}\n\t} finally {\n\t\t// saveEditedEntityRecord resets the resolution status, let's fix it manually\n\t\tawait registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.finishResolution(\n\t\t\t\t'getEntityRecord',\n\t\t\t\tKIND,\n\t\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\t\tbuildWidgetAreasQuery()\n\t\t\t);\n\t}\n};\n\n/**\n * Converts all the blocks from a widget area specified by ID into widgets,\n * and submits a batch request to save everything at once.\n *\n * @param {string} widgetAreaId ID of the widget area to process.\n * @return {Function} An action creator.\n */\nexport const saveWidgetArea = ( widgetAreaId ) => async ( {\n\tdispatch,\n\tselect,\n\tregistry,\n} ) => {\n\tconst widgets = select.getWidgets();\n\n\tconst post = registry\n\t\t.select( coreStore )\n\t\t.getEditedEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreaPostId( widgetAreaId )\n\t\t);\n\n\t// Get all widgets from this area\n\tconst areaWidgets = Object.values( widgets ).filter(\n\t\t( { sidebar } ) => sidebar === widgetAreaId\n\t);\n\n\t// Remove all duplicate reference widget instances for legacy widgets.\n\t// Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget\n\t// implemented using a function. WordPress doesn't support having more than one instance of these, if you try to\n\t// save multiple instances of these in different sidebars you will run into undefined behaviors.\n\tconst usedReferenceWidgets = [];\n\tconst widgetsBlocks = post.blocks.filter( ( block ) => {\n\t\tconst { id } = block.attributes;\n\n\t\tif ( block.name === 'core/legacy-widget' && id ) {\n\t\t\tif ( usedReferenceWidgets.includes( id ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tusedReferenceWidgets.push( id );\n\t\t}\n\t\treturn true;\n\t} );\n\n\t// Determine which widgets have been deleted. We can tell if a widget is\n\t// deleted and not just moved to a different area by looking to see if\n\t// getWidgetAreaForWidgetId() finds something.\n\tconst deletedWidgets = [];\n\tfor ( const widget of areaWidgets ) {\n\t\tconst widgetsNewArea = select.getWidgetAreaForWidgetId( widget.id );\n\t\tif ( ! widgetsNewArea ) {\n\t\t\tdeletedWidgets.push( widget );\n\t\t}\n\t}\n\n\tconst batchMeta = [];\n\tconst batchTasks = [];\n\tconst sidebarWidgetsIds = [];\n\tfor ( let i = 0; i < widgetsBlocks.length; i++ ) {\n\t\tconst block = widgetsBlocks[ i ];\n\t\tconst widgetId = getWidgetIdFromBlock( block );\n\t\tconst oldWidget = widgets[ widgetId ];\n\t\tconst widget = transformBlockToWidget( block, oldWidget );\n\n\t\t// We'll replace the null widgetId after save, but we track it here\n\t\t// since order is important.\n\t\tsidebarWidgetsIds.push( widgetId );\n\n\t\t// Check oldWidget as widgetId might refer to an ID which has been\n\t\t// deleted, e.g. if a deleted block is restored via undo after saving.\n\t\tif ( oldWidget ) {\n\t\t\t// Update an existing widget.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\twidgetId,\n\t\t\t\t{\n\t\t\t\t\t...widget,\n\t\t\t\t\tsidebar: widgetAreaId,\n\t\t\t\t},\n\t\t\t\t{ undoIgnore: true }\n\t\t\t);\n\n\t\t\tconst hasEdits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.hasEditsForEntityRecord( 'root', 'widget', widgetId );\n\n\t\t\tif ( ! hasEdits ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbatchTasks.push( ( { saveEditedEntityRecord } ) =>\n\t\t\t\tsaveEditedEntityRecord( 'root', 'widget', widgetId )\n\t\t\t);\n\t\t} else {\n\t\t\t// Create a new widget.\n\t\t\tbatchTasks.push( ( { saveEntityRecord } ) =>\n\t\t\t\tsaveEntityRecord( 'root', 'widget', {\n\t\t\t\t\t...widget,\n\t\t\t\t\tsidebar: widgetAreaId,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\n\t\tbatchMeta.push( {\n\t\t\tblock,\n\t\t\tposition: i,\n\t\t\tclientId: block.clientId,\n\t\t} );\n\t}\n\tfor ( const widget of deletedWidgets ) {\n\t\tbatchTasks.push( ( { deleteEntityRecord } ) =>\n\t\t\tdeleteEntityRecord( 'root', 'widget', widget.id, {\n\t\t\t\tforce: true,\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst records = await registry\n\t\t.dispatch( coreStore )\n\t\t.__experimentalBatch( batchTasks );\n\tconst preservedRecords = records.filter(\n\t\t( record ) => ! record.hasOwnProperty( 'deleted' )\n\t);\n\n\tconst failedWidgetNames = [];\n\n\tfor ( let i = 0; i < preservedRecords.length; i++ ) {\n\t\tconst widget = preservedRecords[ i ];\n\t\tconst { block, position } = batchMeta[ i ];\n\n\t\t// Set __internalWidgetId on the block. This will be persisted to the\n\t\t// store when we dispatch receiveEntityRecords( post ) below.\n\t\tpost.blocks[ position ].attributes.__internalWidgetId = widget.id;\n\n\t\tconst error = registry\n\t\t\t.select( coreStore )\n\t\t\t.getLastEntitySaveError( 'root', 'widget', widget.id );\n\t\tif ( error ) {\n\t\t\tfailedWidgetNames.push( block.attributes?.name || block?.name );\n\t\t}\n\n\t\tif ( ! sidebarWidgetsIds[ position ] ) {\n\t\t\tsidebarWidgetsIds[ position ] = widget.id;\n\t\t}\n\t}\n\n\tif ( failedWidgetNames.length ) {\n\t\tthrow new Error(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: List of widget names */\n\t\t\t\t__( 'Could not save the following widgets: %s.' ),\n\t\t\t\tfailedWidgetNames.join( ', ' )\n\t\t\t)\n\t\t);\n\t}\n\n\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\tKIND,\n\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\twidgetAreaId,\n\t\t{\n\t\t\twidgets: sidebarWidgetsIds,\n\t\t},\n\t\t{ undoIgnore: true }\n\t);\n\n\tdispatch( trySaveWidgetArea( widgetAreaId ) );\n\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.receiveEntityRecords( KIND, POST_TYPE, post, undefined );\n};\n\nconst trySaveWidgetArea = ( widgetAreaId ) => ( { registry } ) => {\n\tconst saveErrorBefore = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.saveEditedEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tconst saveErrorAfter = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tif ( saveErrorAfter && saveErrorBefore !== saveErrorAfter ) {\n\t\tthrow new Error( saveErrorAfter );\n\t}\n};\n\n/**\n * Sets the clientId stored for a particular widgetId.\n *\n * @param {number} clientId Client id.\n * @param {number} widgetId Widget id.\n *\n * @return {Object} Action.\n */\nexport function setWidgetIdForClientId( clientId, widgetId ) {\n\treturn {\n\t\ttype: 'SET_WIDGET_ID_FOR_CLIENT_ID',\n\t\tclientId,\n\t\twidgetId,\n\t};\n}\n\n/**\n * Sets the open state of all the widget areas.\n *\n * @param {Object} widgetAreasOpenState The open states of all the widget areas.\n *\n * @return {Object} Action.\n */\nexport function setWidgetAreasOpenState( widgetAreasOpenState ) {\n\treturn {\n\t\ttype: 'SET_WIDGET_AREAS_OPEN_STATE',\n\t\twidgetAreasOpenState,\n\t};\n}\n\n/**\n * Sets the open state of the widget area.\n *\n * @param {string} clientId The clientId of the widget area.\n * @param {boolean} isOpen Whether the widget area should be opened.\n *\n * @return {Object} Action.\n */\nexport function setIsWidgetAreaOpen( clientId, isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_WIDGET_AREA_OPEN',\n\t\tclientId,\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @return {Object} Action creator.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editWidgetsStoreName );\n};\n\n/**\n * Action that handles moving a block between widget areas\n *\n * @param {string} clientId The clientId of the block to move.\n * @param {string} widgetAreaId The id of the widget area to move the block to.\n */\nexport const moveBlockToWidgetArea = ( clientId, widgetAreaId ) => async ( {\n\tdispatch,\n\tselect,\n\tregistry,\n} ) => {\n\tconst sourceRootClientId = registry\n\t\t.select( blockEditorStore )\n\t\t.getBlockRootClientId( [ clientId ] );\n\n\t// Search the top level blocks (widget areas) for the one with the matching\n\t// id attribute. Makes the assumption that all top-level blocks are widget\n\t// areas.\n\tconst widgetAreas = registry.select( blockEditorStore ).getBlocks();\n\tconst destinationWidgetAreaBlock = widgetAreas.find(\n\t\t( { attributes } ) => attributes.id === widgetAreaId\n\t);\n\tconst destinationRootClientId = destinationWidgetAreaBlock.clientId;\n\n\t// Get the index for moving to the end of the the destination widget area.\n\tconst destinationInnerBlocksClientIds = registry\n\t\t.select( blockEditorStore )\n\t\t.getBlockOrder( destinationRootClientId );\n\tconst destinationIndex = destinationInnerBlocksClientIds.length;\n\n\t// Reveal the widget area, if it's not open.\n\tconst isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(\n\t\tdestinationRootClientId\n\t);\n\n\tif ( ! isDestinationWidgetAreaOpen ) {\n\t\tdispatch.setIsWidgetAreaOpen( destinationRootClientId, true );\n\t}\n\n\t// Move the block.\n\tregistry\n\t\t.dispatch( blockEditorStore )\n\t\t.moveBlocksToPosition(\n\t\t\t[ clientId ],\n\t\t\tsourceRootClientId,\n\t\t\tdestinationRootClientId,\n\t\t\tdestinationIndex\n\t\t);\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/store/actions.js"],"names":["__","sprintf","store","noticesStore","interfaceStore","getWidgetIdFromBlock","coreStore","blockEditorStore","transformBlockToWidget","buildWidgetAreaPostId","buildWidgetAreasQuery","createStubPost","KIND","POST_TYPE","WIDGET_AREA_ENTITY_TYPE","STORE_NAME","editWidgetsStoreName","persistStubPost","id","blocks","registry","stubPost","dispatch","receiveEntityRecords","saveEditedWidgetAreas","select","editedWidgetAreas","getEditedWidgetAreas","length","saveWidgetAreas","createSuccessNotice","type","e","createErrorNotice","message","widgetAreas","widgetArea","saveWidgetArea","finishResolution","widgetAreaId","widgets","getWidgets","post","getEditedEntityRecord","areaWidgets","Object","values","filter","sidebar","usedReferenceWidgets","widgetsBlocks","block","attributes","name","includes","push","deletedWidgets","widget","widgetsNewArea","getWidgetAreaForWidgetId","batchMeta","batchTasks","sidebarWidgetsIds","i","widgetId","oldWidget","editEntityRecord","undoIgnore","hasEdits","hasEditsForEntityRecord","saveEditedEntityRecord","saveEntityRecord","position","clientId","deleteEntityRecord","force","records","__experimentalBatch","preservedRecords","record","hasOwnProperty","failedWidgetNames","__internalWidgetId","error","getLastEntitySaveError","Error","join","trySaveWidgetArea","undefined","saveErrorBefore","saveErrorAfter","setWidgetIdForClientId","setWidgetAreasOpenState","widgetAreasOpenState","setIsWidgetAreaOpen","isOpen","setIsInserterOpened","value","setIsListViewOpened","closeGeneralSidebar","disableComplementaryArea","moveBlockToWidgetArea","sourceRootClientId","getBlockRootClientId","getBlocks","destinationWidgetAreaBlock","find","destinationRootClientId","destinationInnerBlocksClientIds","getBlockOrder","destinationIndex","isDestinationWidgetAreaOpen","getIsWidgetAreaOpen","moveBlocksToPosition"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,cAAlB,QAAwC,sBAAxC;AACA,SAASC,oBAAT,QAAqC,oBAArC;AACA,SAASH,KAAK,IAAII,SAAlB,QAAmC,sBAAnC;AACA,SAASJ,KAAK,IAAIK,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,gBAAvC;AACA,SACCC,qBADD,EAECC,qBAFD,EAGCC,cAHD,EAICC,IAJD,EAKCC,SALD,EAMCC,uBAND,QAOO,SAPP;AAQA,SAASC,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,EAApB;AACA,QAAMC,0BAA0B,GAAGtE,WAAW,CAACuE,IAAZ,CAClC;AAAA,QAAE;AAAEtD,MAAAA;AAAF,KAAF;AAAA,WAAsBA,UAAU,CAAClC,EAAX,KAAkBqB,YAAxC;AAAA,GADkC,CAAnC;AAGA,QAAMoE,uBAAuB,GAAGF,0BAA0B,CAAChC,QAA3D,CAZM,CAcN;;AACA,QAAMmC,+BAA+B,GAAGxF,QAAQ,CAC9CK,MADsC,CAC9BlB,gBAD8B,EAEtCsG,aAFsC,CAEvBF,uBAFuB,CAAxC;AAGA,QAAMG,gBAAgB,GAAGF,+BAA+B,CAAChF,MAAzD,CAlBM,CAoBN;;AACA,QAAMmF,2BAA2B,GAAGtF,MAAM,CAACuF,mBAAP,CACnCL,uBADmC,CAApC;;AAIA,MAAK,CAAEI,2BAAP,EAAqC;AACpCzF,IAAAA,QAAQ,CAACwE,mBAAT,CAA8Ba,uBAA9B,EAAuD,IAAvD;AACA,GA3BK,CA6BN;;;AACAvF,EAAAA,QAAQ,CACNE,QADF,CACYf,gBADZ,EAEE0G,oBAFF,CAGE,CAAExC,QAAF,CAHF,EAIE6B,kBAJF,EAKEK,uBALF,EAMEG,gBANF;AAQA,CA1CM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { getWidgetIdFromBlock } from '@wordpress/widgets';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { transformBlockToWidget } from './transformers';\nimport {\n\tbuildWidgetAreaPostId,\n\tbuildWidgetAreasQuery,\n\tcreateStubPost,\n\tKIND,\n\tPOST_TYPE,\n\tWIDGET_AREA_ENTITY_TYPE,\n} from './utils';\nimport { STORE_NAME as editWidgetsStoreName } from './constants';\n\n/**\n * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and\n * shouldn't be saved via the API.\n *\n * @param {string} id Post ID.\n * @param {Array} blocks Blocks the post should consist of.\n * @return {Object} The post object.\n */\nexport const persistStubPost = ( id, blocks ) => ( { registry } ) => {\n\tconst stubPost = createStubPost( id, blocks );\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.receiveEntityRecords(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tstubPost,\n\t\t\t{ id: stubPost.id },\n\t\t\tfalse\n\t\t);\n\treturn stubPost;\n};\n\n/**\n * Converts all the blocks from edited widget areas into widgets,\n * and submits a batch request to save everything at once.\n *\n * Creates a snackbar notice on either success or error.\n *\n * @return {Function} An action creator.\n */\nexport const saveEditedWidgetAreas = () => async ( {\n\tselect,\n\tdispatch,\n\tregistry,\n} ) => {\n\tconst editedWidgetAreas = select.getEditedWidgetAreas();\n\tif ( ! editedWidgetAreas?.length ) {\n\t\treturn;\n\t}\n\ttry {\n\t\tawait dispatch.saveWidgetAreas( editedWidgetAreas );\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createSuccessNotice( __( 'Widgets saved.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t} catch ( e ) {\n\t\tregistry.dispatch( noticesStore ).createErrorNotice(\n\t\t\t/* translators: %s: The error message. */\n\t\t\tsprintf( __( 'There was an error. %s' ), e.message ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t}\n};\n\n/**\n * Converts all the blocks from specified widget areas into widgets,\n * and submits a batch request to save everything at once.\n *\n * @param {Object[]} widgetAreas Widget areas to save.\n * @return {Function} An action creator.\n */\nexport const saveWidgetAreas = ( widgetAreas ) => async ( {\n\tdispatch,\n\tregistry,\n} ) => {\n\ttry {\n\t\tfor ( const widgetArea of widgetAreas ) {\n\t\t\tawait dispatch.saveWidgetArea( widgetArea.id );\n\t\t}\n\t} finally {\n\t\t// saveEditedEntityRecord resets the resolution status, let's fix it manually.\n\t\tawait registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.finishResolution(\n\t\t\t\t'getEntityRecord',\n\t\t\t\tKIND,\n\t\t\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\t\t\tbuildWidgetAreasQuery()\n\t\t\t);\n\t}\n};\n\n/**\n * Converts all the blocks from a widget area specified by ID into widgets,\n * and submits a batch request to save everything at once.\n *\n * @param {string} widgetAreaId ID of the widget area to process.\n * @return {Function} An action creator.\n */\nexport const saveWidgetArea = ( widgetAreaId ) => async ( {\n\tdispatch,\n\tselect,\n\tregistry,\n} ) => {\n\tconst widgets = select.getWidgets();\n\n\tconst post = registry\n\t\t.select( coreStore )\n\t\t.getEditedEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreaPostId( widgetAreaId )\n\t\t);\n\n\t// Get all widgets from this area\n\tconst areaWidgets = Object.values( widgets ).filter(\n\t\t( { sidebar } ) => sidebar === widgetAreaId\n\t);\n\n\t// Remove all duplicate reference widget instances for legacy widgets.\n\t// Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget\n\t// implemented using a function. WordPress doesn't support having more than one instance of these, if you try to\n\t// save multiple instances of these in different sidebars you will run into undefined behaviors.\n\tconst usedReferenceWidgets = [];\n\tconst widgetsBlocks = post.blocks.filter( ( block ) => {\n\t\tconst { id } = block.attributes;\n\n\t\tif ( block.name === 'core/legacy-widget' && id ) {\n\t\t\tif ( usedReferenceWidgets.includes( id ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tusedReferenceWidgets.push( id );\n\t\t}\n\t\treturn true;\n\t} );\n\n\t// Determine which widgets have been deleted. We can tell if a widget is\n\t// deleted and not just moved to a different area by looking to see if\n\t// getWidgetAreaForWidgetId() finds something.\n\tconst deletedWidgets = [];\n\tfor ( const widget of areaWidgets ) {\n\t\tconst widgetsNewArea = select.getWidgetAreaForWidgetId( widget.id );\n\t\tif ( ! widgetsNewArea ) {\n\t\t\tdeletedWidgets.push( widget );\n\t\t}\n\t}\n\n\tconst batchMeta = [];\n\tconst batchTasks = [];\n\tconst sidebarWidgetsIds = [];\n\tfor ( let i = 0; i < widgetsBlocks.length; i++ ) {\n\t\tconst block = widgetsBlocks[ i ];\n\t\tconst widgetId = getWidgetIdFromBlock( block );\n\t\tconst oldWidget = widgets[ widgetId ];\n\t\tconst widget = transformBlockToWidget( block, oldWidget );\n\n\t\t// We'll replace the null widgetId after save, but we track it here\n\t\t// since order is important.\n\t\tsidebarWidgetsIds.push( widgetId );\n\n\t\t// Check oldWidget as widgetId might refer to an ID which has been\n\t\t// deleted, e.g. if a deleted block is restored via undo after saving.\n\t\tif ( oldWidget ) {\n\t\t\t// Update an existing widget.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'widget',\n\t\t\t\twidgetId,\n\t\t\t\t{\n\t\t\t\t\t...widget,\n\t\t\t\t\tsidebar: widgetAreaId,\n\t\t\t\t},\n\t\t\t\t{ undoIgnore: true }\n\t\t\t);\n\n\t\t\tconst hasEdits = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.hasEditsForEntityRecord( 'root', 'widget', widgetId );\n\n\t\t\tif ( ! hasEdits ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tbatchTasks.push( ( { saveEditedEntityRecord } ) =>\n\t\t\t\tsaveEditedEntityRecord( 'root', 'widget', widgetId )\n\t\t\t);\n\t\t} else {\n\t\t\t// Create a new widget.\n\t\t\tbatchTasks.push( ( { saveEntityRecord } ) =>\n\t\t\t\tsaveEntityRecord( 'root', 'widget', {\n\t\t\t\t\t...widget,\n\t\t\t\t\tsidebar: widgetAreaId,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\n\t\tbatchMeta.push( {\n\t\t\tblock,\n\t\t\tposition: i,\n\t\t\tclientId: block.clientId,\n\t\t} );\n\t}\n\tfor ( const widget of deletedWidgets ) {\n\t\tbatchTasks.push( ( { deleteEntityRecord } ) =>\n\t\t\tdeleteEntityRecord( 'root', 'widget', widget.id, {\n\t\t\t\tforce: true,\n\t\t\t} )\n\t\t);\n\t}\n\n\tconst records = await registry\n\t\t.dispatch( coreStore )\n\t\t.__experimentalBatch( batchTasks );\n\tconst preservedRecords = records.filter(\n\t\t( record ) => ! record.hasOwnProperty( 'deleted' )\n\t);\n\n\tconst failedWidgetNames = [];\n\n\tfor ( let i = 0; i < preservedRecords.length; i++ ) {\n\t\tconst widget = preservedRecords[ i ];\n\t\tconst { block, position } = batchMeta[ i ];\n\n\t\t// Set __internalWidgetId on the block. This will be persisted to the\n\t\t// store when we dispatch receiveEntityRecords( post ) below.\n\t\tpost.blocks[ position ].attributes.__internalWidgetId = widget.id;\n\n\t\tconst error = registry\n\t\t\t.select( coreStore )\n\t\t\t.getLastEntitySaveError( 'root', 'widget', widget.id );\n\t\tif ( error ) {\n\t\t\tfailedWidgetNames.push( block.attributes?.name || block?.name );\n\t\t}\n\n\t\tif ( ! sidebarWidgetsIds[ position ] ) {\n\t\t\tsidebarWidgetsIds[ position ] = widget.id;\n\t\t}\n\t}\n\n\tif ( failedWidgetNames.length ) {\n\t\tthrow new Error(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: List of widget names */\n\t\t\t\t__( 'Could not save the following widgets: %s.' ),\n\t\t\t\tfailedWidgetNames.join( ', ' )\n\t\t\t)\n\t\t);\n\t}\n\n\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\tKIND,\n\t\tWIDGET_AREA_ENTITY_TYPE,\n\t\twidgetAreaId,\n\t\t{\n\t\t\twidgets: sidebarWidgetsIds,\n\t\t},\n\t\t{ undoIgnore: true }\n\t);\n\n\tdispatch( trySaveWidgetArea( widgetAreaId ) );\n\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.receiveEntityRecords( KIND, POST_TYPE, post, undefined );\n};\n\nconst trySaveWidgetArea = ( widgetAreaId ) => ( { registry } ) => {\n\tconst saveErrorBefore = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tregistry\n\t\t.dispatch( coreStore )\n\t\t.saveEditedEntityRecord( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tconst saveErrorAfter = registry\n\t\t.select( coreStore )\n\t\t.getLastEntitySaveError( KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId );\n\tif ( saveErrorAfter && saveErrorBefore !== saveErrorAfter ) {\n\t\tthrow new Error( saveErrorAfter );\n\t}\n};\n\n/**\n * Sets the clientId stored for a particular widgetId.\n *\n * @param {number} clientId Client id.\n * @param {number} widgetId Widget id.\n *\n * @return {Object} Action.\n */\nexport function setWidgetIdForClientId( clientId, widgetId ) {\n\treturn {\n\t\ttype: 'SET_WIDGET_ID_FOR_CLIENT_ID',\n\t\tclientId,\n\t\twidgetId,\n\t};\n}\n\n/**\n * Sets the open state of all the widget areas.\n *\n * @param {Object} widgetAreasOpenState The open states of all the widget areas.\n *\n * @return {Object} Action.\n */\nexport function setWidgetAreasOpenState( widgetAreasOpenState ) {\n\treturn {\n\t\ttype: 'SET_WIDGET_AREAS_OPEN_STATE',\n\t\twidgetAreasOpenState,\n\t};\n}\n\n/**\n * Sets the open state of the widget area.\n *\n * @param {string} clientId The clientId of the widget area.\n * @param {boolean} isOpen Whether the widget area should be opened.\n *\n * @return {Object} Action.\n */\nexport function setIsWidgetAreaOpen( clientId, isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_WIDGET_AREA_OPEN',\n\t\tclientId,\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n * @return {Object} Action object.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @return {Object} Action creator.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editWidgetsStoreName );\n};\n\n/**\n * Action that handles moving a block between widget areas\n *\n * @param {string} clientId The clientId of the block to move.\n * @param {string} widgetAreaId The id of the widget area to move the block to.\n */\nexport const moveBlockToWidgetArea = ( clientId, widgetAreaId ) => async ( {\n\tdispatch,\n\tselect,\n\tregistry,\n} ) => {\n\tconst sourceRootClientId = registry\n\t\t.select( blockEditorStore )\n\t\t.getBlockRootClientId( [ clientId ] );\n\n\t// Search the top level blocks (widget areas) for the one with the matching\n\t// id attribute. Makes the assumption that all top-level blocks are widget\n\t// areas.\n\tconst widgetAreas = registry.select( blockEditorStore ).getBlocks();\n\tconst destinationWidgetAreaBlock = widgetAreas.find(\n\t\t( { attributes } ) => attributes.id === widgetAreaId\n\t);\n\tconst destinationRootClientId = destinationWidgetAreaBlock.clientId;\n\n\t// Get the index for moving to the end of the the destination widget area.\n\tconst destinationInnerBlocksClientIds = registry\n\t\t.select( blockEditorStore )\n\t\t.getBlockOrder( destinationRootClientId );\n\tconst destinationIndex = destinationInnerBlocksClientIds.length;\n\n\t// Reveal the widget area, if it's not open.\n\tconst isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen(\n\t\tdestinationRootClientId\n\t);\n\n\tif ( ! isDestinationWidgetAreaOpen ) {\n\t\tdispatch.setIsWidgetAreaOpen( destinationRootClientId, true );\n\t}\n\n\t// Move the block.\n\tregistry\n\t\t.dispatch( blockEditorStore )\n\t\t.moveBlocksToPosition(\n\t\t\t[ clientId ],\n\t\t\tsourceRootClientId,\n\t\t\tdestinationRootClientId,\n\t\t\tdestinationIndex\n\t\t);\n};\n"]}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import apiFetch from '@wordpress/api-fetch';
5
- import { createReduxStore, registerStore } from '@wordpress/data';
5
+ import { createReduxStore, register } from '@wordpress/data';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
@@ -15,7 +15,7 @@ import { STORE_NAME } from './constants';
15
15
  /**
16
16
  * Block editor data store configuration.
17
17
  *
18
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
18
+ * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register
19
19
  *
20
20
  * @type {Object}
21
21
  */
@@ -34,10 +34,8 @@ const storeConfig = {
34
34
  * @type {Object}
35
35
  */
36
36
 
37
- export const store = createReduxStore(STORE_NAME, storeConfig); // Once we build a more generic persistence plugin that works across types of stores
38
- // we'd be able to replace this with a register call.
39
-
40
- registerStore(STORE_NAME, storeConfig); // This package uses a few in-memory post types as wrappers for convenience.
37
+ export const store = createReduxStore(STORE_NAME, storeConfig);
38
+ register(store); // This package uses a few in-memory post types as wrappers for convenience.
41
39
  // This middleware prevents any network requests related to these types as they are
42
40
  // bound to fail anyway.
43
41
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/store/index.js"],"names":["apiFetch","createReduxStore","registerStore","reducer","resolvers","selectors","actions","STORE_NAME","storeConfig","store","use","options","next","path","indexOf","Promise","resolve"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG;AACnBL,EAAAA,OADmB;AAEnBE,EAAAA,SAFmB;AAGnBD,EAAAA,SAHmB;AAInBE,EAAAA;AAJmB,CAApB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGR,gBAAgB,CAAEM,UAAF,EAAcC,WAAd,CAA9B,C,CAEP;AACA;;AACAN,aAAa,CAAEK,UAAF,EAAcC,WAAd,CAAb,C,CAEA;AACA;AACA;;AACAR,QAAQ,CAACU,GAAT,CAAc,UAAWC,OAAX,EAAoBC,IAApB,EAA2B;AAAA;;AACxC,MAAK,kBAAAD,OAAO,CAACE,IAAR,gEAAcC,OAAd,CAAuB,0BAAvB,OAAwD,CAA7D,EAAiE;AAChE,WAAOC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAP;AACA;;AAED,SAAOJ,IAAI,CAAED,OAAF,CAAX;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, storeConfig );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/store/index.js"],"names":["apiFetch","createReduxStore","register","reducer","resolvers","selectors","actions","STORE_NAME","storeConfig","store","use","options","next","path","indexOf","Promise","resolve"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,gBAAT,EAA2BC,QAA3B,QAA2C,iBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,WAAW,GAAG;AACnBL,EAAAA,OADmB;AAEnBE,EAAAA,SAFmB;AAGnBD,EAAAA,SAHmB;AAInBE,EAAAA;AAJmB,CAApB;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,KAAK,GAAGR,gBAAgB,CAAEM,UAAF,EAAcC,WAAd,CAA9B;AACPN,QAAQ,CAAEO,KAAF,CAAR,C,CAEA;AACA;AACA;;AACAT,QAAQ,CAACU,GAAT,CAAc,UAAWC,OAAX,EAAoBC,IAApB,EAA2B;AAAA;;AACxC,MAAK,kBAAAD,OAAO,CAACE,IAAR,gEAAcC,OAAd,CAAuB,0BAAvB,OAAwD,CAA7D,EAAiE;AAChE,WAAOC,OAAO,CAACC,OAAR,CAAiB,EAAjB,CAAP;AACA;;AAED,SAAOJ,IAAI,CAAED,OAAF,CAAX;AACA,CAND","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as resolvers from './resolvers';\nimport * as selectors from './selectors';\nimport * as actions from './actions';\nimport { STORE_NAME } from './constants';\n\n/**\n * Block editor data store configuration.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#register\n *\n * @type {Object}\n */\nconst storeConfig = {\n\treducer,\n\tselectors,\n\tresolvers,\n\tactions,\n};\n\n/**\n * Store definition for the edit widgets namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig );\nregister( store );\n\n// This package uses a few in-memory post types as wrappers for convenience.\n// This middleware prevents any network requests related to these types as they are\n// bound to fail anyway.\napiFetch.use( function ( options, next ) {\n\tif ( options.path?.indexOf( '/wp/v2/types/widget-area' ) === 0 ) {\n\t\treturn Promise.resolve( {} );\n\t}\n\n\treturn next( options );\n} );\n"]}
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
304
304
  display: flex;
305
305
  flex-direction: column;
306
306
  overflow: auto;
307
- z-index: 20;
307
+ z-index: 91;
308
308
  }
309
309
 
310
310
  .interface-interface-skeleton__secondary-sidebar,
@@ -447,6 +447,95 @@ body.is-fullscreen-mode .interface-interface-skeleton {
447
447
  max-height: 24px;
448
448
  }
449
449
 
450
+ @media (min-width: 600px) {
451
+ .interface-preferences-modal {
452
+ width: calc(100% - 32px);
453
+ height: calc(100% - 120px);
454
+ }
455
+ }
456
+ @media (min-width: 782px) {
457
+ .interface-preferences-modal {
458
+ width: 750px;
459
+ }
460
+ }
461
+ @media (min-width: 960px) {
462
+ .interface-preferences-modal {
463
+ height: 70%;
464
+ }
465
+ }
466
+ @media (max-width: 781px) {
467
+ .interface-preferences-modal .components-modal__content {
468
+ padding: 0;
469
+ }
470
+ .interface-preferences-modal .components-modal__content::before {
471
+ content: none;
472
+ }
473
+ }
474
+
475
+ .interface-preferences__tabs .components-tab-panel__tabs {
476
+ position: absolute;
477
+ top: 84px;
478
+ right: 16px;
479
+ width: 160px;
480
+ }
481
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item {
482
+ border-radius: 2px;
483
+ font-weight: 400;
484
+ }
485
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active {
486
+ background: #f0f0f0;
487
+ box-shadow: none;
488
+ font-weight: 500;
489
+ }
490
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
491
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
492
+ }
493
+ .interface-preferences__tabs .components-tab-panel__tab-content {
494
+ padding-right: 24px;
495
+ margin-right: 160px;
496
+ }
497
+
498
+ @media (max-width: 781px) {
499
+ .interface-preferences__provider {
500
+ height: 100%;
501
+ }
502
+ }
503
+ .interface-preferences-modal__section {
504
+ margin: 0 0 2.5rem 0;
505
+ }
506
+ .interface-preferences-modal__section:last-child {
507
+ margin: 0;
508
+ }
509
+
510
+ .interface-preferences-modal__section-title {
511
+ font-size: 0.9rem;
512
+ font-weight: 600;
513
+ margin-top: 0;
514
+ }
515
+
516
+ .interface-preferences-modal__section-description {
517
+ margin: -8px 0 8px 0;
518
+ font-size: 12px;
519
+ font-style: normal;
520
+ color: #757575;
521
+ }
522
+
523
+ .interface-preferences-modal__option .components-base-control .components-base-control__field {
524
+ align-items: center;
525
+ display: flex;
526
+ margin-bottom: 0;
527
+ }
528
+ .interface-preferences-modal__option .components-base-control .components-base-control__field > label {
529
+ flex-grow: 1;
530
+ padding: 0.6rem 10px 0.6rem 0;
531
+ }
532
+ .interface-preferences-modal__option .components-base-control__help {
533
+ margin: -8px 58px 8px 0;
534
+ font-size: 12px;
535
+ font-style: normal;
536
+ color: #757575;
537
+ }
538
+
450
539
  .wp-block[data-type="core/widget-area"] {
451
540
  max-width: 700px;
452
541
  margin-right: auto;
@@ -644,39 +733,6 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
644
733
  margin: 0 0.2rem 0 0;
645
734
  }
646
735
 
647
- .edit-widgets-more-menu {
648
- margin-right: -4px;
649
- }
650
- .edit-widgets-more-menu .components-button {
651
- width: auto;
652
- padding: 0 2px;
653
- }
654
- @media (min-width: 600px) {
655
- .edit-widgets-more-menu {
656
- margin-right: 0;
657
- }
658
- .edit-widgets-more-menu .components-button {
659
- padding: 0 4px;
660
- }
661
- }
662
-
663
- .edit-widgets-more-menu__content .components-popover__content {
664
- min-width: 280px;
665
- }
666
- @media (min-width: 480px) {
667
- .edit-widgets-more-menu__content .components-popover__content {
668
- width: auto;
669
- max-width: 480px;
670
- }
671
- }
672
- .edit-widgets-more-menu__content .components-popover__content .components-dropdown-menu__menu {
673
- padding: 0;
674
- }
675
-
676
- .components-popover.edit-widgets-more-menu__content {
677
- z-index: 99998;
678
- }
679
-
680
736
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
681
737
  justify-content: flex-start;
682
738
  padding-right: 0;
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
304
304
  display: flex;
305
305
  flex-direction: column;
306
306
  overflow: auto;
307
- z-index: 20;
307
+ z-index: 91;
308
308
  }
309
309
 
310
310
  .interface-interface-skeleton__secondary-sidebar,
@@ -447,6 +447,95 @@ body.is-fullscreen-mode .interface-interface-skeleton {
447
447
  max-height: 24px;
448
448
  }
449
449
 
450
+ @media (min-width: 600px) {
451
+ .interface-preferences-modal {
452
+ width: calc(100% - 32px);
453
+ height: calc(100% - 120px);
454
+ }
455
+ }
456
+ @media (min-width: 782px) {
457
+ .interface-preferences-modal {
458
+ width: 750px;
459
+ }
460
+ }
461
+ @media (min-width: 960px) {
462
+ .interface-preferences-modal {
463
+ height: 70%;
464
+ }
465
+ }
466
+ @media (max-width: 781px) {
467
+ .interface-preferences-modal .components-modal__content {
468
+ padding: 0;
469
+ }
470
+ .interface-preferences-modal .components-modal__content::before {
471
+ content: none;
472
+ }
473
+ }
474
+
475
+ .interface-preferences__tabs .components-tab-panel__tabs {
476
+ position: absolute;
477
+ top: 84px;
478
+ left: 16px;
479
+ width: 160px;
480
+ }
481
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item {
482
+ border-radius: 2px;
483
+ font-weight: 400;
484
+ }
485
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item.is-active {
486
+ background: #f0f0f0;
487
+ box-shadow: none;
488
+ font-weight: 500;
489
+ }
490
+ .interface-preferences__tabs .components-tab-panel__tabs .components-tab-panel__tabs-item:focus:not(:disabled) {
491
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
492
+ }
493
+ .interface-preferences__tabs .components-tab-panel__tab-content {
494
+ padding-left: 24px;
495
+ margin-left: 160px;
496
+ }
497
+
498
+ @media (max-width: 781px) {
499
+ .interface-preferences__provider {
500
+ height: 100%;
501
+ }
502
+ }
503
+ .interface-preferences-modal__section {
504
+ margin: 0 0 2.5rem 0;
505
+ }
506
+ .interface-preferences-modal__section:last-child {
507
+ margin: 0;
508
+ }
509
+
510
+ .interface-preferences-modal__section-title {
511
+ font-size: 0.9rem;
512
+ font-weight: 600;
513
+ margin-top: 0;
514
+ }
515
+
516
+ .interface-preferences-modal__section-description {
517
+ margin: -8px 0 8px 0;
518
+ font-size: 12px;
519
+ font-style: normal;
520
+ color: #757575;
521
+ }
522
+
523
+ .interface-preferences-modal__option .components-base-control .components-base-control__field {
524
+ align-items: center;
525
+ display: flex;
526
+ margin-bottom: 0;
527
+ }
528
+ .interface-preferences-modal__option .components-base-control .components-base-control__field > label {
529
+ flex-grow: 1;
530
+ padding: 0.6rem 0 0.6rem 10px;
531
+ }
532
+ .interface-preferences-modal__option .components-base-control__help {
533
+ margin: -8px 0 8px 58px;
534
+ font-size: 12px;
535
+ font-style: normal;
536
+ color: #757575;
537
+ }
538
+
450
539
  .wp-block[data-type="core/widget-area"] {
451
540
  max-width: 700px;
452
541
  margin-left: auto;
@@ -644,39 +733,6 @@ body.is-dragging-components-draggable .wp-block[data-type="core/widget-area"] .c
644
733
  margin: 0 0 0 0.2rem;
645
734
  }
646
735
 
647
- .edit-widgets-more-menu {
648
- margin-left: -4px;
649
- }
650
- .edit-widgets-more-menu .components-button {
651
- width: auto;
652
- padding: 0 2px;
653
- }
654
- @media (min-width: 600px) {
655
- .edit-widgets-more-menu {
656
- margin-left: 0;
657
- }
658
- .edit-widgets-more-menu .components-button {
659
- padding: 0 4px;
660
- }
661
- }
662
-
663
- .edit-widgets-more-menu__content .components-popover__content {
664
- min-width: 280px;
665
- }
666
- @media (min-width: 480px) {
667
- .edit-widgets-more-menu__content .components-popover__content {
668
- width: auto;
669
- max-width: 480px;
670
- }
671
- }
672
- .edit-widgets-more-menu__content .components-popover__content .components-dropdown-menu__menu {
673
- padding: 0;
674
- }
675
-
676
- .components-popover.edit-widgets-more-menu__content {
677
- z-index: 99998;
678
- }
679
-
680
736
  .components-panel__header.edit-widgets-sidebar__panel-tabs {
681
737
  justify-content: flex-start;
682
738
  padding-left: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-widgets",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Widgets Page module for WordPress..",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,38 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/api-fetch": "^6.0.1",
31
- "@wordpress/block-editor": "^8.2.0",
32
- "@wordpress/block-library": "^7.0.2",
33
- "@wordpress/blocks": "^11.2.2",
34
- "@wordpress/components": "^19.5.0",
35
- "@wordpress/compose": "^5.1.2",
36
- "@wordpress/core-data": "^4.1.2",
37
- "@wordpress/data": "^6.3.0",
38
- "@wordpress/dom": "^3.3.2",
39
- "@wordpress/element": "^4.1.1",
40
- "@wordpress/hooks": "^3.3.1",
41
- "@wordpress/i18n": "^4.3.1",
42
- "@wordpress/icons": "^7.0.1",
43
- "@wordpress/interface": "^4.2.3",
44
- "@wordpress/keyboard-shortcuts": "^3.1.2",
45
- "@wordpress/keycodes": "^3.3.1",
46
- "@wordpress/media-utils": "^3.1.1",
47
- "@wordpress/notices": "^3.3.2",
48
- "@wordpress/plugins": "^4.1.3",
49
- "@wordpress/reusable-blocks": "^3.1.3",
50
- "@wordpress/url": "^3.4.1",
51
- "@wordpress/widgets": "^2.1.3",
30
+ "@wordpress/api-fetch": "^6.1.0",
31
+ "@wordpress/block-editor": "^8.3.0",
32
+ "@wordpress/block-library": "^7.1.0",
33
+ "@wordpress/blocks": "^11.3.0",
34
+ "@wordpress/components": "^19.6.0",
35
+ "@wordpress/compose": "^5.2.0",
36
+ "@wordpress/core-data": "^4.2.0",
37
+ "@wordpress/data": "^6.4.0",
38
+ "@wordpress/dom": "^3.4.0",
39
+ "@wordpress/element": "^4.2.0",
40
+ "@wordpress/hooks": "^3.4.0",
41
+ "@wordpress/i18n": "^4.4.0",
42
+ "@wordpress/icons": "^8.0.0",
43
+ "@wordpress/interface": "^4.3.0",
44
+ "@wordpress/keyboard-shortcuts": "^3.2.0",
45
+ "@wordpress/keycodes": "^3.4.0",
46
+ "@wordpress/media-utils": "^3.2.0",
47
+ "@wordpress/notices": "^3.4.0",
48
+ "@wordpress/plugins": "^4.2.0",
49
+ "@wordpress/preferences": "^1.0.0-prerelease",
50
+ "@wordpress/reusable-blocks": "^3.2.0",
51
+ "@wordpress/url": "^3.5.0",
52
+ "@wordpress/widgets": "^2.2.0",
52
53
  "classnames": "^2.3.1",
53
54
  "lodash": "^4.17.21"
54
55
  },
56
+ "peerDependencies": {
57
+ "react": "^17.0.0",
58
+ "react-dom": "^17.0.0"
59
+ },
55
60
  "publishConfig": {
56
61
  "access": "public"
57
62
  },
58
- "gitHead": "4566ac290359553d04de4eb574545309343f790b"
63
+ "gitHead": "c37fd7edbc3e379540d7b24fce75a6f640a434ae"
59
64
  }