@wordpress/edit-site 5.13.0 → 5.15.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 (646) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-page/index.js +2 -13
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +29 -15
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/new-template.js +69 -14
  9. package/build/components/add-new-template/new-template.js.map +1 -1
  10. package/build/components/add-new-template/utils.js +10 -8
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/block-editor/constants.js +1 -1
  13. package/build/components/block-editor/constants.js.map +1 -1
  14. package/build/components/block-editor/editor-canvas.js +1 -1
  15. package/build/components/block-editor/editor-canvas.js.map +1 -1
  16. package/build/components/block-editor/index.js +0 -4
  17. package/build/components/block-editor/index.js.map +1 -1
  18. package/build/components/block-editor/inserter-media-categories.js +1 -22
  19. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  20. package/build/components/block-editor/site-editor-canvas.js +29 -32
  21. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  22. package/build/components/block-editor/use-site-editor-settings.js +90 -19
  23. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  24. package/build/components/canvas-spinner/index.js +1 -18
  25. package/build/components/canvas-spinner/index.js.map +1 -1
  26. package/build/components/code-editor/index.js +60 -28
  27. package/build/components/code-editor/index.js.map +1 -1
  28. package/build/components/create-pattern-modal/index.js +15 -11
  29. package/build/components/create-pattern-modal/index.js.map +1 -1
  30. package/build/components/create-template-part-modal/index.js +1 -1
  31. package/build/components/create-template-part-modal/index.js.map +1 -1
  32. package/build/components/editor/index.js +11 -1
  33. package/build/components/editor/index.js.map +1 -1
  34. package/build/components/global-styles/palette.js +1 -1
  35. package/build/components/global-styles/palette.js.map +1 -1
  36. package/build/components/global-styles/ui.js +7 -2
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/header-edit-mode/document-actions/index.js +9 -1
  39. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  40. package/build/components/header-edit-mode/index.js +49 -14
  41. package/build/components/header-edit-mode/index.js.map +1 -1
  42. package/build/components/header-edit-mode/more-menu/index.js +47 -17
  43. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  44. package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
  45. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  46. package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
  47. package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  48. package/build/components/keyboard-shortcuts/register.js +9 -0
  49. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  50. package/build/components/layout/index.js +110 -28
  51. package/build/components/layout/index.js.map +1 -1
  52. package/build/components/page/header.js +1 -1
  53. package/build/components/page/header.js.map +1 -1
  54. package/build/components/page/index.js +3 -1
  55. package/build/components/page/index.js.map +1 -1
  56. package/build/components/page-actions/index.js +2 -2
  57. package/build/components/page-actions/index.js.map +1 -1
  58. package/build/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -15
  59. package/build/components/page-actions/trash-page-menu-item.js.map +1 -0
  60. package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  61. package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  62. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -5
  63. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  64. package/build/components/page-main/index.js +8 -4
  65. package/build/components/page-main/index.js.map +1 -1
  66. package/build/components/page-patterns/duplicate-menu-item.js +163 -0
  67. package/build/components/page-patterns/duplicate-menu-item.js.map +1 -0
  68. package/build/components/page-patterns/grid-item.js +218 -0
  69. package/build/components/page-patterns/grid-item.js.map +1 -0
  70. package/build/components/{page-library → page-patterns}/grid.js +6 -19
  71. package/build/components/page-patterns/grid.js.map +1 -0
  72. package/build/components/page-patterns/header.js +69 -0
  73. package/build/components/page-patterns/header.js.map +1 -0
  74. package/build/components/{page-library → page-patterns}/index.js +9 -7
  75. package/build/components/page-patterns/index.js.map +1 -0
  76. package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
  77. package/build/components/page-patterns/no-patterns.js.map +1 -0
  78. package/build/components/page-patterns/pagination.js +63 -0
  79. package/build/components/page-patterns/pagination.js.map +1 -0
  80. package/build/components/page-patterns/patterns-list.js +175 -0
  81. package/build/components/page-patterns/patterns-list.js.map +1 -0
  82. package/build/components/page-patterns/rename-menu-item.js +109 -0
  83. package/build/components/page-patterns/rename-menu-item.js.map +1 -0
  84. package/build/components/page-patterns/search-items.js.map +1 -0
  85. package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
  86. package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
  87. package/build/components/page-patterns/use-patterns.js +185 -0
  88. package/build/components/page-patterns/use-patterns.js.map +1 -0
  89. package/build/components/{page-library → page-patterns}/utils.js +3 -3
  90. package/build/components/page-patterns/utils.js.map +1 -0
  91. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  92. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  93. package/build/components/page-template-parts/index.js +82 -0
  94. package/build/components/page-template-parts/index.js.map +1 -0
  95. package/build/components/page-templates/index.js +1 -0
  96. package/build/components/page-templates/index.js.map +1 -1
  97. package/build/components/preferences-modal/enable-feature.js +5 -1
  98. package/build/components/preferences-modal/enable-feature.js.map +1 -1
  99. package/build/components/preferences-modal/index.js +43 -4
  100. package/build/components/preferences-modal/index.js.map +1 -1
  101. package/build/components/resizable-frame/index.js +78 -36
  102. package/build/components/resizable-frame/index.js.map +1 -1
  103. package/build/components/save-panel/index.js +5 -5
  104. package/build/components/save-panel/index.js.map +1 -1
  105. package/build/components/sidebar/index.js +6 -6
  106. package/build/components/sidebar/index.js.map +1 -1
  107. package/build/components/sidebar-edit-mode/index.js +4 -2
  108. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  109. package/build/components/sidebar-edit-mode/page-panels/page-content.js +4 -3
  110. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  111. package/build/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  112. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  113. package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
  114. package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  115. package/build/components/sidebar-navigation-screen/index.js +21 -11
  116. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  117. package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
  118. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  119. package/build/components/sidebar-navigation-screen-main/index.js +5 -3
  120. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  121. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +45 -0
  122. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  123. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
  124. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  125. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
  126. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  127. package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -10
  128. package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  129. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  130. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  131. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
  132. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  133. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
  134. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  135. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
  136. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  137. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
  138. package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  139. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  140. package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  141. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
  142. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  143. package/build/components/sidebar-navigation-screen-page/index.js +2 -3
  144. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  145. package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
  146. package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  147. package/build/components/sidebar-navigation-screen-page/status-label.js +2 -35
  148. package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  149. package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
  150. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  151. package/build/components/sidebar-navigation-screen-pattern/index.js +20 -13
  152. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  153. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  154. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  155. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  156. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  157. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
  158. package/build/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  159. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +28 -2
  160. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  161. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  162. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  163. package/build/components/sidebar-navigation-screen-patterns/index.js +173 -0
  164. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  165. package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  166. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +34 -0
  167. package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  168. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -19
  169. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  170. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +52 -0
  171. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  172. package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
  173. package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  174. package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
  175. package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  176. package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  177. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  178. package/build/components/site-hub/index.js +25 -12
  179. package/build/components/site-hub/index.js.map +1 -1
  180. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +10 -5
  181. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  182. package/build/components/sync-state-with-url/use-sync-path-with-url.js +16 -13
  183. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  184. package/build/components/template-actions/index.js +25 -7
  185. package/build/components/template-actions/index.js.map +1 -1
  186. package/build/components/template-actions/rename-menu-item.js +12 -8
  187. package/build/components/template-actions/rename-menu-item.js.map +1 -1
  188. package/build/components/use-edited-entity-record/index.js +6 -1
  189. package/build/components/use-edited-entity-record/index.js.map +1 -1
  190. package/build/components/welcome-guide/editor.js +1 -1
  191. package/build/components/welcome-guide/editor.js.map +1 -1
  192. package/build/components/welcome-guide/index.js +5 -1
  193. package/build/components/welcome-guide/index.js.map +1 -1
  194. package/build/components/welcome-guide/page.js +70 -0
  195. package/build/components/welcome-guide/page.js.map +1 -0
  196. package/build/components/welcome-guide/styles.js +1 -1
  197. package/build/components/welcome-guide/styles.js.map +1 -1
  198. package/build/components/welcome-guide/template.js +71 -0
  199. package/build/components/welcome-guide/template.js.map +1 -0
  200. package/build/hooks/commands/use-common-commands.js +115 -20
  201. package/build/hooks/commands/use-common-commands.js.map +1 -1
  202. package/build/hooks/commands/use-edit-mode-commands.js +195 -44
  203. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  204. package/build/hooks/push-changes-to-global-styles/index.js +56 -10
  205. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  206. package/build/index.js +9 -0
  207. package/build/index.js.map +1 -1
  208. package/build/store/actions.js +5 -2
  209. package/build/store/actions.js.map +1 -1
  210. package/build/store/private-actions.js +7 -1
  211. package/build/store/private-actions.js.map +1 -1
  212. package/build/store/selectors.js +2 -1
  213. package/build/store/selectors.js.map +1 -1
  214. package/build/utils/get-is-list-page.js +2 -2
  215. package/build/utils/get-is-list-page.js.map +1 -1
  216. package/build/utils/normalize-record-key.js +19 -0
  217. package/build/utils/normalize-record-key.js.map +1 -0
  218. package/build/utils/template-part-create.js +2 -2
  219. package/build/utils/template-part-create.js.map +1 -1
  220. package/build/utils/use-activate-theme.js +1 -1
  221. package/build/utils/use-activate-theme.js.map +1 -1
  222. package/build-module/components/add-new-page/index.js +2 -12
  223. package/build-module/components/add-new-page/index.js.map +1 -1
  224. package/build-module/components/add-new-pattern/index.js +28 -16
  225. package/build-module/components/add-new-pattern/index.js.map +1 -1
  226. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  227. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  228. package/build-module/components/add-new-template/new-template.js +72 -17
  229. package/build-module/components/add-new-template/new-template.js.map +1 -1
  230. package/build-module/components/add-new-template/utils.js +9 -6
  231. package/build-module/components/add-new-template/utils.js.map +1 -1
  232. package/build-module/components/block-editor/constants.js +1 -1
  233. package/build-module/components/block-editor/constants.js.map +1 -1
  234. package/build-module/components/block-editor/editor-canvas.js +1 -1
  235. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  236. package/build-module/components/block-editor/index.js +0 -4
  237. package/build-module/components/block-editor/index.js.map +1 -1
  238. package/build-module/components/block-editor/inserter-media-categories.js +1 -22
  239. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  240. package/build-module/components/block-editor/site-editor-canvas.js +29 -32
  241. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  242. package/build-module/components/block-editor/use-site-editor-settings.js +92 -20
  243. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  244. package/build-module/components/canvas-spinner/index.js +1 -15
  245. package/build-module/components/canvas-spinner/index.js.map +1 -1
  246. package/build-module/components/code-editor/index.js +62 -30
  247. package/build-module/components/code-editor/index.js.map +1 -1
  248. package/build-module/components/create-pattern-modal/index.js +14 -11
  249. package/build-module/components/create-pattern-modal/index.js.map +1 -1
  250. package/build-module/components/create-template-part-modal/index.js +1 -1
  251. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  252. package/build-module/components/editor/index.js +11 -1
  253. package/build-module/components/editor/index.js.map +1 -1
  254. package/build-module/components/global-styles/palette.js +1 -1
  255. package/build-module/components/global-styles/palette.js.map +1 -1
  256. package/build-module/components/global-styles/ui.js +8 -3
  257. package/build-module/components/global-styles/ui.js.map +1 -1
  258. package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
  259. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  260. package/build-module/components/header-edit-mode/index.js +51 -16
  261. package/build-module/components/header-edit-mode/index.js.map +1 -1
  262. package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
  263. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  264. package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
  265. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  266. package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
  267. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
  268. package/build-module/components/keyboard-shortcuts/register.js +9 -0
  269. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  270. package/build-module/components/layout/index.js +110 -28
  271. package/build-module/components/layout/index.js.map +1 -1
  272. package/build-module/components/page/header.js +1 -1
  273. package/build-module/components/page/header.js.map +1 -1
  274. package/build-module/components/page/index.js +2 -1
  275. package/build-module/components/page/index.js.map +1 -1
  276. package/build-module/components/page-actions/index.js +2 -2
  277. package/build-module/components/page-actions/index.js.map +1 -1
  278. package/build-module/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +8 -16
  279. package/build-module/components/page-actions/trash-page-menu-item.js.map +1 -0
  280. package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
  281. package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
  282. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +5 -3
  283. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  284. package/build-module/components/page-main/index.js +6 -3
  285. package/build-module/components/page-main/index.js.map +1 -1
  286. package/build-module/components/page-patterns/duplicate-menu-item.js +147 -0
  287. package/build-module/components/page-patterns/duplicate-menu-item.js.map +1 -0
  288. package/build-module/components/page-patterns/grid-item.js +195 -0
  289. package/build-module/components/page-patterns/grid-item.js.map +1 -0
  290. package/build-module/components/page-patterns/grid.js +26 -0
  291. package/build-module/components/page-patterns/grid.js.map +1 -0
  292. package/build-module/components/page-patterns/header.js +54 -0
  293. package/build-module/components/page-patterns/header.js.map +1 -0
  294. package/build-module/components/{page-library → page-patterns}/index.js +8 -6
  295. package/build-module/components/page-patterns/index.js.map +1 -0
  296. package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
  297. package/build-module/components/page-patterns/no-patterns.js.map +1 -0
  298. package/build-module/components/page-patterns/pagination.js +54 -0
  299. package/build-module/components/page-patterns/pagination.js.map +1 -0
  300. package/build-module/components/page-patterns/patterns-list.js +152 -0
  301. package/build-module/components/page-patterns/patterns-list.js.map +1 -0
  302. package/build-module/components/page-patterns/rename-menu-item.js +97 -0
  303. package/build-module/components/page-patterns/rename-menu-item.js.map +1 -0
  304. package/build-module/components/page-patterns/search-items.js.map +1 -0
  305. package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
  306. package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
  307. package/build-module/components/page-patterns/use-patterns.js +167 -0
  308. package/build-module/components/page-patterns/use-patterns.js.map +1 -0
  309. package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
  310. package/build-module/components/page-patterns/utils.js.map +1 -0
  311. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  312. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  313. package/build-module/components/page-template-parts/index.js +63 -0
  314. package/build-module/components/page-template-parts/index.js.map +1 -0
  315. package/build-module/components/page-templates/index.js +1 -0
  316. package/build-module/components/page-templates/index.js.map +1 -1
  317. package/build-module/components/preferences-modal/enable-feature.js +5 -1
  318. package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
  319. package/build-module/components/preferences-modal/index.js +38 -5
  320. package/build-module/components/preferences-modal/index.js.map +1 -1
  321. package/build-module/components/resizable-frame/index.js +79 -39
  322. package/build-module/components/resizable-frame/index.js.map +1 -1
  323. package/build-module/components/save-panel/index.js +5 -5
  324. package/build-module/components/save-panel/index.js.map +1 -1
  325. package/build-module/components/sidebar/index.js +5 -5
  326. package/build-module/components/sidebar/index.js.map +1 -1
  327. package/build-module/components/sidebar-edit-mode/index.js +4 -2
  328. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  329. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +5 -2
  330. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  331. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +3 -8
  332. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  333. package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
  334. package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
  335. package/build-module/components/sidebar-navigation-screen/index.js +22 -12
  336. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  337. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
  338. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  339. package/build-module/components/sidebar-navigation-screen-main/index.js +5 -4
  340. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  341. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +33 -0
  342. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -0
  343. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
  344. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
  345. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
  346. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
  347. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +9 -10
  348. package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
  349. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  350. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  351. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
  352. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  353. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
  354. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  355. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +9 -4
  356. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  357. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
  358. package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
  359. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  360. package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -1
  361. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
  362. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  363. package/build-module/components/sidebar-navigation-screen-page/index.js +2 -3
  364. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  365. package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
  366. package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
  367. package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -33
  368. package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
  369. package/build-module/components/sidebar-navigation-screen-pages/index.js +34 -26
  370. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  371. package/build-module/components/sidebar-navigation-screen-pattern/index.js +18 -12
  372. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  373. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +4 -3
  374. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  375. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  376. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  377. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +11 -3
  378. package/build-module/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js.map +1 -1
  379. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +25 -2
  380. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  381. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  382. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
  383. package/build-module/components/sidebar-navigation-screen-patterns/index.js +148 -0
  384. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
  385. package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
  386. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
  387. package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
  388. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +11 -17
  389. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
  390. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +43 -0
  391. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
  392. package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +2 -2
  393. package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
  394. package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
  395. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
  396. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
  397. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  398. package/build-module/components/site-hub/index.js +25 -12
  399. package/build-module/components/site-hub/index.js.map +1 -1
  400. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +7 -5
  401. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  402. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +17 -13
  403. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  404. package/build-module/components/template-actions/index.js +26 -8
  405. package/build-module/components/template-actions/index.js.map +1 -1
  406. package/build-module/components/template-actions/rename-menu-item.js +11 -8
  407. package/build-module/components/template-actions/rename-menu-item.js.map +1 -1
  408. package/build-module/components/use-edited-entity-record/index.js +3 -1
  409. package/build-module/components/use-edited-entity-record/index.js.map +1 -1
  410. package/build-module/components/welcome-guide/editor.js +1 -1
  411. package/build-module/components/welcome-guide/editor.js.map +1 -1
  412. package/build-module/components/welcome-guide/index.js +3 -1
  413. package/build-module/components/welcome-guide/index.js.map +1 -1
  414. package/build-module/components/welcome-guide/page.js +59 -0
  415. package/build-module/components/welcome-guide/page.js.map +1 -0
  416. package/build-module/components/welcome-guide/styles.js +1 -1
  417. package/build-module/components/welcome-guide/styles.js.map +1 -1
  418. package/build-module/components/welcome-guide/template.js +60 -0
  419. package/build-module/components/welcome-guide/template.js.map +1 -0
  420. package/build-module/hooks/commands/use-common-commands.js +111 -21
  421. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  422. package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
  423. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  424. package/build-module/hooks/push-changes-to-global-styles/index.js +57 -10
  425. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  426. package/build-module/index.js +4 -0
  427. package/build-module/index.js.map +1 -1
  428. package/build-module/store/actions.js +5 -2
  429. package/build-module/store/actions.js.map +1 -1
  430. package/build-module/store/private-actions.js +7 -1
  431. package/build-module/store/private-actions.js.map +1 -1
  432. package/build-module/store/selectors.js +2 -1
  433. package/build-module/store/selectors.js.map +1 -1
  434. package/build-module/utils/get-is-list-page.js +2 -2
  435. package/build-module/utils/get-is-list-page.js.map +1 -1
  436. package/build-module/utils/normalize-record-key.js +12 -0
  437. package/build-module/utils/normalize-record-key.js.map +1 -0
  438. package/build-module/utils/template-part-create.js +1 -1
  439. package/build-module/utils/template-part-create.js.map +1 -1
  440. package/build-module/utils/use-activate-theme.js +1 -1
  441. package/build-module/utils/use-activate-theme.js.map +1 -1
  442. package/build-style/style-rtl.css +383 -109
  443. package/build-style/style.css +383 -109
  444. package/package.json +39 -40
  445. package/src/components/add-new-page/index.js +1 -9
  446. package/src/components/add-new-pattern/index.js +30 -21
  447. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
  448. package/src/components/add-new-template/new-template.js +120 -24
  449. package/src/components/add-new-template/style.scss +30 -2
  450. package/src/components/add-new-template/utils.js +9 -6
  451. package/src/components/block-editor/constants.js +5 -1
  452. package/src/components/block-editor/editor-canvas.js +3 -1
  453. package/src/components/block-editor/index.js +0 -4
  454. package/src/components/block-editor/inserter-media-categories.js +1 -21
  455. package/src/components/block-editor/site-editor-canvas.js +7 -1
  456. package/src/components/block-editor/use-site-editor-settings.js +100 -25
  457. package/src/components/canvas-spinner/index.js +1 -11
  458. package/src/components/canvas-spinner/style.scss +18 -0
  459. package/src/components/code-editor/index.js +51 -33
  460. package/src/components/create-pattern-modal/index.js +15 -13
  461. package/src/components/create-template-part-modal/index.js +1 -1
  462. package/src/components/editor/index.js +16 -1
  463. package/src/components/editor/style.scss +4 -0
  464. package/src/components/global-styles/palette.js +10 -9
  465. package/src/components/global-styles/stories/index.js +1 -0
  466. package/src/components/global-styles/ui.js +34 -24
  467. package/src/components/header-edit-mode/document-actions/index.js +9 -1
  468. package/src/components/header-edit-mode/document-actions/style.scss +12 -0
  469. package/src/components/header-edit-mode/index.js +136 -79
  470. package/src/components/header-edit-mode/more-menu/index.js +74 -30
  471. package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
  472. package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
  473. package/src/components/keyboard-shortcuts/register.js +10 -0
  474. package/src/components/layout/index.js +156 -78
  475. package/src/components/layout/style.scss +49 -2
  476. package/src/components/page/header.js +1 -1
  477. package/src/components/page/index.js +5 -1
  478. package/src/components/page-actions/index.js +2 -2
  479. package/src/components/page-actions/{delete-page-menu-item.js → trash-page-menu-item.js} +9 -21
  480. package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
  481. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +12 -3
  482. package/src/components/page-main/index.js +6 -3
  483. package/src/components/page-patterns/duplicate-menu-item.js +196 -0
  484. package/src/components/page-patterns/grid-item.js +284 -0
  485. package/src/components/page-patterns/grid.js +22 -0
  486. package/src/components/page-patterns/header.js +69 -0
  487. package/src/components/{page-library → page-patterns}/index.js +11 -6
  488. package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
  489. package/src/components/page-patterns/pagination.js +80 -0
  490. package/src/components/page-patterns/patterns-list.js +206 -0
  491. package/src/components/page-patterns/rename-menu-item.js +115 -0
  492. package/src/components/page-patterns/style.scss +219 -0
  493. package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
  494. package/src/components/page-patterns/use-patterns.js +177 -0
  495. package/src/components/{page-library → page-patterns}/utils.js +3 -3
  496. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  497. package/src/components/page-template-parts/index.js +86 -0
  498. package/src/components/page-templates/index.js +1 -1
  499. package/src/components/preferences-modal/enable-feature.js +5 -2
  500. package/src/components/preferences-modal/index.js +35 -4
  501. package/src/components/resizable-frame/index.js +102 -34
  502. package/src/components/resizable-frame/style.scss +9 -9
  503. package/src/components/save-panel/index.js +10 -4
  504. package/src/components/sidebar/index.js +6 -6
  505. package/src/components/sidebar-button/style.scss +1 -1
  506. package/src/components/sidebar-edit-mode/index.js +4 -2
  507. package/src/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  508. package/src/components/sidebar-edit-mode/page-panels/page-status.js +2 -5
  509. package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
  510. package/src/components/sidebar-navigation-item/style.scss +7 -13
  511. package/src/components/sidebar-navigation-screen/index.js +18 -9
  512. package/src/components/sidebar-navigation-screen/style.scss +21 -2
  513. package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
  514. package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
  515. package/src/components/sidebar-navigation-screen-main/index.js +44 -40
  516. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +34 -0
  517. package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
  518. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
  519. package/src/components/sidebar-navigation-screen-navigation-menu/index.js +13 -11
  520. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  521. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
  522. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
  523. package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
  524. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +20 -6
  525. package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
  526. package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +2 -0
  527. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
  528. package/src/components/sidebar-navigation-screen-page/index.js +3 -3
  529. package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
  530. package/src/components/sidebar-navigation-screen-page/status-label.js +2 -36
  531. package/src/components/sidebar-navigation-screen-pages/index.js +40 -30
  532. package/src/components/sidebar-navigation-screen-pattern/index.js +18 -8
  533. package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
  534. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  535. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  536. package/src/components/sidebar-navigation-screen-pattern/use-navigation-menu-content.js +12 -2
  537. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +48 -3
  538. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
  539. package/src/components/sidebar-navigation-screen-patterns/index.js +194 -0
  540. package/src/components/sidebar-navigation-screen-patterns/style.scss +23 -0
  541. package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +24 -0
  542. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +9 -17
  543. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +55 -0
  544. package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +3 -2
  545. package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
  546. package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
  547. package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
  548. package/src/components/site-hub/index.js +46 -29
  549. package/src/components/site-hub/style.scss +17 -3
  550. package/src/components/start-template-options/style.scss +0 -3
  551. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
  552. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
  553. package/src/components/template-actions/index.js +40 -9
  554. package/src/components/template-actions/rename-menu-item.js +17 -10
  555. package/src/components/use-edited-entity-record/index.js +6 -1
  556. package/src/components/welcome-guide/editor.js +1 -1
  557. package/src/components/welcome-guide/index.js +4 -0
  558. package/src/components/welcome-guide/page.js +75 -0
  559. package/src/components/welcome-guide/style.scss +15 -1
  560. package/src/components/welcome-guide/styles.js +1 -1
  561. package/src/components/welcome-guide/template.js +82 -0
  562. package/src/hooks/commands/use-common-commands.js +88 -24
  563. package/src/hooks/commands/use-edit-mode-commands.js +182 -38
  564. package/src/hooks/push-changes-to-global-styles/index.js +63 -9
  565. package/src/index.js +4 -0
  566. package/src/store/actions.js +8 -1
  567. package/src/store/private-actions.js +5 -1
  568. package/src/store/selectors.js +5 -0
  569. package/src/store/test/selectors.js +2 -0
  570. package/src/style.scss +13 -14
  571. package/src/utils/get-is-list-page.js +4 -3
  572. package/src/utils/normalize-record-key.js +11 -0
  573. package/src/utils/template-part-create.js +1 -1
  574. package/src/utils/use-activate-theme.js +1 -1
  575. package/build/components/code-editor/code-editor-text-area.js +0 -96
  576. package/build/components/code-editor/code-editor-text-area.js.map +0 -1
  577. package/build/components/keyboard-shortcuts/index.js +0 -148
  578. package/build/components/keyboard-shortcuts/index.js.map +0 -1
  579. package/build/components/page-actions/delete-page-menu-item.js.map +0 -1
  580. package/build/components/page-content-focus-manager/constants.js +0 -9
  581. package/build/components/page-content-focus-manager/constants.js.map +0 -1
  582. package/build/components/page-library/grid-item.js +0 -165
  583. package/build/components/page-library/grid-item.js.map +0 -1
  584. package/build/components/page-library/grid.js.map +0 -1
  585. package/build/components/page-library/index.js.map +0 -1
  586. package/build/components/page-library/no-patterns.js.map +0 -1
  587. package/build/components/page-library/patterns-list.js +0 -108
  588. package/build/components/page-library/patterns-list.js.map +0 -1
  589. package/build/components/page-library/search-items.js.map +0 -1
  590. package/build/components/page-library/use-library-settings.js.map +0 -1
  591. package/build/components/page-library/use-patterns.js +0 -194
  592. package/build/components/page-library/use-patterns.js.map +0 -1
  593. package/build/components/page-library/utils.js.map +0 -1
  594. package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  595. package/build/components/sidebar-navigation-screen-library/index.js +0 -112
  596. package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
  597. package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  598. package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  599. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -41
  600. package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  601. package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  602. package/build-module/components/code-editor/code-editor-text-area.js +0 -84
  603. package/build-module/components/code-editor/code-editor-text-area.js.map +0 -1
  604. package/build-module/components/keyboard-shortcuts/index.js +0 -132
  605. package/build-module/components/keyboard-shortcuts/index.js.map +0 -1
  606. package/build-module/components/page-actions/delete-page-menu-item.js.map +0 -1
  607. package/build-module/components/page-content-focus-manager/constants.js +0 -2
  608. package/build-module/components/page-content-focus-manager/constants.js.map +0 -1
  609. package/build-module/components/page-library/grid-item.js +0 -145
  610. package/build-module/components/page-library/grid-item.js.map +0 -1
  611. package/build-module/components/page-library/grid.js +0 -38
  612. package/build-module/components/page-library/grid.js.map +0 -1
  613. package/build-module/components/page-library/index.js.map +0 -1
  614. package/build-module/components/page-library/no-patterns.js.map +0 -1
  615. package/build-module/components/page-library/patterns-list.js +0 -87
  616. package/build-module/components/page-library/patterns-list.js.map +0 -1
  617. package/build-module/components/page-library/search-items.js.map +0 -1
  618. package/build-module/components/page-library/use-library-settings.js.map +0 -1
  619. package/build-module/components/page-library/use-patterns.js +0 -176
  620. package/build-module/components/page-library/use-patterns.js.map +0 -1
  621. package/build-module/components/page-library/utils.js.map +0 -1
  622. package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
  623. package/build-module/components/sidebar-navigation-screen-library/index.js +0 -87
  624. package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
  625. package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
  626. package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
  627. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -34
  628. package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
  629. package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
  630. package/src/components/code-editor/code-editor-text-area.js +0 -84
  631. package/src/components/keyboard-shortcuts/index.js +0 -137
  632. package/src/components/page-content-focus-manager/constants.js +0 -5
  633. package/src/components/page-library/grid-item.js +0 -179
  634. package/src/components/page-library/grid.js +0 -39
  635. package/src/components/page-library/patterns-list.js +0 -114
  636. package/src/components/page-library/style.scss +0 -105
  637. package/src/components/page-library/use-patterns.js +0 -238
  638. package/src/components/sidebar-navigation-screen-library/index.js +0 -136
  639. package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
  640. package/src/components/sidebar-navigation-screen-library/use-template-part-areas.js +0 -33
  641. /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
  642. /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  643. /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
  644. /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
  645. /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
  646. /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = PatternsList;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _components = require("@wordpress/components");
