@wordpress/editor 14.17.1 → 14.19.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 (410) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -0
  3. package/build/bindings/pattern-overrides.js +0 -1
  4. package/build/bindings/pattern-overrides.js.map +1 -1
  5. package/build/bindings/post-meta.js +0 -1
  6. package/build/bindings/post-meta.js.map +1 -1
  7. package/build/components/autocompleters/user.js +0 -1
  8. package/build/components/autocompleters/user.js.map +1 -1
  9. package/build/components/block-removal-warnings/index.js +0 -1
  10. package/build/components/block-removal-warnings/index.js.map +1 -1
  11. package/build/components/block-settings-menu/content-only-settings-menu.js +0 -1
  12. package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  13. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  14. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  15. package/build/components/collab-sidebar/comments.js +0 -1
  16. package/build/components/collab-sidebar/comments.js.map +1 -1
  17. package/build/components/collab-sidebar/index.js +0 -1
  18. package/build/components/collab-sidebar/index.js.map +1 -1
  19. package/build/components/collab-sidebar/utils.js +0 -1
  20. package/build/components/collab-sidebar/utils.js.map +1 -1
  21. package/build/components/deprecated.js +0 -1
  22. package/build/components/deprecated.js.map +1 -1
  23. package/build/components/document-outline/index.js +16 -17
  24. package/build/components/document-outline/index.js.map +1 -1
  25. package/build/components/editor/index.js +9 -5
  26. package/build/components/editor/index.js.map +1 -1
  27. package/build/components/editor-help/index.native.js +0 -1
  28. package/build/components/editor-help/index.native.js.map +1 -1
  29. package/build/components/editor-notices/index.js +0 -1
  30. package/build/components/editor-notices/index.js.map +1 -1
  31. package/build/components/editor-snackbars/index.js +0 -1
  32. package/build/components/editor-snackbars/index.js.map +1 -1
  33. package/build/components/entities-saved-states/entity-record-item.js +2 -1
  34. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  35. package/build/components/entities-saved-states/entity-type-list.js +2 -2
  36. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  37. package/build/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  38. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  39. package/build/components/entities-saved-states/index.js +66 -43
  40. package/build/components/entities-saved-states/index.js.map +1 -1
  41. package/build/components/keyboard-shortcut-help-modal/index.js +0 -1
  42. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  43. package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  44. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  45. package/build/components/list-view-sidebar/index.js +0 -1
  46. package/build/components/list-view-sidebar/index.js.map +1 -1
  47. package/build/components/local-autosave-monitor/index.js +0 -1
  48. package/build/components/local-autosave-monitor/index.js.map +1 -1
  49. package/build/components/mode-switcher/index.js +0 -1
  50. package/build/components/mode-switcher/index.js.map +1 -1
  51. package/build/components/page-attributes/parent.js +8 -5
  52. package/build/components/page-attributes/parent.js.map +1 -1
  53. package/build/components/post-actions/actions.js +0 -1
  54. package/build/components/post-actions/actions.js.map +1 -1
  55. package/build/components/post-actions/index.js +19 -29
  56. package/build/components/post-actions/index.js.map +1 -1
  57. package/build/components/post-author/check.js +3 -4
  58. package/build/components/post-author/check.js.map +1 -1
  59. package/build/components/post-author/combobox.js +4 -2
  60. package/build/components/post-author/combobox.js.map +1 -1
  61. package/build/components/post-author/hook.js +8 -5
  62. package/build/components/post-author/hook.js.map +1 -1
  63. package/build/components/post-card-panel/index.js +2 -2
  64. package/build/components/post-card-panel/index.js.map +1 -1
  65. package/build/components/post-featured-image/index.js +4 -2
  66. package/build/components/post-featured-image/index.js.map +1 -1
  67. package/build/components/post-fields/index.js +0 -1
  68. package/build/components/post-fields/index.js.map +1 -1
  69. package/build/components/post-format/index.js +0 -1
  70. package/build/components/post-format/index.js.map +1 -1
  71. package/build/components/post-format/panel.js +0 -1
  72. package/build/components/post-format/panel.js.map +1 -1
  73. package/build/components/post-publish-button/index.js +0 -1
  74. package/build/components/post-publish-button/index.js.map +1 -1
  75. package/build/components/post-publish-panel/maybe-category-panel.js +2 -4
  76. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  77. package/build/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  78. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  79. package/build/components/post-publish-panel/maybe-tags-panel.js +1 -1
  80. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  81. package/build/components/post-publish-panel/maybe-upload-media.js +0 -1
  82. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  83. package/build/components/post-publish-panel/media-util.js +0 -1
  84. package/build/components/post-publish-panel/media-util.js.map +1 -1
  85. package/build/components/post-saved-state/index.js +0 -1
  86. package/build/components/post-saved-state/index.js.map +1 -1
  87. package/build/components/post-schedule/index.js +0 -1
  88. package/build/components/post-schedule/index.js.map +1 -1
  89. package/build/components/post-taxonomies/check.js +1 -1
  90. package/build/components/post-taxonomies/check.js.map +1 -1
  91. package/build/components/post-taxonomies/flat-term-selector.js +2 -3
  92. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  93. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  94. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  95. package/build/components/post-taxonomies/index.js +1 -2
  96. package/build/components/post-taxonomies/index.js.map +1 -1
  97. package/build/components/post-taxonomies/most-used-terms.js +0 -1
  98. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  99. package/build/components/post-template/block-theme.js +68 -48
  100. package/build/components/post-template/block-theme.js.map +1 -1
  101. package/build/components/post-template/classic-theme.js +30 -19
  102. package/build/components/post-template/classic-theme.js.map +1 -1
  103. package/build/components/post-template/create-new-template-modal.js +3 -1
  104. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  105. package/build/components/post-template/panel.js +3 -11
  106. package/build/components/post-template/panel.js.map +1 -1
  107. package/build/components/post-template/swap-template-button.js +0 -1
  108. package/build/components/post-template/swap-template-button.js.map +1 -1
  109. package/build/components/post-transform-panel/hooks.js +0 -1
  110. package/build/components/post-transform-panel/hooks.js.map +1 -1
  111. package/build/components/post-type-support-check/index.js +0 -1
  112. package/build/components/post-type-support-check/index.js.map +1 -1
  113. package/build/components/preferences-modal/block-visibility.js +2 -2
  114. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  115. package/build/components/preferences-modal/index.js +1 -2
  116. package/build/components/preferences-modal/index.js.map +1 -1
  117. package/build/components/preview-dropdown/index.js +6 -3
  118. package/build/components/preview-dropdown/index.js.map +1 -1
  119. package/build/components/provider/disable-non-page-content-blocks.js +0 -1
  120. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  121. package/build/components/provider/index.js +19 -19
  122. package/build/components/provider/index.js.map +1 -1
  123. package/build/components/provider/index.native.js +0 -1
  124. package/build/components/provider/index.native.js.map +1 -1
  125. package/build/components/provider/use-block-editor-settings.js +0 -1
  126. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  127. package/build/components/sidebar/header.js +1 -1
  128. package/build/components/sidebar/header.js.map +1 -1
  129. package/build/components/sidebar/index.js +1 -2
  130. package/build/components/sidebar/index.js.map +1 -1
  131. package/build/components/start-page-options/index.js +148 -23
  132. package/build/components/start-page-options/index.js.map +1 -1
  133. package/build/components/start-template-options/index.js +0 -1
  134. package/build/components/start-template-options/index.js.map +1 -1
  135. package/build/components/template-part-content-panel/index.js +0 -1
  136. package/build/components/template-part-content-panel/index.js.map +1 -1
  137. package/build/components/theme-support-check/index.js +0 -1
  138. package/build/components/theme-support-check/index.js.map +1 -1
  139. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  140. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  141. package/build/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  142. package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  143. package/build/dataviews/store/private-actions.js +0 -1
  144. package/build/dataviews/store/private-actions.js.map +1 -1
  145. package/build/dataviews/store/reducer.js +0 -1
  146. package/build/dataviews/store/reducer.js.map +1 -1
  147. package/build/hooks/custom-sources-backwards-compatibility.js +0 -1
  148. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  149. package/build/hooks/pattern-overrides.js +0 -1
  150. package/build/hooks/pattern-overrides.js.map +1 -1
  151. package/build/store/actions.js +0 -1
  152. package/build/store/actions.js.map +1 -1
  153. package/build/store/private-actions.js +29 -3
  154. package/build/store/private-actions.js.map +1 -1
  155. package/build/store/private-selectors.js +44 -1
  156. package/build/store/private-selectors.js.map +1 -1
  157. package/build/store/reducer.js +0 -1
  158. package/build/store/reducer.js.map +1 -1
  159. package/build/store/reducer.native.js +0 -1
  160. package/build/store/reducer.native.js.map +1 -1
  161. package/build/store/selectors.js +0 -1
  162. package/build/store/selectors.js.map +1 -1
  163. package/build/utils/get-template-info.js +0 -1
  164. package/build/utils/get-template-info.js.map +1 -1
  165. package/build/utils/media-upload/index.js +5 -2
  166. package/build/utils/media-upload/index.js.map +1 -1
  167. package/build/utils/terms.js +0 -1
  168. package/build/utils/terms.js.map +1 -1
  169. package/build-module/bindings/pattern-overrides.js +0 -1
  170. package/build-module/bindings/pattern-overrides.js.map +1 -1
  171. package/build-module/bindings/post-meta.js +0 -1
  172. package/build-module/bindings/post-meta.js.map +1 -1
  173. package/build-module/components/autocompleters/user.js +0 -1
  174. package/build-module/components/autocompleters/user.js.map +1 -1
  175. package/build-module/components/block-removal-warnings/index.js +0 -1
  176. package/build-module/components/block-removal-warnings/index.js.map +1 -1
  177. package/build-module/components/block-settings-menu/content-only-settings-menu.js +0 -1
  178. package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
  179. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -1
  180. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  181. package/build-module/components/collab-sidebar/comments.js +0 -1
  182. package/build-module/components/collab-sidebar/comments.js.map +1 -1
  183. package/build-module/components/collab-sidebar/index.js +0 -1
  184. package/build-module/components/collab-sidebar/index.js.map +1 -1
  185. package/build-module/components/collab-sidebar/utils.js +0 -1
  186. package/build-module/components/collab-sidebar/utils.js.map +1 -1
  187. package/build-module/components/deprecated.js +0 -1
  188. package/build-module/components/deprecated.js.map +1 -1
  189. package/build-module/components/document-outline/index.js +17 -18
  190. package/build-module/components/document-outline/index.js.map +1 -1
  191. package/build-module/components/editor/index.js +9 -5
  192. package/build-module/components/editor/index.js.map +1 -1
  193. package/build-module/components/editor-help/index.native.js +0 -1
  194. package/build-module/components/editor-help/index.native.js.map +1 -1
  195. package/build-module/components/editor-notices/index.js +0 -1
  196. package/build-module/components/editor-notices/index.js.map +1 -1
  197. package/build-module/components/editor-snackbars/index.js +0 -1
  198. package/build-module/components/editor-snackbars/index.js.map +1 -1
  199. package/build-module/components/entities-saved-states/entity-record-item.js +2 -1
  200. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  201. package/build-module/components/entities-saved-states/entity-type-list.js +2 -2
  202. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  203. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +0 -1
  204. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  205. package/build-module/components/entities-saved-states/index.js +67 -44
  206. package/build-module/components/entities-saved-states/index.js.map +1 -1
  207. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  208. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  209. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -1
  210. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  211. package/build-module/components/list-view-sidebar/index.js +0 -1
  212. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  213. package/build-module/components/local-autosave-monitor/index.js +0 -1
  214. package/build-module/components/local-autosave-monitor/index.js.map +1 -1
  215. package/build-module/components/mode-switcher/index.js +0 -1
  216. package/build-module/components/mode-switcher/index.js.map +1 -1
  217. package/build-module/components/page-attributes/parent.js +8 -5
  218. package/build-module/components/page-attributes/parent.js.map +1 -1
  219. package/build-module/components/post-actions/actions.js +0 -1
  220. package/build-module/components/post-actions/actions.js.map +1 -1
  221. package/build-module/components/post-actions/index.js +19 -29
  222. package/build-module/components/post-actions/index.js.map +1 -1
  223. package/build-module/components/post-author/check.js +3 -4
  224. package/build-module/components/post-author/check.js.map +1 -1
  225. package/build-module/components/post-author/combobox.js +4 -2
  226. package/build-module/components/post-author/combobox.js.map +1 -1
  227. package/build-module/components/post-author/hook.js +8 -5
  228. package/build-module/components/post-author/hook.js.map +1 -1
  229. package/build-module/components/post-card-panel/index.js +2 -2
  230. package/build-module/components/post-card-panel/index.js.map +1 -1
  231. package/build-module/components/post-featured-image/index.js +4 -2
  232. package/build-module/components/post-featured-image/index.js.map +1 -1
  233. package/build-module/components/post-fields/index.js +0 -1
  234. package/build-module/components/post-fields/index.js.map +1 -1
  235. package/build-module/components/post-format/index.js +0 -1
  236. package/build-module/components/post-format/index.js.map +1 -1
  237. package/build-module/components/post-format/panel.js +0 -1
  238. package/build-module/components/post-format/panel.js.map +1 -1
  239. package/build-module/components/post-publish-button/index.js +0 -1
  240. package/build-module/components/post-publish-button/index.js.map +1 -1
  241. package/build-module/components/post-publish-panel/maybe-category-panel.js +2 -4
  242. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  243. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +0 -1
  244. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  245. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -1
  246. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  247. package/build-module/components/post-publish-panel/maybe-upload-media.js +0 -1
  248. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  249. package/build-module/components/post-publish-panel/media-util.js +0 -1
  250. package/build-module/components/post-publish-panel/media-util.js.map +1 -1
  251. package/build-module/components/post-saved-state/index.js +0 -1
  252. package/build-module/components/post-saved-state/index.js.map +1 -1
  253. package/build-module/components/post-schedule/index.js +0 -1
  254. package/build-module/components/post-schedule/index.js.map +1 -1
  255. package/build-module/components/post-taxonomies/check.js +1 -1
  256. package/build-module/components/post-taxonomies/check.js.map +1 -1
  257. package/build-module/components/post-taxonomies/flat-term-selector.js +2 -3
  258. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  259. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -3
  260. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  261. package/build-module/components/post-taxonomies/index.js +1 -2
  262. package/build-module/components/post-taxonomies/index.js.map +1 -1
  263. package/build-module/components/post-taxonomies/most-used-terms.js +0 -1
  264. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  265. package/build-module/components/post-template/block-theme.js +68 -48
  266. package/build-module/components/post-template/block-theme.js.map +1 -1
  267. package/build-module/components/post-template/classic-theme.js +30 -19
  268. package/build-module/components/post-template/classic-theme.js.map +1 -1
  269. package/build-module/components/post-template/create-new-template-modal.js +3 -1
  270. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  271. package/build-module/components/post-template/panel.js +3 -11
  272. package/build-module/components/post-template/panel.js.map +1 -1
  273. package/build-module/components/post-template/swap-template-button.js +0 -1
  274. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  275. package/build-module/components/post-transform-panel/hooks.js +0 -1
  276. package/build-module/components/post-transform-panel/hooks.js.map +1 -1
  277. package/build-module/components/post-type-support-check/index.js +0 -1
  278. package/build-module/components/post-type-support-check/index.js.map +1 -1
  279. package/build-module/components/preferences-modal/block-visibility.js +2 -2
  280. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  281. package/build-module/components/preferences-modal/index.js +1 -2
  282. package/build-module/components/preferences-modal/index.js.map +1 -1
  283. package/build-module/components/preview-dropdown/index.js +6 -3
  284. package/build-module/components/preview-dropdown/index.js.map +1 -1
  285. package/build-module/components/provider/disable-non-page-content-blocks.js +0 -1
  286. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  287. package/build-module/components/provider/index.js +19 -19
  288. package/build-module/components/provider/index.js.map +1 -1
  289. package/build-module/components/provider/index.native.js +0 -1
  290. package/build-module/components/provider/index.native.js.map +1 -1
  291. package/build-module/components/provider/use-block-editor-settings.js +0 -1
  292. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  293. package/build-module/components/sidebar/header.js +1 -1
  294. package/build-module/components/sidebar/header.js.map +1 -1
  295. package/build-module/components/sidebar/index.js +1 -2
  296. package/build-module/components/sidebar/index.js.map +1 -1
  297. package/build-module/components/start-page-options/index.js +148 -24
  298. package/build-module/components/start-page-options/index.js.map +1 -1
  299. package/build-module/components/start-template-options/index.js +0 -1
  300. package/build-module/components/start-template-options/index.js.map +1 -1
  301. package/build-module/components/template-part-content-panel/index.js +0 -1
  302. package/build-module/components/template-part-content-panel/index.js.map +1 -1
  303. package/build-module/components/theme-support-check/index.js +0 -1
  304. package/build-module/components/theme-support-check/index.js.map +1 -1
  305. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  306. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  307. package/build-module/components/visual-editor/use-select-nearest-editable-block.js +0 -1
  308. package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -1
  309. package/build-module/dataviews/store/private-actions.js +0 -1
  310. package/build-module/dataviews/store/private-actions.js.map +1 -1
  311. package/build-module/dataviews/store/reducer.js +0 -1
  312. package/build-module/dataviews/store/reducer.js.map +1 -1
  313. package/build-module/hooks/custom-sources-backwards-compatibility.js +0 -1
  314. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  315. package/build-module/hooks/pattern-overrides.js +0 -1
  316. package/build-module/hooks/pattern-overrides.js.map +1 -1
  317. package/build-module/store/actions.js +0 -1
  318. package/build-module/store/actions.js.map +1 -1
  319. package/build-module/store/private-actions.js +25 -1
  320. package/build-module/store/private-actions.js.map +1 -1
  321. package/build-module/store/private-selectors.js +43 -1
  322. package/build-module/store/private-selectors.js.map +1 -1
  323. package/build-module/store/reducer.js +0 -1
  324. package/build-module/store/reducer.js.map +1 -1
  325. package/build-module/store/reducer.native.js +0 -1
  326. package/build-module/store/reducer.native.js.map +1 -1
  327. package/build-module/store/selectors.js +0 -1
  328. package/build-module/store/selectors.js.map +1 -1
  329. package/build-module/utils/get-template-info.js +0 -1
  330. package/build-module/utils/get-template-info.js.map +1 -1
  331. package/build-module/utils/media-upload/index.js +5 -2
  332. package/build-module/utils/media-upload/index.js.map +1 -1
  333. package/build-module/utils/terms.js +0 -1
  334. package/build-module/utils/terms.js.map +1 -1
  335. package/build-style/style-rtl.css +49 -8
  336. package/build-style/style.css +49 -8
  337. package/build-types/components/document-outline/index.d.ts.map +1 -1
  338. package/build-types/components/editor/index.d.ts.map +1 -1
  339. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  340. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  341. package/build-types/components/entities-saved-states/index.d.ts +6 -2
  342. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  343. package/build-types/components/page-attributes/parent.d.ts.map +1 -1
  344. package/build-types/components/post-actions/index.d.ts.map +1 -1
  345. package/build-types/components/post-author/check.d.ts.map +1 -1
  346. package/build-types/components/post-author/combobox.d.ts.map +1 -1
  347. package/build-types/components/post-author/hook.d.ts +1 -0
  348. package/build-types/components/post-author/hook.d.ts.map +1 -1
  349. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  350. package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
  351. package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
  352. package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
  353. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  354. package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
  355. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  356. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  357. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  358. package/build-types/components/post-template/hooks.d.ts +1 -1
  359. package/build-types/components/post-template/hooks.d.ts.map +1 -1
  360. package/build-types/components/post-template/panel.d.ts.map +1 -1
  361. package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -1
  362. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  363. package/build-types/components/provider/index.d.ts.map +1 -1
  364. package/build-types/components/start-page-options/index.d.ts +2 -1
  365. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  366. package/build-types/store/private-actions.d.ts +4 -0
  367. package/build-types/store/private-actions.d.ts.map +1 -1
  368. package/build-types/store/private-selectors.d.ts +13 -0
  369. package/build-types/store/private-selectors.d.ts.map +1 -1
  370. package/build-types/utils/media-upload/index.d.ts +3 -1
  371. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  372. package/package.json +37 -37
  373. package/src/components/document-outline/index.js +22 -16
  374. package/src/components/editor/index.js +24 -13
  375. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  376. package/src/components/entities-saved-states/entity-type-list.js +6 -2
  377. package/src/components/entities-saved-states/index.js +98 -58
  378. package/src/components/entities-saved-states/style.scss +40 -5
  379. package/src/components/page-attributes/parent.js +55 -38
  380. package/src/components/post-actions/index.js +19 -37
  381. package/src/components/post-author/check.js +7 -4
  382. package/src/components/post-author/combobox.js +3 -1
  383. package/src/components/post-author/hook.js +4 -3
  384. package/src/components/post-card-panel/index.js +7 -5
  385. package/src/components/post-featured-image/index.js +2 -0
  386. package/src/components/post-publish-panel/maybe-category-panel.js +6 -2
  387. package/src/components/post-publish-panel/maybe-tags-panel.js +5 -1
  388. package/src/components/post-taxonomies/check.js +5 -3
  389. package/src/components/post-taxonomies/flat-term-selector.js +2 -2
  390. package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
  391. package/src/components/post-taxonomies/index.js +5 -1
  392. package/src/components/post-taxonomies/test/index.js +32 -18
  393. package/src/components/post-template/block-theme.js +76 -56
  394. package/src/components/post-template/classic-theme.js +31 -15
  395. package/src/components/post-template/create-new-template-modal.js +1 -0
  396. package/src/components/post-template/panel.js +2 -12
  397. package/src/components/post-text-editor/style.scss +0 -2
  398. package/src/components/preferences-modal/block-visibility.js +2 -1
  399. package/src/components/preferences-modal/index.js +1 -1
  400. package/src/components/preview-dropdown/index.js +8 -6
  401. package/src/components/provider/index.js +21 -30
  402. package/src/components/sidebar/header.js +1 -1
  403. package/src/components/sidebar/index.js +1 -1
  404. package/src/components/start-page-options/index.js +149 -23
  405. package/src/components/start-page-options/style.scss +27 -0
  406. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
  407. package/src/store/private-actions.js +33 -0
  408. package/src/store/private-selectors.js +57 -0
  409. package/src/utils/media-upload/index.js +3 -0
  410. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useSelect","useDispatch","store","preferencesStore","interfaceStore","editorStore","StartPageOptions","postId","enabled","select","getCurrentPostId","getCurrentPostType","preferencesModalActive","isModalActive","choosePatternModalEnabled","get","isEditedPostDirty","isEditedPostEmpty","setIsInserterOpened","isFreshPage","tab","category"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function StartPageOptions() {\n\tconst { postId, enabled } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst preferencesModalActive =\n\t\t\tselect( interfaceStore ).isModalActive( 'editor/preferences' );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled &&\n\t\t\t\t! preferencesModalActive &&\n\t\t\t\t'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\tif ( isFreshPage ) {\n\t\t\tsetIsInserterOpened( {\n\t\t\t\ttab: 'patterns',\n\t\t\t\tcategory: 'core/starter-content',\n\t\t\t} );\n\t\t}\n\n\t\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\t}, [\n\t\tpostId,\n\t\tenabled,\n\t\tsetIsInserterOpened,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAASF,KAAK,IAAIG,WAAW,QAAQ,aAAa;AAElD,eAAe,SAASC,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IACpD,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEJ,WAAY,CAAC;IACtE,MAAMO,sBAAsB,GAC3BH,MAAM,CAAEL,cAAe,CAAC,CAACS,aAAa,CAAE,oBAAqB,CAAC;IAC/D,MAAMC,yBAAyB,GAAGL,MAAM,CAAEN,gBAAiB,CAAC,CAACY,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OAAO;MACNR,MAAM,EAAEG,gBAAgB,CAAC,CAAC;MAC1BF,OAAO,EACNM,yBAAyB,IACzB,CAAEF,sBAAsB,IACxB,MAAM,KAAKD,kBAAkB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEK,iBAAiB;IAAEC;EAAkB,CAAC,GAAGjB,SAAS,CAAEK,WAAY,CAAC;EACzE,MAAM;IAAEa;EAAoB,CAAC,GAAGjB,WAAW,CAAEI,WAAY,CAAC;EAE1DN,SAAS,CAAE,MAAM;IAChB,IAAK,CAAES,OAAO,EAAG;MAChB;IACD;IAEA,MAAMW,WAAW,GAAG,CAAEH,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE,IAAKE,WAAW,EAAG;MAClBD,mBAAmB,CAAE;QACpBE,GAAG,EAAE,UAAU;QACfC,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;;IAEA;IACA;EACD,CAAC,EAAE,CACFd,MAAM,EACNC,OAAO,EACPU,mBAAmB,EACnBF,iBAAiB,EACjBC,iBAAiB,CAChB,CAAC;EAEH,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["Flex","FlexItem","Modal","ToggleControl","__","useState","useMemo","useEffect","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","coreStore","__unstableSerializeAndClean","preferencesStore","interfaceStore","editorStore","jsx","_jsx","jsxs","_jsxs","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getBlocksByName","getCurrentPostType","getRenderingMode","rootClientId","length","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","editEntityRecord","postId","getCurrentPostId","onClickPattern","_pattern","blocks","content","blocksForSerialization","StartPageOptionsModal","onClose","showStartPatterns","setShowStartPatterns","set","setPreference","startPatterns","hasStartPattern","handleClose","className","title","isFullScreen","onRequestClose","children","justify","expanded","__nextHasNoMarginBottom","checked","label","help","onChange","newValue","StartPageOptions","isOpen","setIsOpen","isEditedPostDirty","isEditedPostEmpty","isModalActive","enabled","choosePatternModalEnabled","get","isFreshPage","isPreferencesModalActive"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Flex, FlexItem, Modal, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! blockPatternsWithPostContentBlockType?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t/*\n\t\t * Filter patterns without postTypes declared if the current postType is page\n\t\t * or patterns that declare the current postType in its post type array.\n\t\t */\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst [ showStartPatterns, setShowStartPatterns ] = useState( true );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\tfunction handleClose() {\n\t\tonClose();\n\t\tsetPreference( 'core', 'enableChoosePatternModal', showStartPatterns );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ handleClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ handleClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-page-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ showStartPatterns }\n\t\t\t\t\t\tlabel={ __( 'Show starter patterns' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows starter patterns when creating a new page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetShowStartPatterns( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { isModalActive } = useSelect( interfaceStore );\n\tconst { enabled, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled && 'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\tuseEffect( () => {\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\t// Prevents immediately opening when features is enabled via preferences modal.\n\t\tconst isPreferencesModalActive = isModalActive( 'editor/preferences' );\n\t\tif ( ! enabled || ! isFreshPage || isPreferencesModalActive ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Open the modal after the initial render for a new page.\n\t\tsetIsOpen( true );\n\t}, [\n\t\tenabled,\n\t\tpostId,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t\tisModalActive,\n\t] );\n\n\tif ( ! isOpen ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsOpen( false ) } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,aAAa,QAAQ,uBAAuB;AAC5E,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AACzD,SAASC,2BAA2B,QAAQ,mBAAmB;AAC/D,SAASP,KAAK,IAAIQ,gBAAgB,QAAQ,wBAAwB;AAClE,SAASR,KAAK,IAAIS,cAAc,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAAST,KAAK,IAAIU,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnD,OAAO,SAASC,gBAAgBA,CAAA,EAAG;EAClC;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAGb,SAAS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E,EAAG,CAAC;;EAEP;EACA;EACAtB,SAAS,CAAE,MAAM;IAChB,MAAM0E,WAAW,GAAG,CAAEN,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE;IACA,MAAMM,wBAAwB,GAAGL,aAAa,CAAE,oBAAqB,CAAC;IACtE,IAAK,CAAEC,OAAO,IAAI,CAAEG,WAAW,IAAIC,wBAAwB,EAAG;MAC7D;IACD;;IAEA;IACAR,SAAS,CAAE,IAAK,CAAC;EAClB,CAAC,EAAE,CACFI,OAAO,EACPnC,MAAM,EACNgC,iBAAiB,EACjBC,iBAAiB,EACjBC,aAAa,CACZ,CAAC;EAEH,IAAK,CAAEJ,MAAM,EAAG;IACf,OAAO,IAAI;EACZ;EAEA,oBAAOrD,IAAA,CAAC8B,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMuB,SAAS,CAAE,KAAM;EAAG,CAAE,CAAC;AACtE","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","__next40pxDefaultSize","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACrE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,+BAA+B,IAAIC,iBAAiB,QAAQ,yB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AM8E,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVF,SAAS,EACTC,OACD,CAAC;IACD,MAAMI,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVH,SAAS,EACTC,OACD,CAAC;IAED,OAAO;MACNF,eAAe,EACd,CAAEM,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAC7D,OAAO,IAC7Bd,kBAAkB,KAAKuE,SAAS;MACjCjE,IAAI,EAAEqE,cAAc,CAACrE,IAAI;MACzBC,QAAQ,EAAEoE,cAAc,CAAC/D,SAAS;MAClCY,QAAQ,EAAE+C,SAAS;MACnBhD,MAAM,EAAEiD;IACT,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAEDjF,SAAS,CAAE,MAAM;IAChB;IACA8E,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAE7C,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAE+C,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACClE,IAAA,CAACoD,UAAU;IACVhD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrB+B,OAAO,EAAGA,CAAA,KAAMc,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","__next40pxDefaultSize","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,Q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B,CAAC,CAAC;IACtC,MAAMoD,OAAO,GAAGnD,gBAAgB,CAAC,CAAC;IAClC,MAAM;MAAEoD,qBAAqB;MAAEC;IAAwB,CAAC,GACvDlE,MAAM,CAAEX,SAAU,CAAC;IACpB,MAAM8E,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVF,SAAS,EACTC,OACD,CAAC;IACD,MAAMI,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVH,SAAS,EACTC,OACD,CAAC;IAED,OAAO;MACNF,eAAe,EACd,CAAEM,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAC7D,OAAO,IAC7Bd,kBAAkB,KAAKuE,SAAS;MACjCjE,IAAI,EAAEqE,cAAc,CAACrE,IAAI;MACzBC,QAAQ,EAAEoE,cAAc,CAAC/D,SAAS;MAClCY,QAAQ,EAAE+C,SAAS;MACnBhD,MAAM,EAAEiD;IACT,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAEDjF,SAAS,CAAE,MAAM;IAChB;IACA8E,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAE7C,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAE+C,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACClE,IAAA,CAACoD,UAAU;IACVhD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrB+B,OAAO,EAAGA,CAAA,KAAMc,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useMemo","store","blocksStore","blockEditorStore","privateApis","blockEditorPrivateApis","PanelBody","__","unlock","TEMPLATE_PART_POST_TYPE","editorStore","jsx","_jsx","BlockQuickNavigation","TemplatePartContentPanelInner","blockTypes","select","getBlockTypes","themeBlockNames","filter","blockType","category","map","name","themeBlocks","getBlocksByName","length","title","children","clientIds","TemplatePartContentPanel","postType","getCurrentPostType"],"sources":["@wordpress/editor/src/components/template-part-content-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nfunction TemplatePartContentPanelInner() {\n\tconst blockTypes = useSelect( ( select ) => {\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\treturn getBlockTypes();\n\t}, [] );\n\tconst themeBlockNames = useMemo( () => {\n\t\treturn blockTypes\n\t\t\t.filter( ( blockType ) => {\n\t\t\t\treturn blockType.category === 'theme';\n\t\t\t} )\n\t\t\t.map( ( { name } ) => name );\n\t}, [ blockTypes ] );\n\tconst themeBlocks = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByName } = select( blockEditorStore );\n\t\t\treturn getBlocksByName( themeBlockNames );\n\t\t},\n\t\t[ themeBlockNames ]\n\t);\n\tif ( themeBlocks.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t<BlockQuickNavigation clientIds={ themeBlocks } />\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartContentPanel() {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn getCurrentPostType();\n\t}, [] );\n\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\treturn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AAe,CAClB,CAAC;EACD,IAAKM,WAAW,CAACE,MAAM,KAAK,CAAC,EAAG;IAC/B,OAAO,IAAI;EACZ;EACA,oBACCd,IAAA,CAACN,SAAS;IAACqB,KAAK,EAAGpB,EAAE,CAAE,SAAU,CAAG;IAAAqB,QAAA,eACnChB,IAAA,CAACC,oBAAoB;MAACgB,SAAS,EAAGL;IAAa,CAAE;EAAC,CACxC,CAAC;AAEd;AAEA,eAAe,SAASM,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,QAAQ,GAAGhC,SAAS,CAAIiB,MAAM,IAAM;IACzC,MAAM;MAAEgB;IAAmB,CAAC,GAAGhB,MAAM,CAAEN,WAAY,CAAC;IACpD,OAAOsB,kBAAkB,CAAC,CAAC;EAC5B,CAAC,EAAE,EAAG,CAAC;EACP,IAAKD,QAAQ,KAAKtB,uBAAuB,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,oBAAOG,IAAA,CAACE,6BAA6B,IAAE,CAAC;AACzC","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useMemo","store","blocksStore","blockEditorStore","privateApis","blockEditorPrivateApis","PanelBody","__","unlock","TEMPLATE_PART_POST_TYPE","editorStore","jsx","_jsx","BlockQuickNavigation","TemplatePartContentPanelInner","blockTypes","select","getBlockTypes","themeBlockNames","filter","blockType","category","map","name","themeBlocks","getBlocksByName","length","title","children","clientIds","TemplatePartContentPanel","postType","getCurrentPostType"],"sources":["@wordpress/editor/src/components/template-part-content-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nfunction TemplatePartContentPanelInner() {\n\tconst blockTypes = useSelect( ( select ) => {\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\treturn getBlockTypes();\n\t}, [] );\n\tconst themeBlockNames = useMemo( () => {\n\t\treturn blockTypes\n\t\t\t.filter( ( blockType ) => {\n\t\t\t\treturn blockType.category === 'theme';\n\t\t\t} )\n\t\t\t.map( ( { name } ) => name );\n\t}, [ blockTypes ] );\n\tconst themeBlocks = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByName } = select( blockEditorStore );\n\t\t\treturn getBlocksByName( themeBlockNames );\n\t\t},\n\t\t[ themeBlockNames ]\n\t);\n\tif ( themeBlocks.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t<BlockQuickNavigation clientIds={ themeBlocks } />\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartContentPanel() {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn getCurrentPostType();\n\t}, [] );\n\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\treturn <TemplatePartContentPanelInner />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SACCD,KAAK,IAAIE,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASR,KAAK,IAAIS,WA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kB,CAAC,CAAC;EAC5B,CAAC,EAAE,EAAG,CAAC;EACP,IAAKD,QAAQ,KAAKtB,uBAAuB,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,oBAAOG,IAAA,CAACE,6BAA6B,IAAE,CAAC;AACzC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","editorStore","ThemeSupportCheck","children","supportKeys","postType","themeSupports","select","getEditedPostAttribute","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Checks if the current theme supports specific features and renders the children if supported.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The children to render if the theme supports the specified features.\n * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.\n *\n * @return {React.ReactNode} The rendered children if the theme supports the specified features, otherwise null.\n */\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAC5D,OAAO;MACNF,QAAQ,EAAEE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,MAAO,CAAC;MAChEF,aAAa,EAAEC,MAAM,CAAEP,SAAU,CAAC,CAACS,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAER,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DS,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGT,aAAa,GAAIQ,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEZ,QAAS,CAAC;IACtC;IACA,OAAOW,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOP,QAAQ;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","editorStore","ThemeSupportCheck","children","supportKeys","postType","themeSupports","select","getEditedPostAttribute","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Checks if the current theme supports specific features and renders the children if supported.\n *\n * @param {Object} props The component props.\n * @param {React.ReactNode} props.children The children to render if the theme supports the specified features.\n * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.\n *\n * @return {React.ReactNode} The rendered children if the theme supports the specified features, otherwise null.\n */\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAGR,SAAS,CAAIS,MAAM,IAAM;IAC5D,OAAO;MACNF,QAAQ,EAAEE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,MAAO,CAAC;MAChEF,aAAa,EAAEC,MAAM,CAAEP,SAAU,CAAC,CAACS,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAER,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DS,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGT,aAAa,GAAIQ,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEZ,QAAS,CAAC;IACtC;IACA,OAAOW,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOP,QAAQ;AAChB","ignoreList":[]}
