@wordpress/edit-widgets 5.11.0 → 5.12.1

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 (138) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/blocks/widget-area/edit/index.js +24 -29
  3. package/build/blocks/widget-area/edit/index.js.map +1 -1
  4. package/build/blocks/widget-area/edit/inner-blocks.js +5 -5
  5. package/build/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  6. package/build/blocks/widget-area/index.js +3 -6
  7. package/build/blocks/widget-area/index.js.map +1 -1
  8. package/build/components/error-boundary/index.js +8 -10
  9. package/build/components/error-boundary/index.js.map +1 -1
  10. package/build/components/header/index.js +2 -2
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  13. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  14. package/build/components/keyboard-shortcut-help-modal/index.js +42 -50
  15. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  16. package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  17. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  18. package/build/components/keyboard-shortcuts/index.js +4 -4
  19. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  20. package/build/components/layout/index.js +3 -4
  21. package/build/components/layout/index.js.map +1 -1
  22. package/build/components/layout/interface.js +3 -4
  23. package/build/components/layout/interface.js.map +1 -1
  24. package/build/components/layout/unsaved-changes-warning.js +1 -1
  25. package/build/components/layout/unsaved-changes-warning.js.map +1 -1
  26. package/build/components/more-menu/tools-more-menu-group.js +5 -8
  27. package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
  28. package/build/components/notices/index.js +11 -20
  29. package/build/components/notices/index.js.map +1 -1
  30. package/build/components/save-button/index.js +1 -3
  31. package/build/components/save-button/index.js.map +1 -1
  32. package/build/components/secondary-sidebar/inserter-sidebar.js +4 -6
  33. package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  34. package/build/components/secondary-sidebar/list-view-sidebar.js +8 -3
  35. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  36. package/build/components/sidebar/index.js +7 -8
  37. package/build/components/sidebar/index.js.map +1 -1
  38. package/build/components/sidebar/widget-areas.js +5 -6
  39. package/build/components/sidebar/widget-areas.js.map +1 -1
  40. package/build/components/welcome-guide/index.js +6 -7
  41. package/build/components/welcome-guide/index.js.map +1 -1
  42. package/build/components/widget-areas-block-editor-content/index.js +3 -4
  43. package/build/components/widget-areas-block-editor-content/index.js.map +1 -1
  44. package/build/components/widget-areas-block-editor-provider/index.js +18 -24
  45. package/build/components/widget-areas-block-editor-provider/index.js.map +1 -1
  46. package/build/filters/move-to-widget-area.js +4 -5
  47. package/build/filters/move-to-widget-area.js.map +1 -1
  48. package/build/hooks/use-last-selected-widget-area.js +2 -4
  49. package/build/hooks/use-last-selected-widget-area.js.map +1 -1
  50. package/build/hooks/use-widget-library-insertion-point.js +1 -3
  51. package/build/hooks/use-widget-library-insertion-point.js.map +1 -1
  52. package/build/{private-apis.js → lock-unlock.js} +1 -1
  53. package/build/lock-unlock.js.map +1 -0
  54. package/build/store/actions.js +49 -74
  55. package/build/store/actions.js.map +1 -1
  56. package/build/store/index.js +1 -3
  57. package/build/store/index.js.map +1 -1
  58. package/build/store/reducer.js +3 -11
  59. package/build/store/reducer.js.map +1 -1
  60. package/build/store/resolvers.js +8 -10
  61. package/build/store/resolvers.js.map +1 -1
  62. package/build/store/selectors.js +15 -32
  63. package/build/store/selectors.js.map +1 -1
  64. package/build/store/transformers.js +1 -2
  65. package/build/store/transformers.js.map +1 -1
  66. package/build-module/blocks/widget-area/edit/index.js +24 -29
  67. package/build-module/blocks/widget-area/edit/index.js.map +1 -1
  68. package/build-module/blocks/widget-area/edit/inner-blocks.js +5 -5
  69. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +1 -1
  70. package/build-module/blocks/widget-area/index.js +3 -6
  71. package/build-module/blocks/widget-area/index.js.map +1 -1
  72. package/build-module/components/error-boundary/index.js +8 -10
  73. package/build-module/components/error-boundary/index.js.map +1 -1
  74. package/build-module/components/header/index.js +1 -1
  75. package/build-module/components/header/index.js.map +1 -1
  76. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
  77. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  78. package/build-module/components/keyboard-shortcut-help-modal/index.js +40 -48
  79. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  80. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
  81. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  82. package/build-module/components/keyboard-shortcuts/index.js +4 -4
  83. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  84. package/build-module/components/layout/index.js +3 -4
  85. package/build-module/components/layout/index.js.map +1 -1
  86. package/build-module/components/layout/interface.js +3 -4
  87. package/build-module/components/layout/interface.js.map +1 -1
  88. package/build-module/components/layout/unsaved-changes-warning.js +1 -1
  89. package/build-module/components/layout/unsaved-changes-warning.js.map +1 -1
  90. package/build-module/components/more-menu/tools-more-menu-group.js +5 -8
  91. package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
  92. package/build-module/components/notices/index.js +11 -20
  93. package/build-module/components/notices/index.js.map +1 -1
  94. package/build-module/components/save-button/index.js +1 -3
  95. package/build-module/components/save-button/index.js.map +1 -1
  96. package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
  97. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
  98. package/build-module/components/secondary-sidebar/list-view-sidebar.js +9 -3
  99. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  100. package/build-module/components/sidebar/index.js +9 -10
  101. package/build-module/components/sidebar/index.js.map +1 -1
  102. package/build-module/components/sidebar/widget-areas.js +5 -6
  103. package/build-module/components/sidebar/widget-areas.js.map +1 -1
  104. package/build-module/components/welcome-guide/index.js +6 -7
  105. package/build-module/components/welcome-guide/index.js.map +1 -1
  106. package/build-module/components/widget-areas-block-editor-content/index.js +3 -4
  107. package/build-module/components/widget-areas-block-editor-content/index.js.map +1 -1
  108. package/build-module/components/widget-areas-block-editor-provider/index.js +17 -22
  109. package/build-module/components/widget-areas-block-editor-provider/index.js.map +1 -1
  110. package/build-module/filters/move-to-widget-area.js +4 -5
  111. package/build-module/filters/move-to-widget-area.js.map +1 -1
  112. package/build-module/hooks/use-last-selected-widget-area.js +2 -4
  113. package/build-module/hooks/use-last-selected-widget-area.js.map +1 -1
  114. package/build-module/hooks/use-widget-library-insertion-point.js +1 -3
  115. package/build-module/hooks/use-widget-library-insertion-point.js.map +1 -1
  116. package/build-module/{private-apis.js → lock-unlock.js} +1 -1
  117. package/build-module/lock-unlock.js.map +1 -0
  118. package/build-module/store/actions.js +49 -74
  119. package/build-module/store/actions.js.map +1 -1
  120. package/build-module/store/index.js +1 -3
  121. package/build-module/store/index.js.map +1 -1
  122. package/build-module/store/reducer.js +3 -11
  123. package/build-module/store/reducer.js.map +1 -1
  124. package/build-module/store/resolvers.js +8 -10
  125. package/build-module/store/resolvers.js.map +1 -1
  126. package/build-module/store/selectors.js +15 -32
  127. package/build-module/store/selectors.js.map +1 -1
  128. package/build-module/store/transformers.js +1 -2
  129. package/build-module/store/transformers.js.map +1 -1
  130. package/package.json +27 -27
  131. package/src/components/header/index.js +1 -1
  132. package/src/components/keyboard-shortcuts/index.js +4 -4
  133. package/src/components/secondary-sidebar/list-view-sidebar.js +8 -1
  134. package/src/components/sidebar/index.js +3 -3
  135. package/src/components/widget-areas-block-editor-provider/index.js +1 -1
  136. package/build/private-apis.js.map +0 -1
  137. package/build-module/private-apis.js.map +0 -1
  138. /package/src/{private-apis.js → lock-unlock.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","isActive","select","preferencesStore","get","toggle","widgetAreas","editWidgetsStore","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","image","content","InserterIconImage","WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,YAAT,GAAwB;AAAA;;AACtC,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CACF,mBADE,EAEF,cAFE,CAFY,EAMhB,EANgB,CAAjB;AASA,QAAM;AAAEC,IAAAA;AAAF,MAAa,uBAAaF,kBAAb,CAAnB;AAEA,QAAMG,WAAW,GAAG,qBACjBJ,MAAF,IACCA,MAAM,CAAEK,YAAF,CAAN,CAA2BC,cAA3B,CAA2C;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAA3C,CAFkB,EAGnB,EAHmB,CAApB;;AAMA,MAAK,CAAER,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,QAAMS,sBAAsB,GAAGJ,WAAH,aAAGA,WAAH,uBAAGA,WAAW,CAAEK,KAAb,CAC5BC,UAAF,IACCA,UAAU,CAACC,EAAX,KAAkB,qBAAlB,IACAD,UAAU,CAACE,OAAX,CAAmBH,KAAnB,CAA4BI,QAAF,IACzBA,QAAQ,CAACC,UAAT,CAAqB,QAArB,CADD,CAH6B,CAA/B;AAQA,QAAMC,cAAc,4BACnBX,WADmB,aACnBA,WADmB,uBACnBA,WAAW,CAAEY,MAAb,CACGN,UAAF,IAAkBA,UAAU,CAACC,EAAX,KAAkB,qBADrC,EAEEM,MAHiB,yEAGP,CAHb;AAKA,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,4BADX;AAEC,IAAA,YAAY,EAAG,cAAI,0BAAJ,CAFhB;AAGC,IAAA,gBAA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,EAAC;AAAb,SACG,uCACD,cACC,+HADD,CADC,EAID;AACCC,QAAAA,iBAAiB,EAChB;AACC,UAAA,SAAS,EAAC,2CADX;AAEC,UAAA,GAAG,EAAG,cAAI,UAAJ,CAFP;AAGC,UAAA,GAAG,EAAC;AAHL;AAFF,OAJC,CADH,CAJD;AARF,KA3EO,EA0GP;AACCF,MAAAA,KAAK,EACJ,4BAAC,iBAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,qDACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACG,cAAI,mCAAJ,CADH,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8DADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,qEADM;AADR,SAKG,cAAI,0BAAJ,CALH,CAJD,CAJD;AARF,KA1GO;AALT,IADD;AA8IA;;AAED,SAASE,iBAAT,OAA8D;AAAA,MAAlC;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,GAAkC;AAC7D,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst widgetAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getWidgetAreas( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isEntirelyBlockWidgets = widgetAreas?.every(\n\t\t( widgetArea ) =>\n\t\t\twidgetArea.id === 'wp_inactive_widgets' ||\n\t\t\twidgetArea.widgets.every( ( widgetId ) =>\n\t\t\t\twidgetId.startsWith( 'block-' )\n\t\t\t)\n\t);\n\n\tconst numWidgetAreas =\n\t\twidgetAreas?.filter(\n\t\t\t( widgetArea ) => widgetArea.id !== 'wp_inactive_widgets'\n\t\t).length ?? 0;\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-widgets-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to block Widgets' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-widgets', 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t{ isEntirelyBlockWidgets ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s: Number of block areas in the current theme.\n\t\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Want to stick with the old widgets?'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Get the Classic Widgets plugin.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Make each block your own' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Get to know the block library' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tInserterIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-welcome-guide__inserter-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'inserter' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn how to use the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to the block editor? Want to learn more about using it? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n\nfunction WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-widgets-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","isActive","select","preferencesStore","get","toggle","widgetAreas","editWidgetsStore","getWidgetAreas","per_page","isEntirelyBlockWidgets","every","widgetArea","id","widgets","widgetId","startsWith","numWidgetAreas","filter","length","image","content","InserterIconImage","WelcomeGuideImage","nonAnimatedSrc","animatedSrc"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AAEA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,YAAT,GAAwB;AAAA;;AACtC,QAAMC,QAAQ,GAAG,qBACdC,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEC,kBAA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EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACG,cACD,8DADC,CADH,EAIC,4BAAC,wBAAD;AACC,QAAA,IAAI,EAAG,cACN,qEADM;AADR,SAKG,cAAI,0BAAJ,CALH,CAJD,CAJD;AARF,KA1GO;AALT,IADD;AA8IA;;AAED,SAASE,iBAAT,CAA4B;AAAEC,EAAAA,cAAF;AAAkBC,EAAAA;AAAlB,CAA5B,EAA8D;AAC7D,SACC;AAAS,IAAA,SAAS,EAAC;AAAnB,KACC;AACC,IAAA,MAAM,EAAGD,cADV;AAEC,IAAA,KAAK,EAAC;AAFP,IADD,EAKC;AAAK,IAAA,GAAG,EAAGC,WAAX;AAAyB,IAAA,KAAK,EAAC,KAA/B;AAAqC,IAAA,MAAM,EAAC,KAA5C;AAAkD,IAAA,GAAG,EAAC;AAAtD,IALD,CADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __, sprintf, _n } from '@wordpress/i18n';\nimport { createInterpolateElement } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst widgetAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editWidgetsStore ).getWidgetAreas( { per_page: -1 } ),\n\t\t[]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\tconst isEntirelyBlockWidgets = widgetAreas?.every(\n\t\t( widgetArea ) =>\n\t\t\twidgetArea.id === 'wp_inactive_widgets' ||\n\t\t\twidgetArea.widgets.every( ( widgetId ) =>\n\t\t\t\twidgetId.startsWith( 'block-' )\n\t\t\t)\n\t);\n\n\tconst numWidgetAreas =\n\t\twidgetAreas?.filter(\n\t\t\t( widgetArea ) => widgetArea.id !== 'wp_inactive_widgets'\n\t\t).length ?? 0;\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-widgets-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to block Widgets' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggle( 'core/edit-widgets', 'welcomeGuide' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-canvas.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t{ isEntirelyBlockWidgets ? (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// Translators: %s: Number of block areas in the current theme.\n\t\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\t'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.',\n\t\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tnumWidgetAreas\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t\t\t<strong>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Want to stick with the old widgets?'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Get the Classic Widgets plugin.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Make each block your own' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-library.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Get to know the block library' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tInserterIconImage: (\n\t\t\t\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"edit-widgets-welcome-guide__inserter-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\talt={ __( 'inserter' ) }\n\t\t\t\t\t\t\t\t\t\t\t\tsrc=\"data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A\"\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-widgets-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn how to use the block editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-widgets-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to the block editor? Want to learn more about using it? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n\nfunction WelcomeGuideImage( { nonAnimatedSrc, animatedSrc } ) {\n\treturn (\n\t\t<picture className=\"edit-widgets-welcome-guide__image\">\n\t\t\t<source\n\t\t\t\tsrcSet={ nonAnimatedSrc }\n\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t/>\n\t\t\t<img src={ animatedSrc } width=\"312\" height=\"240\" alt=\"\" />\n\t\t</picture>\n\t);\n}\n"]}
@@ -26,10 +26,9 @@ var _keyboardShortcuts = _interopRequireDefault(require("../keyboard-shortcuts")
26
26
  /**
27
27
  * Internal dependencies
28
28
  */
29
- function WidgetAreasBlockEditorContent(_ref) {
30
- let {
31
- blockEditorSettings
32
- } = _ref;
29
+ function WidgetAreasBlockEditorContent({
30
+ blockEditorSettings
31
+ }) {
33
32
  const hasThemeStyles = (0, _data.useSelect)(select => !!select(_preferences.store).get('core/edit-widgets', 'themeStyles'), []);
34
33
  const styles = (0, _element.useMemo)(() => {
35
34
  return hasThemeStyles ? blockEditorSettings.styles : [];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"names":["WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","preferencesStore","get","styles"],"mappings":";;;;;;;;;AAYA;;AATA;;AAQA;;AAEA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIe,SAASA,6BAAT,OAEX;AAAA,MAFmD;AACtDC,IAAAA;AADsD,GAEnD;AACH,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CACF,mBADE,EAEF,aAFE,CAFkB,EAMtB,EANsB,CAAvB;AASA,QAAMC,MAAM,GAAG,sBAAS,MAAM;AAC7B,WAAOJ,cAAc,GAAGD,mBAAmB,CAACK,MAAvB,GAAgC,EAArD;AACA,GAFc,EAEZ,CAAEL,mBAAF,EAAuBC,cAAvB,CAFY,CAAf;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD,OADD,EAEC,4BAAC,uBAAD,QACC,4BAAC,0BAAD,OADD,EAEC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGI;AAAvB,IAFD,EAGC,4BAAC,kCAAD,QACC,4BAAC,wBAAD,QACC,4BAAC,0BAAD,QACC,4BAAC,sBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,IADD,CADD,CADD,CAHD,CAFD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\tObserveTyping,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-content/index.js"],"names":["WidgetAreasBlockEditorContent","blockEditorSettings","hasThemeStyles","select","preferencesStore","get","styles"],"mappings":";;;;;;;;;AAYA;;AATA;;AAQA;;AAEA;;AAKA;;AACA;;AAnBA;AACA;AACA;;AAaA;AACA;AACA;AAIe,SAASA,6BAAT,CAAwC;AACtDC,EAAAA;AADsD,CAAxC,EAEX;AACH,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEC,kBAAF,CAAN,CAA2BC,GAA3B,CACF,mBADE,EAEF,aAFE,CAFkB,EAMtB,EANsB,CAAvB;AASA,QAAMC,MAAM,GAAG,sBAAS,MAAM;AAC7B,WAAOJ,cAAc,GAAGD,mBAAmB,CAACK,MAAvB,GAAgC,EAArD;AACA,GAFc,EAEZ,CAAEL,mBAAF,EAAuBC,cAAvB,CAFY,CAAf;AAIA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,gBAAD,OADD,EAEC,4BAAC,uBAAD,QACC,4BAAC,0BAAD,OADD,EAEC,4BAAC,mCAAD;AAAc,IAAA,MAAM,EAAGI;AAAvB,IAFD,EAGC,4BAAC,kCAAD,QACC,4BAAC,wBAAD,QACC,4BAAC,0BAAD,QACC,4BAAC,sBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,IADD,CADD,CADD,CAHD,CAFD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tBlockTools,\n\tBlockSelectionClearer,\n\tWritingFlow,\n\tObserveTyping,\n\t__unstableEditorStyles as EditorStyles,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Notices from '../notices';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\n\nexport default function WidgetAreasBlockEditorContent( {\n\tblockEditorSettings,\n} ) {\n\tconst hasThemeStyles = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get(\n\t\t\t\t'core/edit-widgets',\n\t\t\t\t'themeStyles'\n\t\t\t),\n\t\t[]\n\t);\n\n\tconst styles = useMemo( () => {\n\t\treturn hasThemeStyles ? blockEditorSettings.styles : [];\n\t}, [ blockEditorSettings, hasThemeStyles ] );\n\n\treturn (\n\t\t<div className=\"edit-widgets-block-editor\">\n\t\t\t<Notices />\n\t\t\t<BlockTools>\n\t\t\t\t<KeyboardShortcuts />\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<BlockSelectionClearer>\n\t\t\t\t\t<WritingFlow>\n\t\t\t\t\t\t<ObserveTyping>\n\t\t\t\t\t\t\t<BlockList className=\"edit-widgets-main-block-list\" />\n\t\t\t\t\t\t</ObserveTyping>\n\t\t\t\t\t</WritingFlow>\n\t\t\t\t</BlockSelectionClearer>\n\t\t\t</BlockTools>\n\t\t</div>\n\t);\n}\n"]}
@@ -9,8 +9,6 @@ exports.default = WidgetAreasBlockEditorProvider;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
12
  var _components = require("@wordpress/components");
15
13
 
16
14
  var _mediaUtils = require("@wordpress/media-utils");
@@ -37,7 +35,7 @@ var _store = require("../../store");
37
35
 
38
36
  var _constants = require("../../constants");
39
37
 
40
- var _privateApis = require("../../private-apis");
38
+ var _lockUnlock = require("../../lock-unlock");
41
39
 
42
40
  /**
43
41
  * WordPress dependencies
@@ -48,14 +46,13 @@ var _privateApis = require("../../private-apis");
48
46
  */
49
47
  const {
50
48
  ExperimentalBlockEditorProvider
51
- } = (0, _privateApis.unlock)(_blockEditor.privateApis);
49
+ } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
52
50
 
53
- function WidgetAreasBlockEditorProvider(_ref) {
54
- let {
55
- blockEditorSettings,
56
- children,
57
- ...props
58
- } = _ref;
51
+ function WidgetAreasBlockEditorProvider({
52
+ blockEditorSettings,
53
+ children,
54
+ ...props
55
+ }) {
59
56
  const mediaPermissions = (0, _coreData.useResourcePermissions)('media');
60
57
  const {
61
58
  reusableBlocks,
@@ -75,19 +72,15 @@ function WidgetAreasBlockEditorProvider(_ref) {
75
72
  let mediaUploadBlockEditor;
76
73
 
77
74
  if (mediaPermissions.canCreate) {
78
- mediaUploadBlockEditor = _ref2 => {
79
- let {
80
- onError,
81
- ...argumentsObject
82
- } = _ref2;
75
+ mediaUploadBlockEditor = ({
76
+ onError,
77
+ ...argumentsObject
78
+ }) => {
83
79
  (0, _mediaUtils.uploadMedia)({
84
80
  wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,
85
- onError: _ref3 => {
86
- let {
87
- message
88
- } = _ref3;
89
- return onError(message);
90
- },
81
+ onError: ({
82
+ message
83
+ }) => onError(message),
91
84
  ...argumentsObject
92
85
  });
93
86
  };
@@ -106,13 +99,14 @@ function WidgetAreasBlockEditorProvider(_ref) {
106
99
  const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)(_utils.KIND, _utils.POST_TYPE, {
107
100
  id: (0, _utils.buildWidgetAreasPostId)()
108
101
  });
109
- return (0, _element.createElement)(_keyboardShortcuts.ShortcutProvider, null, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_keyboardShortcuts2.default.Register, null), (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(ExperimentalBlockEditorProvider, (0, _extends2.default)({
102
+ return (0, _element.createElement)(_keyboardShortcuts.ShortcutProvider, null, (0, _element.createElement)(_blockEditor.BlockEditorKeyboardShortcuts.Register, null), (0, _element.createElement)(_keyboardShortcuts2.default.Register, null), (0, _element.createElement)(_components.SlotFillProvider, null, (0, _element.createElement)(ExperimentalBlockEditorProvider, {
110
103
  value: blocks,
111
104
  onInput: onInput,
112
105
  onChange: onChange,
113
106
  settings: settings,
114
- useSubRegistry: false
115
- }, props), (0, _element.createElement)(_blockEditor.CopyHandler, null, children), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, {
107
+ useSubRegistry: false,
108
+ ...props
109
+ }, (0, _element.createElement)(_blockEditor.CopyHandler, null, children), (0, _element.createElement)(_reusableBlocks.ReusableBlocksMenuItems, {
116
110
  rootClientId: widgetAreaId
117
111
  }))));
118
112
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/components/widget-areas-block-editor-provider/index.js"],"names":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","coreStore","getEntityRecords","preferencesStore","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","KIND","POST_TYPE","id"],"mappings":";;;;;;;;;AAWA;;;;AARA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAmBA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,yBAAQC,wBAAR,CAA5C;;AAEe,SAASC,8BAAT,OAIX;AAAA,MAJoD;AACvDC,IAAAA,mBADuD;AAEvDC,IAAAA,QAFuD;AAGvD,OAAGC;AAHoD,GAIpD;AACH,QAAMC,gBAAgB,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A,eAAe,EAAEvB,oBAHX;AAINC,MAAAA,oBAJM;AAKNuB,MAAAA,WAAW,EAAET,sBALP;AAMNU,MAAAA,YAAY,EAAE,KANR;AAONC,MAAAA,iCAAiC,EAAEb;AAP7B,KAAP;AASA,GApBgB,EAoBd,CACFlB,mBADE,EAEFK,oBAFE,EAGFC,oBAHE,EAIFH,gBAAgB,CAACkB,SAJf,EAKFjB,cALE,EAMFc,mBANE,CApBc,CAAjB;AA6BA,QAAMc,YAAY,GAAG,yCAArB;AAEA,QAAM,CAAEC,MAAF,EAAUC,OAAV,EAAmBC,QAAnB,IAAgC,oCACrCC,WADqC,EAErCC,gBAFqC,EAGrC;AAAEC,IAAAA,EAAE,EAAE;AAAN,GAHqC,CAAtC;AAMA,SACC,4BAAC,mCAAD,QACC,4BAAC,yCAAD,CAA8B,QAA9B,OADD,EAEC,4BAAC,2BAAD,CAAmB,QAAnB,OAFD,EAGC,4BAAC,4BAAD,QACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGL,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGhB,QAJZ;AAKC,IAAA,cAAc,EAAG;AALlB,KAMMjB,KANN,GAQC,4BAAC,wBAAD,QAAeD,QAAf,CARD,EASC,4BAAC,uCAAD;AAAyB,IAAA,YAAY,EAAG+B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n\tprivateApis as blockEditorPrivateApis,\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 { 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';\nimport { unlock } from '../../private-apis';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst { reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block'\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'fixedToolbar'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( mediaPermissions.canCreate ) {\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\tmediaPermissions.canCreate,\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<ExperimentalBlockEditorProvider\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</ExperimentalBlockEditorProvider>\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":["ExperimentalBlockEditorProvider","blockEditorPrivateApis","WidgetAreasBlockEditorProvider","blockEditorSettings","children","props","mediaPermissions","reusableBlocks","isFixedToolbarActive","keepCaretInsideBlock","select","widgetAreas","editWidgetsStore","getWidgetAreas","widgets","getWidgets","ALLOW_REUSABLE_BLOCKS","coreStore","getEntityRecords","preferencesStore","get","setIsInserterOpened","settings","mediaUploadBlockEditor","canCreate","onError","argumentsObject","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalReusableBlocks","hasFixedToolbar","mediaUpload","templateLock","__experimentalSetIsInserterOpened","widgetAreaId","blocks","onInput","onChange","KIND","POST_TYPE","id"],"mappings":";;;;;;;;;AAWA;;AARA;;AACA;;AACA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA7BA;AACA;AACA;;AAmBA;AACA;AACA;AAQA,MAAM;AAAEA,EAAAA;AAAF,IAAsC,wBAAQC,wBAAR,CAA5C;;AAEe,SAASC,8BAAT,CAAyC;AACvDC,EAAAA,mBADuD;AAEvDC,EAAAA,QAFuD;AAGvD,KAAGC;AAHoD,CAAzC,EAIX;AACH,QAAMC,gBAAgB,GAAG,sCAAwB,OAAxB,CAAzB;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,oBAAlB;AAAwCC,IAAAA;AAAxC,MACL,qBACGC,MAAF,KAAgB;AACfC,IAAAA,WAAW,EAAED,MAAM,CAAEE,YAAF,CAAN,CAA2BC,cAA3B,EADE;AAEfC,IAAAA,OAAO,EAAEJ,MAAM,CAAEE,YAAF,CAAN,CAA2BG,UAA3B,EAFM;AAGfR,IAAAA,cAAc,EAAES,mCACbN,MAAM,CAAEO,eAAF,CAAN,CAAoBC,gBAApB,CACA,UADA,EAEA,UAFA,CADa,GAKb,EARY;AASfV,IAAAA,oBAAoB,EAAE,CAAC,CAAEE,MAAM,CAAES,kBAAF,CAAN,CAA2BC,GAA3B,CACxB,mBADwB,EAExB,cAFwB,CATV;AAafX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D,CAAmB,QAAnB,OAFD,EAGC,4BAAC,4BAAD,QACC,4BAAC,+BAAD;AACC,IAAA,KAAK,EAAGL,MADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ,EAAGhB,QAJZ;AAKC,IAAA,cAAc,EAAG,KALlB;AAAA,OAMMjB;AANN,KAQC,4BAAC,wBAAD,QAAeD,QAAf,CARD,EASC,4BAAC,uCAAD;AAAyB,IAAA,YAAY,EAAG+B;AAAxC,IATD,CADD,CAHD,CADD;AAmBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tBlockEditorKeyboardShortcuts,\n\tCopyHandler,\n\tprivateApis as blockEditorPrivateApis,\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 { 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';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function WidgetAreasBlockEditorProvider( {\n\tblockEditorSettings,\n\tchildren,\n\t...props\n} ) {\n\tconst mediaPermissions = useResourcePermissions( 'media' );\n\tconst { reusableBlocks, isFixedToolbarActive, keepCaretInsideBlock } =\n\t\tuseSelect(\n\t\t\t( select ) => ( {\n\t\t\t\twidgetAreas: select( editWidgetsStore ).getWidgetAreas(),\n\t\t\t\twidgets: select( editWidgetsStore ).getWidgets(),\n\t\t\t\treusableBlocks: ALLOW_REUSABLE_BLOCKS\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block'\n\t\t\t\t\t )\n\t\t\t\t\t: [],\n\t\t\t\tisFixedToolbarActive: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'fixedToolbar'\n\t\t\t\t),\n\t\t\t\tkeepCaretInsideBlock: !! select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-widgets',\n\t\t\t\t\t'keepCaretInsideBlock'\n\t\t\t\t),\n\t\t\t} ),\n\t\t\t[]\n\t\t);\n\tconst { setIsInserterOpened } = useDispatch( editWidgetsStore );\n\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( mediaPermissions.canCreate ) {\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\tmediaPermissions.canCreate,\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<ExperimentalBlockEditorProvider\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</ExperimentalBlockEditorProvider>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -31,8 +31,6 @@ const withMoveToWidgetAreaToolbarItem = (0, _compose.createHigherOrderComponent)
31
31
  currentWidgetAreaId,
32
32
  canInsertBlockInWidgetArea
33
33
  } = (0, _data.useSelect)(select => {
34
- var _widgetAreaBlock$attr;
35
-
36
34
  // Component won't display for a widget area, so don't run selectors.
37
35
  if (blockName === 'core/widget-area') {
38
36
  return {};
@@ -42,16 +40,17 @@ const withMoveToWidgetAreaToolbarItem = (0, _compose.createHigherOrderComponent)
42
40
  const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId);
43
41
  return {
44
42
  widgetAreas: selectors.getWidgetAreas(),
45
- currentWidgetAreaId: widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : (_widgetAreaBlock$attr = widgetAreaBlock.attributes) === null || _widgetAreaBlock$attr === void 0 ? void 0 : _widgetAreaBlock$attr.id,
43
+ currentWidgetAreaId: widgetAreaBlock?.attributes?.id,
46
44
  canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName)
47
45
  };
48
46
  }, [clientId, blockName]);
49
47
  const {
50
48
  moveBlockToWidgetArea
51
49
  } = (0, _data.useDispatch)(_store.store);
52
- const hasMultipleWidgetAreas = (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) > 1;
50
+ const hasMultipleWidgetAreas = widgetAreas?.length > 1;
53
51
  const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea;
54
- return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, props), isMoveToWidgetAreaVisible && (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_widgets.MoveToWidgetArea, {
52
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockEdit, { ...props
53
+ }), isMoveToWidgetAreaVisible && (0, _element.createElement)(_blockEditor.BlockControls, null, (0, _element.createElement)(_widgets.MoveToWidgetArea, {
55
54
  widgetAreas: widgetAreas,
56
55
  currentWidgetAreaId: currentWidgetAreaId,
57
56
  onSelect: widgetAreaId => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"names":["withMoveToWidgetAreaToolbarItem","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","select","selectors","editWidgetsStore","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","widgetAreaId"],"mappings":";;;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,+BAA+B,GAAG,yCACrCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAI,EAAEC;AAAlB,MAAgCH,KAAtC;AACA,QAAM;AAAEI,IAAAA,WAAF;AAAeC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port { BlockControls } from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\n\nconst withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name: blockName } = props;\n\t\tconst { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// Component won't display for a widget area, so don't run selectors.\n\t\t\t\t\tif ( blockName === 'core/widget-area' ) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst selectors = select( editWidgetsStore );\n\n\t\t\t\t\tconst widgetAreaBlock =\n\t\t\t\t\t\tselectors.getParentWidgetAreaBlock( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidgetAreas: selectors.getWidgetAreas(),\n\t\t\t\t\t\tcurrentWidgetAreaId: widgetAreaBlock?.attributes?.id,\n\t\t\t\t\t\tcanInsertBlockInWidgetArea:\n\t\t\t\t\t\t\tselectors.canInsertBlockInWidgetArea( blockName ),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ clientId, blockName ]\n\t\t\t);\n\n\t\tconst { moveBlockToWidgetArea } = useDispatch( editWidgetsStore );\n\t\tconst hasMultipleWidgetAreas = widgetAreas?.length > 1;\n\t\tconst isMoveToWidgetAreaVisible =\n\t\t\tblockName !== 'core/widget-area' &&\n\t\t\thasMultipleWidgetAreas &&\n\t\t\tcanInsertBlockInWidgetArea;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isMoveToWidgetAreaVisible && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ widgetAreas }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ currentWidgetAreaId }\n\t\t\t\t\t\t\tonSelect={ ( widgetAreaId ) => {\n\t\t\t\t\t\t\t\tmoveBlockToWidgetArea(\n\t\t\t\t\t\t\t\t\tprops.clientId,\n\t\t\t\t\t\t\t\t\twidgetAreaId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToWidgetAreaToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-widgets/block-edit',\n\twithMoveToWidgetAreaToolbarItem\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"names":["withMoveToWidgetAreaToolbarItem","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","select","selectors","editWidgetsStore","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","widgetAreaId"],"mappings":";;;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAbA;AACA;AACA;;AAQA;AACA;AACA;AAGA,MAAMA,+BAA+B,GAAG,yCACrCC,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,IAAI,EAAEC;AAAlB,MAAgCH,KAAtC;AACA,QAAM;AAAEI,IAAAA,WAAF;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MACL,qBACGC,MAAF,IAAc;AACb;AACA,QAAKJ,SAAS,KAAK,kBAAnB,EAAwC;AACvC,aAAO,EAAP;AACA;;AAED,UAAMK,SAAS,GAAGD,MAAM,CAAEE,YAAF,CAAxB;AAEA,UAAMC,eAAe,GACpBF,SAAS,CAACG,wBAAV,CAAoCV,QAApC,CADD;AAGA,WAAO;AACNG,MAAAA,WAAW,EAAEI,SAAS,CAACI,cAAV,EADP;AAENP,MAAAA,mBAAmB,EAAEK,eAAe,EAAEG,UAAjB,EAA6BC,EAF5C;AAGNR,MAAAA,0BAA0B,EACzBE,SAAS,CAACF,0BAAV,CAAsCH,SAAtC;AAJK,KAAP;AAMA,GAlBF,EAmBC,CAAEF,QAAF,EAAYE,SAAZ,CAnBD,CADD;AAuBA,QAAM;AAAEY,IAAAA;AAAF,MAA4B,uBAAaN,YAAb,CAAlC;AACA,QAAMO,sBAAsB,GAAGZ,WAAW,EAAEa,MAAb,GAAsB,CAArD;AACA,QAAMC,yBAAyB,GAC9Bf,SAAS,KAAK,kBAAd,IACAa,sBADA,IAEAV,0BAHD;AAKA,SACC,qDACC,4BAAC,SAAD,OAAgBN;AAAhB,IADD,EAEGkB,yBAAyB,IAC1B,4BAAC,0BAAD,QACC,4BAAC,yBAAD;AACC,IAAA,WAAW,EAAGd,WADf;AAEC,IAAA,mBAAmB,EAAGC,mBAFvB;AAGC,IAAA,QAAQ,EAAKc,YAAF,IAAoB;AAC9BJ,MAAAA,qBAAqB,CACpBf,KAAK,CAACC,QADc,EAEpBkB,YAFoB,CAArB;AAIA;AARF,IADD,CAHF,CADD;AAmBA,CApDsC,EAqDvC,iCArDuC,CAAxC;AAwDA,sBACC,kBADD,EAEC,8BAFD,EAGCrB,+BAHD","sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { BlockControls } from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\n\nconst withMoveToWidgetAreaToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name: blockName } = props;\n\t\tconst { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea } =\n\t\t\tuseSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\t// Component won't display for a widget area, so don't run selectors.\n\t\t\t\t\tif ( blockName === 'core/widget-area' ) {\n\t\t\t\t\t\treturn {};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst selectors = select( editWidgetsStore );\n\n\t\t\t\t\tconst widgetAreaBlock =\n\t\t\t\t\t\tselectors.getParentWidgetAreaBlock( clientId );\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\twidgetAreas: selectors.getWidgetAreas(),\n\t\t\t\t\t\tcurrentWidgetAreaId: widgetAreaBlock?.attributes?.id,\n\t\t\t\t\t\tcanInsertBlockInWidgetArea:\n\t\t\t\t\t\t\tselectors.canInsertBlockInWidgetArea( blockName ),\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[ clientId, blockName ]\n\t\t\t);\n\n\t\tconst { moveBlockToWidgetArea } = useDispatch( editWidgetsStore );\n\t\tconst hasMultipleWidgetAreas = widgetAreas?.length > 1;\n\t\tconst isMoveToWidgetAreaVisible =\n\t\t\tblockName !== 'core/widget-area' &&\n\t\t\thasMultipleWidgetAreas &&\n\t\t\tcanInsertBlockInWidgetArea;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isMoveToWidgetAreaVisible && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ widgetAreas }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ currentWidgetAreaId }\n\t\t\t\t\t\t\tonSelect={ ( widgetAreaId ) => {\n\t\t\t\t\t\t\t\tmoveBlockToWidgetArea(\n\t\t\t\t\t\t\t\t\tprops.clientId,\n\t\t\t\t\t\t\t\t\twidgetAreaId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToWidgetAreaToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-widgets/block-edit',\n\twithMoveToWidgetAreaToolbarItem\n);\n"]}
@@ -30,8 +30,6 @@ var _utils = require("../store/utils");
30
30
  * @return {string} clientId of the widget area last selected.
31
31
  */
32
32
  const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
33
- var _widgetAreasPost$bloc;
34
-
35
33
  const {
36
34
  getBlockSelectionEnd,
37
35
  getBlockName
@@ -46,7 +44,7 @@ const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
46
44
  getParentWidgetAreaBlock
47
45
  } = select(_store.store);
48
46
  const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
49
- const widgetAreaBlockClientId = widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : widgetAreaBlock.clientId;
47
+ const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
50
48
 
51
49
  if (widgetAreaBlockClientId) {
52
50
  return widgetAreaBlockClientId;
@@ -58,7 +56,7 @@ const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
58
56
  getEntityRecord
59
57
  } = select(_coreData.store);
60
58
  const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
61
- return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId;
59
+ return widgetAreasPost?.blocks[0]?.clientId;
62
60
  }, []);
63
61
 
64
62
  var _default = useLastSelectedWidgetArea;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"names":["useLastSelectedWidgetArea","select","getBlockSelectionEnd","getBlockName","blockEditorStore","selectionEndClientId","getParentWidgetAreaBlock","widgetsEditorStore","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,yBAAyB,GAAG,MACjC,qBAAaC,MAAF,IAAc;AAAA;;AACxB,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACLF,MAAM,CAAEG,kBAAF,CADP;AAEA,QAAMC,oBAAoB,GAAGH,oBAAoB,EAAjD,CAHwB,CAKxB;;AACA,MAAKC,YAAY,CAAEE,oBAAF,CAAZ,KAAyC,kBAA9C,EAAmE;AAClE,WAAOA,oBAAP;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAA+BL,MAAM,CAAEM,YAAF,CAA3C;AACA,QAAMC,eAAe,GACpBF,wBAAwB,CAAED,oBAAF,CADzB;AAEA,QAAMI,uBAAuB,GAAGD,eAAH,aAAGA,eAAH,uBAAGA,eAAe,CAAEE,QAAjD;;AAEA,MAAKD,uBAAL,EAA+B;AAC9B,WAAOA,uBAAP;AACA,GAjBuB,CAmBxB;AACA;;;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAsBV,MAAM,CAAEW,eAAF,CAAlC;AACA,QAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,SAAOF,eAAP,aAAOA,eAAP,gDAAOA,eAAe,CAAEG,MAAjB,CAAyB,CAAzB,CAAP,0DAAO,sBAA8BN,QAArC;AACA,CA5BD,EA4BG,EA5BH,CADD;;eA+BeV,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as widgetsEditorStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\n/**\n * A react hook that returns the client id of the last widget area to have\n * been selected, or to have a selected block within it.\n *\n * @return {string} clientId of the widget area last selected.\n */\nconst useLastSelectedWidgetArea = () =>\n\tuseSelect( ( select ) => {\n\t\tconst { getBlockSelectionEnd, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionEndClientId = getBlockSelectionEnd();\n\n\t\t// If the selected block is a widget area, return its clientId.\n\t\tif ( getBlockName( selectionEndClientId ) === 'core/widget-area' ) {\n\t\t\treturn selectionEndClientId;\n\t\t}\n\n\t\tconst { getParentWidgetAreaBlock } = select( widgetsEditorStore );\n\t\tconst widgetAreaBlock =\n\t\t\tgetParentWidgetAreaBlock( selectionEndClientId );\n\t\tconst widgetAreaBlockClientId = widgetAreaBlock?.clientId;\n\n\t\tif ( widgetAreaBlockClientId ) {\n\t\t\treturn widgetAreaBlockClientId;\n\t\t}\n\n\t\t// If no widget area has been selected, return the clientId of the first\n\t\t// area.\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\nexport default useLastSelectedWidgetArea;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"names":["useLastSelectedWidgetArea","select","getBlockSelectionEnd","getBlockName","blockEditorStore","selectionEndClientId","getParentWidgetAreaBlock","widgetsEditorStore","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,yBAAyB,GAAG,MACjC,qBAAaC,MAAF,IAAc;AACxB,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MACLF,MAAM,CAAEG,kBAAF,CADP;AAEA,QAAMC,oBAAoB,GAAGH,oBAAoB,EAAjD,CAHwB,CAKxB;;AACA,MAAKC,YAAY,CAAEE,oBAAF,CAAZ,KAAyC,kBAA9C,EAAmE;AAClE,WAAOA,oBAAP;AACA;;AAED,QAAM;AAAEC,IAAAA;AAAF,MAA+BL,MAAM,CAAEM,YAAF,CAA3C;AACA,QAAMC,eAAe,GACpBF,wBAAwB,CAAED,oBAAF,CADzB;AAEA,QAAMI,uBAAuB,GAAGD,eAAe,EAAEE,QAAjD;;AAEA,MAAKD,uBAAL,EAA+B;AAC9B,WAAOA,uBAAP;AACA,GAjBuB,CAmBxB;AACA;;;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAsBV,MAAM,CAAEW,eAAF,CAAlC;AACA,QAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,SAAOF,eAAe,EAAEG,MAAjB,CAAyB,CAAzB,GAA8BN,QAArC;AACA,CA5BD,EA4BG,EA5BH,CADD;;eA+BeV,yB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as widgetsEditorStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\n/**\n * A react hook that returns the client id of the last widget area to have\n * been selected, or to have a selected block within it.\n *\n * @return {string} clientId of the widget area last selected.\n */\nconst useLastSelectedWidgetArea = () =>\n\tuseSelect( ( select ) => {\n\t\tconst { getBlockSelectionEnd, getBlockName } =\n\t\t\tselect( blockEditorStore );\n\t\tconst selectionEndClientId = getBlockSelectionEnd();\n\n\t\t// If the selected block is a widget area, return its clientId.\n\t\tif ( getBlockName( selectionEndClientId ) === 'core/widget-area' ) {\n\t\t\treturn selectionEndClientId;\n\t\t}\n\n\t\tconst { getParentWidgetAreaBlock } = select( widgetsEditorStore );\n\t\tconst widgetAreaBlock =\n\t\t\tgetParentWidgetAreaBlock( selectionEndClientId );\n\t\tconst widgetAreaBlockClientId = widgetAreaBlock?.clientId;\n\n\t\tif ( widgetAreaBlockClientId ) {\n\t\t\treturn widgetAreaBlockClientId;\n\t\t}\n\n\t\t// If no widget area has been selected, return the clientId of the first\n\t\t// area.\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\nexport default useLastSelectedWidgetArea;\n"]}
@@ -24,14 +24,12 @@ var _utils = require("../store/utils");
24
24
  */
25
25
  const useWidgetLibraryInsertionPoint = () => {
26
26
  const firstRootId = (0, _data.useSelect)(select => {
27
- var _widgetAreasPost$bloc;
28
-
29
27
  // Default to the first widget area
30
28
  const {
31
29
  getEntityRecord
32
30
  } = select(_coreData.store);
33
31
  const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
34
- return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId;
32
+ return widgetAreasPost?.blocks[0]?.clientId;
35
33
  }, []);
36
34
  return (0, _data.useSelect)(select => {
37
35
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"names":["useWidgetLibraryInsertionPoint","firstRootId","select","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","blockEditorStore","insertionPoint","editWidgetsStore","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,8BAA8B,GAAG,MAAM;AAC5C,QAAMC,WAAW,GAAG,qBAAaC,MAAF,IAAc;AAAA;;AAC5C;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AACA,UAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,WAAOF,eAAP,aAAOA,eAAP,gDAAOA,eAAe,CAAEG,MAAjB,CAAyB,CAAzB,CAAP,0DAAO,sBAA8BC,QAArC;AACA,GATmB,EASjB,EATiB,CAApB;AAWA,SAAO,qBACJP,MAAF,IAAc;AACb,UAAM;AACLQ,MAAAA,oBADK;AAELC,MAAAA,oBAFK;AAGLC,MAAAA,aAHK;AAILC,MAAAA;AAJK,QAKFX,MAAM,CAAEY,kBAAF,CALV;;AAOA,UAAMC,cAAc,GACnBb,MAAM,CAAEc,YAAF,CAAN,CAA2BC,+BAA3B,EADD,CARa,CAWb;AACA;;;AACA,QAAKF,cAAc,CAACG,YAApB,EAAmC;AAClC,aAAOH,cAAP;AACA;;AAED,UAAMN,QAAQ,GAAGE,oBAAoB,MAAMV,WAA3C;AACA,UAAMiB,YAAY,GAAGR,oBAAoB,CAAED,QAAF,CAAzC,CAlBa,CAoBb;AACA;AACA;;AACA,QAAKA,QAAQ,IAAIS,YAAY,KAAK,EAAlC,EAAuC;AACtC,aAAO;AACNA,QAAAA,YAAY,EAAET,QADR;AAENU,QAAAA,cAAc,EAAEP,aAAa,CAAEH,QAAF,CAAb,CAA0BW;AAFpC,OAAP;AAIA;;AAED,WAAO;AACNF,MAAAA,YADM;AAENC,MAAAA,cAAc,EAAEN,aAAa,CAAEJ,QAAF,CAAb,GAA4B;AAFtC,KAAP;AAIA,GAnCK,EAoCN,CAAER,WAAF,CApCM,CAAP;AAsCA,CAlDD;;eAoDeD,8B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\nconst useWidgetLibraryInsertionPoint = () => {\n\tconst firstRootId = useSelect( ( select ) => {\n\t\t// Default to the first widget area\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst insertionPoint =\n\t\t\t\tselect( editWidgetsStore ).__experimentalGetInsertionPoint();\n\n\t\t\t// \"Browse all\" in the quick inserter will set the rootClientId to the current block.\n\t\t\t// Otherwise, it will just be undefined, and we'll have to handle it differently below.\n\t\t\tif ( insertionPoint.rootClientId ) {\n\t\t\t\treturn insertionPoint;\n\t\t\t}\n\n\t\t\tconst clientId = getBlockSelectionEnd() || firstRootId;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t// If the selected block is at the root level, it's a widget area and\n\t\t\t// blocks can't be inserted here. Return this block as the root and the\n\t\t\t// last child clientId indicating insertion at the end.\n\t\t\tif ( clientId && rootClientId === '' ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: clientId,\n\t\t\t\t\tinsertionIndex: getBlockOrder( clientId ).length,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trootClientId,\n\t\t\t\tinsertionIndex: getBlockIndex( clientId ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ firstRootId ]\n\t);\n};\n\nexport default useWidgetLibraryInsertionPoint;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"names":["useWidgetLibraryInsertionPoint","firstRootId","select","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","blockEditorStore","insertionPoint","editWidgetsStore","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIA,MAAMA,8BAA8B,GAAG,MAAM;AAC5C,QAAMC,WAAW,GAAG,qBAAaC,MAAF,IAAc;AAC5C;AACA,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEE,eAAF,CAAlC;AACA,UAAMC,eAAe,GAAGF,eAAe,CACtCG,WADsC,EAEtCC,gBAFsC,EAGtC,oCAHsC,CAAvC;AAKA,WAAOF,eAAe,EAAEG,MAAjB,CAAyB,CAAzB,GAA8BC,QAArC;AACA,GATmB,EASjB,EATiB,CAApB;AAWA,SAAO,qBACJP,MAAF,IAAc;AACb,UAAM;AACLQ,MAAAA,oBADK;AAELC,MAAAA,oBAFK;AAGLC,MAAAA,aAHK;AAILC,MAAAA;AAJK,QAKFX,MAAM,CAAEY,kBAAF,CALV;;AAOA,UAAMC,cAAc,GACnBb,MAAM,CAAEc,YAAF,CAAN,CAA2BC,+BAA3B,EADD,CARa,CAWb;AACA;;;AACA,QAAKF,cAAc,CAACG,YAApB,EAAmC;AAClC,aAAOH,cAAP;AACA;;AAED,UAAMN,QAAQ,GAAGE,oBAAoB,MAAMV,WAA3C;AACA,UAAMiB,YAAY,GAAGR,oBAAoB,CAAED,QAAF,CAAzC,CAlBa,CAoBb;AACA;AACA;;AACA,QAAKA,QAAQ,IAAIS,YAAY,KAAK,EAAlC,EAAuC;AACtC,aAAO;AACNA,QAAAA,YAAY,EAAET,QADR;AAENU,QAAAA,cAAc,EAAEP,aAAa,CAAEH,QAAF,CAAb,CAA0BW;AAFpC,OAAP;AAIA;;AAED,WAAO;AACNF,MAAAA,YADM;AAENC,MAAAA,cAAc,EAAEN,aAAa,CAAEJ,QAAF,CAAb,GAA4B;AAFtC,KAAP;AAIA,GAnCK,EAoCN,CAAER,WAAF,CApCM,CAAP;AAsCA,CAlDD;;eAoDeD,8B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editWidgetsStore } from '../store';\nimport { buildWidgetAreasPostId, KIND, POST_TYPE } from '../store/utils';\n\nconst useWidgetLibraryInsertionPoint = () => {\n\tconst firstRootId = useSelect( ( select ) => {\n\t\t// Default to the first widget area\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst widgetAreasPost = getEntityRecord(\n\t\t\tKIND,\n\t\t\tPOST_TYPE,\n\t\t\tbuildWidgetAreasPostId()\n\t\t);\n\t\treturn widgetAreasPost?.blocks[ 0 ]?.clientId;\n\t}, [] );\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockSelectionEnd,\n\t\t\t\tgetBlockOrder,\n\t\t\t\tgetBlockIndex,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst insertionPoint =\n\t\t\t\tselect( editWidgetsStore ).__experimentalGetInsertionPoint();\n\n\t\t\t// \"Browse all\" in the quick inserter will set the rootClientId to the current block.\n\t\t\t// Otherwise, it will just be undefined, and we'll have to handle it differently below.\n\t\t\tif ( insertionPoint.rootClientId ) {\n\t\t\t\treturn insertionPoint;\n\t\t\t}\n\n\t\t\tconst clientId = getBlockSelectionEnd() || firstRootId;\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\t// If the selected block is at the root level, it's a widget area and\n\t\t\t// blocks can't be inserted here. Return this block as the root and the\n\t\t\t// last child clientId indicating insertion at the end.\n\t\t\tif ( clientId && rootClientId === '' ) {\n\t\t\t\treturn {\n\t\t\t\t\trootClientId: clientId,\n\t\t\t\t\tinsertionIndex: getBlockOrder( clientId ).length,\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\trootClientId,\n\t\t\t\tinsertionIndex: getBlockIndex( clientId ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ firstRootId ]\n\t);\n};\n\nexport default useWidgetLibraryInsertionPoint;\n"]}
@@ -16,4 +16,4 @@ const {
16
16
  } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/edit-widgets');
17
17
  exports.unlock = unlock;
18
18
  exports.lock = lock;
19
- //# sourceMappingURL=private-apis.js.map
19
+ //# sourceMappingURL=lock-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-widgets/src/lock-unlock.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,yBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-widgets'\n\t);\n"]}
@@ -44,10 +44,9 @@ var _constants = require("./constants");
44
44
  * @param {Array} blocks Blocks the post should consist of.
45
45
  * @return {Object} The post object.
46
46
  */
47
- const persistStubPost = (id, blocks) => _ref => {
48
- let {
49
- registry
50
- } = _ref;
47
+ const persistStubPost = (id, blocks) => ({
48
+ registry
49
+ }) => {
51
50
  const stubPost = (0, _utils.createStubPost)(id, blocks);
52
51
  registry.dispatch(_coreData.store).receiveEntityRecords(_utils.KIND, _utils.POST_TYPE, stubPost, {
53
52
  id: stubPost.id
@@ -66,15 +65,14 @@ const persistStubPost = (id, blocks) => _ref => {
66
65
 
67
66
  exports.persistStubPost = persistStubPost;
68
67
 
69
- const saveEditedWidgetAreas = () => async _ref2 => {
70
- let {
71
- select,
72
- dispatch,
73
- registry
74
- } = _ref2;
68
+ const saveEditedWidgetAreas = () => async ({
69
+ select,
70
+ dispatch,
71
+ registry
72
+ }) => {
75
73
  const editedWidgetAreas = select.getEditedWidgetAreas();
76
74
 
77
- if (!(editedWidgetAreas !== null && editedWidgetAreas !== void 0 && editedWidgetAreas.length)) {
75
+ if (!editedWidgetAreas?.length) {
78
76
  return;
79
77
  }
80
78
 
@@ -102,12 +100,10 @@ const saveEditedWidgetAreas = () => async _ref2 => {
102
100
 
103
101
  exports.saveEditedWidgetAreas = saveEditedWidgetAreas;
104
102
 
105
- const saveWidgetAreas = widgetAreas => async _ref3 => {
106
- let {
107
- dispatch,
108
- registry
109
- } = _ref3;
110
-
103
+ const saveWidgetAreas = widgetAreas => async ({
104
+ dispatch,
105
+ registry
106
+ }) => {
111
107
  try {
112
108
  for (const widgetArea of widgetAreas) {
113
109
  await dispatch.saveWidgetArea(widgetArea.id);
@@ -128,21 +124,17 @@ const saveWidgetAreas = widgetAreas => async _ref3 => {
128
124
 
129
125
  exports.saveWidgetAreas = saveWidgetAreas;
130
126
 
131
- const saveWidgetArea = widgetAreaId => async _ref4 => {
132
- let {
133
- dispatch,
134
- select,
135
- registry
136
- } = _ref4;
127
+ const saveWidgetArea = widgetAreaId => async ({
128
+ dispatch,
129
+ select,
130
+ registry
131
+ }) => {
137
132
  const widgets = select.getWidgets();
138
133
  const post = registry.select(_coreData.store).getEditedEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreaPostId)(widgetAreaId)); // Get all widgets from this area
139
134
 
140
- const areaWidgets = Object.values(widgets).filter(_ref5 => {
141
- let {
142
- sidebar
143
- } = _ref5;
144
- return sidebar === widgetAreaId;
145
- }); // Remove all duplicate reference widget instances for legacy widgets.
135
+ const areaWidgets = Object.values(widgets).filter(({
136
+ sidebar
137
+ }) => sidebar === widgetAreaId); // Remove all duplicate reference widget instances for legacy widgets.
146
138
  // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget
147
139
  // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to
148
140
  // save multiple instances of these in different sidebars you will run into undefined behaviors.
@@ -203,22 +195,16 @@ const saveWidgetArea = widgetAreaId => async _ref4 => {
203
195
  continue;
204
196
  }
205
197
 
206
- batchTasks.push(_ref6 => {
207
- let {
208
- saveEditedEntityRecord
209
- } = _ref6;
210
- return saveEditedEntityRecord('root', 'widget', widgetId);
211
- });
198
+ batchTasks.push(({
199
+ saveEditedEntityRecord
200
+ }) => saveEditedEntityRecord('root', 'widget', widgetId));
212
201
  } else {
213
202
  // Create a new widget.
214
- batchTasks.push(_ref7 => {
215
- let {
216
- saveEntityRecord
217
- } = _ref7;
218
- return saveEntityRecord('root', 'widget', { ...widget,
219
- sidebar: widgetAreaId
220
- });
221
- });
203
+ batchTasks.push(({
204
+ saveEntityRecord
205
+ }) => saveEntityRecord('root', 'widget', { ...widget,
206
+ sidebar: widgetAreaId
207
+ }));
222
208
  }
223
209
 
224
210
  batchMeta.push({
@@ -229,14 +215,11 @@ const saveWidgetArea = widgetAreaId => async _ref4 => {
229
215
  }
230
216
 
231
217
  for (const widget of deletedWidgets) {
232
- batchTasks.push(_ref8 => {
233
- let {
234
- deleteEntityRecord
235
- } = _ref8;
236
- return deleteEntityRecord('root', 'widget', widget.id, {
237
- force: true
238
- });
239
- });
218
+ batchTasks.push(({
219
+ deleteEntityRecord
220
+ }) => deleteEntityRecord('root', 'widget', widget.id, {
221
+ force: true
222
+ }));
240
223
  }
241
224
 
242
225
  const records = await registry.dispatch(_coreData.store).__experimentalBatch(batchTasks);
@@ -255,9 +238,7 @@ const saveWidgetArea = widgetAreaId => async _ref4 => {
255
238
  const error = registry.select(_coreData.store).getLastEntitySaveError('root', 'widget', widget.id);
256
239
 
257
240
  if (error) {
258
- var _block$attributes;
259
-
260
- failedWidgetNames.push(((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.name) || (block === null || block === void 0 ? void 0 : block.name));
241
+ failedWidgetNames.push(block.attributes?.name || block?.name);
261
242
  }
262
243
 
263
244
  if (!sidebarWidgetsIds[position]) {
@@ -282,10 +263,9 @@ const saveWidgetArea = widgetAreaId => async _ref4 => {
282
263
 
283
264
  exports.saveWidgetArea = saveWidgetArea;
284
265
 
285
- const trySaveWidgetArea = widgetAreaId => _ref9 => {
286
- let {
287
- registry
288
- } = _ref9;
266
+ const trySaveWidgetArea = widgetAreaId => ({
267
+ registry
268
+ }) => {
289
269
  registry.dispatch(_coreData.store).saveEditedEntityRecord(_utils.KIND, _utils.WIDGET_AREA_ENTITY_TYPE, widgetAreaId, {
290
270
  throwOnError: true
291
271
  });
@@ -380,10 +360,9 @@ function setIsListViewOpened(isOpen) {
380
360
  */
381
361
 
382
362
 
383
- const closeGeneralSidebar = () => _ref10 => {
384
- let {
385
- registry
386
- } = _ref10;
363
+ const closeGeneralSidebar = () => ({
364
+ registry
365
+ }) => {
387
366
  registry.dispatch(_interface.store).disableComplementaryArea(_constants.STORE_NAME);
388
367
  };
389
368
  /**
@@ -396,23 +375,19 @@ const closeGeneralSidebar = () => _ref10 => {
396
375
 
397
376
  exports.closeGeneralSidebar = closeGeneralSidebar;
398
377
 
399
- const moveBlockToWidgetArea = (clientId, widgetAreaId) => async _ref11 => {
400
- let {
401
- dispatch,
402
- select,
403
- registry
404
- } = _ref11;
378
+ const moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({
379
+ dispatch,
380
+ select,
381
+ registry
382
+ }) => {
405
383
  const sourceRootClientId = registry.select(_blockEditor.store).getBlockRootClientId(clientId); // Search the top level blocks (widget areas) for the one with the matching
406
384
  // id attribute. Makes the assumption that all top-level blocks are widget
407
385
  // areas.
408
386
 
409
387
  const widgetAreas = registry.select(_blockEditor.store).getBlocks();
410
- const destinationWidgetAreaBlock = widgetAreas.find(_ref12 => {
411
- let {
412
- attributes
413
- } = _ref12;
414
- return attributes.id === widgetAreaId;
415
- });
388
+ const destinationWidgetAreaBlock = widgetAreas.find(({
389
+ attributes
390
+ }) => attributes.id === widgetAreaId);
416
391
  const destinationRootClientId = destinationWidgetAreaBlock.clientId; // Get the index for moving to the end of the destination widget area.
417
392
 
418
393
  const destinationInnerBlocksClientIds = registry.select(_blockEditor.store).getBlockOrder(destinationRootClientId);