@wordpress/edit-site 5.33.0 → 5.34.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 (272) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +3 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +8 -7
  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 +3 -0
  7. package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  8. package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
  9. package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  10. package/build/components/block-editor/resize-handle.js +20 -5
  11. package/build/components/block-editor/resize-handle.js.map +1 -1
  12. package/build/components/create-template-part-modal/index.js +3 -0
  13. package/build/components/create-template-part-modal/index.js.map +1 -1
  14. package/build/components/editor/index.js +28 -5
  15. package/build/components/editor/index.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/context.js +9 -3
  17. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  21. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  23. package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  24. package/build/components/global-styles/style-variations-container.js +8 -2
  25. package/build/components/global-styles/style-variations-container.js.map +1 -1
  26. package/build/components/header-edit-mode/index.js +33 -49
  27. package/build/components/header-edit-mode/index.js.map +1 -1
  28. package/build/components/header-edit-mode/more-menu/index.js +3 -97
  29. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  30. package/build/components/keyboard-shortcuts/register.js +0 -49
  31. package/build/components/keyboard-shortcuts/register.js.map +1 -1
  32. package/build/components/layout/index.js +7 -4
  33. package/build/components/layout/index.js.map +1 -1
  34. package/build/components/layout/router.js +9 -38
  35. package/build/components/layout/router.js.map +1 -1
  36. package/build/components/page-pages/index.js +4 -3
  37. package/build/components/page-pages/index.js.map +1 -1
  38. package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
  39. package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  40. package/build/components/page-patterns/header.js +3 -1
  41. package/build/components/page-patterns/header.js.map +1 -1
  42. package/build/components/page-patterns/index.js +20 -49
  43. package/build/components/page-patterns/index.js.map +1 -1
  44. package/build/components/page-patterns/use-patterns.js +1 -0
  45. package/build/components/page-patterns/use-patterns.js.map +1 -1
  46. package/build/components/page-templates/hooks.js.map +1 -0
  47. package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
  48. package/build/components/page-templates/index.js.map +1 -0
  49. package/build/components/pattern-modal/duplicate.js +7 -5
  50. package/build/components/pattern-modal/duplicate.js.map +1 -1
  51. package/build/components/plugin-template-setting-panel/index.js +9 -0
  52. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  53. package/build/components/resizable-frame/index.js +9 -6
  54. package/build/components/resizable-frame/index.js.map +1 -1
  55. package/build/components/sidebar-edit-mode/index.js +3 -2
  56. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
  58. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
  60. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
  62. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  63. package/build/components/sidebar-navigation-screen-page/index.js +39 -8
  64. package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
  65. package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
  66. package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  67. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  68. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  69. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  70. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  71. package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  72. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  73. package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
  74. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  75. package/build/components/sidebar-navigation-screen-template/index.js +1 -1
  76. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  77. package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  78. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  79. package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
  80. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  81. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  82. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  83. package/build/components/template-actions/index.js +1 -1
  84. package/build/components/template-actions/index.js.map +1 -1
  85. package/build/deprecated.js +55 -0
  86. package/build/deprecated.js.map +1 -0
  87. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
  88. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  89. package/build/index.js +18 -18
  90. package/build/index.js.map +1 -1
  91. package/build/utils/constants.js +1 -2
  92. package/build/utils/constants.js.map +1 -1
  93. package/build-module/components/add-new-page/index.js +3 -0
  94. package/build-module/components/add-new-page/index.js.map +1 -1
  95. package/build-module/components/add-new-pattern/index.js +8 -7
  96. package/build-module/components/add-new-pattern/index.js.map +1 -1
  97. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  98. package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
  99. package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
  100. package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
  101. package/build-module/components/block-editor/resize-handle.js +21 -6
  102. package/build-module/components/block-editor/resize-handle.js.map +1 -1
  103. package/build-module/components/create-template-part-modal/index.js +3 -0
  104. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  105. package/build-module/components/editor/index.js +28 -5
  106. package/build-module/components/editor/index.js.map +1 -1
  107. package/build-module/components/global-styles/font-library-modal/context.js +9 -3
  108. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  109. package/build-module/components/global-styles/font-library-modal/font-collection.js +7 -2
  110. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  111. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +22 -20
  112. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  113. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  114. package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
  115. package/build-module/components/global-styles/style-variations-container.js +8 -2
  116. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  117. package/build-module/components/header-edit-mode/index.js +39 -55
  118. package/build-module/components/header-edit-mode/index.js.map +1 -1
  119. package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
  120. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  121. package/build-module/components/keyboard-shortcuts/register.js +0 -49
  122. package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
  123. package/build-module/components/layout/index.js +7 -4
  124. package/build-module/components/layout/index.js.map +1 -1
  125. package/build-module/components/layout/router.js +9 -38
  126. package/build-module/components/layout/router.js.map +1 -1
  127. package/build-module/components/page-pages/index.js +5 -4
  128. package/build-module/components/page-pages/index.js.map +1 -1
  129. package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
  130. package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
  131. package/build-module/components/page-patterns/header.js +3 -1
  132. package/build-module/components/page-patterns/header.js.map +1 -1
  133. package/build-module/components/page-patterns/index.js +22 -51
  134. package/build-module/components/page-patterns/index.js.map +1 -1
  135. package/build-module/components/page-patterns/use-patterns.js +1 -0
  136. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  137. package/build-module/components/page-templates/hooks.js.map +1 -0
  138. package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
  139. package/build-module/components/page-templates/index.js.map +1 -0
  140. package/build-module/components/pattern-modal/duplicate.js +7 -5
  141. package/build-module/components/pattern-modal/duplicate.js.map +1 -1
  142. package/build-module/components/plugin-template-setting-panel/index.js +8 -0
  143. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  144. package/build-module/components/resizable-frame/index.js +9 -6
  145. package/build-module/components/resizable-frame/index.js.map +1 -1
  146. package/build-module/components/sidebar-edit-mode/index.js +4 -3
  147. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  148. package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
  149. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  150. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
  151. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  152. package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
  153. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  154. package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
  155. package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
  156. package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
  157. package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
  158. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  159. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  160. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  161. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  162. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
  163. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  164. package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
  165. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  166. package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
  167. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  168. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  169. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  170. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
  171. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  172. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
  173. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  174. package/build-module/components/template-actions/index.js +1 -1
  175. package/build-module/components/template-actions/index.js.map +1 -1
  176. package/build-module/deprecated.js +45 -0
  177. package/build-module/deprecated.js.map +1 -0
  178. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
  179. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  180. package/build-module/index.js +2 -4
  181. package/build-module/index.js.map +1 -1
  182. package/build-module/utils/constants.js +0 -1
  183. package/build-module/utils/constants.js.map +1 -1
  184. package/build-style/style-rtl.css +79 -125
  185. package/build-style/style.css +79 -125
  186. package/package.json +42 -42
  187. package/src/components/add-new-page/index.js +7 -1
  188. package/src/components/add-new-pattern/index.js +15 -12
  189. package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
  190. package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
  191. package/src/components/block-editor/resize-handle.js +30 -11
  192. package/src/components/block-editor/style.scss +10 -15
  193. package/src/components/create-template-part-modal/index.js +3 -0
  194. package/src/components/editor/index.js +42 -3
  195. package/src/components/editor/style.scss +6 -1
  196. package/src/components/global-styles/font-library-modal/context.js +9 -3
  197. package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
  198. package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
  199. package/src/components/global-styles/font-library-modal/style.scss +17 -0
  200. package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
  201. package/src/components/global-styles/style-variations-container.js +11 -2
  202. package/src/components/header-edit-mode/index.js +56 -76
  203. package/src/components/header-edit-mode/more-menu/index.js +8 -145
  204. package/src/components/header-edit-mode/style.scss +13 -85
  205. package/src/components/keyboard-shortcuts/register.js +0 -58
  206. package/src/components/layout/index.js +11 -2
  207. package/src/components/layout/router.js +9 -49
  208. package/src/components/page-pages/index.js +14 -4
  209. package/src/components/page-pages/style.scss +11 -0
  210. package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
  211. package/src/components/page-patterns/header.js +3 -1
  212. package/src/components/page-patterns/index.js +17 -76
  213. package/src/components/page-patterns/style.scss +14 -1
  214. package/src/components/page-patterns/use-patterns.js +1 -0
  215. package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
  216. package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
  217. package/src/components/pattern-modal/duplicate.js +4 -3
  218. package/src/components/plugin-template-setting-panel/index.js +8 -0
  219. package/src/components/resizable-frame/index.js +4 -3
  220. package/src/components/sidebar-edit-mode/index.js +13 -2
  221. package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
  222. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
  223. package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
  224. package/src/components/sidebar-navigation-screen-page/index.js +48 -9
  225. package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
  226. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
  227. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  228. package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
  229. package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
  230. package/src/components/sidebar-navigation-screen-template/index.js +1 -1
  231. package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
  232. package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
  233. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
  234. package/src/components/template-actions/index.js +1 -1
  235. package/src/deprecated.js +42 -0
  236. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
  237. package/src/index.js +2 -9
  238. package/src/style.scss +1 -5
  239. package/src/utils/constants.js +1 -1
  240. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
  241. package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  242. package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
  243. package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  244. package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
  245. package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  246. package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
  247. package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  248. package/build/components/page-templates-template-parts/hooks.js.map +0 -1
  249. package/build/components/page-templates-template-parts/index.js.map +0 -1
  250. package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
  251. package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  252. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
  253. package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
  254. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  255. package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
  256. package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
  257. package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
  258. package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
  259. package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
  260. package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
  261. package/build-module/components/page-templates-template-parts/index.js.map +0 -1
  262. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
  263. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
  264. package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
  265. package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
  266. package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
  267. package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
  268. package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
  269. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
  270. /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  271. /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
  272. /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
