@wordpress/edit-widgets 6.31.1-next.f56bd8138.0 → 6.32.1-next.47f435fc9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/blocks/widget-area/block.json +26 -0
  3. package/build/blocks/widget-area/edit/index.js +94 -87
  4. package/build/blocks/widget-area/edit/index.js.map +7 -1
  5. package/build/blocks/widget-area/edit/inner-blocks.js +68 -50
  6. package/build/blocks/widget-area/edit/inner-blocks.js.map +7 -1
  7. package/build/blocks/widget-area/edit/use-is-dragging-within.js +34 -40
  8. package/build/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
  9. package/build/blocks/widget-area/index.js +49 -52
  10. package/build/blocks/widget-area/index.js.map +7 -1
  11. package/build/components/error-boundary/index.js +49 -51
  12. package/build/components/error-boundary/index.js.map +7 -1
  13. package/build/components/header/document-tools/index.js +104 -74
  14. package/build/components/header/document-tools/index.js.map +7 -1
  15. package/build/components/header/index.js +81 -62
  16. package/build/components/header/index.js.map +7 -1
  17. package/build/components/header/undo-redo/redo.js +50 -38
  18. package/build/components/header/undo-redo/redo.js.map +7 -1
  19. package/build/components/header/undo-redo/undo.js +49 -37
  20. package/build/components/header/undo-redo/undo.js.map +7 -1
  21. package/build/components/keyboard-shortcut-help-modal/config.js +74 -71
  22. package/build/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  23. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +61 -44
  24. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  25. package/build/components/keyboard-shortcut-help-modal/index.js +154 -103
  26. package/build/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  27. package/build/components/keyboard-shortcut-help-modal/shortcut.js +74 -56
  28. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  29. package/build/components/keyboard-shortcuts/index.js +89 -82
  30. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  31. package/build/components/layout/index.js +75 -49
  32. package/build/components/layout/index.js.map +7 -1
  33. package/build/components/layout/interface.js +89 -75
  34. package/build/components/layout/interface.js.map +7 -1
  35. package/build/components/layout/unsaved-changes-warning.js +35 -42
  36. package/build/components/layout/unsaved-changes-warning.js.map +7 -1
  37. package/build/components/more-menu/index.js +189 -108
  38. package/build/components/more-menu/index.js.map +7 -1
  39. package/build/components/more-menu/tools-more-menu-group.js +29 -23
  40. package/build/components/more-menu/tools-more-menu-group.js.map +7 -1
  41. package/build/components/notices/index.js +62 -48
  42. package/build/components/notices/index.js.map +7 -1
  43. package/build/components/save-button/index.js +55 -47
  44. package/build/components/save-button/index.js.map +7 -1
  45. package/build/components/secondary-sidebar/index.js +41 -34
  46. package/build/components/secondary-sidebar/index.js.map +7 -1
  47. package/build/components/secondary-sidebar/inserter-sidebar.js +55 -46
  48. package/build/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
  49. package/build/components/secondary-sidebar/list-view-sidebar.js +76 -67
  50. package/build/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
  51. package/build/components/sidebar/index.js +149 -138
  52. package/build/components/sidebar/index.js.map +7 -1
  53. package/build/components/sidebar/widget-areas.js +73 -57
  54. package/build/components/sidebar/widget-areas.js.map +7 -1
  55. package/build/components/welcome-guide/index.js +182 -137
  56. package/build/components/welcome-guide/index.js.map +7 -1
  57. package/build/components/widget-areas-block-editor-content/index.js +64 -43
  58. package/build/components/widget-areas-block-editor-content/index.js.map +7 -1
  59. package/build/components/widget-areas-block-editor-provider/index.js +115 -92
  60. package/build/components/widget-areas-block-editor-provider/index.js.map +7 -1
  61. package/build/constants.js +30 -8
  62. package/build/constants.js.map +7 -1
  63. package/build/filters/index.js +3 -5
  64. package/build/filters/index.js.map +7 -1
  65. package/build/filters/move-to-widget-area.js +52 -59
  66. package/build/filters/move-to-widget-area.js.map +7 -1
  67. package/build/filters/replace-media-upload.js +9 -11
  68. package/build/filters/replace-media-upload.js.map +7 -1
  69. package/build/hooks/use-last-selected-widget-area.js +38 -44
  70. package/build/hooks/use-last-selected-widget-area.js.map +7 -1
  71. package/build/hooks/use-widget-library-insertion-point.js +60 -55
  72. package/build/hooks/use-widget-library-insertion-point.js.map +7 -1
  73. package/build/index.js +86 -93
  74. package/build/index.js.map +7 -1
  75. package/build/lock-unlock.js +31 -15
  76. package/build/lock-unlock.js.map +7 -1
  77. package/build/store/actions.js +181 -313
  78. package/build/store/actions.js.map +7 -1
  79. package/build/store/constants.js +27 -10
  80. package/build/store/constants.js.map +7 -1
  81. package/build/store/index.js +51 -51
  82. package/build/store/index.js.map +7 -1
  83. package/build/store/private-selectors.js +28 -7
  84. package/build/store/private-selectors.js.map +7 -1
  85. package/build/store/reducer.js +65 -118
  86. package/build/store/reducer.js.map +7 -1
  87. package/build/store/resolvers.js +64 -63
  88. package/build/store/resolvers.js.map +7 -1
  89. package/build/store/selectors.js +194 -231
  90. package/build/store/selectors.js.map +7 -1
  91. package/build/store/transformers.js +47 -41
  92. package/build/store/transformers.js.map +7 -1
  93. package/build/store/utils.js +47 -70
  94. package/build/store/utils.js.map +7 -1
  95. package/build-module/blocks/widget-area/block.json +26 -0
  96. package/build-module/blocks/widget-area/edit/index.js +63 -75
  97. package/build-module/blocks/widget-area/edit/index.js.map +7 -1
  98. package/build-module/blocks/widget-area/edit/inner-blocks.js +38 -41
  99. package/build-module/blocks/widget-area/edit/inner-blocks.js.map +7 -1
  100. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js +14 -33
  101. package/build-module/blocks/widget-area/edit/use-is-dragging-within.js.map +7 -1
  102. package/build-module/blocks/widget-area/index.js +14 -46
  103. package/build-module/blocks/widget-area/index.js.map +7 -1
  104. package/build-module/components/error-boundary/index.js +30 -43
  105. package/build-module/components/error-boundary/index.js.map +7 -1
  106. package/build-module/components/header/document-tools/index.js +75 -66
  107. package/build-module/components/header/document-tools/index.js.map +7 -1
  108. package/build-module/components/header/index.js +52 -54
  109. package/build-module/components/header/index.js.map +7 -1
  110. package/build-module/components/header/undo-redo/redo.js +32 -32
  111. package/build-module/components/header/undo-redo/redo.js.map +7 -1
  112. package/build-module/components/header/undo-redo/undo.js +31 -31
  113. package/build-module/components/header/undo-redo/undo.js.map +7 -1
  114. package/build-module/components/keyboard-shortcut-help-modal/config.js +62 -75
  115. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +7 -1
  116. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +33 -37
  117. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +7 -1
  118. package/build-module/components/keyboard-shortcut-help-modal/index.js +130 -97
  119. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +7 -1
  120. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +56 -50
  121. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +7 -1
  122. package/build-module/components/keyboard-shortcuts/index.js +73 -75
  123. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  124. package/build-module/components/layout/index.js +46 -41
  125. package/build-module/components/layout/index.js.map +7 -1
  126. package/build-module/components/layout/interface.js +63 -66
  127. package/build-module/components/layout/interface.js.map +7 -1
  128. package/build-module/components/layout/unsaved-changes-warning.js +17 -37
  129. package/build-module/components/layout/unsaved-changes-warning.js.map +7 -1
  130. package/build-module/components/more-menu/index.js +167 -102
  131. package/build-module/components/more-menu/index.js.map +7 -1
  132. package/build-module/components/more-menu/tools-more-menu-group.js +11 -17
  133. package/build-module/components/more-menu/tools-more-menu-group.js.map +7 -1
  134. package/build-module/components/notices/index.js +43 -42
  135. package/build-module/components/notices/index.js.map +7 -1
  136. package/build-module/components/save-button/index.js +37 -41
  137. package/build-module/components/save-button/index.js.map +7 -1
  138. package/build-module/components/secondary-sidebar/index.js +14 -27
  139. package/build-module/components/secondary-sidebar/index.js.map +7 -1
  140. package/build-module/components/secondary-sidebar/inserter-sidebar.js +26 -38
  141. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +7 -1
  142. package/build-module/components/secondary-sidebar/list-view-sidebar.js +57 -60
  143. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +7 -1
  144. package/build-module/components/sidebar/index.js +129 -127
  145. package/build-module/components/sidebar/index.js.map +7 -1
  146. package/build-module/components/sidebar/widget-areas.js +53 -49
  147. package/build-module/components/sidebar/widget-areas.js.map +7 -1
  148. package/build-module/components/welcome-guide/index.js +165 -132
  149. package/build-module/components/welcome-guide/index.js.map +7 -1
  150. package/build-module/components/widget-areas-block-editor-content/index.js +43 -36
  151. package/build-module/components/widget-areas-block-editor-content/index.js.map +7 -1
  152. package/build-module/components/widget-areas-block-editor-provider/index.js +85 -83
  153. package/build-module/components/widget-areas-block-editor-provider/index.js.map +7 -1
  154. package/build-module/constants.js +7 -3
  155. package/build-module/constants.js.map +7 -1
  156. package/build-module/filters/index.js +3 -6
  157. package/build-module/filters/index.js.map +7 -1
  158. package/build-module/filters/move-to-widget-area.js +52 -57
  159. package/build-module/filters/move-to-widget-area.js.map +7 -1
  160. package/build-module/filters/replace-media-upload.js +8 -7
  161. package/build-module/filters/replace-media-upload.js.map +7 -1
  162. package/build-module/hooks/use-last-selected-widget-area.js +20 -39
  163. package/build-module/hooks/use-last-selected-widget-area.js.map +7 -1
  164. package/build-module/hooks/use-widget-library-insertion-point.js +42 -49
  165. package/build-module/hooks/use-widget-library-insertion-point.js.map +7 -1
  166. package/build-module/index.js +60 -72
  167. package/build-module/index.js.map +7 -1
  168. package/build-module/lock-unlock.js +8 -7
  169. package/build-module/lock-unlock.js.map +7 -1
  170. package/build-module/store/actions.js +153 -293
  171. package/build-module/store/actions.js.map +7 -1
  172. package/build-module/store/constants.js +5 -5
  173. package/build-module/store/constants.js.map +7 -1
  174. package/build-module/store/index.js +16 -40
  175. package/build-module/store/index.js.map +7 -1
  176. package/build-module/store/private-selectors.js +7 -3
  177. package/build-module/store/private-selectors.js.map +7 -1
  178. package/build-module/store/reducer.js +42 -111
  179. package/build-module/store/reducer.js.map +7 -1
  180. package/build-module/store/resolvers.js +43 -51
  181. package/build-module/store/resolvers.js.map +7 -1
  182. package/build-module/store/selectors.js +171 -224
  183. package/build-module/store/selectors.js.map +7 -1
  184. package/build-module/store/transformers.js +23 -34
  185. package/build-module/store/transformers.js.map +7 -1
  186. package/build-module/store/utils.js +22 -63
  187. package/build-module/store/utils.js.map +7 -1
  188. package/build-style/style-rtl.css +216 -88
  189. package/build-style/style.css +216 -88
  190. package/package.json +36 -29
  191. package/src/blocks/widget-area/editor.scss +3 -0
  192. package/src/components/customizer-edit-widgets-initializer/style.scss +3 -0
  193. package/src/components/error-boundary/style.scss +2 -0
  194. package/src/components/header/style.scss +5 -0
  195. package/src/components/keyboard-shortcut-help-modal/style.scss +2 -0
  196. package/src/components/layout/style.scss +3 -0
  197. package/src/components/more-menu/style.scss +2 -0
  198. package/src/components/notices/style.scss +3 -0
  199. package/src/components/secondary-sidebar/style.scss +4 -0
  200. package/src/components/sidebar/style.scss +2 -0
  201. package/src/components/welcome-guide/style.scss +2 -0
  202. package/src/components/widget-areas-block-editor-content/style.scss +2 -0
  203. package/src/style.scss +16 -13
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blockEditor","require","_compose","_data","_hooks","_widgets","_store","_jsxRuntime","withMoveToWidgetAreaToolbarItem","createHigherOrderComponent","BlockEdit","props","clientId","name","blockName","widgetAreas","currentWidgetAreaId","canInsertBlockInWidgetArea","useSelect","select","selectors","editWidgetsStore","widgetAreaBlock","getParentWidgetAreaBlock","getWidgetAreas","attributes","id","moveBlockToWidgetArea","useDispatch","hasMultipleWidgetAreas","length","isMoveToWidgetAreaVisible","jsxs","Fragment","children","jsx","BlockControls","MoveToWidgetArea","onSelect","widgetAreaId","addFilter"],"sources":["@wordpress/edit-widgets/src/filters/move-to-widget-area.js"],"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 key=\"edit\" { ...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"],"mappings":";;AAIA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAqD,IAAAM,WAAA,GAAAN,OAAA;AAbrD;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAMO,+BAA+B,GAAG,IAAAC,mCAA0B,EAC/DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAM;IAAEC,QAAQ;IAAEC,IAAI,EAAEC;EAAU,CAAC,GAAGH,KAAK;EAC3C,MAAM;IAAEI,WAAW;IAAEC,mBAAmB;IAAEC;EAA2B,CAAC,GACrE,IAAAC,eAAS,EACNC,MAAM,IAAM;IACb;IACA,IAAKL,SAAS,KAAK,kBAAkB,EAAG;MACvC,OAAO,CAAC,CAAC;IACV;IAEA,MAAMM,SAAS,GAAGD,MAAM,CAAEE,YAAiB,CAAC;IAE5C,MAAMC,eAAe,GACpBF,SAAS,CAACG,wBAAwB,CAAEX,QAAS,CAAC;IAE/C,OAAO;MACNG,WAAW,EAAEK,SAAS,CAACI,cAAc,CAAC,CAAC;MACvCR,mBAAmB,EAAEM,eAAe,EAAEG,UAAU,EAAEC,EAAE;MACpDT,0BAA0B,EACzBG,SAAS,CAACH,0BAA0B,CAAEH,SAAU;IAClD,CAAC;EACF,CAAC,EACD,CAAEF,QAAQ,EAAEE,SAAS,CACtB,CAAC;EAEF,MAAM;IAAEa;EAAsB,CAAC,GAAG,IAAAC,iBAAW,EAAEP,YAAiB,CAAC;EACjE,MAAMQ,sBAAsB,GAAGd,WAAW,EAAEe,MAAM,GAAG,CAAC;EACtD,MAAMC,yBAAyB,GAC9BjB,SAAS,KAAK,kBAAkB,IAChCe,sBAAsB,IACtBZ,0BAA0B;EAE3B,oBACC,IAAAV,WAAA,CAAAyB,IAAA,EAAAzB,WAAA,CAAA0B,QAAA;IAAAC,QAAA,gBACC,IAAA3B,WAAA,CAAA4B,GAAA,EAACzB,SAAS;MAAA,GAAiBC;IAAK,GAAjB,MAAqB,CAAC,EACnCoB,yBAAyB,iBAC1B,IAAAxB,WAAA,CAAA4B,GAAA,EAACnC,YAAA,CAAAoC,aAAa;MAAAF,QAAA,eACb,IAAA3B,WAAA,CAAA4B,GAAA,EAAC9B,QAAA,CAAAgC,gBAAgB;QAChBtB,WAAW,EAAGA,WAAa;QAC3BC,mBAAmB,EAAGA,mBAAqB;QAC3CsB,QAAQ,EAAKC,YAAY,IAAM;UAC9BZ,qBAAqB,CACpBhB,KAAK,CAACC,QAAQ,EACd2B,YACD,CAAC;QACF;MAAG,CACH;IAAC,CACY,CACf;EAAA,CACA,CAAC;AAEL,CAAC,EACD,iCACD,CAAC;AAED,IAAAC,gBAAS,EACR,kBAAkB,EAClB,8BAA8B,EAC9BhC,+BACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/filters/move-to-widget-area.js"],
4
+ "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 key=\"edit\" { ...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"],
5
+ "mappings": "AAiDG;AA7CH,0BAA8B;AAC9B,qBAA2C;AAC3C,kBAAuC;AACvC,mBAA0B;AAC1B,qBAAiC;AAKjC,mBAA0C;AAE1C,MAAM,sCAAkC;AAAA,EACvC,CAAE,cAAe,CAAE,UAAW;AAC7B,UAAM,EAAE,UAAU,MAAM,UAAU,IAAI;AACtC,UAAM,EAAE,aAAa,qBAAqB,2BAA2B,QACpE;AAAA,MACC,CAAE,WAAY;AAEb,YAAK,cAAc,oBAAqB;AACvC,iBAAO,CAAC;AAAA,QACT;AAEA,cAAM,YAAY,OAAQ,aAAAA,KAAiB;AAE3C,cAAM,kBACL,UAAU,yBAA0B,QAAS;AAE9C,eAAO;AAAA,UACN,aAAa,UAAU,eAAe;AAAA,UACtC,qBAAqB,iBAAiB,YAAY;AAAA,UAClD,4BACC,UAAU,2BAA4B,SAAU;AAAA,QAClD;AAAA,MACD;AAAA,MACA,CAAE,UAAU,SAAU;AAAA,IACvB;AAED,UAAM,EAAE,sBAAsB,QAAI,yBAAa,aAAAA,KAAiB;AAChE,UAAM,yBAAyB,aAAa,SAAS;AACrD,UAAM,4BACL,cAAc,sBACd,0BACA;AAED,WACC,4EACC;AAAA,kDAAC,aAAuB,GAAG,SAAZ,MAAoB;AAAA,MACjC,6BACD,4CAAC,qCACA;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAW,CAAE,iBAAkB;AAC9B;AAAA,cACC,MAAM;AAAA,cACN;AAAA,YACD;AAAA,UACD;AAAA;AAAA,MACD,GACD;AAAA,OAEF;AAAA,EAEF;AAAA,EACA;AACD;AAAA,IAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
+ "names": ["editWidgetsStore"]
7
+ }
@@ -1,11 +1,9 @@
1
- "use strict";
2
-
3
- var _hooks = require("@wordpress/hooks");
4
- var _mediaUtils = require("@wordpress/media-utils");
5
- /**
6
- * WordPress dependencies
7
- */
8
-
9
- const replaceMediaUpload = () => _mediaUtils.MediaUpload;
10
- (0, _hooks.addFilter)('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload);
11
- //# sourceMappingURL=replace-media-upload.js.map
1
+ var import_hooks = require("@wordpress/hooks");
2
+ var import_media_utils = require("@wordpress/media-utils");
3
+ const replaceMediaUpload = () => import_media_utils.MediaUpload;
4
+ (0, import_hooks.addFilter)(
5
+ "editor.MediaUpload",
6
+ "core/edit-widgets/replace-media-upload",
7
+ replaceMediaUpload
8
+ );
9
+ //# sourceMappingURL=replace-media-upload.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_hooks","require","_mediaUtils","replaceMediaUpload","MediaUpload","addFilter"],"sources":["@wordpress/edit-widgets/src/filters/replace-media-upload.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,MAAME,kBAAkB,GAAGA,CAAA,KAAMC,uBAAW;AAE5C,IAAAC,gBAAS,EACR,oBAAoB,EACpB,wCAAwC,EACxCF,kBACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/filters/replace-media-upload.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { MediaUpload } from '@wordpress/media-utils';\n\nconst replaceMediaUpload = () => MediaUpload;\n\naddFilter(\n\t'editor.MediaUpload',\n\t'core/edit-widgets/replace-media-upload',\n\treplaceMediaUpload\n);\n"],
5
+ "mappings": "AAGA,mBAA0B;AAC1B,yBAA4B;AAE5B,MAAM,qBAAqB,MAAM;AAAA,IAEjC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AACD;",
6
+ "names": []
7
+ }
@@ -1,55 +1,49 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var use_last_selected_widget_area_exports = {};
19
+ __export(use_last_selected_widget_area_exports, {
20
+ default: () => use_last_selected_widget_area_default
5
21
  });