13
+
14
+ var _i18n = require("@wordpress/i18n");
15
+
16
+ var _icons = require("@wordpress/icons");
17
+
18
+ var _router = require("@wordpress/router");
19
+
20
+ var _compose = require("@wordpress/compose");
21
+
22
+ var _header = _interopRequireDefault(require("./header"));
23
+
24
+ var _grid = _interopRequireDefault(require("./grid"));
25
+
26
+ var _noPatterns = _interopRequireDefault(require("./no-patterns"));
27
+
28
+ var _usePatterns = _interopRequireDefault(require("./use-patterns"));
29
+
30
+ var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
31
+
32
+ var _useDebouncedInput = _interopRequireDefault(require("../../utils/use-debounced-input"));
33
+
34
+ var _lockUnlock = require("../../lock-unlock");
35
+
36
+ var _utils = require("./utils");
37
+
38
+ var _pagination = _interopRequireDefault(require("./pagination"));
39
+
40
+ /**
41
+ * WordPress dependencies
42
+ */
43
+
44
+ /**
45
+ * Internal dependencies
46
+ */
47
+ const {
48
+ useLocation,
49
+ useHistory
50
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
51
+ const SYNC_FILTERS = {
52
+ all: (0, _i18n.__)('All'),
53
+ [_utils.SYNC_TYPES.full]: (0, _i18n.__)('Synced'),
54
+ [_utils.SYNC_TYPES.unsynced]: (0, _i18n.__)('Standard')
55
+ };
56
+ const SYNC_DESCRIPTIONS = {
57
+ all: '',
58
+ [_utils.SYNC_TYPES.full]: (0, _i18n.__)('Patterns that are kept in sync across the site.'),
59
+ [_utils.SYNC_TYPES.unsynced]: (0, _i18n.__)('Patterns that can be changed freely without affecting the site.')
60
+ };
61
+ const PAGE_SIZE = 20;
62
+
63
+ function PatternsList({
64
+ categoryId,
65
+ type
66
+ }) {
67
+ const location = useLocation();
68
+ const history = useHistory();
69
+ const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
70
+ const [filterValue, setFilterValue, delayedFilterValue] = (0, _useDebouncedInput.default)('');
71
+ const deferredFilterValue = (0, _element.useDeferredValue)(delayedFilterValue);
72
+ const [syncFilter, setSyncFilter] = (0, _element.useState)('all');
73
+ const [currentPage, setCurrentPage] = (0, _element.useState)(1);
74
+ const deferredSyncedFilter = (0, _element.useDeferredValue)(syncFilter);
75
+ const {
76
+ patterns,
77
+ isResolving
78
+ } = (0, _usePatterns.default)(type, categoryId !== 'uncategorized' ? categoryId : '', {
79
+ search: deferredFilterValue,
80
+ syncStatus: deferredSyncedFilter === 'all' ? undefined : deferredSyncedFilter
81
+ });
82
+ const id = (0, _element.useId)();
83
+ const titleId = `${id}-title`;
84
+ const descriptionId = `${id}-description`;
85
+ const hasPatterns = patterns.length;
86
+ const title = SYNC_FILTERS[syncFilter];
87
+ const description = SYNC_DESCRIPTIONS[syncFilter];
88
+ const totalItems = patterns.length;
89
+ const pageIndex = currentPage - 1;
90
+ const numPages = Math.ceil(patterns.length / PAGE_SIZE);
91
+ const list = (0, _element.useMemo)(() => patterns.slice(pageIndex * PAGE_SIZE, pageIndex * PAGE_SIZE + PAGE_SIZE), [pageIndex, patterns]);
92
+ const asyncList = (0, _compose.useAsyncList)(list, {
93
+ step: 10
94
+ });
95
+
96
+ const changePage = page => {
97
+ const scrollContainer = document.querySelector('.edit-site-patterns');
98
+ scrollContainer?.scrollTo(0, 0);
99
+ setCurrentPage(page);
100
+ };
101
+
102
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalVStack, {
103
+ className: "edit-site-patterns__header",
104
+ spacing: 6
105
+ }, (0, _element.createElement)(_header.default, {
106
+ categoryId: categoryId,
107
+ type: type,
108
+ titleId: titleId,
109
+ descriptionId: descriptionId
110
+ }), (0, _element.createElement)(_components.Flex, {
111
+ alignment: "stretch",
112
+ wrap: true
113
+ }, isMobileViewport && (0, _element.createElement)(_sidebarButton.default, {
114
+ icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
115
+ label: (0, _i18n.__)('Back'),
116
+ onClick: () => {
117
+ // Go back in history if we came from the Patterns page.
118
+ // Otherwise push a stack onto the history.
119
+ if (location.state?.backPath === '/patterns') {
120
+ history.back();
121
+ } else {
122
+ history.push({
123
+ path: '/patterns'
124
+ });
125
+ }
126
+ }
127
+ }), (0, _element.createElement)(_components.FlexBlock, {
128
+ className: "edit-site-patterns__search-block"
129
+ }, (0, _element.createElement)(_components.SearchControl, {
130
+ className: "edit-site-patterns__search",
131
+ onChange: value => setFilterValue(value),
132
+ placeholder: (0, _i18n.__)('Search patterns'),
133
+ label: (0, _i18n.__)('Search patterns'),
134
+ value: filterValue,
135
+ __nextHasNoMarginBottom: true
136
+ })), categoryId === _utils.USER_PATTERN_CATEGORY && (0, _element.createElement)(_components.__experimentalToggleGroupControl, {
137
+ className: "edit-site-patterns__sync-status-filter",
138
+ hideLabelFromVision: true,
139
+ label: (0, _i18n.__)('Filter by sync status'),
140
+ value: syncFilter,
141
+ isBlock: true,
142
+ onChange: value => setSyncFilter(value),
143
+ __nextHasNoMarginBottom: true
144
+ }, Object.entries(SYNC_FILTERS).map(([key, label]) => (0, _element.createElement)(_components.__experimentalToggleGroupControlOption, {
145
+ className: "edit-site-patterns__sync-status-filter-option",
146
+ key: key,
147
+ value: key,
148
+ label: label
149
+ }))))), (0, _element.createElement)(_components.__experimentalVStack, {
150
+ className: "edit-site-patterns__section",
151
+ justify: "flex-start",
152
+ spacing: 6
153
+ }, syncFilter !== 'all' && (0, _element.createElement)(_components.__experimentalVStack, {
154
+ className: "edit-site-patterns__section-header"
155
+ }, (0, _element.createElement)(_components.__experimentalHeading, {
156
+ as: "h3",
157
+ level: 5,
158
+ id: titleId
159
+ }, title), description ? (0, _element.createElement)(_components.__experimentalText, {
160
+ variant: "muted",
161
+ as: "p",
162
+ id: descriptionId
163
+ }, description) : null), hasPatterns && (0, _element.createElement)(_grid.default, {
164
+ categoryId: categoryId,
165
+ items: asyncList,
166
+ "aria-labelledby": titleId,
167
+ "aria-describedby": descriptionId
168
+ }), !isResolving && !hasPatterns && (0, _element.createElement)(_noPatterns.default, null)), numPages > 1 && (0, _element.createElement)(_pagination.default, {
169
+ currentPage: currentPage,
170
+ numPages: numPages,
171
+ changePage: changePage,
172
+ totalItems: totalItems
173
+ }));
174
+ }
175
+ //# sourceMappingURL=patterns-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/patterns-list.js"],"names":["useLocation","useHistory","routerPrivateApis","SYNC_FILTERS","all","SYNC_TYPES","full","unsynced","SYNC_DESCRIPTIONS","PAGE_SIZE","PatternsList","categoryId","type","location","history","isMobileViewport","filterValue","setFilterValue","delayedFilterValue","deferredFilterValue","syncFilter","setSyncFilter","currentPage","setCurrentPage","deferredSyncedFilter","patterns","isResolving","search","syncStatus","undefined","id","titleId","descriptionId","hasPatterns","length","title","description","totalItems","pageIndex","numPages","Math","ceil","list","slice","asyncList","step","changePage","page","scrollContainer","document","querySelector","scrollTo","chevronRight","chevronLeft","state","backPath","back","push","path","value","USER_PATTERN_C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ADD;AAkGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useDeferredValue, useId, useMemo } from '@wordpress/element';\nimport {\n\tSearchControl,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tFlexBlock,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useAsyncList, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PatternsHeader from './header';\nimport Grid from './grid';\nimport NoPatterns from './no-patterns';\nimport usePatterns from './use-patterns';\nimport SidebarButton from '../sidebar-button';\nimport useDebouncedInput from '../../utils/use-debounced-input';\nimport { unlock } from '../../lock-unlock';\nimport { SYNC_TYPES, USER_PATTERN_CATEGORY } from './utils';\nimport Pagination from './pagination';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nconst SYNC_FILTERS = {\n\tall: __( 'All' ),\n\t[ SYNC_TYPES.full ]: __( 'Synced' ),\n\t[ SYNC_TYPES.unsynced ]: __( 'Standard' ),\n};\n\nconst SYNC_DESCRIPTIONS = {\n\tall: '',\n\t[ SYNC_TYPES.full ]: __(\n\t\t'Patterns that are kept in sync across the site.'\n\t),\n\t[ SYNC_TYPES.unsynced ]: __(\n\t\t'Patterns that can be changed freely without affecting the site.'\n\t),\n};\n\nconst PAGE_SIZE = 20;\n\nexport default function PatternsList( { categoryId, type } ) {\n\tconst location = useLocation();\n\tconst history = useHistory();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst [ filterValue, setFilterValue, delayedFilterValue ] =\n\t\tuseDebouncedInput( '' );\n\tconst deferredFilterValue = useDeferredValue( delayedFilterValue );\n\n\tconst [ syncFilter, setSyncFilter ] = useState( 'all' );\n\tconst [ currentPage, setCurrentPage ] = useState( 1 );\n\n\tconst deferredSyncedFilter = useDeferredValue( syncFilter );\n\n\tconst { patterns, isResolving } = usePatterns(\n\t\ttype,\n\t\tcategoryId !== 'uncategorized' ? categoryId : '',\n\t\t{\n\t\t\tsearch: deferredFilterValue,\n\t\t\tsyncStatus:\n\t\t\t\tdeferredSyncedFilter === 'all'\n\t\t\t\t\t? undefined\n\t\t\t\t\t: deferredSyncedFilter,\n\t\t}\n\t);\n\n\tconst id = useId();\n\tconst titleId = `${ id }-title`;\n\tconst descriptionId = `${ id }-description`;\n\n\tconst hasPatterns = patterns.length;\n\tconst title = SYNC_FILTERS[ syncFilter ];\n\tconst description = SYNC_DESCRIPTIONS[ syncFilter ];\n\n\tconst totalItems = patterns.length;\n\tconst pageIndex = currentPage - 1;\n\tconst numPages = Math.ceil( patterns.length / PAGE_SIZE );\n\n\tconst list = useMemo(\n\t\t() =>\n\t\t\tpatterns.slice(\n\t\t\t\tpageIndex * PAGE_SIZE,\n\t\t\t\tpageIndex * PAGE_SIZE + PAGE_SIZE\n\t\t\t),\n\t\t[ pageIndex, patterns ]\n\t);\n\n\tconst asyncList = useAsyncList( list, { step: 10 } );\n\n\tconst changePage = ( page ) => {\n\t\tconst scrollContainer = document.querySelector( '.edit-site-patterns' );\n\t\tscrollContainer?.scrollTo( 0, 0 );\n\n\t\tsetCurrentPage( page );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<VStack className=\"edit-site-patterns__header\" spacing={ 6 }>\n\t\t\t\t<PatternsHeader\n\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\ttype={ type }\n\t\t\t\t\ttitleId={ titleId }\n\t\t\t\t\tdescriptionId={ descriptionId }\n\t\t\t\t/>\n\t\t\t\t<Flex alignment=\"stretch\" wrap>\n\t\t\t\t\t{ isMobileViewport && (\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tlabel={ __( 'Back' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t// Go back in history if we came from the Patterns page.\n\t\t\t\t\t\t\t\t// Otherwise push a stack onto the history.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tlocation.state?.backPath === '/patterns'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\thistory.back();\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\thistory.push( { path: '/patterns' } );\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<FlexBlock className=\"edit-site-patterns__search-block\">\n\t\t\t\t\t\t<SearchControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__search\"\n\t\t\t\t\t\t\tonChange={ ( value ) => setFilterValue( value ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tlabel={ __( 'Search patterns' ) }\n\t\t\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t{ categoryId === USER_PATTERN_CATEGORY && (\n\t\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter\"\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tlabel={ __( 'Filter by sync status' ) }\n\t\t\t\t\t\t\tvalue={ syncFilter }\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tonChange={ ( value ) => setSyncFilter( value ) }\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ Object.entries( SYNC_FILTERS ).map(\n\t\t\t\t\t\t\t\t( [ key, label ] ) => (\n\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-site-patterns__sync-status-filter-option\"\n\t\t\t\t\t\t\t\t\t\tkey={ key }\n\t\t\t\t\t\t\t\t\t\tvalue={ key }\n\t\t\t\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t) }\n\t\t\t\t</Flex>\n\t\t\t</VStack>\n\t\t\t<VStack\n\t\t\t\tclassName=\"edit-site-patterns__section\"\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tspacing={ 6 }\n\t\t\t>\n\t\t\t\t{ syncFilter !== 'all' && (\n\t\t\t\t\t<VStack className=\"edit-site-patterns__section-header\">\n\t\t\t\t\t\t<Heading as=\"h3\" level={ 5 } id={ titleId }>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t\t{ description ? (\n\t\t\t\t\t\t\t<Text variant=\"muted\" as=\"p\" id={ descriptionId }>\n\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</VStack>\n\t\t\t\t) }\n\t\t\t\t{ hasPatterns && (\n\t\t\t\t\t<Grid\n\t\t\t\t\t\tcategoryId={ categoryId }\n\t\t\t\t\t\titems={ asyncList }\n\t\t\t\t\t\taria-labelledby={ titleId }\n\t\t\t\t\t\taria-describedby={ descriptionId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isResolving && ! hasPatterns && <NoPatterns /> }\n\t\t\t</VStack>\n\t\t\t{ numPages > 1 && (\n\t\t\t\t<Pagination\n\t\t\t\t\tcurrentPage={ currentPage }\n\t\t\t\t\tnumPages={ numPages }\n\t\t\t\t\tchangePage={ changePage }\n\t\t\t\t\ttotalItems={ totalItems }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = RenameMenuItem;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _components = require("@wordpress/components");
11
+
12
+ var _coreData = require("@wordpress/core-data");
13
+
14
+ var _data = require("@wordpress/data");
15
+
16
+ var _i18n = require("@wordpress/i18n");
17
+
18
+ var _notices = require("@wordpress/notices");
19
+
20
+ var _utils = require("./utils");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ function RenameMenuItem({
30
+ item,
31
+ onClose
32
+ }) {
33
+ const [title, setTitle] = (0, _element.useState)(() => item.title);
34
+ const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
35
+ const {
36
+ editEntityRecord,
37
+ saveEditedEntityRecord
38
+ } = (0, _data.useDispatch)(_coreData.store);
39
+ const {
40
+ createSuccessNotice,
41
+ createErrorNotice
42
+ } = (0, _data.useDispatch)(_notices.store);
43
+
44
+ if (item.type === _utils.TEMPLATE_PARTS && !item.isCustom) {
45
+ return null;
46
+ }
47
+
48
+ async function onRename(event) {
49
+ event.preventDefault();
50
+
51
+ try {
52
+ await editEntityRecord('postType', item.type, item.id, {
53
+ title
54
+ }); // Update state before saving rerenders the list.
55
+
56
+ setTitle('');
57
+ setIsModalOpen(false);
58
+ onClose(); // Persist edited entity.
59
+
60
+ await saveEditedEntityRecord('postType', item.type, item.id, {
61
+ throwOnError: true
62
+ });
63
+ createSuccessNotice((0, _i18n.__)('Entity renamed.'), {
64
+ type: 'snackbar'
65
+ });
66
+ } catch (error) {
67
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while renaming the entity.');
68
+ createErrorNotice(errorMessage, {
69
+ type: 'snackbar'
70
+ });
71
+ }
72
+ }
73
+
74
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
75
+ onClick: () => {
76
+ setIsModalOpen(true);
77
+ setTitle(item.title);
78
+ }
79
+ }, (0, _i18n.__)('Rename')), isModalOpen && (0, _element.createElement)(_components.Modal, {
80
+ title: (0, _i18n.__)('Rename'),
81
+ onRequestClose: () => {
82
+ setIsModalOpen(false);
83
+ onClose();
84
+ },
85
+ overlayClassName: "edit-site-list__rename_modal"
86
+ }, (0, _element.createElement)("form", {
87
+ onSubmit: onRename
88
+ }, (0, _element.createElement)(_components.__experimentalVStack, {
89
+ spacing: "5"
90
+ }, (0, _element.createElement)(_components.TextControl, {
91
+ __nextHasNoMarginBottom: true,
92
+ label: (0, _i18n.__)('Name'),
93
+ value: title,
94
+ onChange: setTitle,
95
+ required: true
96
+ }), (0, _element.createElement)(_components.__experimentalHStack, {
97
+ justify: "right"
98
+ }, (0, _element.createElement)(_components.Button, {
99
+ variant: "tertiary",
100
+ onClick: () => {
101
+ setIsModalOpen(false);
102
+ onClose();
103
+ }
104
+ }, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
105
+ variant: "primary",
106
+ type: "submit"
107
+ }, (0, _i18n.__)('Save')))))));
108
+ }
109
+ //# sourceMappingURL=rename-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/rename-menu-item.js"],"names":["RenameMenuItem","item","onClose","title","setTitle","isModalOpen","setIsModalOpen","editEntityRecord","saveEditedEntityRecord","coreStore","createSuccessNotice","createErrorNotice","noticesStore","type","TEMPLATE_PARTS","isCustom","onRename","event","preventDefault","id","throwOnError","error","errorMessage","message","code"],"mappings":";;;;;;;AAaA;;AAVA;;AAQA;;AACA;;AAEA;;AACA;;AAKA;;AApBA;AACA;AACA;;AAeA;AACA;AACA;AAGe,SAASA,cAAT,CAAyB;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,CAAzB,EAA6C;AAC3D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,MAAMH,IAAI,CAACE,KAArB,CA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C,oBAAD;AACC,IAAA,OAAO,EAAG,MAAM;AACfP,MAAAA,cAAc,CAAE,IAAF,CAAd;AACAF,MAAAA,QAAQ,CAAEH,IAAI,CAACE,KAAP,CAAR;AACA;AAJF,KAMG,cAAI,QAAJ,CANH,CADD,EASGE,WAAW,IACZ,4BAAC,iBAAD;AACC,IAAA,KAAK,EAAG,cAAI,QAAJ,CADT;AAEC,IAAA,cAAc,EAAG,MAAM;AACtBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAJ,MAAAA,OAAO;AACP,KALF;AAMC,IAAA,gBAAgB,EAAC;AANlB,KAQC;AAAM,IAAA,QAAQ,EAAGc;AAAjB,KACC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,uBAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,IAAA,KAAK,EAAGb,KAHT;AAIC,IAAA,QAAQ,EAAGC,QAJZ;AAKC,IAAA,QAAQ;AALT,IADD,EASC,4BAAC,gCAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfE,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAJ,MAAAA,OAAO;AACP;AALF,KAOG,cAAI,QAAJ,CAPH,CADD,EAWC,4BAAC,kBAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACG,cAAI,MAAJ,CADH,CAXD,CATD,CADD,CARD,CAVF,CADD;AAkDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tMenuItem,\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_PARTS } from './utils';\n\nexport default function RenameMenuItem( { item, onClose } ) {\n\tconst [ title, setTitle ] = useState( () => item.title );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tif ( item.type === TEMPLATE_PARTS && ! item.isCustom ) {\n\t\treturn null;\n\t}\n\n\tasync function onRename( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, { title } );\n\n\t\t\t// Update state before saving rerenders the list.\n\t\t\tsetTitle( '' );\n\t\t\tsetIsModalOpen( false );\n\t\t\tonClose();\n\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice( __( 'Entity renamed.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while renaming the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\tsetTitle( item.title );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-site-list__rename_modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/search-items.js"],"names":["defaultGetName","item","name","defaultGetTitle","title","defaultGetDescription","description","defaultGetKeywords","keywords","defaultHasCategory","extractWords","input","splitRegexp","stripRegexp","split","filter","Boolean","normalizeSearchInput","replace","toLowerCase","getNormalizedSearchTerms","removeMatchingTerms","unmatchedTerms","unprocessedTerms","term","some","unprocessedTerm","includes","searchItems","items","searchInput","config","normalizedSearchTerms","onlyFilterByCategory","length","searchRankConfig","threshold","rankedItems","map","getItemSearchRank","rank","sort","rank1","rank2","searchTerm","categoryId","getName","getTitle","getDescription","getKeywords","hasCategory","normalizedSearchInput","normalizedTitle","startsWith","terms","join"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA;AACA,MAAMA,cAAc,GAAKC,IAAF,IAAYA,IAAI,CAACC,IAAL,IAAa,EAAhD;;AACA,MAAMC,eAAe,GAAKF,IAAF,IAAYA,IAAI,CAACG,KAAzC;;AACA,MAAMC,qBAAqB,GAAKJ,IAAF,IAAYA,IAAI,CAACK,WAAL,IAAoB,EAA9D;;AACA,MAAMC,kBAAkB,GAAKN,IAAF,IAAYA,IAAI,CAACO,QAAL,IAAiB,EAAxD;;AACA,MAAMC,kBAAkB,GAAG,MAAM,KAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,YAAT,CAAuBC,KAAK,GAAG,EAA/B,EAAoC;AACnC,SAAO,wBAAQA,KAAR,EAAe;AACrBC,IAAAA,WAAW,EAAE,CACZ,yCADY,EAC+B;AAC3C,sDAFY,CAEwC;AAFxC,KADQ;AAKrBC,IAAAA,WAAW,EAAE,yBALQ,CAKmB;;AALnB,GAAf,EAOLC,KAPK,CAOE,GAPF,EAQLC,MARK,CAQGC,OARH,CAAP;AASA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BN,KAAK,GAAG,EAAvC,EAA4C;AAC3C;AACA;AACAA,EAAAA,KAAK,GAAG,4BAAeA,KAAf,CAAR,CAH2C,CAK3C;AACA;;AACAA,EAAAA,KAAK,GAAGA,KAAK,CAACO,OAAN,CAAe,KAAf,EAAsB,EAAtB,CAAR,CAP2C,CAS3C;AACA;;AACAP,EAAAA,KAAK,GAAGA,KAAK,CAACQ,WAAN,EAAR;AAEA,SAAOR,KAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMS,wBAAwB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O,IAAKY,eAAe,CAACC,UAAhB,CAA4BF,qBAA5B,CAAL,EAA2D;AACjEX,IAAAA,IAAI,IAAI,EAAR;AACA,GAFM,MAEA;AACN,UAAMc,KAAK,GAAG,CAAEpD,IAAF,EAAQE,KAAR,EAAeE,WAAf,EAA4B,GAAGE,QAA/B,EAA0C+C,IAA1C,CAAgD,GAAhD,CAAd;AACA,UAAMvB,qBAAqB,GAAGtB,YAAY,CAAEyC,qBAAF,CAA1C;AACA,UAAM7B,cAAc,GAAGD,mBAAmB,CACzCW,qBADyC,EAEzCsB,KAFyC,CAA1C;;AAKA,QAAKhC,cAAc,CAACY,MAAf,KAA0B,CAA/B,EAAmC;AAClCM,MAAAA,IAAI,IAAI,EAAR;AACA;AACD;;AAED,SAAOA,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { noCase } from 'change-case';\n\n// Default search helpers.\nconst defaultGetName = ( item ) => item.name || '';\nconst defaultGetTitle = ( item ) => item.title;\nconst defaultGetDescription = ( item ) => item.description || '';\nconst defaultGetKeywords = ( item ) => item.keywords || [];\nconst defaultHasCategory = () => false;\n\n/**\n * Extracts words from an input string.\n *\n * @param {string} input The input string.\n *\n * @return {Array} Words, extracted from the input string.\n */\nfunction extractWords( input = '' ) {\n\treturn noCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/([\\p{Ll}\\p{Lo}\\p{N}])([\\p{Lu}\\p{Lt}])/gu, // One lowercase or digit, followed by one uppercase.\n\t\t\t/([\\p{Lu}\\p{Lt}])([\\p{Lu}\\p{Lt}][\\p{Ll}\\p{Lo}])/gu, // One uppercase followed by one uppercase and one lowercase.\n\t\t],\n\t\tstripRegexp: /(\\p{C}|\\p{P}|\\p{S})+/giu, // Anything that's not a punctuation, symbol or control/format character.\n\t} )\n\t\t.split( ' ' )\n\t\t.filter( Boolean );\n}\n\n/**\n * Sanitizes the search input string.\n *\n * @param {string} input The search input to normalize.\n *\n * @return {string} The normalized search input.\n */\nfunction normalizeSearchInput( input = '' ) {\n\t// Disregard diacritics.\n\t// Input: \"média\"\n\tinput = removeAccents( input );\n\n\t// Accommodate leading slash, matching autocomplete expectations.\n\t// Input: \"/media\"\n\tinput = input.replace( /^\\//, '' );\n\n\t// Lowercase.\n\t// Input: \"MEDIA\"\n\tinput = input.toLowerCase();\n\n\treturn input;\n}\n\n/**\n * Converts the search term into a list of normalized terms.\n *\n * @param {string} input The search term to normalize.\n *\n * @return {string[]} The normalized list of search terms.\n */\nexport const getNormalizedSearchTerms = ( input = '' ) => {\n\treturn extractWords( normalizeSearchInput( input ) );\n};\n\nconst removeMatchingTerms = ( unmatchedTerms, unprocessedTerms ) => {\n\treturn unmatchedTerms.filter(\n\t\t( term ) =>\n\t\t\t! getNormalizedSearchTerms( unprocessedTerms ).some(\n\t\t\t\t( unprocessedTerm ) => unprocessedTerm.includes( term )\n\t\t\t)\n\t);\n};\n\n/**\n * Filters an item list given a search term.\n *\n * @param {Array} items Item list\n * @param {string} searchInput Search input.\n * @param {Object} config Search Config.\n *\n * @return {Array} Filtered item list.\n */\nexport const searchItems = ( items = [], searchInput = '', config = {} ) => {\n\tconst normalizedSearchTerms = getNormalizedSearchTerms( searchInput );\n\tconst onlyFilterByCategory = ! normalizedSearchTerms.length;\n\tconst searchRankConfig = { ...config, onlyFilterByCategory };\n\n\t// If we aren't filtering on search terms, matching on category is satisfactory.\n\t// If we are, then we need more than a category match.\n\tconst threshold = onlyFilterByCategory ? 0 : 1;\n\n\tconst rankedItems = items\n\t\t.map( ( item ) => {\n\t\t\treturn [\n\t\t\t\titem,\n\t\t\t\tgetItemSearchRank( item, searchInput, searchRankConfig ),\n\t\t\t];\n\t\t} )\n\t\t.filter( ( [ , rank ] ) => rank > threshold );\n\n\t// If we didn't have terms to search on, there's no point sorting.\n\tif ( normalizedSearchTerms.length === 0 ) {\n\t\treturn rankedItems.map( ( [ item ] ) => item );\n\t}\n\n\trankedItems.sort( ( [ , rank1 ], [ , rank2 ] ) => rank2 - rank1 );\n\treturn rankedItems.map( ( [ item ] ) => item );\n};\n\n/**\n * Get the search rank for a given item and a specific search term.\n * The better the match, the higher the rank.\n * If the rank equals 0, it should be excluded from the results.\n *\n * @param {Object} item Item to filter.\n * @param {string} searchTerm Search term.\n * @param {Object} config Search Config.\n *\n * @return {number} Search Rank.\n */\nfunction getItemSearchRank( item, searchTerm, config ) {\n\tconst {\n\t\tcategoryId,\n\t\tgetName = defaultGetName,\n\t\tgetTitle = defaultGetTitle,\n\t\tgetDescription = defaultGetDescription,\n\t\tgetKeywords = defaultGetKeywords,\n\t\thasCategory = defaultHasCategory,\n\t\tonlyFilterByCategory,\n\t} = config;\n\n\tlet rank = hasCategory( item, categoryId ) ? 1 : 0;\n\n\t// If an item doesn't belong to the current category or we don't have\n\t// search terms to filter by, return the initial rank value.\n\tif ( ! rank || onlyFilterByCategory ) {\n\t\treturn rank;\n\t}\n\n\tconst name = getName( item );\n\tconst title = getTitle( item );\n\tconst description = getDescription( item );\n\tconst keywords = getKeywords( item );\n\n\tconst normalizedSearchInput = normalizeSearchInput( searchTerm );\n\tconst normalizedTitle = normalizeSearchInput( title );\n\n\t// Prefers exact matches\n\t// Then prefers if the beginning of the title matches the search term\n\t// name, keywords, description matches come later.\n\tif ( normalizedSearchInput === normalizedTitle ) {\n\t\trank += 30;\n\t} else if ( normalizedTitle.startsWith( normalizedSearchInput ) ) {\n\t\trank += 20;\n\t} else {\n\t\tconst terms = [ name, title, description, ...keywords ].join( ' ' );\n\t\tconst normalizedSearchTerms = extractWords( normalizedSearchInput );\n\t\tconst unmatchedTerms = removeMatchingTerms(\n\t\t\tnormalizedSearchTerms,\n\t\t\tterms\n\t\t);\n\n\t\tif ( unmatchedTerms.length === 0 ) {\n\t\t\trank += 10;\n\t\t}\n\t}\n\n\treturn rank;\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = useLibrarySettings;
6
+ exports.default = usePatternSettings;
7
7
 