@@ -11,7 +11,7 @@ var _i18n = require("@wordpress/i18n");
11
11
  var _coreData = require("@wordpress/core-data");
12
12
  var _editor = require("@wordpress/editor");
13
13
  var _data = require("@wordpress/data");
14
- var _hooks = require("../page-templates-template-parts/hooks");
14
+ var _hooks = require("../page-templates/hooks");
15
15
  var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
16
16
  var _useNavigationMenuContent = _interopRequireDefault(require("./use-navigation-menu-content"));
17
17
  var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
@@ -1 +1 @@
1
- {"version":3,"names":["_changeCase","require","_i18n","_coreData","_editor","_data","_hooks","_useEditedEntityRecord","_interopRequireDefault","_useNavigationMenuContent","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenDetailsPanel","_constants","usePatternDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","coreStore","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","PATTERN_TYPES","user","sprintf","__","footer","modified","_react","createElement","default","details","TEMPLATE_PART_POST_TYPE","push","label","value","wp_pattern_sync_status","PATTERN_SYNC_TYPES","unsynced","_x","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","sentenceCase","className","origin","TEMPLATE_ORIGINS","plugin","has_theme_file","isCustomized","content","Fragment","useNavigationMenuContent","SidebarNavigationScreenDetailsPanel","spacing","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n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AAK,EAAG,IAAAM,QAAE,EAAE,SAAU;EAAG,GAEvBM,OAAO,CAACqB,GAAG,CAAE,CAAE;IAAElB,KAAK;IAAEC;EAAM,CAAC,KAChC,IAAAP,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA4E,sCAAsC;IAACC,GAAG,EAAGrC;EAAO,GACpD,IAAAN,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA8E,wCAAwC,QACtCtC,KACuC,CAAC,EAC3C,IAAAN,MAAA,CAAAC,aAAA,EAACnC,oCAAA,CAAA+E,wCAAwC,QACtCtC,KACuC,CACH,CACvC,CACkC,CAErC,CACF;EAED,OAAO;IAAEhB,KAAK;IAAEC,WAAW;IAAE6C,OAAO;IAAEvC;EAAO,CAAC;AAC/C","ignoreList":[]}
1
+ {"version":3,"names":["_changeCase","require","_i18n","_coreData","_editor","_data","_hooks","_useEditedEntityRecord","_interopRequireDefault","_useNavigationMenuContent","_sidebarNavigationScreenDetailsFooter","_sidebarNavigationScreenDetailsPanel","_constants","usePatternDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","coreStore","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","PATTERN_TYPES","user","sprintf","__","footer","modified","_react","createElement","default","details","TEMPLATE_PART_POST_TYPE","push","label","value","wp_pattern_sync_status","PATTERN_SYNC_TYPES","unsynced","_x","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","sentenceCase","className","origin","TEMPLATE_ORIGINS","plugin","has_theme_file","isCustomized","content","Fragment","useNavigationMenuContent","SidebarNavigationScreenDetailsPanel","spacing","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,qCAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,oCAAA,GAAAV,OAAA;AAMA,IAAAW,UAAA,GAAAX,OAAA;AA1BA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;;AAkBe,SAASY,iBAAiBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC7D,MAAM;IAAEC,cAAc;IAAEC,QAAQ;IAAEC;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'
22
23
  }) {
23
24
  const linkInfo = (0, _link.useLink)({
24
- path: '/patterns',
25
+ path,
25
26
  categoryType: type,
26
27
  categoryId: id
27
28
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_sidebarNavigationItem","_interopRequireDefault","require","_link","CategoryItem","count","icon","id","isActive","label","type","linkInfo","useLink","path","categoryType","categoryId","_react","createElement","default","suffix","undefined"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n} ) {\n\tconst linkInfo = useLink( {\n\t\tpath: '/patterns',\n\t\tcategoryType: type,\n\t\tcategoryId: id,\n\t} );\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,QAAQ;EACRC,KAAK;EACLC;AACD,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,aAAO,EAAE;IACzBC,IAAI,EAAE,WAAW;IACjBC,YAAY,EAAEJ,IAAI;IAClBK,UAAU,EAAER;EACb,CAAE,CAAC;EAEH,IAAK,CAAEF,KAAK,EAAG;IACd;EACD;EAEA,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,sBAAA,CAAAkB,OAAqB;IAAA,GAChBP,QAAQ;IACbL,IAAI,EAAGA,IAAM;IACba,MAAM,EAAG,IAAAH,MAAA,CAAAC,aAAA,gBAAQZ,KAAa,CAAG;IACjC,gBAAeG,QAAQ,GAAG,MAAM,GAAGY;EAAW,GAE5CX,KACoB,CAAC;AAE1B","ignoreList":[]}
1
+ {"version":3,"names":["_sidebarNavigationItem","_interopRequireDefault","require","_link","CategoryItem","count","icon","id","isActive","label","type","path","linkInfo","useLink","categoryType","categoryId","_react","createElement","default","suffix","undefined"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/category-item.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useLink } from '../routes/link';\n\nexport default function CategoryItem( {\n\tcount,\n\ticon,\n\tid,\n\tisActive,\n\tlabel,\n\ttype,\n\tpath = '/patterns',\n} ) {\n\tconst linkInfo = useLink( {\n\t\tpath,\n\t\tcategoryType: type,\n\t\tcategoryId: id,\n\t} );\n\n\tif ( ! count ) {\n\t\treturn;\n\t}\n\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...linkInfo }\n\t\t\ticon={ icon }\n\t\t\tsuffix={ <span>{ count }</span> }\n\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t>\n\t\t\t{ label }\n\t\t</SidebarNavigationItem>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,sBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,EAAE;EACFC,QAAQ;EACRC,KAAK;EACLC,IAAI;EACJC,IAAI,GAAG;AACR,CAAC,EAAG;EACH,MAAMC,QAAQ,GAAG,IAAAC,aAAO,EAAE;IACzBF,IAAI;IACJG,YAAY,EAAEJ,IAAI;IAClBK,UAAU,EAAER;EACb,CAAE,CAAC;EAEH,IAAK,CAAEF,KAAK,EAAG;IACd;EACD;EAEA,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,sBAAA,CAAAkB,OAAqB;IAAA,GAChBN,QAAQ;IACbN,IAAI,EAAGA,IAAM;IACba,MAAM,EAAG,IAAAH,MAAA,CAAAC,aAAA,gBAAQZ,KAAa,CAAG;IACjC,gBAAeG,QAAQ,GAAG,MAAM,GAAGY;EAAW,GAE5CX,KACoB,CAAC;AAE1B","ignoreList":[]}
@@ -7,22 +7,19 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = SidebarNavigationScreenPatterns;
8
8
  var _react = require("react");
9
9
  var _components = require("@wordpress/components");
10
- var _compose = require("@wordpress/compose");
11
10
  var _editor = require("@wordpress/editor");
12
11
  var _i18n = require("@wordpress/i18n");
13
- var _url = require("@wordpress/url");
14
12
  var _coreData = require("@wordpress/core-data");
15
13
  var _data = require("@wordpress/data");
16
14
  var _icons = require("@wordpress/icons");
15
+ var _router = require("@wordpress/router");
17
16
  var _addNewPattern = _interopRequireDefault(require("../add-new-pattern"));
18
- var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
19
17
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
20
18
  var _categoryItem = _interopRequireDefault(require("./category-item"));
21
19
  var _constants = require("../../utils/constants");
22
- var _link = require("../routes/link");
23
20
  var _usePatternCategories = _interopRequireDefault(require("./use-pattern-categories"));
24
21
  var _useTemplatePartAreas = _interopRequireDefault(require("./use-template-part-areas"));
25
- var _store = require("../../store");
22
+ var _lockUnlock = require("../../lock-unlock");
26
23
  /**
27
24
  * WordPress dependencies
28
25
  */
@@ -31,7 +28,11 @@ var _store = require("../../store");
31
28
  * Internal dependencies
32
29
  */
33
30
 
31
+ const {
32
+ useLocation
33
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
34
34
  function CategoriesGroup({
35
+ path,
35
36
  templatePartAreas,
36
37
  patternCategories,
37
38
  currentCategory,
@@ -42,19 +43,21 @@ function CategoriesGroup({
42
43
  className: "edit-site-sidebar-navigation-screen-patterns__group"
43
44
  }, (0, _react.createElement)(_categoryItem.default, {
44
45
  key: "all",
46
+ path: path,
45
47
  count: Object.values(templatePartAreas).map(({
46
48
  templateParts
47
49
  }) => templateParts?.length || 0).reduce((acc, val) => acc + val, 0),
48
50
  icon: (0, _editor.getTemplatePartIcon)() /* no name, so it provides the fallback icon */,
49
51
  label: (0, _i18n.__)('All template parts'),
50
- id: 'all-parts',
52
+ id: _constants.TEMPLATE_PART_ALL_AREAS_CATEGORY,
51
53
  type: _constants.TEMPLATE_PART_POST_TYPE,
52
- isActive: currentCategory === 'all-parts' && currentType === _constants.TEMPLATE_PART_POST_TYPE
54
+ isActive: currentCategory === _constants.TEMPLATE_PART_ALL_AREAS_CATEGORY && currentType === _constants.TEMPLATE_PART_POST_TYPE
53
55
  }), Object.entries(templatePartAreas).map(([area, {
54
56
  label,
55
57
  templateParts
56
58
  }]) => (0, _react.createElement)(_categoryItem.default, {
57
59
  key: area,
60
+ path: path,
58
61
  count: templateParts?.length,
59
62
  icon: (0, _editor.getTemplatePartIcon)(area),
60
63
  label: label,
@@ -65,6 +68,7 @@ function CategoriesGroup({
65
68
  className: "edit-site-sidebar-navigation-screen-patterns__divider"
66
69
  }), allPatterns && (0, _react.createElement)(_categoryItem.default, {
67
70
  key: allPatterns.name,
71
+ path: path,
68
72
  count: allPatterns.count,
69
73
  label: allPatterns.label,
70
74
  icon: _icons.file,
@@ -73,6 +77,7 @@ function CategoriesGroup({
73
77
  isActive: currentCategory === `${allPatterns.name}` && (currentType === _constants.PATTERN_TYPES.theme || currentType === _constants.PATTERN_TYPES.user)
74
78
  }), otherPatterns.map(category => (0, _react.createElement)(_categoryItem.default, {
75
79
  key: category.name,
80
+ path: path,
76
81
  count: category.count,
77
82
  label: category.label,
78
83
  icon: _icons.file,
@@ -82,11 +87,13 @@ function CategoriesGroup({
82
87
  })));
83
88
  }
84
89
  function SidebarNavigationScreenPatterns() {
85
- const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
86
90
  const {
87
- categoryType,
88
- categoryId
89
- } = (0, _url.getQueryArgs)(window.location.href);
91
+ params: {
92
+ categoryType,
93
+ categoryId,
94
+ path
95
+ }
96
+ } = useLocation();
90
97
  const currentCategory = categoryId || _constants.PATTERN_DEFAULT_CATEGORY;
91
98
  const currentType = categoryType || _constants.PATTERN_TYPES.theme;
92
99
  const {
@@ -99,29 +106,28 @@ function SidebarNavigationScreenPatterns() {
99
106
  hasPatterns
100
107
  } = (0, _usePatternCategories.default)();
101
108
  const isBlockBasedTheme = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme()?.is_block_theme, []);
102
- const isTemplatePartsMode = (0, _data.useSelect)(select => {
103
- const settings = select(_store.store).getSettings();
104
- return !!settings.supportsTemplatePartsMode;
105
- }, []);
106
- const templatePartsLink = (0, _link.useLink)({
107
- path: '/wp_template_part/all',
108
- // If a classic theme that supports template parts accessed
109
- // the Patterns page directly, preserve that state in the URL.
110
- didAccessPatternsPage: !isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined
111
- });
112
- const footer = !isMobileViewport ? (0, _react.createElement)(_components.__experimentalItemGroup, null, (isBlockBasedTheme || isTemplatePartsMode) && (0, _react.createElement)(_sidebarNavigationItem.default, {
113
- withChevron: true,
114
- ...templatePartsLink
115
- }, (0, _i18n.__)('Manage all template parts'))) : undefined;
109
+
110
+ /**
111
+ * This sidebar needs to temporarily accomodate two different "URLs":
112
+ *
113
+ * 1. path = /patterns
114
+ * Block based themes. Also classic themes can access this URL, though it's not linked anywhere.
115
+ *
116
+ * 2. path = /wp_template_part/all
117
+ * Classic themes with support for block-template-parts. We need to list only Template Parts in this case.
118
+ * The URL is accessible from the Appearance > Template Parts menu.
119
+ *
120
+ * This is temporary. We aim to consolidate to /patterns.
121
+ */
116
122
  return (0, _react.createElement)(_sidebarNavigationScreen.default, {
117
123
  isRoot: !isBlockBasedTheme,
118
124
  title: (0, _i18n.__)('Patterns'),
119
125
  description: (0, _i18n.__)('Manage what patterns are available when editing the site.'),
120
126
  actions: (0, _react.createElement)(_addNewPattern.default, null),
121
- footer: footer,
122
- content: (0, _react.createElement)(_react.Fragment, null, isLoading && (0, _i18n.__)('Loading patterns…'), !isLoading && (0, _react.createElement)(_react.Fragment, null, !hasTemplateParts && !hasPatterns && (0, _react.createElement)(_components.__experimentalItemGroup, {
127
+ content: (0, _react.createElement)(_react.Fragment, null, isLoading && (0, _i18n.__)('Loading items…'), !isLoading && (0, _react.createElement)(_react.Fragment, null, !hasTemplateParts && !hasPatterns && (0, _react.createElement)(_components.__experimentalItemGroup, {
123
128
  className: "edit-site-sidebar-navigation-screen-patterns__group"
124
- }, (0, _react.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No template parts or patterns found'))), (0, _react.createElement)(CategoriesGroup, {
129
+ }, (0, _react.createElement)(_components.__experimentalItem, null, (0, _i18n.__)('No items found'))), (0, _react.createElement)(CategoriesGroup, {
130
+ path: path,
125
131
  templatePartAreas: templatePartAreas,
126
132
  patternCategories: patternCategories,
127
133
  currentCategory: currentCategory,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_compose","_editor","_i18n","_url","_coreData","_data","_icons","_addNewPattern","_interopRequireDefault","_sidebarNavigationItem","_sidebarNavigationScreen","_categoryItem","_constants","_link","_usePatternCategories","_useTemplatePartAreas","_store","CategoriesGroup","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","_react","createElement","__experimentalItemGroup","className","default","key","count","Object","values","map","templateParts","length","reduce","acc","val","icon","getTemplatePartIcon","label","__","id","type","TEMPLATE_PART_POST_TYPE","isActive","entries","area","name","file","PATTERN_TYPES","theme","user","category","SidebarNavigationScreenPatterns","isMobileViewport","useViewportMatch","categoryType","categoryId","getQueryArgs","window","location","href","PATTERN_DEFAULT_CATEGORY","hasTemplateParts","isLoading","useTemplatePartAreas","hasPatterns","usePatternCategories","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","isTemplatePartsMode","settings","editSiteStore","getSettings","supportsTemplatePartsMode","templatePartsLink","useLink","path","didAccessPatternsPage","undefined","footer","withChevron","isRoot","title","description","actions","content","Fragment","__experimentalItem"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { getQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport { useLink } from '../routes/link';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { store as editSiteStore } from '../../store';\n\nfunction CategoriesGroup( {\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ 'all-parts' }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === 'all-parts' &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) }\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { categoryType, categoryId } = getQueryArgs( window.location.href );\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst templatePartsLink = useLink( {\n\t\tpath: '/wp_template_part/all',\n\t\t// If a classic theme that supports template parts accessed\n\t\t// the Patterns page directly, preserve that state in the URL.\n\t\tdidAccessPatternsPage:\n\t\t\t! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,\n\t} );\n\n\tconst footer = ! isMobileViewport ? (\n\t\t<ItemGroup>\n\t\t\t{ ( isBlockBasedTheme || isTemplatePartsMode ) && (\n\t\t\t\t<SidebarNavigationItem withChevron { ...templatePartsLink }>\n\t\t\t\t\t{ __( 'Manage all template parts' ) }\n\t\t\t\t</SidebarNavigationItem>\n\t\t\t) }\n\t\t</ItemGroup>\n\t) : undefined;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tfooter={ footer }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading patterns…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t'No template parts or patterns found'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<CategoriesGroup\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAKA,IAAAQ,cAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,wBAAA,GAAAF,sBAAA,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AEJ","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_editor","_i18n","_coreData","_data","_icons","_router","_addNewPattern","_interopRequireDefault","_sidebarNavigationScreen","_categoryItem","_constants","_usePatternCategories","_useTemplatePartAreas","_lockUnlock","useLocation","unlock","routerPrivateApis","CategoriesGroup","path","templatePartAreas","patternCategories","currentCategory","currentType","allPatterns","otherPatterns","_react","createElement","__experimentalItemGroup","className","default","key","count","Object","values","map","templateParts","length","reduce","acc","val","icon","getTemplatePartIcon","label","__","id","TEMPLATE_PART_ALL_AREAS_CATEGORY","type","TEMPLATE_PART_POST_TYPE","isActive","entries","area","name","file","PATTERN_TYPES","theme","user","category","SidebarNavigationScreenPatterns","params","categoryType","categoryId","PATTERN_DEFAULT_CATEGORY","hasTemplateParts","isLoading","useTemplatePartAreas","hasPatterns","usePatternCategories","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","isRoot","title","description","actions","content","Fragment","__experimentalItem"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { getTemplatePartIcon } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { file } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport CategoryItem from './category-item';\nimport {\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_PART_ALL_AREAS_CATEGORY,\n} from '../../utils/constants';\nimport usePatternCategories from './use-pattern-categories';\nimport useTemplatePartAreas from './use-template-part-areas';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction CategoriesGroup( {\n\tpath,\n\ttemplatePartAreas,\n\tpatternCategories,\n\tcurrentCategory,\n\tcurrentType,\n} ) {\n\tconst [ allPatterns, ...otherPatterns ] = patternCategories;\n\n\treturn (\n\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t<CategoryItem\n\t\t\t\tkey=\"all\"\n\t\t\t\tpath={ path }\n\t\t\t\tcount={ Object.values( templatePartAreas )\n\t\t\t\t\t.map( ( { templateParts } ) => templateParts?.length || 0 )\n\t\t\t\t\t.reduce( ( acc, val ) => acc + val, 0 ) }\n\t\t\t\ticon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */\n\t\t\t\tlabel={ __( 'All template parts' ) }\n\t\t\t\tid={ TEMPLATE_PART_ALL_AREAS_CATEGORY }\n\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\tisActive={\n\t\t\t\t\tcurrentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&\n\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ Object.entries( templatePartAreas ).map(\n\t\t\t\t( [ area, { label, templateParts } ] ) => (\n\t\t\t\t\t<CategoryItem\n\t\t\t\t\t\tkey={ area }\n\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\tcount={ templateParts?.length }\n\t\t\t\t\t\ticon={ getTemplatePartIcon( area ) }\n\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\tid={ area }\n\t\t\t\t\t\ttype={ TEMPLATE_PART_POST_TYPE }\n\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\tcurrentCategory === area &&\n\t\t\t\t\t\t\tcurrentType === TEMPLATE_PART_POST_TYPE\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t) }\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-patterns__divider\" />\n\t\t\t{ allPatterns && (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ allPatterns.name }\n\t\t\t\t\tpath={ path }\n\t\t\t\t\tcount={ allPatterns.count }\n\t\t\t\t\tlabel={ allPatterns.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ allPatterns.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ allPatterns.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ otherPatterns.map( ( category ) => (\n\t\t\t\t<CategoryItem\n\t\t\t\t\tkey={ category.name }\n\t\t\t\t\tpath={ path }\n\t\t\t\t\tcount={ category.count }\n\t\t\t\t\tlabel={ category.label }\n\t\t\t\t\ticon={ file }\n\t\t\t\t\tid={ category.name }\n\t\t\t\t\ttype=\"pattern\"\n\t\t\t\t\tisActive={\n\t\t\t\t\t\tcurrentCategory === `${ category.name }` &&\n\t\t\t\t\t\t( currentType === PATTERN_TYPES.theme ||\n\t\t\t\t\t\t\tcurrentType === PATTERN_TYPES.user )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ItemGroup>\n\t);\n}\n\nexport default function SidebarNavigationScreenPatterns() {\n\tconst {\n\t\tparams: { categoryType, categoryId, path },\n\t} = useLocation();\n\tconst currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;\n\tconst currentType = categoryType || PATTERN_TYPES.theme;\n\n\tconst { templatePartAreas, hasTemplateParts, isLoading } =\n\t\tuseTemplatePartAreas();\n\tconst { patternCategories, hasPatterns } = usePatternCategories();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\n\t/**\n\t * This sidebar needs to temporarily accomodate two different \"URLs\":\n\t *\n\t * 1. path = /patterns\n\t * Block based themes. Also classic themes can access this URL, though it's not linked anywhere.\n\t *\n\t * 2. path = /wp_template_part/all\n\t * Classic themes with support for block-template-parts. We need to list only Template Parts in this case.\n\t * The URL is accessible from the Appearance > Template Parts menu.\n\t *\n\t * This is temporary. We aim to consolidate to /patterns.\n\t */\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ ! isBlockBasedTheme }\n\t\t\ttitle={ __( 'Patterns' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Manage what patterns are available when editing the site.'\n\t\t\t) }\n\t\t\tactions={ <AddNewPattern /> }\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && __( 'Loading items…' ) }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! hasTemplateParts && ! hasPatterns && (\n\t\t\t\t\t\t\t\t<ItemGroup className=\"edit-site-sidebar-navigation-screen-patterns__group\">\n\t\t\t\t\t\t\t\t\t<Item>{ __( 'No items found' ) }</Item>\n\t\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<CategoriesGroup\n\t\t\t\t\t\t\t\tpath={ path }\n\t\t\t\t\t\t\t\ttemplatePartAreas={ templatePartAreas }\n\t\t\t\t\t\t\t\tpatternCategories={ patternCategories }\n\t\t\t\t\t\t\t\tcurrentCategory={ currentCategory }\n\t\t\t\t\t\t\t\tcurrentType={ currentType }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL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W,EAAG,IAAAhC,QAAE,EACf,2DACD,CAAG;IACHiC,OAAO,EAAG,IAAAnD,MAAA,CAAAC,aAAA,EAACpB,cAAA,CAAAuB,OAAa,MAAE,CAAG;IAC7BgD,OAAO,EACN,IAAApD,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAqD,QAAA,QACGf,SAAS,IAAI,IAAApB,QAAE,EAAE,gBAAiB,CAAC,EACnC,CAAEoB,SAAS,IACZ,IAAAtC,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAqD,QAAA,QACG,CAAEhB,gBAAgB,IAAI,CAAEG,WAAW,IACpC,IAAAxC,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAA6B,uBAAS;MAACC,SAAS,EAAC;IAAqD,GACzE,IAAAH,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAAiF,kBAAI,QAAG,IAAApC,QAAE,EAAE,gBAAiB,CAAS,CAC5B,CACX,EACD,IAAAlB,MAAA,CAAAC,aAAA,EAACT,eAAe;MACfC,IAAI,EAAGA,IAAM;MACbC,iBAAiB,EAAGA,iBAAmB;MACvCC,iBAAiB,EAAGA,iBAAmB;MACvCC,eAAe,EAAGA,eAAiB;MACnCC,WAAW,EAAGA;IAAa,CAC3B,CACA,CAEF;EACF,CACD,CAAC;AAEJ","ignoreList":[]}
@@ -18,7 +18,7 @@ var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entit
18
18
  var _lockUnlock = require("../../lock-unlock");
19
19
  var _store = require("../../store");
20
20
  var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
21
- var _hooks = require("../page-templates-template-parts/hooks");
21
+ var _hooks = require("../page-templates/hooks");
22
22
  var _templateActions = _interopRequireDefault(require("../template-actions"));
23
23
  var _homeTemplateDetails = _interopRequireDefault(require("./home-template-details"));
24
24
  var _sidebarNavigationScreenDetailsFooter = _interopRequireDefault(require("../sidebar-navigation-screen-details-footer"));
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_icons","_components","_coreData","_router","_templateAreas","_interopRequireDefault","_sidebarNavigationScreen","_useEditedEntityRecord","_lockUnlock","_store","_sidebarButton","_hooks","_templateActions","_homeTemplateDetails","_sidebarNavigationScreenDetailsFooter","useHistory","useLocation","unlock","routerPrivateApis","useTemplateDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","currentTheme","useSelect","select","coreStore","getCurrentTheme","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","__","content","slug","_react","createElement","Fragment","default","footer","modified","description","className","imageUrl","src","alt","width","height","Icon","icon","isCustomized","_x","SidebarNavigationScreenTemplate","history","params","setCanvasMode","useDispatch","editSiteStore","actions","toggleProps","as","SidebarButton","onRemove","push","path","onClick","label","pencil"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useLocation();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( { path: '/' + postType } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,cAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,wBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,sBAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,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version":3,"names":["_i18n","require","_data","_icons","_components","_coreData","_router","_templateAreas","_interopRequireDefault","_sidebarNavigationScreen","_useEditedEntityRecord","_lockUnlock","_store","_sidebarButton","_hooks","_templateActions","_homeTemplateDetails","_sidebarNavigationScreenDetailsFooter","useHistory","useLocation","unlock","routerPrivateApis","useTemplateDetails","postType","postId","getDescription","getTitle","record","useEditedEntityRecord","currentTheme","useSelect","select","coreStore","getCurrentTheme","addedBy","useAddedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","__","content","slug","_react","createElement","Fragment","default","footer","modified","description","className","imageUrl","src","alt","width","height","Icon","icon","isCustomized","_x","SidebarNavigationScreenTemplate","history","params","setCanvasMode","useDispatch","editSiteStore","actions","toggleProps","as","SidebarButton","onRemove","push","path","onClick","label","pencil"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { Icon } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useLocation();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( { path: '/' + postType } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\t\t\tfooter={ footer }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,cAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,wBAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,sBAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,WAAA,GAAA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","ignoreList":[]}
@@ -10,8 +10,9 @@ var _coreData = require("@wordpress/core-data");
10
10
  var _element = require("@wordpress/element");
11
11
  var _components = require("@wordpress/components");
12
12
  var _dataviewItem = _interopRequireDefault(require("../sidebar-dataviews/dataview-item"));
13
- var _hooks = require("../page-templates-template-parts/hooks");
13
+ var _hooks = require("../page-templates/hooks");
14
14
  var _icons = require("@wordpress/icons");
15
+ var _constants = require("../../utils/constants");
15
16
  /**
16
17
  * WordPress dependencies
17
18
  */
@@ -40,12 +41,11 @@ function TemplateDataviewItem({
40
41
  }
41
42
  function DataviewsTemplatesSidebarContent({
42
43
  activeView,
43
- postType,
44
44
  title
45
45
  }) {
46
46
  const {
47
47
  records
48
- } = (0, _coreData.useEntityRecords)('postType', postType, {
48
+ } = (0, _coreData.useEntityRecords)('postType', _constants.TEMPLATE_POST_TYPE, {
49
49
  per_page: -1
50
50
  });
51
51
  const firstItemPerAuthorText = (0, _element.useMemo)(() => {
@@ -1 +1 @@
1
- {"version":3,"names":["_coreData","require","_element","_components","_dataviewItem","_interopRequireDefault","_hooks","_icons","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","useAddedBy","type","id","_react","createElement","default","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","useEntityRecords","per_page","firstItemPerAuthorText","useMemo","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","__experimentalItemGroup","layout","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\tpostType,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN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AE,CAAEmB,OAAO,CAAG,CAAC;EAEhB,OACC,IAAAV,MAAA,CAAAC,aAAA,EAACf,WAAA,CAAAqC,uBAAS,QACT,IAAAvB,MAAA,CAAAC,aAAA,EAACd,aAAA,CAAAe,OAAY;IACZE,IAAI,EAAG,KAAO;IACdC,KAAK,EAAGA,KAAO;IACfT,IAAI,EAAG4B,aAAQ;IACf9B,QAAQ,EAAGc,UAAU,KAAK,KAAO;IACjCF,QAAQ,EAAG;EAAO,CAClB,CAAC,EACAO,sBAAsB,CAACY,GAAG,CAAIhC,QAAQ,IAAM;IAC7C,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACT,oBAAoB;MACpBW,GAAG,EAAGV,QAAQ,CAAC2B,WAAa;MAC5B3B,QAAQ,EAAGA,QAAU;MACrBC,QAAQ,EAAGc,UAAU,KAAKf,QAAQ,CAAC2B;IAAa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd","ignoreList":[]}
1
+ {"version":3,"names":["_coreData","require","_element","_components","_dataviewItem","_interopRequireDefault","_hooks","_icons","_constants","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","useAddedBy","type","id","_react","createElement","default","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","records","useEntityRecords","TEMPLATE_POST_TYPE","per_page","firstItemPerAuthorText","useMemo","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","__experimentalItemGroup","layout","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates/hooks';\nimport { layout } from '@wordpress/icons';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,aAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAA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AmB,CAAC,cAAAD,IAAA,cAAAA,IAAA,GAC3DxB,WAAW;EAEb,CAAC,EAAE,CAAEkB,OAAO,CAAG,CAAC;EAEhB,OACC,IAAAT,MAAA,CAAAC,aAAA,EAAChB,WAAA,CAAAsC,uBAAS,QACT,IAAAvB,MAAA,CAAAC,aAAA,EAACf,aAAA,CAAAgB,OAAY;IACZE,IAAI,EAAG,KAAO;IACdC,KAAK,EAAGA,KAAO;IACfT,IAAI,EAAG4B,aAAQ;IACf9B,QAAQ,EAAGc,UAAU,KAAK,KAAO;IACjCF,QAAQ,EAAG;EAAO,CAClB,CAAC,EACAO,sBAAsB,CAACY,GAAG,CAAIhC,QAAQ,IAAM;IAC7C,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACT,oBAAoB;MACpBW,GAAG,EAAGV,QAAQ,CAAC2B,WAAa;MAC5B3B,QAAQ,EAAGA,QAAU;MACrBC,QAAQ,EAAGc,UAAU,KAAKf,QAAQ,CAAC2B;IAAa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd","ignoreList":[]}
@@ -7,11 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = SidebarNavigationScreenTemplatesBrowse;
8
8
  var _react = require("react");
9
9
  var _i18n = require("@wordpress/i18n");
10
- var _data = require("@wordpress/data");
11
10
  var _router = require("@wordpress/router");
12
11
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
13
- var _store = require("../../store");
14
- var _constants = require("../../utils/constants");
15
12
  var _lockUnlock = require("../../lock-unlock");
16
13
  var _content = _interopRequireDefault(require("./content"));
17
14
  /**
@@ -22,48 +19,21 @@ var _content = _interopRequireDefault(require("./content"));
22
19
  * Internal dependencies
23
20
  */
24
21
 
25
- const config = {
26
- [_constants.TEMPLATE_POST_TYPE]: {
27
- title: (0, _i18n.__)('Manage templates'),
28
- description: (0, _i18n.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
29
- contentTitle: (0, _i18n.__)('All templates')
30
- },
31
- [_constants.TEMPLATE_PART_POST_TYPE]: {
32
- title: (0, _i18n.__)('Manage template parts'),
33
- description: (0, _i18n.__)('Create new template parts, or reset any customizations made to the template parts supplied by your theme.'),
34
- backPath: {
35
- path: '/patterns'
36
- },
37
- contentTitle: (0, _i18n.__)('All template parts')
38
- }
39
- };
40
22
  const {
41
23
  useLocation
42
24
  } = (0, _lockUnlock.unlock)(_router.privateApis);
43
- function SidebarNavigationScreenTemplatesBrowse({
44
- postType
45
- }) {
25
+ function SidebarNavigationScreenTemplatesBrowse() {
46
26
  const {
47
27
  params: {
48
- didAccessPatternsPage,
49
28
  activeView = 'all'
50
29
  }
51
30
  } = useLocation();
52
- const isTemplatePartsMode = (0, _data.useSelect)(select => {
53
- return !!select(_store.store).getSettings().supportsTemplatePartsMode;
54
- }, []);
55
- return (0, _react.createElement)(_sidebarNavigationScreen.default
56
- // If a classic theme that supports template parts has never
57
- // accessed the Patterns page, return to the dashboard.
58
- , {
59
- isRoot: isTemplatePartsMode && !didAccessPatternsPage,
60
- title: config[postType].title,
61
- description: config[postType].description,
62
- backPath: config[postType].backPath,
31
+ return (0, _react.createElement)(_sidebarNavigationScreen.default, {
32
+ title: (0, _i18n.__)('Manage templates'),
33
+ description: (0, _i18n.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.'),
63
34
  content: (0, _react.createElement)(_content.default, {
64
35
  activeView: activeView,
65
- postType: postType,
66
- title: config[postType].contentTitle
36
+ title: (0, _i18n.__)('All templates')
67
37
  })
68
38
  });
69
39
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_router","_sidebarNavigationScreen","_interopRequireDefault","_store","_constants","_lockUnlock","_content","config","TEMPLATE_POST_TYPE","title","__","description","contentTitle","TEMPLATE_PART_POST_TYPE","backPath","path","useLocation","unlock","routerPrivateApis","SidebarNavigationScreenTemplatesBrowse","postType","params","didAccessPatternsPage","activeView","isTemplatePartsMode","useSelect","select","editSiteStore","getSettings","supportsTemplatePartsMode","_react","createElement","default","isRoot","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport DataviewsTemplatesSidebarContent from './content';\n\nconst config = {\n\t[ TEMPLATE_POST_TYPE ]: {\n\t\ttitle: __( 'Manage templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t\tcontentTitle: __( 'All templates' ),\n\t},\n\t[ TEMPLATE_PART_POST_TYPE ]: {\n\t\ttitle: __( 'Manage template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'\n\t\t),\n\t\tbackPath: { path: '/patterns' },\n\t\tcontentTitle: __( 'All template parts' ),\n\t},\n};\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenTemplatesBrowse( { postType } ) {\n\tconst {\n\t\tparams: { didAccessPatternsPage, activeView = 'all' },\n\t} = useLocation();\n\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\treturn !! select( editSiteStore ).getSettings()\n\t\t\t.supportsTemplatePartsMode;\n\t}, [] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\t// If a classic theme that supports template parts has never\n\t\t\t// accessed the Patterns page, return to the dashboard.\n\t\t\tisRoot={ isTemplatePartsMode && ! didAccessPatternsPage }\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t\tbackPath={ config[ postType ].backPath }\n\t\t\tcontent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,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACpD,OAAO,CAAC,CAAEA,MAAM,CAAEC,YAAc,CAAC,CAACC,WAAW,CAAC,CAAC,CAC7CC,yBAAyB;EAC5B,CAAC,EAAE,EAAG,CAAC;EAEP,OACC,IAAAC,MAAA,CAAAC,aAAA,EAAC9B,wBAAA,CAAA+B;EACA;EACA;EAAA;IACAC,MAAM,EAAGT,mBAAmB,IAAI,CAAEF,qBAAuB;IACzDb,KAAK,EAAGF,MAAM,CAAEa,QAAQ,CAAE,CAACX,KAAO;IAClCE,WAAW,EAAGJ,MAAM,CAAEa,QAAQ,CAAE,CAACT,WAAa;IAC9CG,QAAQ,EAAGP,MAAM,CAAEa,QAAQ,CAAE,CAACN,QAAU;IACxCoB,OAAO,EACN,IAAAJ,MAAA,CAAAC,aAAA,EAACzB,QAAA,CAAA0B,OAAgC;MAChCT,UAAU,EAAGA,UAAY;MACzBH,QAAQ,EAAGA,QAAU;MACrBX,KAAK,EAAGF,MAAM,CAAEa,QAAQ,CAAE,CAACR;IAAc,CACzC;EACD,CACD,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_router","_sidebarNavigationScreen","_interopRequireDefault","_lockUnlock","_content","useLocation","unlock","routerPrivateApis","SidebarNavigationScreenTemplatesBrowse","params","activeView","_react","createElement","default","title","__","description","content"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport DataviewsTemplatesSidebarContent from './content';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { activeView = 'all' },\n\t} = useLocation();\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Manage templates' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<DataviewsTemplatesSidebarContent\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttitle={ __( 'All templates' ) }\n\t\t\t\t/>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,wBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAF,sBAAA,CAAAH,OAAA;AAXA;AACA;AACA;;AAIA;AACA;AACA;;AAKA,MAAM;EAAEM;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEpC,SAASC,sCAAsCA,CAAA,EAAG;EAChE,MAAM;IACLC,MAAM,EAAE;MAAEC,UAAU,GAAG;IAAM;EAC9B,CAAC,GAAGL,WAAW,CAAC,CAAC;EAEjB,OACC,IAAAM,MAAA,CAAAC,aAAA,EAACX,wBAAA,CAAAY,OAAuB;IACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,kBAAmB,CAAG;IAClCC,WAAW,EAAG,IAAAD,QAAE,EACf,iGACD,CAAG;IACHE,OAAO,EACN,IAAAN,MAAA,CAAAC,aAAA,EAACR,QAAA,CAAAS,OAAgC;MAChCH,UAAU,EAAGA,UAAY;MACzBI,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;IAAG,CAC/B;EACD,CACD,CAAC;AAEJ","ignoreList":[]}
@@ -186,14 +186,6 @@ function useResolveEditedEntityAndContext({
186
186
  context
187
187
  };
188
188
  }
189
- if (path === '/wp_template_part/all' && postId) {
190
- return {
191
- isReady: true,
192
- postType: 'wp_template_part',
193
- postId,
194
- context
195
- };
196
- }
197
189
  if (postTypesWithoutParentTemplate.includes(postType)) {
198
190
  return {
199
191
  isReady: true,
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_router","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","postTypesWithoutParentTemplate","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","postsPageId","url","frontPageTemplateId","useSelect","select","getSite","getUnstableBase","getEntityRecords","coreDataStore","siteData","base","templates","per_page","_homepageId","show_on_front","includes","page_on_front","toString","_postsPageId","page_for_posts","_frontPageTemplateId","frontPageTemplate","find","t","slug","id","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","link","currentTemplateSlug","template","currentTemplate","slugToCheck","context","useMemo","isReady","useInitEditedEntityFromURL","params","setEditedEntity","useDispatch","editSiteStore","useEffect"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst {\n\t\thasLoadedAllDependencies,\n\t\thomepageId,\n\t\tpostsPageId,\n\t\turl,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\tselect( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\t\tconst templates = getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\t\tconst _homepageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_on_front ) &&\n\t\t\t!! +siteData.page_on_front // We also need to check if it's not zero(`0`).\n\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t: null;\n\t\tconst _postsPageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_for_posts )\n\t\t\t\t? siteData.page_for_posts.toString()\n\t\t\t\t: null;\n\t\tlet _frontPageTemplateId;\n\t\tif ( templates ) {\n\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t);\n\t\t\t_frontPageTemplateId = frontPageTemplate\n\t\t\t\t? frontPageTemplate.id\n\t\t\t\t: false;\n\t\t}\n\t\treturn {\n\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\thomepageId: _homepageId,\n\t\t\tpostsPageId: _postsPageId,\n\t\t\turl: base?.home,\n\t\t\tfrontPageTemplateId: _frontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// Check if the current page is the posts page.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\tpostsPageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\treturn __experimentalGetTemplateForLink( editedEntity.link )\n\t\t\t\t\t\t?.id;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/page' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\tpostsPageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/page' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( path === '/wp_template_part/all' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template_part', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\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C,IAAI,KAAK,uBAAuB,IAAIC,MAAM,EAAG;IACjD,OAAO;MAAE+C,OAAO,EAAE,IAAI;MAAE9C,QAAQ,EAAE,kBAAkB;MAAED,MAAM;MAAE6C;IAAQ,CAAC;EACxE;EAEA,IAAKrD,8BAA8B,CAAC2B,QAAQ,CAAElB,QAAS,CAAC,EAAG;IAC1D,OAAO;MAAE8C,OAAO,EAAE,IAAI;MAAE9C,QAAQ;MAAED,MAAM;MAAE6C;IAAQ,CAAC;EACpD;EAEA,IAAK3C,wBAAwB,EAAG;IAC/B,OAAO;MACN6C,OAAO,EAAEhB,kBAAkB,KAAKC,SAAS;MACzC/B,QAAQ,EAAER,6BAAkB;MAC5BO,MAAM,EAAE+B,kBAAkB;MAC1Bc;IACD,CAAC;EACF;EAEA,OAAO;IAAEE,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEe,SAASC,0BAA0BA,CAAA,EAAG;EACpD,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAG5D,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEY,QAAQ;IAAED,MAAM;IAAE6C,OAAO;IAAEE;EAAQ,CAAC,GAC3CjD,gCAAgC,CAAEmD,MAAO,CAAC;EAE3C,MAAM;IAAEC;EAAgB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAExD,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKN,OAAO,EAAG;MACdG,eAAe,CAAEjD,QAAQ,EAAED,MAAM,EAAE6C,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEE,OAAO,EAAE9C,QAAQ,EAAED,MAAM,EAAE6C,OAAO,EAAEK,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_router","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","postTypesWithoutParentTemplate","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","postsPageId","url","frontPageTemplateId","useSelect","select","getSite","getUnstableBase","getEntityRecords","coreDataStore","siteData","base","templates","per_page","_homepageId","show_on_front","includes","page_on_front","toString","_postsPageId","page_for_posts","_frontPageTemplateId","frontPageTemplate","find","t","slug","id","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","link","currentTemplateSlug","template","currentTemplate","slugToCheck","context","useMemo","isReady","useInitEditedEntityFromURL","params","setEditedEntity","useDispatch","editSiteStore","useEffect"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst {\n\t\thasLoadedAllDependencies,\n\t\thomepageId,\n\t\tpostsPageId,\n\t\turl,\n\t\tfrontPageTemplateId,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\tselect( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\t\tconst templates = getEntityRecords( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\t\tconst _homepageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_on_front ) &&\n\t\t\t!! +siteData.page_on_front // We also need to check if it's not zero(`0`).\n\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t: null;\n\t\tconst _postsPageId =\n\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t[ 'number', 'string' ].includes( typeof siteData.page_for_posts )\n\t\t\t\t? siteData.page_for_posts.toString()\n\t\t\t\t: null;\n\t\tlet _frontPageTemplateId;\n\t\tif ( templates ) {\n\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t);\n\t\t\t_frontPageTemplateId = frontPageTemplate\n\t\t\t\t? frontPageTemplate.id\n\t\t\t\t: false;\n\t\t}\n\t\treturn {\n\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\thomepageId: _homepageId,\n\t\t\tpostsPageId: _postsPageId,\n\t\t\turl: base?.home,\n\t\t\tfrontPageTemplateId: _frontPageTemplateId,\n\t\t};\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// Check if the current page is the posts page.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\tpostsPageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\treturn __experimentalGetTemplateForLink( editedEntity.link )\n\t\t\t\t\t\t?.id;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/page' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\tpostsPageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/page' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAMA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