@@ -82,7 +82,7 @@ export default function EditTemplateBlocksNotification({
82
82
  },
83
83
  onCancel: () => setIsDialogOpen(false),
84
84
  size: "medium",
85
- children: __('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?')
85
+ children: __('You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?')
86
86
  });
87
87
  }
88
88
  //# sourceMappingURL=edit-template-blocks-notification.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useEffect","useState","__","__experimentalConfirmDialog","ConfirmDialog","editorStore","jsx","_jsx","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","select","getEditorSettings","getCurrentTemplateId","canEditTemplate","canUser","kind","name","isDialogOpen","setIsDialogOpen","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","isOpen","confirmButtonText","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page content and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;;AAEpF;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;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AAU,EAAEX,cAAe,CAAC;IACtD,OAAO,MAAM;MACZS,MAAM,EAAEG,mBAAmB,CAAE,UAAU,EAAEZ,cAAe,CAAC;IAC1D,CAAC;EACF,CAAC,EAAE,CAAEZ,UAAU,EAAEM,eAAe,CAAG,CAAC;EAEpC,IAAK,CAAEA,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,oBACCR,IAAA,CAACH,aAAa;IACb8B,MAAM,EAAGf,YAAc;IACvBgB,iBAAiB,EAAGjC,EAAE,CAAE,eAAgB,CAAG;IAC3CkC,SAAS,EAAGA,CAAA,KAAM;MACjBhB,eAAe,CAAE,KAAM,CAAC;MACxBV,wBAAwB,CAAE;QACzB2B,MAAM,EAAE1B,UAAU;QAClB2B,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMnB,eAAe,CAAE,KAAM,CAAG;IAC3CoB,IAAI,EAAC,QAAQ;IAAAC,QAAA,EAEXvC,EAAE,CACH,6IACD;EAAC,CACa,CAAC;AAElB","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","useEffect","useState","__","__experimentalConfirmDialog","ConfirmDialog","editorStore","jsx","_jsx","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","select","getEditorSettings","getCurrentTemplateId","canEditTemplate","canUser","kind","name","isDialogOpen","setIsDialogOpen","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","isOpen","confirmButtonText","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page content and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;;AAEpF;AACA;AACA;AACA,SAASN,KAAK,IAAIO,WAAW,QAAQ,aAAa;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAbA,SAAAC,GAAA,IAAAC,IAAA;AAcA,eAAe,SAASC,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAGd,SAAS,CAAIe,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEP,WAAY,CAAC;IAEtB,OAAO;MACNK,wBAAwB,EACvBG,iBAAiB,CAAC,CAAC,CAACH,wBAAwB;MAC7CC,UAAU,EAAEG,oBAAoB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,eAAe,GAAGlB,SAAS,CAC9Be,MAAM,IACP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AAGA,CAAA,KAAMnB,eAAe,CAAE,KAAM,CAAG;IAC3CoB,IAAI,EAAC,QAAQ;IAAAC,QAAA,EAEXvC,EAAE,CACH,yIACD;EAAC,CACa,CAAC;AAElB","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useRefEffect","useSelect","useDispatch","store","blockEditorStore","unlock","DISTANCE_THRESHOLD","clamp","value","min","max","Math","distanceFromRect","x","y","rect","dx","left","right","dy","top","bottom","sqrt","useSelectNearestEditableBlock","isEnabled","getEnabledClientIdsTree","getBlockName","getBlockOrder","selectBlock","element","selectNearestEditableBlock","editableBlockClientIds","flatMap","clientId","blockName","innerBlocks","length","nearestDistance","Infinity","nearestClientId","block","querySelector","getBoundingClientRect","distance","handleClick","event","shouldSelect","target","classList","contains","clientX","clientY","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/visual-editor/use-select-nearest-editable-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst DISTANCE_THRESHOLD = 500;\n\nfunction clamp( value, min, max ) {\n\treturn Math.min( Math.max( value, min ), max );\n}\n\nfunction distanceFromRect( x, y, rect ) {\n\tconst dx = x - clamp( x, rect.left, rect.right );\n\tconst dy = y - clamp( y, rect.top, rect.bottom );\n\treturn Math.sqrt( dx * dx + dy * dy );\n}\n\nexport default function useSelectNearestEditableBlock( {\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock(\n\t\tuseSelect( blockEditorStore )\n\t);\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectNearestEditableBlock = ( x, y ) => {\n\t\t\t\tconst editableBlockClientIds =\n\t\t\t\t\tgetEnabledClientIdsTree().flatMap( ( { clientId } ) => {\n\t\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\t\tif ( blockName === 'core/template-part' ) {\n\t\t\t\t\t\t\treturn [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\t\tconst innerBlocks = getBlockOrder( clientId );\n\t\t\t\t\t\t\tif ( innerBlocks.length ) {\n\t\t\t\t\t\t\t\treturn innerBlocks;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [ clientId ];\n\t\t\t\t\t} );\n\n\t\t\t\tlet nearestDistance = Infinity,\n\t\t\t\t\tnearestClientId = null;\n\n\t\t\t\tfor ( const clientId of editableBlockClientIds ) {\n\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ clientId }\"]`\n\t\t\t\t\t);\n\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst rect = block.getBoundingClientRect();\n\t\t\t\t\tconst distance = distanceFromRect( x, y, rect );\n\t\t\t\t\tif (\n\t\t\t\t\t\tdistance < nearestDistance &&\n\t\t\t\t\t\tdistance < DISTANCE_THRESHOLD\n\t\t\t\t\t) {\n\t\t\t\t\t\tnearestDistance = distance;\n\t\t\t\t\t\tnearestClientId = clientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( nearestClientId ) {\n\t\t\t\t\tselectBlock( nearestClientId );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldSelect =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( shouldSelect ) {\n\t\t\t\t\tselectNearestEditableBlock( event.clientX, event.clientY );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAMC,kBAAkB,GAAG,GAAG;AAE9B,SAASC,KAAKA,CAAEC,KAAK,EAAEC,GAAG,EAAEC,GAAG,EAAG;EACjC,OAAOC,IAAI,CAACF,GAAG,CAAEE,IAAI,CAACD,GAAG,CAAEF,KAAK,EAAEC,GAAI,CAAC,EAAEC,GAAI,CAAC;AAC/C;AAEA,SAASE,gBAAgBA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAG;EACvC,MAAMC,EAAE,GAAGH,CAAC,GAAGN,KAAK,CAAEM,CAAC,EAAEE,IAAI,CAACE,IAAI,EAAEF,IAAI,CAACG,KAAM,CAAC;EAChD,MAAMC,EAAE,GAAGL,CAAC,GAAGP,KAAK,CAAEO,CAAC,EAAEC,IAAI,CAACK,GAAG,EAAEL,IAAI,CAACM,MAAO,CAAC;EAChD,OAAOV,IAAI,CAACW,IAAI,CAAEN,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAG,CAAC;AACtC;AAEA,eAAe,SAASI,6BAA6BA,CAAE;EACtDC,SAAS,GAAG;AACb,CAAC,GAAG,CAAC,CAAC,EAAG;EACR,MAAM;IAAEC,uBAAuB;IAAEC,YAAY;IAAEC;EAAc,CAAC,GAAGtB,MAAM,CACtEJ,SAAS,CAAEG,gBAAiB,CAC7B,CAAC;EACD,MAAM;IAAEwB;EAAY,CAAC,GAAG1B,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MAChC,MAAMC,YAAY,GACjBD,KAAK,CAACE,MAAM,KAAKlB,OAAO,IACxBgB,KAAK,CAACE,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAE,mBAAoB,CAAC;MACvD,IAAKH,YAAY,EAAG;QACnBhB,0BAA0B,CAAEe,KAAK,CAACK,OAAO,EAAEL,KAAK,CAACM,OAAQ,CAAC;MAC3D;IACD,CAAC;IAEDtB,OAAO,CAACuB,gBAAgB,CAAE,OAAO,EAAER,WAAY,CAAC;IAChD,OAAO,MAAMf,OAAO,CAACwB,mBAAmB,CAAE,OAAO,EAAET,WAAY,CAAC;EACjE,CAAC,EACD,CAAEpB,SAAS,CACZ,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["useRefEffect","useSelect","useDispatch","store","blockEditorStore","unlock","DISTANCE_THRESHOLD","clamp","value","min","max","Math","distanceFromRect","x","y","rect","dx","left","right","dy","top","bottom","sqrt","useSelectNearestEditableBlock","isEnabled","getEnabledClientIdsTree","getBlockName","getBlockOrder","selectBlock","element","selectNearestEditableBlock","editableBlockClientIds","flatMap","clientId","blockName","innerBlocks","length","nearestDistance","Infinity","nearestClientId","block","querySelector","getBoundingClientRect","distance","handleClick","event","shouldSelect","target","classList","contains","clientX","clientY","addEventListener","removeEventListener"],"sources":["@wordpress/editor/src/components/visual-editor/use-select-nearest-editable-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRefEffect } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst DISTANCE_THRESHOLD = 500;\n\nfunction clamp( value, min, max ) {\n\treturn Math.min( Math.max( value, min ), max );\n}\n\nfunction distanceFromRect( x, y, rect ) {\n\tconst dx = x - clamp( x, rect.left, rect.right );\n\tconst dy = y - clamp( y, rect.top, rect.bottom );\n\treturn Math.sqrt( dx * dx + dy * dy );\n}\n\nexport default function useSelectNearestEditableBlock( {\n\tisEnabled = true,\n} = {} ) {\n\tconst { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock(\n\t\tuseSelect( blockEditorStore )\n\t);\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn useRefEffect(\n\t\t( element ) => {\n\t\t\tif ( ! isEnabled ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectNearestEditableBlock = ( x, y ) => {\n\t\t\t\tconst editableBlockClientIds =\n\t\t\t\t\tgetEnabledClientIdsTree().flatMap( ( { clientId } ) => {\n\t\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\t\tif ( blockName === 'core/template-part' ) {\n\t\t\t\t\t\t\treturn [];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( blockName === 'core/post-content' ) {\n\t\t\t\t\t\t\tconst innerBlocks = getBlockOrder( clientId );\n\t\t\t\t\t\t\tif ( innerBlocks.length ) {\n\t\t\t\t\t\t\t\treturn innerBlocks;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn [ clientId ];\n\t\t\t\t\t} );\n\n\t\t\t\tlet nearestDistance = Infinity,\n\t\t\t\t\tnearestClientId = null;\n\n\t\t\t\tfor ( const clientId of editableBlockClientIds ) {\n\t\t\t\t\tconst block = element.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ clientId }\"]`\n\t\t\t\t\t);\n\t\t\t\t\tif ( ! block ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst rect = block.getBoundingClientRect();\n\t\t\t\t\tconst distance = distanceFromRect( x, y, rect );\n\t\t\t\t\tif (\n\t\t\t\t\t\tdistance < nearestDistance &&\n\t\t\t\t\t\tdistance < DISTANCE_THRESHOLD\n\t\t\t\t\t) {\n\t\t\t\t\t\tnearestDistance = distance;\n\t\t\t\t\t\tnearestClientId = clientId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( nearestClientId ) {\n\t\t\t\t\tselectBlock( nearestClientId );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst handleClick = ( event ) => {\n\t\t\t\tconst shouldSelect =\n\t\t\t\t\tevent.target === element ||\n\t\t\t\t\tevent.target.classList.contains( 'is-root-container' );\n\t\t\t\tif ( shouldSelect ) {\n\t\t\t\t\tselectNearestEditableBlock( event.clientX, event.clientY );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\telement.addEventListener( 'click', handleClick );\n\t\t\treturn () => element.removeEventListener( 'click', handleClick );\n\t\t},\n\t\t[ isEnabled ]\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAMC,kBAAkB,GAAG,GAAG;AAE9B,SAASC,KAAKA,CAAEC,KAAK,EAAEC,GAAG,EAAEC,GAAG,EAAG;EACjC,OAAOC,IAAI,CAACF,GAAG,CAAEE,IAAI,CAACD,GAAG,CAAEF,KAAK,EAAEC,GAAI,CAAC,EAAEC,GAAI,CAAC;AAC/C;AAEA,SAASE,gBAAgBA,CAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAG;EACvC,MAAMC,EAAE,GAAGH,CAAC,GAAGN,KAAK,CAAEM,CAAC,EAAEE,IAAI,CAACE,IAAI,EAAEF,IAAI,CAACG,KAAM,CAAC;EAChD,MAAMC,EAAE,GAAGL,CAAC,GAAGP,KAAK,CAAEO,CAAC,EAAEC,IAAI,CAACK,GAAG,EAAEL,IAAI,CAACM,MAAO,CAAC;EAChD,OAAOV,IAAI,CAACW,IAAI,CAAEN,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAG,CAAC;AACtC;AAEA,eAAe,SAASI,6BAA6BA,CAAE;EAC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GAAGrC,kBAAkB,EAC5B;UACD+B,eAAe,GAAGM,QAAQ;UAC1BJ,eAAe,GAAGN,QAAQ;QAC3B;MACD;MAEA,IAAKM,eAAe,EAAG;QACtBX,WAAW,CAAEW,eAAgB,CAAC;MAC/B;IACD,CAAC;IAED,MAAMK,WAAW,GAAKC,KAAK,IAAM;MAChC,MAAMC,YAAY,GACjBD,KAAK,CAACE,MAAM,KAAKlB,OAAO,IACxBgB,KAAK,CAACE,MAAM,CAACC,SAAS,CAACC,QAAQ,CAAE,mBAAoB,CAAC;MACvD,IAAKH,YAAY,EAAG;QACnBhB,0BAA0B,CAAEe,KAAK,CAACK,OAAO,EAAEL,KAAK,CAACM,OAAQ,CAAC;MAC3D;IACD,CAAC;IAEDtB,OAAO,CAACuB,gBAAgB,CAAE,OAAO,EAAER,WAAY,CAAC;IAChD,OAAO,MAAMf,OAAO,CAACwB,mBAAmB,CAAE,OAAO,EAAET,WAAY,CAAC;EACjE,CAAC,EACD,CAAEpB,SAAS,CACZ,CAAC;AACF","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["store","coreStore","doAction","viewPost","viewPostRevisions","duplicatePost","duplicatePattern","reorderPage","exportPattern","permanentlyDeletePost","restorePost","trashPost","renamePost","resetPost","deletePost","duplicateTemplatePart","featuredImageField","dateField","parentField","passwordField","commentStatusField","slugField","statusField","authorField","titleField","templateField","templateTitleField","pageTitleField","patternTitleField","editorStore","postPreviewField","unlock","registerEntityAction","kind","name","config","type","unregisterEntityAction","actionId","registerEntityField","unregisterEntityField","fieldId","setIsReady","registerPostTypeSchema","postType","registry","isReady","select","isEntityReady","dispatch","postTypeConfig","resolveSelect","getPostType","canCreate","canUser","currentTheme","getCurrentTheme","actions","viewable","undefined","supports","revisions","globalThis","IS_GUTENBERG_PLUGIN","includes","slug","is_block_theme","title","filter","Boolean","fields","thumbnail","theme_supports","author","comments","editor","_titleField","push","batch","forEach","action","field"],"sources":["@wordpress/editor/src/dataviews/store/private-actions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n} from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\t\t\tpostTypeConfig.slug\n\t\t\t\t ) &&\n\t\t\t\t canCreate &&\n\t\t\t\t duplicatePost\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\tconst fields = [\n\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\tfeaturedImageField,\n\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\tstatusField,\n\t\t\tdateField,\n\t\t\tslugField,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\ttemplateField,\n\t\t\tpasswordField,\n\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\tpostPreviewField,\n\t\t].filter( Boolean );\n\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\tlet _titleField;\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\t_titleField = pageTitleField;\n\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t_titleField = templateTitleField;\n\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t_titleField = patternTitleField;\n\t\t\t} else {\n\t\t\t\t_titleField = titleField;\n\t\t\t}\n\t\t\tfields.push( _titleField );\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAEzD,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SACCC,QAAQ,EACRC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,iBAAiB,QACX,mBAAmB;;AAE1B;AACA;AACA;AACA,SAAS5B,KAAK,IAAI6B,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,2BAA2B;AACxD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,oBAAoBA,CACnCC,IAAY,EACZC,IAAY,EACZC,MAAsB,EACrB;EACD,OAAO;IACNC,IAAI,EAAE,wBAAiC;IACvCH,IAAI;IACJC,IAAI;IACJC;EACD,CAAC;AACF;AAEA,OAAO,SAASE,sBAAsBA,CACrCJ,IAAY,EACZC,IAAY,EACZI,QAAgB,EACf;EACD,OAAO;IACNF,IAAI,EAAE,0BAAmC;IACzCH,IAAI;IACJC,IAAI;IACJI;EACD,CAAC;AACF;AAEA,OAAO,SAASC,mBAAmBA,CAClCN,IAAY,EACZC,IAAY,EACZC,MAAqB,EACpB;EACD,OAAO;IACNC,IAAI,EAAE,uBAAgC;IACtCH,IAAI;IACJC,IAAI;IACJC;EACD,CAAC;AACF;AAEA,OAAO,SAASK,qBAAqBA,CACpCP,IAAY,EACZC,IAAY,EACZO,OAAe,EACd;EAC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AK,aAAa,EAAG;MACxCgC,WAAW,GAAGlD,kBAAkB;IACjC,CAAC,MAAM,IAAKkB,QAAQ,KAAK,UAAU,EAAG;MACrCgC,WAAW,GAAGhD,iBAAiB;IAChC,CAAC,MAAM;MACNgD,WAAW,GAAGpD,UAAU;IACzB;IACA8C,MAAM,CAACO,IAAI,CAAED,WAAY,CAAC;EAC3B;EAEA/B,QAAQ,CAACiC,KAAK,CAAE,MAAM;IACrBrB,OAAO,CAACsB,OAAO,CAAIC,MAAM,IAAM;MAC9BjD,MAAM,CAAEc,QAAQ,CAACI,QAAQ,CAAEpB,WAAY,CAAE,CAAC,CAACG,oBAAoB,CAC9D,UAAU,EACVY,QAAQ,EACRoC,MACD,CAAC;IACF,CAAE,CAAC;IACHV,MAAM,CAACS,OAAO,CAAIE,KAAK,IAAM;MAC5BlD,MAAM,CAAEc,QAAQ,CAACI,QAAQ,CAAEpB,WAAY,CAAE,CAAC,CAACU,mBAAmB,CAC7D,UAAU,EACVK,QAAQ,EACRqC,KACD,CAAC;IACF,CAAE,CAAC;EACJ,CAAE,CAAC;EAEH/E,QAAQ,CAAE,6BAA6B,EAAE0C,QAAS,CAAC;AACpD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["store","coreStore","doAction","viewPost","viewPostRevisions","duplicatePost","duplicatePattern","reorderPage","exportPattern","permanentlyDeletePost","restorePost","trashPost","renamePost","resetPost","deletePost","duplicateTemplatePart","featuredImageField","dateField","parentField","passwordField","commentStatusField","slugField","statusField","authorField","titleField","templateField","templateTitleField","pageTitleField","patternTitleField","editorStore","postPreviewField","unlock","registerEntityAction","kind","name","config","type","unregisterEntityAction","actionId","registerEntityField","unregisterEntityField","fieldId","setIsReady","registerPostTypeSchema","postType","registry","isReady","select","isEntityReady","dispatch","postTypeConfig","resolveSelect","getPostType","canCreate","canUser","currentTheme","getCurrentTheme","actions","viewable","undefined","supports","revisions","globalThis","IS_GUTENBERG_PLUGIN","includes","slug","is_block_theme","title","filter","Boolean","fields","thumbnail","theme_supports","author","comments","editor","_titleField","push","batch","forEach","action","field"],"sources":["@wordpress/editor/src/dataviews/store/private-actions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action, Field } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\nimport type { PostType } from '@wordpress/fields';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n\tduplicateTemplatePart,\n\tfeaturedImageField,\n\tdateField,\n\tparentField,\n\tpasswordField,\n\tcommentStatusField,\n\tslugField,\n\tstatusField,\n\tauthorField,\n\ttitleField,\n\ttemplateField,\n\ttemplateTitleField,\n\tpageTitleField,\n\tpatternTitleField,\n} from '@wordpress/fields';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport postPreviewField from '../fields/content-preview';\nimport { unlock } from '../../lock-unlock';\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function registerEntityField< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Field< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityField(\n\tkind: string,\n\tname: string,\n\tfieldId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_FIELD' as const,\n\t\tkind,\n\t\tname,\n\t\tfieldId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\nexport const registerPostTypeSchema =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\t\t\tpostTypeConfig.slug\n\t\t\t\t ) &&\n\t\t\t\t canCreate &&\n\t\t\t\t duplicatePost\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t].filter( Boolean );\n\n\t\tconst fields = [\n\t\t\tpostTypeConfig.supports?.thumbnail &&\n\t\t\t\tcurrentTheme?.theme_supports?.[ 'post-thumbnails' ] &&\n\t\t\t\tfeaturedImageField,\n\t\t\tpostTypeConfig.supports?.author && authorField,\n\t\t\tstatusField,\n\t\t\tdateField,\n\t\t\tslugField,\n\t\t\tpostTypeConfig.supports?.[ 'page-attributes' ] && parentField,\n\t\t\tpostTypeConfig.supports?.comments && commentStatusField,\n\t\t\ttemplateField,\n\t\t\tpasswordField,\n\t\t\tpostTypeConfig.supports?.editor &&\n\t\t\t\tpostTypeConfig.viewable &&\n\t\t\t\tpostPreviewField,\n\t\t].filter( Boolean );\n\t\tif ( postTypeConfig.supports?.title ) {\n\t\t\tlet _titleField;\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\t_titleField = pageTitleField;\n\t\t\t} else if ( postType === 'wp_template' ) {\n\t\t\t\t_titleField = templateTitleField;\n\t\t\t} else if ( postType === 'wp_block' ) {\n\t\t\t\t_titleField = patternTitleField;\n\t\t\t} else {\n\t\t\t\t_titleField = titleField;\n\t\t\t}\n\t\t\tfields.push( _titleField );\n\t\t}\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t\tfields.forEach( ( field ) => {\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityField(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tfield\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeSchema', postType );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AAEzD,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,SACCC,QAAQ,EACRC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,qBAAqB,EACrBC,WAAW,EACXC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,SAAS,EACTC,WAAW,EACXC,WAAW,EACXC,UAAU,EACVC,aAAa,EACbC,kBAAkB,EAClBC,cAAc,EACdC,iBAAiB,QACX,mBAAmB;;AAE1B;AACA;AACA;AACA,SAAS5B,KAAK,IAAI6B,WAAW,QAAQ,aAAa;AAClD,OAAOC,gBAAgB,MAAM,2BAA2B;AACxD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,OAAO,SAASC,oBAAoBA,CACnCC,IAAY,EACZC,IAAY,EACZC,MAAsB,EACrB;EACD,OAAO;IACNC,IAAI,EAAE,wBAAiC;IACvCH,IAAI;IACJC,IAAI;IACJC;EACD,CAAC;AACF;AAEA,OAAO,SAASE,sBAAsBA,CACrCJ,IAAY,EACZC,IAAY,EACZI,QAAgB,EACf;EACD,OAAO;IACNF,IAAI,EAAE,0BAAmC;IACzCH,IAAI;IACJC,IAAI;IACJI;EACD,CAAC;AACF;AAEA,OAAO,SAASC,mBAAmBA,CAClCN,IAAY,EACZC,IAAY,EACZC,MAAqB,EACpB;EACD,OAAO;IACNC,IAAI,EAAE,uBAAgC;IACtCH,IAAI;IACJC,IAAI;IACJC;EACD,CAAC;AACF;AAEA,OAAO,SAASK,qBAAqBA,CACpCP,IAAY,EACZC,IAAY,EACZO,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iB,QAAQ,KAAK,aAAa,EAAG;MACxCgC,WAAW,GAAGlD,kBAAkB;IACjC,CAAC,MAAM,IAAKkB,QAAQ,KAAK,UAAU,EAAG;MACrCgC,WAAW,GAAGhD,iBAAiB;IAChC,CAAC,MAAM;MACNgD,WAAW,GAAGpD,UAAU;IACzB;IACA8C,MAAM,CAACO,IAAI,CAAED,WAAY,CAAC;EAC3B;EAEA/B,QAAQ,CAACiC,KAAK,CAAE,MAAM;IACrBrB,OAAO,CAACsB,OAAO,CAAIC,MAAM,IAAM;MAC9BjD,MAAM,CAAEc,QAAQ,CAACI,QAAQ,CAAEpB,WAAY,CAAE,CAAC,CAACG,oBAAoB,CAC9D,UAAU,EACVY,QAAQ,EACRoC,MACD,CAAC;IACF,CAAE,CAAC;IACHV,MAAM,CAACS,OAAO,CAAIE,KAAK,IAAM;MAC5BlD,MAAM,CAAEc,QAAQ,CAACI,QAAQ,CAAEpB,WAAY,CAAE,CAAC,CAACU,mBAAmB,CAC7D,UAAU,EACVK,QAAQ,EACRqC,KACD,CAAC;IACF,CAAE,CAAC;EACJ,CAAE,CAAC;EAEH/E,QAAQ,CAAE,6BAA6B,EAAE0C,QAAS,CAAC;AACpD,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["combineReducers","isReady","state","action","type","kind","name","actions","_state$action$kind$ac","filter","_action","id","config","_state$action$kind$ac2","actionId","fields","_state$action$kind$ac3","_state$action$kind$ac4","_field","fieldId"],"sources":["@wordpress/editor/src/dataviews/store/reducer.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport type { Action, Field } from '@wordpress/dataviews';\n\ntype ReduxAction =\n\t| ReturnType< typeof import('./private-actions').registerEntityAction >\n\t| ReturnType< typeof import('./private-actions').unregisterEntityAction >\n\t| ReturnType< typeof import('./private-actions').registerEntityField >\n\t| ReturnType< typeof import('./private-actions').unregisterEntityField >\n\t| ReturnType< typeof import('./private-actions').setIsReady >;\n\nexport type ActionState = Record< string, Record< string, Action< any >[] > >;\nexport type FieldsState = Record< string, Record< string, Field< any >[] > >;\nexport type ReadyState = Record< string, Record< string, boolean > >;\nexport type State = {\n\tactions: ActionState;\n\tfields: FieldsState;\n\tisReady: ReadyState;\n};\n\nfunction isReady( state: ReadyState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_READY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: true,\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nfunction actions( state: ActionState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ENTITY_ACTION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: [\n\t\t\t\t\t\t...(\n\t\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t( _action ) => _action.id !== action.config.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\taction.config,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_ENTITY_ACTION': {\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: (\n\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t).filter( ( _action ) => _action.id !== action.actionId ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\nfunction fields( state: FieldsState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ENTITY_FIELD':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: [\n\t\t\t\t\t\t...(\n\t\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t( _field ) => _field.id !== action.config.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\taction.config,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_ENTITY_FIELD':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: (\n\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t).filter( ( _field ) => _field.id !== action.fieldId ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tactions,\n\tfields,\n\tisReady,\n} );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AAmBjD,SAASC,OAAOA,CAAEC,KAAiB,GAAG,CAAC,CAAC,EAAEC,MAAmB,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,cAAc;MAClB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChB,GAAGH,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE;UACvB,CAAEF,MAAM,CAACG,IAAI,GAAI;QAClB;MACD,CAAC;EACH;EAEA,OAAOJ,KAAK;AACb;AAEA,SAASK,OAAOA,CAAEL,KAAkB,GAAG,CAAC,CAAC,EAAEC,MAAmB,EAAG;EAAA,IAAAK,qBAAA;EAChE,QAASL,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,G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AACG,IAAI,CAAE,cAAAU,sBAAA,cAAAA,sBAAA,GAAI,EAAE,EAC1CP,MAAM,CACLS,MAAM,IAAMA,MAAM,CAACP,EAAE,KAAKR,MAAM,CAACS,MAAM,CAACD,EAC3C,CAAC,EACDR,MAAM,CAACS,MAAM;QAEf;MACD,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGV,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChB,GAAGH,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE;UACvB,CAAEF,MAAM,CAACG,IAAI,GAAI,EAAAW,sBAAA,GAChBf,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE,GAAIF,MAAM,CAACG,IAAI,CAAE,cAAAW,sBAAA,cAAAA,sBAAA,GAAI,EAAE,EAC1CR,MAAM,CAAIS,MAAM,IAAMA,MAAM,CAACP,EAAE,KAAKR,MAAM,CAACgB,OAAQ;QACtD;MACD,CAAC;EACH;EAEA,OAAOjB,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,OAAO;EACPQ,MAAM;EACNd;AACD,CAAE,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["combineReducers","isReady","state","action","type","kind","name","actions","_state$action$kind$ac","filter","_action","id","config","_state$action$kind$ac2","actionId","fields","_state$action$kind$ac3","_state$action$kind$ac4","_field","fieldId"],"sources":["@wordpress/editor/src/dataviews/store/reducer.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\nimport type { Action, Field } from '@wordpress/dataviews';\n\ntype ReduxAction =\n\t| ReturnType< typeof import('./private-actions').registerEntityAction >\n\t| ReturnType< typeof import('./private-actions').unregisterEntityAction >\n\t| ReturnType< typeof import('./private-actions').registerEntityField >\n\t| ReturnType< typeof import('./private-actions').unregisterEntityField >\n\t| ReturnType< typeof import('./private-actions').setIsReady >;\n\nexport type ActionState = Record< string, Record< string, Action< any >[] > >;\nexport type FieldsState = Record< string, Record< string, Field< any >[] > >;\nexport type ReadyState = Record< string, Record< string, boolean > >;\nexport type State = {\n\tactions: ActionState;\n\tfields: FieldsState;\n\tisReady: ReadyState;\n};\n\nfunction isReady( state: ReadyState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_READY':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: true,\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nfunction actions( state: ActionState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ENTITY_ACTION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: [\n\t\t\t\t\t\t...(\n\t\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t( _action ) => _action.id !== action.config.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\taction.config,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_ENTITY_ACTION': {\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: (\n\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t).filter( ( _action ) => _action.id !== action.actionId ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n\nfunction fields( state: FieldsState = {}, action: ReduxAction ) {\n\tswitch ( action.type ) {\n\t\tcase 'REGISTER_ENTITY_FIELD':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: [\n\t\t\t\t\t\t...(\n\t\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t( _field ) => _field.id !== action.config.id\n\t\t\t\t\t\t),\n\t\t\t\t\t\taction.config,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\tcase 'UNREGISTER_ENTITY_FIELD':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.kind ]: {\n\t\t\t\t\t...state[ action.kind ],\n\t\t\t\t\t[ action.name ]: (\n\t\t\t\t\t\tstate[ action.kind ]?.[ action.name ] ?? []\n\t\t\t\t\t).filter( ( _field ) => _field.id !== action.fieldId ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tactions,\n\tfields,\n\tisReady,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,iBAAiB;AAmBjD,SAASC,OAAOA,CAAEC,KAAiB,GAAG,CAAC,CAAC,EAAEC,MAAmB,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,cAAc;MAClB,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChB,GAAGH,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE;UACvB,CAAEF,MAAM,CAACG,IAAI,GAAI;QAClB;MACD,CAAC;EACH;EAEA,OAAOJ,KAAK;AACb;AAEA,SAASK,OAAOA,CAAEL,KAAkB,GAAG,CAAC,CAAC,EAAEC,MAAmB,EAAG;EAAA,IAAAK,qBAAA;EAChE,QAASL,MAAM,CAACC,IAAI;IACnB,KAAK,wBAAwB;MAC5B,OAAO;QACN,GAAGF,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChB,GAAGH,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE;UACvB,CAAEF,MAAM,CAACG,IAAI,GAAI,CAChB,GAAG,EAAAE,qBAAA,GACFN,KAAK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AAM,CAACD,EAC3C,CAAC,EACDR,MAAM,CAACS,MAAM;QAEf;MACD,CAAC;IACF,KAAK,yBAAyB;MAC7B,OAAO;QACN,GAAGV,KAAK;QACR,CAAEC,MAAM,CAACE,IAAI,GAAI;UAChB,GAAGH,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE;UACvB,CAAEF,MAAM,CAACG,IAAI,GAAI,EAAAW,sBAAA,GAChBf,KAAK,CAAEC,MAAM,CAACE,IAAI,CAAE,GAAIF,MAAM,CAACG,IAAI,CAAE,cAAAW,sBAAA,cAAAA,sBAAA,GAAI,EAAE,EAC1CR,MAAM,CAAIS,MAAM,IAAMA,MAAM,CAACP,EAAE,KAAKR,MAAM,CAACgB,OAAQ;QACtD;MACD,CAAC;EACH;EAEA,OAAOjB,KAAK;AACb;AAEA,eAAeF,eAAe,CAAE;EAC/BO,OAAO;EACPQ,MAAM;EACNd;AACD,CAAE,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","store","editorStore","jsx","_jsx","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","_settings$attributes","source","edit"],"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\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\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n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6B,mBACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","store","editorStore","jsx","_jsx","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","select","getCurrentPostType","meta","setMeta","mergedAttributes","Object","fromEntries","entries","map","attributeKey","metaKey","nextAttributes","nextMeta","filter","key","value","length","shimAttributeSource","settings","_settings$attributes","source","edit"],"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...Object.fromEntries(\n\t\t\t\t\t\t\tObject.entries( metaAttributes ).map(\n\t\t\t\t\t\t\t\t( [ attributeKey, metaKey ] ) => [\n\t\t\t\t\t\t\t\t\tattributeKey,\n\t\t\t\t\t\t\t\t\tmeta[ metaKey ],\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\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.entries( nextMeta ).length ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = Object.fromEntries(\n\t\tObject.entries( settings.attributes ?? {} )\n\t\t\t.filter( ( [ , { source } ] ) => source === 'meta' )\n\t\t\t.map( ( [ attributeKey, { meta } ] ) => [ attributeKey, meta ] )\n\t);\n\tif ( Object.entries( metaAttributes ).length ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,UAAU;;AAE/C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA,SAAAC,GAAA,IAAAC,IAAA;AAUA,MAAMC,6BAA6B,GAAKC,cAAc,IACrDP,0BAA0B,CACvBQ,SAAS,IACV,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAE,GAAGC;AAAM,CAAC,KAAM;EAC9C,MAAMC,QAAQ,GAAGf,SAAS,CACvBgB,MAAM,IAAMA,MAAM,CAAEV,WAAY,CAAC,CAACW,kBAAkB,CAAC,CAAC,EAC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CAACC,WAAW,CACxCD,MAAM,CAACE,OAAO,EAAAY,oBAAA,GAAED,QAAQ,CAACtB,UAAU,cAAAuB,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAE,CAAC,CACzCN,MAAM,CAAE,CAAE,GAAI;IAAEO;EAAO,CAAC,CAAE,KAAMA,MAAM,KAAK,MAAO,CAAC,CACnDZ,GAAG,CAAE,CAAE,CAAEC,YAAY,EAAE;IAAEP;EAAK,CAAC,CAAE,KAAM,CAAEO,YAAY,EAAEP,IAAI,CAAG,CACjE,CAAC;EACD,IAAKG,MAAM,CAACE,OAAO,CAAEb,cAAe,CAAC,CAACsB,MAAM,EAAG;IAC9CE,QAAQ,CAACG,IAAI,GAAG5B,6BAA6B,CAAEC,cAAe,CAAC,CAC9DwB,QAAQ,CAACG,IACV,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB;AAEA9B,SAAS,CACR,0BAA0B,EAC1B,0EAA0E,EAC1E6B,mBACD,CAAC","ignoreList":[]}