8
8
  var _coreData = require("@wordpress/core-data");
9
9
 
@@ -24,7 +24,7 @@ var _utils = require("./utils");
24
24
  /**
25
25
  * Internal dependencies
26
26
  */
27
- function useLibrarySettings() {
27
+ function usePatternSettings() {
28
28
  var _storedSettings$__exp;
29
29
 
30
30
  const storedSettings = (0, _data.useSelect)(select => {
@@ -50,4 +50,4 @@ function useLibrarySettings() {
50
50
  }, [storedSettings, blockPatterns]);
51
51
  return settings;
52
52
  }
53
- //# sourceMappingURL=use-library-settings.js.map
53
+ //# sourceMappingURL=use-pattern-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-pattern-settings.js"],"names":["usePatternSettings","storedSettings","select","getSettings","editSiteStore","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","blockPatterns","filter","filterOutDuplicatesByName","settings","restStoredSettings","__unstableIsPreviewMode"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAZA;AACA;AACA;;AAKA;AACA;AACA;AAKe,SAASA,kBAAT,GAA8B;AAAA;;AAC5C,QAAMC,cAAc,GAAG,qBAAaC,MAAF,IAAc;AAC/C,UAAM;AAAEC,MAAAA;AAAF,QAAkB,wBAAQD,MAAM,CAAEE,YAAF,CAAd,CAAxB;AACA,WAAOD,WAAW,EAAlB;AACA,GAHsB,EAGpB,EAHoB,CAAvB;AAKA,QAAME,qBAAqB,4BAC1BJ,cAAc,CAACK,qCADW,yEAC8B;AACxDL,EAAAA,cAAc,CAACM,2BAFhB,CAN4C,CAQC;;AAE7C,QAAMC,iBAAiB,GAAG,qBACvBN,MAAF,IAAcA,MAAM,CAAEO,eAAF,CAAN,CAAoBC,gBAApB,EADW,EAEzB,EAFyB,CAA1B;AAKA,QAAMC,aAAa,GAAG,sBACrB,MACC,CACC,IAAKN,qBAAqB,IAAI,EAA9B,CADD,EAEC,IAAKG,iBAAiB,IAAI,EAA1B,CAFD,EAGEI,MAHF,CAGUC,gCAHV,CAFoB,EAMrB,CAAER,qBAAF,EAAyBG,iBAAzB,CANqB,CAAtB;AASA,QAAMM,QAAQ,GAAG,sBAAS,MAAM;AAC/B,UAAM;AAAER,MAAAA,qCAAF;AAAyC,SAAGS;AAA5C,QACLd,cADD;AAGA,WAAO,EACN,GAAGc,kBADG;AAENR,MAAAA,2BAA2B,EAAEI,aAFvB;AAGNK,MAAAA,uBAAuB,EAAE;AAHnB,KAAP;AAKA,GATgB,EASd,CAAEf,cAAF,EAAkBU,aAAlB,CATc,CAAjB;AAWA,SAAOG,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport { filterOutDuplicatesByName } from './utils';\n\nexport default function usePatternSettings() {\n\tconst storedSettings = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn getSettings();\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tstoredSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tstoredSettings.__experimentalBlockPatterns; // WP 5.9\n\n\tconst restBlockPatterns = useSelect(\n\t\t( select ) => select( coreStore ).getBlockPatterns(),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t].filter( filterOutDuplicatesByName ),\n\t\t[ settingsBlockPatterns, restBlockPatterns ]\n\t);\n\n\tconst settings = useMemo( () => {\n\t\tconst { __experimentalAdditionalBlockPatterns, ...restStoredSettings } =\n\t\t\tstoredSettings;\n\n\t\treturn {\n\t\t\t...restStoredSettings,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__unstableIsPreviewMode: true,\n\t\t};\n\t}, [ storedSettings, blockPatterns ] );\n\n\treturn settings;\n}\n"]}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePatterns = exports.default = void 0;
7
+
8
+ var _blocks = require("@wordpress/blocks");
9
+
10
+ var _data = require("@wordpress/data");
11
+
12
+ var _coreData = require("@wordpress/core-data");
13
+
14
+ var _htmlEntities = require("@wordpress/html-entities");
15
+
16
+ var _utils = require("./utils");
17
+
18
+ var _lockUnlock = require("../../lock-unlock");
19
+
20
+ var _searchItems = require("./search-items");
21
+
22
+ var _store = require("../../store");
23
+
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+ const EMPTY_PATTERN_LIST = [];
32
+
33
+ const createTemplatePartId = (theme, slug) => theme && slug ? theme + '//' + slug : null;
34
+
35
+ const templatePartToPattern = templatePart => ({
36
+ blocks: (0, _blocks.parse)(templatePart.content.raw),
37
+ categories: [templatePart.area],
38
+ description: templatePart.description || '',
39
+ isCustom: templatePart.source === 'custom',
40
+ keywords: templatePart.keywords || [],
41
+ id: createTemplatePartId(templatePart.theme, templatePart.slug),
42
+ name: createTemplatePartId(templatePart.theme, templatePart.slug),
43
+ title: (0, _htmlEntities.decodeEntities)(templatePart.title.rendered),
44
+ type: templatePart.type,
45
+ templatePart
46
+ });
47
+
48
+ const templatePartHasCategory = (item, category) => item.templatePart.area === category;
49
+
50
+ const selectTemplatePartsAsPatterns = (select, {
51
+ categoryId,
52
+ search = ''
53
+ } = {}) => {
54
+ var _getEntityRecords;
55
+
56
+ const {
57
+ getEntityRecords,
58
+ getIsResolving
59
+ } = select(_coreData.store);
60
+ const query = {
61
+ per_page: -1
62
+ };
63
+ const rawTemplateParts = (_getEntityRecords = getEntityRecords('postType', _utils.TEMPLATE_PARTS, query)) !== null && _getEntityRecords !== void 0 ? _getEntityRecords : EMPTY_PATTERN_LIST;
64
+ const templateParts = rawTemplateParts.map(templatePart => templatePartToPattern(templatePart));
65
+ const isResolving = getIsResolving('getEntityRecords', ['postType', 'wp_template_part', query]);
66
+ const patterns = (0, _searchItems.searchItems)(templateParts, search, {
67
+ categoryId,
68
+ hasCategory: templatePartHasCategory
69
+ });
70
+ return {
71
+ patterns,
72
+ isResolving
73
+ };
74
+ };
75
+
76
+ const selectThemePatterns = (select, {
77
+ categoryId,
78
+ search = ''
79
+ } = {}) => {
80
+ var _settings$__experimen;
81
+
82
+ const {
83
+ getSettings
84
+ } = (0, _lockUnlock.unlock)(select(_store.store));
85
+ const settings = getSettings();
86
+ const blockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen : settings.__experimentalBlockPatterns;
87
+ const restBlockPatterns = select(_coreData.store).getBlockPatterns();
88
+ let patterns = [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !_utils.CORE_PATTERN_SOURCES.includes(pattern.source)).filter(_utils.filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false).map(pattern => ({ ...pattern,
89
+ keywords: pattern.keywords || [],
90
+ type: 'pattern',
91
+ blocks: (0, _blocks.parse)(pattern.content)
92
+ }));
93
+
94
+ if (categoryId) {
95
+ patterns = (0, _searchItems.searchItems)(patterns, search, {
96
+ categoryId,
97
+ hasCategory: (item, currentCategory) => item.categories?.includes(currentCategory)
98
+ });
99
+ } else {
100
+ patterns = (0, _searchItems.searchItems)(patterns, search, {
101
+ hasCategory: item => !item.hasOwnProperty('categories')
102
+ });
103
+ }
104
+
105
+ return {
106
+ patterns,
107
+ isResolving: false
108
+ };
109
+ };
110
+
111
+ const reusableBlockToPattern = reusableBlock => ({
112
+ blocks: (0, _blocks.parse)(reusableBlock.content.raw),
113
+ categories: reusableBlock.wp_pattern,
114
+ id: reusableBlock.id,
115
+ name: reusableBlock.slug,
116
+ syncStatus: reusableBlock.wp_pattern_sync_status || _utils.SYNC_TYPES.full,
117
+ title: reusableBlock.title.raw,
118
+ type: reusableBlock.type,
119
+ reusableBlock
120
+ });
121
+
122
+ const selectUserPatterns = (select, {
123
+ search = '',
124
+ syncStatus
125
+ } = {}) => {
126
+ const {
127
+ getEntityRecords,
128
+ getIsResolving
129
+ } = select(_coreData.store);
130
+ const query = {
131
+ per_page: -1
132
+ };
133
+ const records = getEntityRecords('postType', _utils.USER_PATTERNS, query);
134
+ let patterns = records ? records.map(record => reusableBlockToPattern(record)) : EMPTY_PATTERN_LIST;
135
+ const isResolving = getIsResolving('getEntityRecords', ['postType', _utils.USER_PATTERNS, query]);
136
+
137
+ if (syncStatus) {
138
+ patterns = patterns.filter(pattern => pattern.syncStatus === syncStatus);
139
+ }
140
+
141
+ patterns = (0, _searchItems.searchItems)(patterns, search, {
142
+ // We exit user pattern retrieval early if we aren't in the
143
+ // catch-all category for user created patterns, so it has
144
+ // to be in the category.
145
+ hasCategory: () => true
146
+ });
147
+ return {
148
+ patterns,
149
+ isResolving
150
+ };
151
+ };
152
+
153
+ const usePatterns = (categoryType, categoryId, {
154
+ search = '',
155
+ syncStatus
156
+ }) => {
157
+ return (0, _data.useSelect)(select => {
158
+ if (categoryType === _utils.TEMPLATE_PARTS) {
159
+ return selectTemplatePartsAsPatterns(select, {
160
+ categoryId,
161
+ search
162
+ });
163
+ } else if (categoryType === _utils.PATTERNS) {
164
+ return selectThemePatterns(select, {
165
+ categoryId,
166
+ search
167
+ });
168
+ } else if (categoryType === _utils.USER_PATTERNS) {
169
+ return selectUserPatterns(select, {
170
+ search,
171
+ syncStatus
172
+ });
173
+ }
174
+
175
+ return {
176
+ patterns: EMPTY_PATTERN_LIST,
177
+ isResolving: false
178
+ };
179
+ }, [categoryId, categoryType, search, syncStatus]);
180
+ };
181
+
182
+ exports.usePatterns = usePatterns;
183
+ var _default = usePatterns;
184
+ exports.default = _default;
185
+ //# sourceMappingURL=use-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/use-patterns.js"],"names":["EMPTY_PATTERN_LIST","createTemplatePartId","theme","slug","templatePartToPattern","templatePart","blocks","content","raw","categories","area","description","isCustom","source","keywords","id","name","title","rendered","type","templatePartHasCategory","item","category","selectTemplatePartsAsPatterns","select","categoryId","search","getEntityRecords","getIsResolving","coreStore","query","per_page","rawTemplateParts","TEMPLATE_PARTS","templateParts","map","isResolving","patterns","hasCategory","selectThemePatterns","getSettings","editSiteStore","settings","blockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","getBlockPatterns","filter","pattern","CORE_PATTERN_SOURCES","includes","filterOutDuplicatesByName","inserter","currentCategory","hasOwnProperty","reusableBlockToPattern","reusableBlock","wp_pattern","syncStatus","wp_pattern_sync_status","SYNC_TYPES","full","selectUserPatterns","records","USER_PATTERNS","record","usePatterns","categoryType","PATTERNS"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AACA;;AACA;;AArBA;AACA;AACA;;AAMA;AACA;AACA;AAaA,MAAMA,kBAAkB,GAAG,EAA3B;;AAEA,MAAMC,oBAAoB,GAAG,CAAEC,KAAF,EAASC,IAAT,KAC5BD,KAAK,IAAIC,IAAT,GAAgBD,KAAK,GAAG,IAAR,GAAeC,IAA/B,GAAsC,IADvC;;AAGA,MAAMC,qBAAqB,GAAKC,YAAF,KAAsB;AACnDC,EAAAA,MAAM,EAAE,mBAAOD,YAAY,CAACE,OAAb,CAAqBC,GAA5B,CAD2C;AAEnDC,EAAAA,UAAU,EAAE,CAAEJ,YAAY,CAACK,IAAf,CAFuC;AAGnDC,EAAAA,WAAW,EAAEN,YAAY,CAACM,WAAb,IAA4B,EAHU;AAInDC,EAAAA,QAAQ,EAAEP,YAAY,CAACQ,MAAb,KAAwB,QAJiB;AAKnDC,EAAAA,QAAQ,EAAET,YAAY,CAACS,QAAb,IAAyB,EALgB;AAMnDC,EAAAA,E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N,CAAEX,UAAF,EAAc2C,YAAd,EAA4B1C,MAA5B,EAAoCiC,UAApC,CAdM,CAAP;AAgBA,CArBM;;;eAuBQQ,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCORE_PATTERN_SOURCES,\n\tPATTERNS,\n\tSYNC_TYPES,\n\tTEMPLATE_PARTS,\n\tUSER_PATTERNS,\n\tfilterOutDuplicatesByName,\n} from './utils';\nimport { unlock } from '../../lock-unlock';\nimport { searchItems } from './search-items';\nimport { store as editSiteStore } from '../../store';\n\nconst EMPTY_PATTERN_LIST = [];\n\nconst createTemplatePartId = ( theme, slug ) =>\n\ttheme && slug ? theme + '//' + slug : null;\n\nconst templatePartToPattern = ( templatePart ) => ( {\n\tblocks: parse( templatePart.content.raw ),\n\tcategories: [ templatePart.area ],\n\tdescription: templatePart.description || '',\n\tisCustom: templatePart.source === 'custom',\n\tkeywords: templatePart.keywords || [],\n\tid: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\tname: createTemplatePartId( templatePart.theme, templatePart.slug ),\n\ttitle: decodeEntities( templatePart.title.rendered ),\n\ttype: templatePart.type,\n\ttemplatePart,\n} );\n\nconst templatePartHasCategory = ( item, category ) =>\n\titem.templatePart.area === category;\n\nconst selectTemplatePartsAsPatterns = (\n\tselect,\n\t{ categoryId, search = '' } = {}\n) => {\n\tconst { getEntityRecords, getIsResolving } = select( coreStore );\n\tconst query = { per_page: -1 };\n\tconst rawTemplateParts =\n\t\tgetEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??\n\t\tEMPTY_PATTERN_LIST;\n\tconst templateParts = rawTemplateParts.map( ( templatePart ) =>\n\t\ttemplatePartToPattern( templatePart )\n\t);\n\n\tconst isResolving = getIsResolving( 'getEntityRecords', [\n\t\t'postType',\n\t\t'wp_template_part',\n\t\tquery,\n\t] );\n\n\tconst patterns = searchItems( templateParts, search, {\n\t\tcategoryId,\n\t\thasCategory: templatePartHasCategory,\n\t} );\n\n\treturn { patterns, isResolving };\n};\n\nconst selectThemePatterns = ( select, { categoryId, search = '' } = {} ) => {\n\tconst { getSettings } = unlock( select( editSiteStore ) );\n\tconst settings = getSettings();\n\tconst blockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ??\n\t\tsettings.__experimentalBlockPatterns;\n\n\tconst restBlockPatterns = select( coreStore ).getBlockPatterns();\n\n\tlet patterns = [\n\t\t...( blockPatterns || [] ),\n\t\t...( restBlockPatterns || [] ),\n\t]\n\t\t.filter(\n\t\t\t( pattern ) => ! CORE_PATTERN_SOURCES.includes( pattern.source )\n\t\t)\n\t\t.filter( filterOutDuplicatesByName )\n\t\t.filter( ( pattern ) => pattern.inserter !== false )\n\t\t.map( ( pattern ) => ( {\n\t\t\t...pattern,\n\t\t\tkeywords: pattern.keywords || [],\n\t\t\ttype: 'pattern',\n\t\t\tblocks: parse( pattern.content ),\n\t\t} ) );\n\n\tif ( categoryId ) {\n\t\tpatterns = searchItems( patterns, search, {\n\t\t\tcategoryId,\n\t\t\thasCategory: ( item, currentCategory ) =>\n\t\t\t\titem.categories?.includes( currentCategory ),\n\t\t} );\n\t} else {\n\t\tpatterns = searchItems( patterns, search, {\n\t\t\thasCategory: ( item ) => ! item.hasOwnProperty( 'categories' ),\n\t\t} );\n\t}\n\n\treturn { patterns, isResolving: false };\n};\n\nconst reusableBlockToPattern = ( reusableBlock ) => ( {\n\tblocks: parse( reusableBlock.content.raw ),\n\tcategories: reusableBlock.wp_pattern,\n\tid: reusableBlock.id,\n\tname: reusableBlock.slug,\n\tsyncStatus: reusableBlock.wp_pattern_sync_status || SYNC_TYPES.full,\n\ttitle: reusableBlock.title.raw,\n\ttype: reusableBlock.type,\n\treusableBlock,\n} );\n\nconst selectUserPatterns = ( select, { search = '', syncStatus } = {} ) => {\n\tconst { getEntityRecords, getIsResolving } = select( coreStore );\n\n\tconst query = { per_page: -1 };\n\tconst records = getEntityRecords( 'postType', USER_PATTERNS, query );\n\n\tlet patterns = records\n\t\t? records.map( ( record ) => reusableBlockToPattern( record ) )\n\t\t: EMPTY_PATTERN_LIST;\n\tconst isResolving = getIsResolving( 'getEntityRecords', [\n\t\t'postType',\n\t\tUSER_PATTERNS,\n\t\tquery,\n\t] );\n\n\tif ( syncStatus ) {\n\t\tpatterns = patterns.filter(\n\t\t\t( pattern ) => pattern.syncStatus === syncStatus\n\t\t);\n\t}\n\n\tpatterns = searchItems( patterns, search, {\n\t\t// We exit user pattern retrieval early if we aren't in the\n\t\t// catch-all category for user created patterns, so it has\n\t\t// to be in the category.\n\t\thasCategory: () => true,\n\t} );\n\n\treturn { patterns, isResolving };\n};\n\nexport const usePatterns = (\n\tcategoryType,\n\tcategoryId,\n\t{ search = '', syncStatus }\n) => {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( categoryType === TEMPLATE_PARTS ) {\n\t\t\t\treturn selectTemplatePartsAsPatterns( select, {\n\t\t\t\t\tcategoryId,\n\t\t\t\t\tsearch,\n\t\t\t\t} );\n\t\t\t} else if ( categoryType === PATTERNS ) {\n\t\t\t\treturn selectThemePatterns( select, { categoryId, search } );\n\t\t\t} else if ( categoryType === USER_PATTERNS ) {\n\t\t\t\treturn selectUserPatterns( select, { search, syncStatus } );\n\t\t\t}\n\t\t\treturn { patterns: EMPTY_PATTERN_LIST, isResolving: false };\n\t\t},\n\t\t[ categoryId, categoryType, search, syncStatus ]\n\t);\n};\n\nexport default usePatterns;\n"]}
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.filterOutDuplicatesByName = exports.USER_PATTERN_CATEGORY = exports.USER_PATTERNS = exports.TEMPLATE_PARTS = exports.SYNC_TYPES = exports.PATTERNS = exports.DEFAULT_TYPE = exports.DEFAULT_CATEGORY = exports.CORE_PATTERN_SOURCES = void 0;
7
- const DEFAULT_CATEGORY = 'header';
7
+ const DEFAULT_CATEGORY = 'my-patterns';
8
8
  exports.DEFAULT_CATEGORY = DEFAULT_CATEGORY;
9
- const DEFAULT_TYPE = 'wp_template_part';
9
+ const DEFAULT_TYPE = 'wp_block';
10
10
  exports.DEFAULT_TYPE = DEFAULT_TYPE;
11
11
  const PATTERNS = 'pattern';
12
12
  exports.PATTERNS = PATTERNS;
@@ -14,7 +14,7 @@ const TEMPLATE_PARTS = 'wp_template_part';
14
14
  exports.TEMPLATE_PARTS = TEMPLATE_PARTS;
15
15
  const USER_PATTERNS = 'wp_block';
16
16
  exports.USER_PATTERNS = USER_PATTERNS;
17
- const USER_PATTERN_CATEGORY = 'custom-patterns';
17
+ const USER_PATTERN_CATEGORY = 'my-patterns';
18
18
  exports.USER_PATTERN_CATEGORY = USER_PATTERN_CATEGORY;
19
19
  const CORE_PATTERN_SOURCES = ['core', 'pattern-directory/core', 'pattern-directory/featured', 'pattern-directory/theme'];
20
20
  exports.CORE_PATTERN_SOURCES = CORE_PATTERN_SOURCES;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/page-patterns/utils.js"],"names":["DEFAULT_CATEGORY","DEFAULT_TYPE","PATTERNS","TEMPLATE_PARTS","USER_PATTERNS","USER_PATTERN_CATEGORY","CORE_PATTERN_SOURCES","SYNC_TYPES","full","unsynced","filterOutDuplicatesByName","currentItem","index","items","findIndex","item","name"],"mappings":";;;;;;AAAO,MAAMA,gBAAgB,GAAG,aAAzB;;AACA,MAAMC,YAAY,GAAG,UAArB;;AACA,MAAMC,QAAQ,GAAG,SAAjB;;AACA,MAAMC,cAAc,GAAG,kBAAvB;;AACA,MAAMC,aAAa,GAAG,UAAtB;;AACA,MAAMC,qBAAqB,GAAG,aAA9B;;AAEA,MAAMC,oBAAoB,GAAG,CACnC,MADmC,EAEnC,wBAFmC,EAGnC,4BAHmC,EAInC,yBAJmC,CAA7B;;AAOA,MAAMC,UAAU,GAAG;AACzBC,EAAAA,IAAI,EAAE,OADmB;AAEzBC,EAAAA,QAAQ,EAAE;AAFe,CAAnB;;;AAKA,MAAMC,yBAAyB,GAAG,CAAEC,WAAF,EAAeC,KAAf,EAAsBC,KAAtB,KACxCD,KAAK,KAAKC,KAAK,CAACC,SAAN,CAAmBC,IAAF,IAAYJ,WAAW,CAACK,IAAZ,KAAqBD,IAAI,CAACC,IAAvD,CADJ","sourcesContent":["export const DEFAULT_CATEGORY = 'my-patterns';\nexport const DEFAULT_TYPE = 'wp_block';\nexport const PATTERNS = 'pattern';\nexport const TEMPLATE_PARTS = 'wp_template_part';\nexport const USER_PATTERNS = 'wp_block';\nexport const USER_PATTERN_CATEGORY = 'my-patterns';\n\nexport const CORE_PATTERN_SOURCES = [\n\t'core',\n\t'pattern-directory/core',\n\t'pattern-directory/featured',\n\t'pattern-directory/theme',\n];\n\nexport const SYNC_TYPES = {\n\tfull: 'fully',\n\tunsynced: 'unsynced',\n};\n\nexport const filterOutDuplicatesByName = ( currentItem, index, items ) =>\n\tindex === items.findIndex( ( item ) => currentItem.name === item.name );\n"]}