6
- exports.default = void 0;
7
- var _data = require("@wordpress/data");
8
- var _blockEditor = require("@wordpress/block-editor");
9
- var _coreData = require("@wordpress/core-data");
10
- var _store = require("../store");
11
- var _utils = require("../store/utils");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
-
20
- /**
21
- * A react hook that returns the client id of the last widget area to have
22
- * been selected, or to have a selected block within it.
23
- *
24
- * @return {string} clientId of the widget area last selected.
25
- */
26
- const useLastSelectedWidgetArea = () => (0, _data.useSelect)(select => {
27
- const {
28
- getBlockSelectionEnd,
29
- getBlockName
30
- } = select(_blockEditor.store);
22
+ module.exports = __toCommonJS(use_last_selected_widget_area_exports);
23
+ var import_data = require("@wordpress/data");
24
+ var import_block_editor = require("@wordpress/block-editor");
25
+ var import_core_data = require("@wordpress/core-data");
26
+ var import_store = require("../store");
27
+ var import_utils = require("../store/utils");
28
+ const useLastSelectedWidgetArea = () => (0, import_data.useSelect)((select) => {
29
+ const { getBlockSelectionEnd, getBlockName } = select(import_block_editor.store);
31
30
  const selectionEndClientId = getBlockSelectionEnd();
32
-
33
- // If the selected block is a widget area, return its clientId.
34
- if (getBlockName(selectionEndClientId) === 'core/widget-area') {
31
+ if (getBlockName(selectionEndClientId) === "core/widget-area") {
35
32
  return selectionEndClientId;
36
33
  }
37
- const {
38
- getParentWidgetAreaBlock
39
- } = select(_store.store);
34
+ const { getParentWidgetAreaBlock } = select(import_store.store);
40
35
  const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId);
41
36
  const widgetAreaBlockClientId = widgetAreaBlock?.clientId;
42
37
  if (widgetAreaBlockClientId) {
43
38
  return widgetAreaBlockClientId;
44
39
  }
45
-
46
- // If no widget area has been selected, return the clientId of the first
47
- // area.
48
- const {
49
- getEntityRecord
50
- } = select(_coreData.store);
51
- const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
40
+ const { getEntityRecord } = select(import_core_data.store);
41
+ const widgetAreasPost = getEntityRecord(
42
+ import_utils.KIND,
43
+ import_utils.POST_TYPE,
44
+ (0, import_utils.buildWidgetAreasPostId)()
45
+ );
52
46
  return widgetAreasPost?.blocks[0]?.clientId;
53
47
  }, []);
54
- var _default = exports.default = useLastSelectedWidgetArea;
55
- //# sourceMappingURL=use-last-selected-widget-area.js.map
48
+ var use_last_selected_widget_area_default = useLastSelectedWidgetArea;
49
+ //# sourceMappingURL=use-last-selected-widget-area.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_coreData","_store","_utils","useLastSelectedWidgetArea","useSelect","select","getBlockSelectionEnd","getBlockName","blockEditorStore","selectionEndClientId","getParentWidgetAreaBlock","widgetsEditorStore","widgetAreaBlock","widgetAreaBlockClientId","clientId","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","buildWidgetAreasPostId","blocks","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/hooks/use-last-selected-widget-area.js"],"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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,OAAA,GAEMrB,yBAAyB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-last-selected-widget-area.js"],
4
+ "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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAA0C;AAC1C,uBAAmC;AAKnC,mBAA4C;AAC5C,mBAAwD;AAQxD,MAAM,4BAA4B,UACjC,uBAAW,CAAE,WAAY;AACxB,QAAM,EAAE,sBAAsB,aAAa,IAC1C,OAAQ,oBAAAA,KAAiB;AAC1B,QAAM,uBAAuB,qBAAqB;AAGlD,MAAK,aAAc,oBAAqB,MAAM,oBAAqB;AAClE,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,yBAAyB,IAAI,OAAQ,aAAAC,KAAmB;AAChE,QAAM,kBACL,yBAA0B,oBAAqB;AAChD,QAAM,0BAA0B,iBAAiB;AAEjD,MAAK,yBAA0B;AAC9B,WAAO;AAAA,EACR;AAIA,QAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAC,KAAU;AAC9C,QAAM,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,QACA,qCAAuB;AAAA,EACxB;AACA,SAAO,iBAAiB,OAAQ,CAAE,GAAG;AACtC,GAAG,CAAC,CAAE;AAEP,IAAO,wCAAQ;",
6
+ "names": ["blockEditorStore", "widgetsEditorStore", "coreStore"]
7
+ }
@@ -1,62 +1,67 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var use_widget_library_insertion_point_exports = {};
19
+ __export(use_widget_library_insertion_point_exports, {
20
+ default: () => use_widget_library_insertion_point_default
5
21
  });
6
- exports.default = void 0;
7
- var _data = require("@wordpress/data");
8
- var _blockEditor = require("@wordpress/block-editor");
9
- var _coreData = require("@wordpress/core-data");
10
- var _store = require("../store");
11
- var _utils = require("../store/utils");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- /**
17
- * Internal dependencies
18
- */
19
-
22
+ module.exports = __toCommonJS(use_widget_library_insertion_point_exports);
23
+ var import_data = require("@wordpress/data");
24
+ var import_block_editor = require("@wordpress/block-editor");
25
+ var import_core_data = require("@wordpress/core-data");
26
+ var import_store = require("../store");
27
+ var import_utils = require("../store/utils");
20
28
  const useWidgetLibraryInsertionPoint = () => {
21
- const firstRootId = (0, _data.useSelect)(select => {
22
- // Default to the first widget area
23
- const {
24
- getEntityRecord
25
- } = select(_coreData.store);
26
- const widgetAreasPost = getEntityRecord(_utils.KIND, _utils.POST_TYPE, (0, _utils.buildWidgetAreasPostId)());
29
+ const firstRootId = (0, import_data.useSelect)((select) => {
30
+ const { getEntityRecord } = select(import_core_data.store);
31
+ const widgetAreasPost = getEntityRecord(
32
+ import_utils.KIND,
33
+ import_utils.POST_TYPE,
34
+ (0, import_utils.buildWidgetAreasPostId)()
35
+ );
27
36
  return widgetAreasPost?.blocks[0]?.clientId;
28
37
  }, []);
29
- return (0, _data.useSelect)(select => {
30
- const {
31
- getBlockRootClientId,
32
- getBlockSelectionEnd,
33
- getBlockOrder,
34
- getBlockIndex
35
- } = select(_blockEditor.store);
36
- const insertionPoint = select(_store.store).__experimentalGetInsertionPoint();
37
-
38
- // "Browse all" in the quick inserter will set the rootClientId to the current block.
39
- // Otherwise, it will just be undefined, and we'll have to handle it differently below.
40
- if (insertionPoint.rootClientId) {
41
- return insertionPoint;
42
- }
43
- const clientId = getBlockSelectionEnd() || firstRootId;
44
- const rootClientId = getBlockRootClientId(clientId);
45
-
46
- // If the selected block is at the root level, it's a widget area and
47
- // blocks can't be inserted here. Return this block as the root and the
48
- // last child clientId indicating insertion at the end.
49
- if (clientId && rootClientId === '') {
38
+ return (0, import_data.useSelect)(
39
+ (select) => {
40
+ const {
41
+ getBlockRootClientId,
42
+ getBlockSelectionEnd,
43
+ getBlockOrder,
44
+ getBlockIndex
45
+ } = select(import_block_editor.store);
46
+ const insertionPoint = select(import_store.store).__experimentalGetInsertionPoint();
47
+ if (insertionPoint.rootClientId) {
48
+ return insertionPoint;
49
+ }
50
+ const clientId = getBlockSelectionEnd() || firstRootId;
51
+ const rootClientId = getBlockRootClientId(clientId);
52
+ if (clientId && rootClientId === "") {
53
+ return {
54
+ rootClientId: clientId,
55
+ insertionIndex: getBlockOrder(clientId).length
56
+ };
57
+ }
50
58
  return {
51
- rootClientId: clientId,
52
- insertionIndex: getBlockOrder(clientId).length
59
+ rootClientId,
60
+ insertionIndex: getBlockIndex(clientId) + 1
53
61
  };
54
- }
55
- return {
56
- rootClientId,
57
- insertionIndex: getBlockIndex(clientId) + 1
58
- };
59
- }, [firstRootId]);
62
+ },
63
+ [firstRootId]
64
+ );
60
65
  };
61
- var _default = exports.default = useWidgetLibraryInsertionPoint;
62
- //# sourceMappingURL=use-widget-library-insertion-point.js.map
66
+ var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint;
67
+ //# sourceMappingURL=use-widget-library-insertion-point.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_coreData","_store","_utils","useWidgetLibraryInsertionPoint","firstRootId","useSelect","select","getEntityRecord","coreStore","widgetAreasPost","KIND","POST_TYPE","buildWidgetAreasPostId","blocks","clientId","getBlockRootClientId","getBlockSelectionEnd","getBlockOrder","getBlockIndex","blockEditorStore","insertionPoint","editWidgetsStore","__experimentalGetInsertionPoint","rootClientId","insertionIndex","length","_default","exports","default"],"sources":["@wordpress/edit-widgets/src/hooks/use-widget-library-insertion-point.js"],"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[ firstR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F,YAAY;MACZC,cAAc,EAAEN,aAAa,CAAEJ,QAAS,CAAC,GAAG;IAC7C,CAAC;EACF,CAAC,EACD,CAAEV,WAAW,CACd,CAAC;AACF,CAAC;AAAC,IAAAsB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazB,8BAA8B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-widget-library-insertion-point.js"],
4
+ "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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,0BAA0C;AAC1C,uBAAmC;AAKnC,mBAA0C;AAC1C,mBAAwD;AAExD,MAAM,iCAAiC,MAAM;AAC5C,QAAM,kBAAc,uBAAW,CAAE,WAAY;AAE5C,UAAM,EAAE,gBAAgB,IAAI,OAAQ,iBAAAA,KAAU;AAC9C,UAAM,kBAAkB;AAAA,MACvB;AAAA,MACA;AAAA,UACA,qCAAuB;AAAA,IACxB;AACA,WAAO,iBAAiB,OAAQ,CAAE,GAAG;AAAA,EACtC,GAAG,CAAC,CAAE;AAEN,aAAO;AAAA,IACN,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,IAAI,OAAQ,oBAAAC,KAAiB;AAE7B,YAAM,iBACL,OAAQ,aAAAC,KAAiB,EAAE,gCAAgC;AAI5D,UAAK,eAAe,cAAe;AAClC,eAAO;AAAA,MACR;AAEA,YAAM,WAAW,qBAAqB,KAAK;AAC3C,YAAM,eAAe,qBAAsB,QAAS;AAKpD,UAAK,YAAY,iBAAiB,IAAK;AACtC,eAAO;AAAA,UACN,cAAc;AAAA,UACd,gBAAgB,cAAe,QAAS,EAAE;AAAA,QAC3C;AAAA,MACD;AAEA,aAAO;AAAA,QACN;AAAA,QACA,gBAAgB,cAAe,QAAS,IAAI;AAAA,MAC7C;AAAA,IACD;AAAA,IACA,CAAE,WAAY;AAAA,EACf;AACD;AAEA,IAAO,6CAAQ;",
6
+ "names": ["coreStore", "blockEditorStore", "editWidgetsStore"]
7
+ }
package/build/index.js CHANGED
@@ -1,118 +1,111 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.initialize = void 0;
8
- exports.initializeEditor = initializeEditor;
9
- exports.reinitializeEditor = reinitializeEditor;
10
- Object.defineProperty(exports, "store", {
11
- enumerable: true,
12
- get: function () {
13
- return _store.store;
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
16
  }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var index_exports = {};
29
+ __export(index_exports, {
30
+ initialize: () => initialize,
31
+ initializeEditor: () => initializeEditor,
32
+ reinitializeEditor: () => reinitializeEditor,
33
+ store: () => import_store2.store
15
34
  });
16
- var _blocks = require("@wordpress/blocks");
17
- var _data = require("@wordpress/data");
18
- var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
19
- var _element = require("@wordpress/element");
20
- var _blockLibrary = require("@wordpress/block-library");
21
- var _coreData = require("@wordpress/core-data");
22
- var _widgets = require("@wordpress/widgets");
23
- var _preferences = require("@wordpress/preferences");
24
- var _store = require("./store");
25
- require("./filters");
26
- var widgetArea = _interopRequireWildcard(require("./blocks/widget-area"));
27
- var _layout = _interopRequireDefault(require("./components/layout"));
28
- var _constants = require("./constants");
29
- var _jsxRuntime = require("react/jsx-runtime");
30
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
31
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
32
- /**
33
- * WordPress dependencies
34
- */
35
-
36
- /**
37
- * Internal dependencies
38
- */
39
-
40
- const disabledBlocks = ['core/more', 'core/freeform', 'core/template-part', ...(_constants.ALLOW_REUSABLE_BLOCKS ? [] : ['core/block'])];
41
-
42
- /**
43
- * Initializes the block editor in the widgets screen.
44
- *
45
- * @param {string} id ID of the root element to render the screen in.
46
- * @param {Object} settings Block editor settings.
47
- */
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_blocks = require("@wordpress/blocks");
38
+ var import_data = require("@wordpress/data");
39
+ var import_deprecated = __toESM(require("@wordpress/deprecated"));
40
+ var import_element = require("@wordpress/element");
41
+ var import_block_library = require("@wordpress/block-library");
42
+ var import_core_data = require("@wordpress/core-data");
43
+ var import_widgets = require("@wordpress/widgets");
44
+ var import_preferences = require("@wordpress/preferences");
45
+ var import_store = require("./store");
46
+ var import_filters = require("./filters");
47
+ var widgetArea = __toESM(require("./blocks/widget-area"));
48
+ var import_layout = __toESM(require("./components/layout"));
49
+ var import_constants = require("./constants");
50
+ var import_store2 = require("./store");
51
+ const disabledBlocks = [
52
+ "core/more",
53
+ "core/freeform",
54
+ "core/template-part",
55
+ ...import_constants.ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"]
56
+ ];
48
57
  function initializeEditor(id, settings) {
49
58
  const target = document.getElementById(id);
50
- const root = (0, _element.createRoot)(target);
51
- const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(block => {
52
- 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'));
59
+ const root = (0, import_element.createRoot)(target);
60
+ const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter((block) => {
61
+ 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"));
53
62
  });
54
- (0, _data.dispatch)(_preferences.store).setDefaults('core/edit-widgets', {
63
+ (0, import_data.dispatch)(import_preferences.store).setDefaults("core/edit-widgets", {
55
64
  fixedToolbar: false,
56
65
  welcomeGuide: true,
57
66
  showBlockBreadcrumbs: true,
58
67
  themeStyles: true
59
68
  });
60
- (0, _data.dispatch)(_blocks.store).reapplyBlockTypeFilters();
61
- (0, _blockLibrary.registerCoreBlocks)(coreBlocks);
62
- (0, _widgets.registerLegacyWidgetBlock)();
69
+ (0, import_data.dispatch)(import_blocks.store).reapplyBlockTypeFilters();
70
+ (0, import_block_library.registerCoreBlocks)(coreBlocks);
71
+ (0, import_widgets.registerLegacyWidgetBlock)();
63
72
  if (globalThis.IS_GUTENBERG_PLUGIN) {
64
- (0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
65
- enableFSEBlocks: _constants.ENABLE_EXPERIMENTAL_FSE_BLOCKS
73
+ (0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({
74
+ enableFSEBlocks: import_constants.ENABLE_EXPERIMENTAL_FSE_BLOCKS
66
75
  });
67
76
  }
68
- (0, _widgets.registerLegacyWidgetVariations)(settings);
77
+ (0, import_widgets.registerLegacyWidgetVariations)(settings);
69
78
  registerBlock(widgetArea);
70
- (0, _widgets.registerWidgetGroupBlock)();
71
- settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
72
-
73
- // As we are unregistering `core/freeform` to avoid the Classic block, we must
74
- // replace it with something as the default freeform content handler. Failure to
75
- // do this will result in errors in the default block parser.
76
- // see: https://github.com/WordPress/gutenberg/issues/33097
77
- (0, _blocks.setFreeformContentHandlerName)('core/html');
78
- root.render(/*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
80
- blockEditorSettings: settings
81
- })
82
- }));
79
+ (0, import_widgets.registerWidgetGroupBlock)();
80
+ settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
81
+ (0, import_blocks.setFreeformContentHandlerName)("core/html");
82
+ root.render(
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_element.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.default, { blockEditorSettings: settings }) })
84
+ );
83
85
  return root;
84
86
  }
85
-
86
- /**
87
- * Compatibility export under the old `initialize` name.
88
- */
89
- const initialize = exports.initialize = initializeEditor;
87
+ const initialize = initializeEditor;
90
88
  function reinitializeEditor() {
91
- (0, _deprecated.default)('wp.editWidgets.reinitializeEditor', {
92
- since: '6.2',
93
- version: '6.3'
89
+ (0, import_deprecated.default)("wp.editWidgets.reinitializeEditor", {
90
+ since: "6.2",
91
+ version: "6.3"
94
92
  });
95
93
  }
96
-
97
- /**
98
- * Function to register an individual block.
99
- *
100
- * @param {Object} block The block to be registered.
101
- */
102
- const registerBlock = block => {
94
+ const registerBlock = (block) => {
103
95
  if (!block) {
104
96
  return;
105
97
  }
106
- const {
107
- metadata,
108
- settings,
109
- name
110
- } = block;
98
+ const { metadata, settings, name } = block;
111
99
  if (metadata) {
112
- (0, _blocks.unstable__bootstrapServerSideBlockDefinitions)({
113
- [name]: metadata
114
- });
100
+ (0, import_blocks.unstable__bootstrapServerSideBlockDefinitions)({ [name]: metadata });
115
101
  }
116
- (0, _blocks.registerBlockType)(name, settings);
102
+ (0, import_blocks.registerBlockType)(name, settings);
117
103
  };
118
- //# sourceMappingURL=index.js.map
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ initialize,
107
+ initializeEditor,
108
+ reinitializeEditor,
109
+ store
110
+ });
111
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blocks","require","_data","_deprecated","_interopRequireDefault","_element","_blockLibrary","_coreData","_widgets","_preferences","_store","widgetArea","_interopRequireWildcard","_layout","_constants","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","disabledBlocks","ALLOW_REUSABLE_BLOCKS","initializeEditor","id","settings","target","document","getElementById","root","createRoot","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","showBlockBreadcrumbs","themeStyles","blocksStore","reapplyBlockTypeFilters","registerCoreBlocks","registerLegacyWidgetBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerLegacyWidgetVariations","registerBlock","registerWidgetGroupBlock","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","setFreeformContentHandlerName","render","jsx","StrictMode","children","blockEditorSettings","initialize","exports","reinitializeEditor","deprecated","since","version","metadata","unstable__bootstrapServerSideBlockDefinitions","registerBlockType"],"sources":["@wordpress/edit-widgets/src/index.js"],"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 deprecated from '@wordpress/deprecated';\nimport { StrictMode, createRoot } 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';\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 * 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 initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\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 ).reapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.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\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout blockEditorSettings={ settings } />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\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\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAKA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACAA,OAAA;AACA,IAAAU,UAAA,GAAAC,uBAAA,CAAAX,OAAA;AACA,IAAAY,OAAA,GAAAT,sBAAA,CAAAH,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAGqB,IAAAc,WAAA,GAAAd,OAAA;AAAA,SAAAe,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,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C,gBAAgB;AAEnC,SAAS8C,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,mCAAmC,EAAE;IAChDC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMjB,aAAa,GAAKrB,KAAK,IAAM;EAClC,IAAK,CAAEA,KAAK,EAAG;IACd;EACD;EACA,MAAM;IAAEuC,QAAQ;IAAEhD,QAAQ;IAAEW;EAAK,CAAC,GAAGF,KAAK;EAC1C,IAAKuC,QAAQ,EAAG;IACf,IAAAC,qDAA6C,EAAE;MAAE,CAAEtC,IAAI,GAAIqC;IAAS,CAAE,CAAC;EACxE;EACA,IAAAE,yBAAiB,EAAEvC,IAAI,EAAEX,QAAS,CAAC;AACpC,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.js"],
4
+ "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 deprecated from '@wordpress/deprecated';\nimport { StrictMode, createRoot } 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';\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 * 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 initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\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 ).reapplyBlockTypeFilters();\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.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\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<Layout blockEditorSettings={ settings } />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\n/**\n * Compatibility export under the old `initialize` name.\n */\nexport const initialize = initializeEditor;\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editWidgets.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\n/**\n * Function to register an individual block.\n *\n * @param {Object} block The block to be registered.\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\nexport { store } from './store';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8FG;AA3FH,oBAKO;AACP,kBAAyB;AACzB,wBAAuB;AACvB,qBAAuC;AACvC,2BAIO;AACP,uBAA2E;AAC3E,qBAIO;AACP,yBAA0C;AAK1C,mBAAO;AACP,qBAAO;AACP,iBAA4B;AAC5B,oBAAmB;AACnB,uBAGO;AA8FP,IAAAA,gBAAsB;AA5FtB,MAAM,iBAAiB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAK,yCAAwB,CAAC,IAAI,CAAE,YAAa;AAClD;AAQO,SAAS,iBAAkB,IAAI,UAAW;AAChD,QAAM,SAAS,SAAS,eAAgB,EAAG;AAC3C,QAAM,WAAO,2BAAY,MAAO;AAEhC,QAAM,iBAAa,kDAA4B,EAAE,OAAQ,CAAE,UAAW;AACrE,WAAO,EACN,eAAe,SAAU,MAAM,IAAK,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,YAAa,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,iBAAkB;AAAA,EAE3C,CAAE;AAEF,4BAAU,mBAAAC,KAAiB,EAAE,YAAa,qBAAqB;AAAA,IAC9D,cAAc;AAAA,IACd,cAAc;AAAA,IACd,sBAAsB;AAAA,IACtB,aAAa;AAAA,EACd,CAAE;AAEF,4BAAU,cAAAC,KAAY,EAAE,wBAAwB;AAChD,+CAAoB,UAAW;AAC/B,gDAA0B;AAC1B,MAAK,WAAW,qBAAsB;AACrC,2EAA8C;AAAA,MAC7C,iBAAiB;AAAA,IAClB,CAAE;AAAA,EACH;AACA,qDAAgC,QAAS;AACzC,gBAAe,UAAW;AAC1B,+CAAyB;AAEzB,WAAS,qCAAqC,CAAE,QAAQ,sBACvD,iBAAAC,oCAAsB,QAAQ,eAAe,QAAS;AAMvD,mDAA+B,WAAY;AAE3C,OAAK;AAAA,IACJ,4CAAC,6BACA,sDAAC,cAAAC,SAAA,EAAO,qBAAsB,UAAW,GAC1C;AAAA,EACD;AAEA,SAAO;AACR;AAKO,MAAM,aAAa;AAEnB,SAAS,qBAAqB;AACpC,wBAAAC,SAAY,qCAAqC;AAAA,IAChD,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACH;AAOA,MAAM,gBAAgB,CAAE,UAAW;AAClC,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AACA,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC,MAAK,UAAW;AACf,qEAA+C,EAAE,CAAE,IAAK,GAAG,SAAS,CAAE;AAAA,EACvE;AACA,uCAAmB,MAAM,QAAS;AACnC;",
6
+ "names": ["import_store", "preferencesStore", "blocksStore", "fetchLinkSuggestions", "Layout", "deprecated"]
7
+ }
@@ -1,18 +1,34 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var lock_unlock_exports = {};
19
+ __export(lock_unlock_exports, {
20
+ lock: () => lock,
21
+ unlock: () => unlock
5
22
  });
6
- exports.unlock = exports.lock = void 0;
7
- var _privateApis = require("@wordpress/private-apis");
8
- /**
9
- * WordPress dependencies
10
- */
11
-
12
- const {
23
+ module.exports = __toCommonJS(lock_unlock_exports);
24
+ var import_private_apis = require("@wordpress/private-apis");
25
+ const { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
26
+ "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
27
+ "@wordpress/edit-widgets"
28
+ );
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
13
31
  lock,
14
32
  unlock
15
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-widgets');
16
- exports.unlock = unlock;
17
- exports.lock = lock;
18
- //# sourceMappingURL=lock-unlock.js.map
33
+ });
34
+ //# sourceMappingURL=lock-unlock.js.map