@@ -1,4 +1,3 @@
1
- /* wp:polyfill */
2
1
  /**
3
2
  * WordPress dependencies
4
3
  */
@@ -1 +1 @@
1
- {"version":3,"names":["addFilter","privateApis","patternsPrivateApis","createHigherOrderComponent","useBlockEditingMode","useSelect","getBlockBindingsSource","store","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","withPatternOverrideControls","BlockEdit","props","isSupportedBlock","name","children","isSelected","ControlsWithStoreSubscription","blockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","select","getCurrentPostType","getEditedPostAttribute","user","wp_pattern_sync_status","unsynced","bindings","attributes","metadata","hasPatternBindings","Object","values","some","binding","source","shouldShowPatternOverridesControls","shouldShowResetOverridesControl"],"sources":["@wordpress/editor/src/hooks/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\nconst {\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPatternOverrideControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock =\n\t\t\t!! PARTIAL_SYNCING_SUPPORTED_BLOCKS[ props.name ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t\t{ isSupportedBlock && <PatternOverridesBlockControls /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withPatternOverrideControls'\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t\tisEditingSyncedPattern:\n\t\t\t\t\tgetCurrentPostType() === PATTERN_TYPES.user &&\n\t\t\t\t\tgetEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced &&\n\t\t\t\t\tgetEditedPostAttribute( 'wp_pattern_sync_status' ) !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst bindings = props.attributes.metadata?.bindings;\n\tconst hasPatternBindings =\n\t\t!! bindings &&\n\t\tObject.values( bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst shouldShowPatternOverridesControls =\n\t\tisEditingSyncedPattern && blockEditingMode === 'default';\n\tconst shouldShowResetOverridesControl =\n\t\t! isEditingSyncedPattern &&\n\t\t!! props.attributes.metadata?.name &&\n\t\tblockEditingMode !== 'disabled' &&\n\t\thasPatternBindings;\n\n\tif ( ! hasPatternOverridesSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldShowPatternOverridesControls && (\n\t\t\t\t<PatternOverridesControls { ...props } />\n\t\t\t) }\n\t\t\t{ shouldShowResetOverridesControl && (\n\t\t\t\t<ResetOverridesControl { ...props } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-pattern-override-controls',\n\twithPatternOverrideControls\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,SAAS,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CACnD,wBACD,CAAC;MACD0B,sBAAsB,EACrBE,kBAAkB,CAAC,CAAC,KAAKf,aAAa,CAACiB,IAAI,IAC3CD,sBAAsB,CAAE,MAAO,CAAC,EAAEE,sBAAsB,KACvDhB,kBAAkB,CAACiB,QAAQ,IAC5BH,sBAAsB,CAAE,wBAAyB,CAAC,KACjDd,kBAAkB,CAACiB;IACtB,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAMC,QAAQ,GAAGf,KAAK,CAACgB,UAAU,CAACC,QAAQ,EAAEF,QAAQ;EACpD,MAAMG,kBAAkB,GACvB,CAAC,CAAEH,QAAQ,IACXI,MAAM,CAACC,MAAM,CAAEL,QAAS,CAAC,CAACM,IAAI,CAC3BC,OAAO,IAAMA,OAAO,CAACC,MAAM,KAAK,wBACnC,CAAC;EAEF,MAAMC,kCAAkC,GACvChB,sBAAsB,IAAIF,gBAAgB,KAAK,SAAS;EACzD,MAAMmB,+BAA+B,GACpC,CAAEjB,sBAAsB,IACxB,CAAC,CAAER,KAAK,CAACgB,UAAU,CAACC,QAAQ,EAAEf,IAAI,IAClCI,gBAAgB,KAAK,UAAU,IAC/BY,kBAAkB;EAEnB,IAAK,CAAEX,yBAAyB,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,oBACChB,KAAA,CAAAF,SAAA;IAAAc,QAAA,GACGqB,kCAAkC,iBACnCrC,IAAA,CAACK,wBAAwB;MAAA,GAAMQ;IAAK,CAAI,CACxC,EACCyB,+BAA+B,iBAChCtC,IAAA,CAACM,qBAAqB;MAAA,GAAMO;IAAK,CAAI,CACrC;EAAA,CACA,CAAC;AAEL;AAEAxB,SAAS,CACR,kBAAkB,EAClB,4CAA4C,EAC5CsB,2BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["addFilter","privateApis","patternsPrivateApis","createHigherOrderComponent","useBlockEditingMode","useSelect","getBlockBindingsSource","store","editorStore","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","withPatternOverrideControls","BlockEdit","props","isSupportedBlock","name","children","isSelected","ControlsWithStoreSubscription","blockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","select","getCurrentPostType","getEditedPostAttribute","user","wp_pattern_sync_status","unsynced","bindings","attributes","metadata","hasPatternBindings","Object","values","some","binding","source","shouldShowPatternOverridesControls","shouldShowResetOverridesControl"],"sources":["@wordpress/editor/src/hooks/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\nconst {\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPatternOverrideControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock =\n\t\t\t!! PARTIAL_SYNCING_SUPPORTED_BLOCKS[ props.name ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t\t{ isSupportedBlock && <PatternOverridesBlockControls /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withPatternOverrideControls'\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t\tisEditingSyncedPattern:\n\t\t\t\t\tgetCurrentPostType() === PATTERN_TYPES.user &&\n\t\t\t\t\tgetEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced &&\n\t\t\t\t\tgetEditedPostAttribute( 'wp_pattern_sync_status' ) !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst bindings = props.attributes.metadata?.bindings;\n\tconst hasPatternBindings =\n\t\t!! bindings &&\n\t\tObject.values( bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst shouldShowPatternOverridesControls =\n\t\tisEditingSyncedPattern && blockEditingMode === 'default';\n\tconst shouldShowResetOverridesControl =\n\t\t! isEditingSyncedPattern &&\n\t\t!! props.attributes.metadata?.name &&\n\t\tblockEditingMode !== 'disabled' &&\n\t\thasPatternBindings;\n\n\tif ( ! hasPatternOverridesSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldShowPatternOverridesControls && (\n\t\t\t\t<PatternOverridesControls { ...props } />\n\t\t\t) }\n\t\t\t{ shouldShowResetOverridesControl && (\n\t\t\t\t<ResetOverridesControl { ...props } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-pattern-override-controls',\n\twithPatternOverrideControls\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,sBAAsB,QAAQ,mBAAmB;;AAE1D;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,UAAU;AAC/C,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEA,MAAM;EACLC,wBAAwB;EACxBC,qBAAqB;EACrBC,6BAA6B;EAC7BC,aAAa;EACbC,gCAAgC;EAChCC;AACD,CAAC,GAAGZ,MAAM,CAAEP,mBAAoB,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMoB,2BAA2B,GAAGnB,0BAA0B,CAC3DoB,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GACrB,CAAC,CAAEL,gCAAgC,CAAEI,KAAK,CAACE,IAAI,CAAE;EAElD,oBACCX,KAAA,CAAAF,SAAA;IAAAc,QAAA,gBACChB,IAAA,CAACY,SAAS;MAAA,GAAiBC;IAAK,GAAjB,MAAqB,CAAC,EACnCA,KAAK,CAACI,UAAU,IAAIH,gBAAgB,iBACrCd,IAAA,CAACkB,6BAA6B;MAAA,GAAML;IAAK,CAAI,CAC7C,EACCC,gBAAgB,iBAAId,IAAA,CAACO,6BAA6B,IAAE,CAA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