@wordpress/edit-site 6.13.0 → 6.13.1-next.a9f418477.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 (514) hide show
  1. package/build/components/add-new-pattern/index.js +3 -16
  2. package/build/components/add-new-pattern/index.js.map +1 -1
  3. package/build/components/add-new-post/index.js +1 -1
  4. package/build/components/add-new-post/index.js.map +1 -1
  5. package/build/components/add-new-template/index.js +1 -5
  6. package/build/components/add-new-template/index.js.map +1 -1
  7. package/build/components/app/index.js +31 -29
  8. package/build/components/app/index.js.map +1 -1
  9. package/build/components/block-editor/use-editor-iframe-props.js +8 -8
  10. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  11. package/build/components/block-editor/use-navigate-to-entity-record.js +1 -5
  12. package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  13. package/build/components/block-editor/use-site-editor-settings.js +4 -4
  14. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  15. package/build/components/dataviews-actions/index.js +1 -5
  16. package/build/components/dataviews-actions/index.js.map +1 -1
  17. package/build/components/editor/index.js +38 -22
  18. package/build/components/editor/index.js.map +1 -1
  19. package/build/components/editor/use-editor-title.js +5 -0
  20. package/build/components/editor/use-editor-title.js.map +1 -1
  21. package/build/components/editor/use-resolve-edited-entity.js +19 -4
  22. package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/context.js +0 -1
  24. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/font-collection.js +36 -26
  26. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  28. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  30. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  31. package/build/components/global-styles/preview-colors.js +2 -2
  32. package/build/components/global-styles/preview-colors.js.map +1 -1
  33. package/build/components/global-styles/preview-styles.js +2 -2
  34. package/build/components/global-styles/preview-styles.js.map +1 -1
  35. package/build/components/global-styles/preview-typography.js +2 -2
  36. package/build/components/global-styles/preview-typography.js.map +1 -1
  37. package/build/components/global-styles/{preview-iframe.js → preview-wrapper.js} +10 -29
  38. package/build/components/global-styles/preview-wrapper.js.map +1 -0
  39. package/build/components/global-styles/typography-example.js +8 -1
  40. package/build/components/global-styles/typography-example.js.map +1 -1
  41. package/build/components/global-styles-sidebar/index.js +5 -5
  42. package/build/components/global-styles-sidebar/index.js.map +1 -1
  43. package/build/components/layout/index.js +44 -19
  44. package/build/components/layout/index.js.map +1 -1
  45. package/build/components/page-patterns/delete-category-menu-item.js +1 -4
  46. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  47. package/build/components/page-patterns/fields.js +6 -57
  48. package/build/components/page-patterns/fields.js.map +1 -1
  49. package/build/components/page-patterns/index.js +31 -30
  50. package/build/components/page-patterns/index.js.map +1 -1
  51. package/build/components/page-templates/fields.js +6 -34
  52. package/build/components/page-templates/fields.js.map +1 -1
  53. package/build/components/page-templates/index.js +34 -46
  54. package/build/components/page-templates/index.js.map +1 -1
  55. package/build/components/post-edit/header.js +83 -0
  56. package/build/components/post-edit/header.js.map +1 -0
  57. package/build/components/post-edit/index.js +42 -7
  58. package/build/components/post-edit/index.js.map +1 -1
  59. package/build/components/post-list/index.js +26 -40
  60. package/build/components/post-list/index.js.map +1 -1
  61. package/build/components/posts-app/index.js +10 -16
  62. package/build/components/posts-app/index.js.map +1 -1
  63. package/build/components/posts-app-routes/index.js +3 -7
  64. package/build/components/posts-app-routes/index.js.map +1 -1
  65. package/build/components/posts-app-routes/{posts-edit.js → post-item.js} +9 -13
  66. package/build/components/posts-app-routes/post-item.js.map +1 -0
  67. package/build/components/posts-app-routes/posts.js +89 -0
  68. package/build/components/posts-app-routes/posts.js.map +1 -0
  69. package/build/components/resizable-frame/index.js +6 -5
  70. package/build/components/resizable-frame/index.js.map +1 -1
  71. package/build/components/save-panel/index.js +9 -6
  72. package/build/components/save-panel/index.js.map +1 -1
  73. package/build/components/sidebar-dataviews/add-new-view.js +7 -8
  74. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  75. package/build/components/sidebar-dataviews/dataview-item.js +5 -8
  76. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  77. package/build/components/sidebar-dataviews/default-views.js +7 -24
  78. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  79. package/build/components/sidebar-dataviews/index.js +4 -3
  80. package/build/components/sidebar-dataviews/index.js.map +1 -1
  81. package/build/components/sidebar-global-styles-wrapper/index.js +18 -18
  82. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  83. package/build/components/sidebar-navigation-item/index.js +8 -5
  84. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  85. package/build/components/sidebar-navigation-screen/index.js +2 -2
  86. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  87. package/build/components/sidebar-navigation-screen-global-styles/content.js +12 -38
  88. package/build/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
  89. package/build/components/sidebar-navigation-screen-global-styles/index.js +8 -19
  90. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  91. package/build/components/sidebar-navigation-screen-main/index.js +6 -14
  92. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  93. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  94. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  95. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  96. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  97. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  98. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  99. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  100. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  101. package/build/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  102. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  103. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -5
  104. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  105. package/build/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  106. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  107. package/build/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  108. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  109. package/build/components/site-editor-routes/{home-view.js → home.js} +7 -8
  110. package/build/components/site-editor-routes/home.js.map +1 -0
  111. package/build/components/site-editor-routes/index.js +12 -18
  112. package/build/components/site-editor-routes/index.js.map +1 -1
  113. package/build/components/site-editor-routes/navigation-item.js +49 -0
  114. package/build/components/site-editor-routes/navigation-item.js.map +1 -0
  115. package/build/components/{posts-app-routes/home.js → site-editor-routes/navigation.js} +16 -18
  116. package/build/components/site-editor-routes/navigation.js.map +1 -0
  117. package/build/components/site-editor-routes/{pages-edit.js → page-item.js} +10 -17
  118. package/build/components/site-editor-routes/page-item.js.map +1 -0
  119. package/build/components/site-editor-routes/pages.js +87 -0
  120. package/build/components/site-editor-routes/pages.js.map +1 -0
  121. package/build/components/site-editor-routes/{home-edit.js → pattern-item.js} +11 -11
  122. package/build/components/site-editor-routes/pattern-item.js.map +1 -0
  123. package/build/components/site-editor-routes/{patterns-view.js → patterns.js} +6 -9
  124. package/build/components/site-editor-routes/patterns.js.map +1 -0
  125. package/build/components/site-editor-routes/{styles-view.js → styles.js} +28 -9
  126. package/build/components/site-editor-routes/styles.js.map +1 -0
  127. package/build/components/site-editor-routes/{templates-edit.js → template-item.js} +6 -11
  128. package/build/components/site-editor-routes/template-item.js.map +1 -0
  129. package/build/components/site-editor-routes/{patterns-edit.js → template-part-item.js} +6 -11
  130. package/build/components/site-editor-routes/template-part-item.js.map +1 -0
  131. package/build/components/site-editor-routes/{templates-list-view.js → templates.js} +20 -13
  132. package/build/components/site-editor-routes/templates.js.map +1 -0
  133. package/build/components/site-hub/index.js +3 -3
  134. package/build/components/site-hub/index.js.map +1 -1
  135. package/build/components/style-book/constants.js +8 -19
  136. package/build/components/style-book/constants.js.map +1 -1
  137. package/build/components/style-book/examples.js +42 -27
  138. package/build/components/style-book/examples.js.map +1 -1
  139. package/build/components/style-book/index.js +21 -5
  140. package/build/components/style-book/index.js.map +1 -1
  141. package/build/components/style-book/types.js.map +1 -1
  142. package/build/hooks/commands/use-common-commands.js +12 -48
  143. package/build/hooks/commands/use-common-commands.js.map +1 -1
  144. package/build/hooks/commands/use-set-command-context.js +2 -2
  145. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  146. package/build/store/private-actions.js +7 -0
  147. package/build/store/private-actions.js.map +1 -1
  148. package/build/store/reducer.js +2 -0
  149. package/build/store/reducer.js.map +1 -1
  150. package/build/utils/is-previewing-theme.js +1 -1
  151. package/build/utils/is-previewing-theme.js.map +1 -1
  152. package/build/utils/use-activate-theme.js +9 -8
  153. package/build/utils/use-activate-theme.js.map +1 -1
  154. package/build-module/components/add-new-pattern/index.js +3 -16
  155. package/build-module/components/add-new-pattern/index.js.map +1 -1
  156. package/build-module/components/add-new-post/index.js +1 -1
  157. package/build-module/components/add-new-post/index.js.map +1 -1
  158. package/build-module/components/add-new-template/index.js +1 -5
  159. package/build-module/components/add-new-template/index.js.map +1 -1
  160. package/build-module/components/app/index.js +33 -31
  161. package/build-module/components/app/index.js.map +1 -1
  162. package/build-module/components/block-editor/use-editor-iframe-props.js +8 -8
  163. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  164. package/build-module/components/block-editor/use-navigate-to-entity-record.js +1 -5
  165. package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  166. package/build-module/components/block-editor/use-site-editor-settings.js +4 -4
  167. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  168. package/build-module/components/dataviews-actions/index.js +1 -5
  169. package/build-module/components/dataviews-actions/index.js.map +1 -1
  170. package/build-module/components/editor/index.js +38 -22
  171. package/build-module/components/editor/index.js.map +1 -1
  172. package/build-module/components/editor/use-editor-title.js +5 -0
  173. package/build-module/components/editor/use-editor-title.js.map +1 -1
  174. package/build-module/components/editor/use-resolve-edited-entity.js +19 -4
  175. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
  176. package/build-module/components/global-styles/font-library-modal/context.js +0 -1
  177. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  178. package/build-module/components/global-styles/font-library-modal/font-collection.js +37 -27
  179. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  180. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  181. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  183. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  184. package/build-module/components/global-styles/preview-colors.js +2 -2
  185. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  186. package/build-module/components/global-styles/preview-styles.js +2 -2
  187. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  188. package/build-module/components/global-styles/preview-typography.js +2 -2
  189. package/build-module/components/global-styles/preview-typography.js.map +1 -1
  190. package/build-module/components/global-styles/{preview-iframe.js → preview-wrapper.js} +12 -31
  191. package/build-module/components/global-styles/preview-wrapper.js.map +1 -0
  192. package/build-module/components/global-styles/typography-example.js +8 -1
  193. package/build-module/components/global-styles/typography-example.js.map +1 -1
  194. package/build-module/components/global-styles-sidebar/index.js +5 -5
  195. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  196. package/build-module/components/layout/index.js +45 -20
  197. package/build-module/components/layout/index.js.map +1 -1
  198. package/build-module/components/page-patterns/delete-category-menu-item.js +1 -4
  199. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  200. package/build-module/components/page-patterns/fields.js +7 -58
  201. package/build-module/components/page-patterns/fields.js.map +1 -1
  202. package/build-module/components/page-patterns/index.js +29 -28
  203. package/build-module/components/page-patterns/index.js.map +1 -1
  204. package/build-module/components/page-templates/fields.js +5 -31
  205. package/build-module/components/page-templates/fields.js.map +1 -1
  206. package/build-module/components/page-templates/index.js +33 -45
  207. package/build-module/components/page-templates/index.js.map +1 -1
  208. package/build-module/components/post-edit/header.js +76 -0
  209. package/build-module/components/post-edit/header.js.map +1 -0
  210. package/build-module/components/post-edit/index.js +42 -7
  211. package/build-module/components/post-edit/index.js.map +1 -1
  212. package/build-module/components/post-list/index.js +26 -40
  213. package/build-module/components/post-list/index.js.map +1 -1
  214. package/build-module/components/posts-app/index.js +11 -17
  215. package/build-module/components/posts-app/index.js.map +1 -1
  216. package/build-module/components/posts-app-routes/index.js +3 -7
  217. package/build-module/components/posts-app-routes/index.js.map +1 -1
  218. package/build-module/components/posts-app-routes/{posts-edit.js → post-item.js} +8 -12
  219. package/build-module/components/posts-app-routes/post-item.js.map +1 -0
  220. package/build-module/components/posts-app-routes/posts.js +81 -0
  221. package/build-module/components/posts-app-routes/posts.js.map +1 -0
  222. package/build-module/components/resizable-frame/index.js +6 -5
  223. package/build-module/components/resizable-frame/index.js.map +1 -1
  224. package/build-module/components/save-panel/index.js +9 -6
  225. package/build-module/components/save-panel/index.js.map +1 -1
  226. package/build-module/components/sidebar-dataviews/add-new-view.js +7 -8
  227. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  228. package/build-module/components/sidebar-dataviews/dataview-item.js +5 -8
  229. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  230. package/build-module/components/sidebar-dataviews/default-views.js +7 -24
  231. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  232. package/build-module/components/sidebar-dataviews/index.js +4 -3
  233. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  234. package/build-module/components/sidebar-global-styles-wrapper/index.js +18 -18
  235. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  236. package/build-module/components/sidebar-navigation-item/index.js +8 -5
  237. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  238. package/build-module/components/sidebar-navigation-screen/index.js +2 -2
  239. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  240. package/build-module/components/sidebar-navigation-screen-global-styles/content.js +12 -38
  241. package/build-module/components/sidebar-navigation-screen-global-styles/content.js.map +1 -1
  242. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +9 -20
  243. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  244. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -14
  245. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  246. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  247. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  248. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  249. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  250. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  251. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  252. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  253. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  254. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  255. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  256. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -5
  257. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  258. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  259. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  260. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  261. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  262. package/build-module/components/site-editor-routes/{home-edit.js → home.js} +5 -7
  263. package/build-module/components/site-editor-routes/home.js.map +1 -0
  264. package/build-module/components/site-editor-routes/index.js +12 -18
  265. package/build-module/components/site-editor-routes/index.js.map +1 -1
  266. package/build-module/components/site-editor-routes/navigation-item.js +41 -0
  267. package/build-module/components/site-editor-routes/navigation-item.js.map +1 -0
  268. package/build-module/components/site-editor-routes/navigation.js +38 -0
  269. package/build-module/components/site-editor-routes/navigation.js.map +1 -0
  270. package/build-module/components/site-editor-routes/{pages-edit.js → page-item.js} +9 -16
  271. package/build-module/components/site-editor-routes/page-item.js.map +1 -0
  272. package/build-module/components/site-editor-routes/pages.js +79 -0
  273. package/build-module/components/site-editor-routes/pages.js.map +1 -0
  274. package/build-module/components/site-editor-routes/pattern-item.js +18 -0
  275. package/build-module/components/site-editor-routes/pattern-item.js.map +1 -0
  276. package/build-module/components/site-editor-routes/{patterns-view.js → patterns.js} +5 -8
  277. package/build-module/components/site-editor-routes/patterns.js.map +1 -0
  278. package/build-module/components/site-editor-routes/styles.js +44 -0
  279. package/build-module/components/site-editor-routes/styles.js.map +1 -0
  280. package/build-module/components/site-editor-routes/{templates-edit.js → template-item.js} +5 -10
  281. package/build-module/components/site-editor-routes/template-item.js.map +1 -0
  282. package/build-module/components/site-editor-routes/template-part-item.js +18 -0
  283. package/build-module/components/site-editor-routes/template-part-item.js.map +1 -0
  284. package/build-module/components/site-editor-routes/templates.js +33 -0
  285. package/build-module/components/site-editor-routes/templates.js.map +1 -0
  286. package/build-module/components/site-hub/index.js +3 -3
  287. package/build-module/components/site-hub/index.js.map +1 -1
  288. package/build-module/components/style-book/constants.js +8 -19
  289. package/build-module/components/style-book/constants.js.map +1 -1
  290. package/build-module/components/style-book/examples.js +42 -27
  291. package/build-module/components/style-book/examples.js.map +1 -1
  292. package/build-module/components/style-book/index.js +21 -5
  293. package/build-module/components/style-book/index.js.map +1 -1
  294. package/build-module/components/style-book/types.js.map +1 -1
  295. package/build-module/hooks/commands/use-common-commands.js +12 -48
  296. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  297. package/build-module/hooks/commands/use-set-command-context.js +2 -2
  298. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  299. package/build-module/store/private-actions.js +6 -0
  300. package/build-module/store/private-actions.js.map +1 -1
  301. package/build-module/store/reducer.js +2 -0
  302. package/build-module/store/reducer.js.map +1 -1
  303. package/build-module/utils/is-previewing-theme.js +1 -1
  304. package/build-module/utils/is-previewing-theme.js.map +1 -1
  305. package/build-module/utils/use-activate-theme.js +9 -8
  306. package/build-module/utils/use-activate-theme.js.map +1 -1
  307. package/build-style/posts-rtl.css +73 -107
  308. package/build-style/posts.css +73 -107
  309. package/build-style/style-rtl.css +201 -142
  310. package/build-style/style.css +201 -142
  311. package/package.json +40 -40
  312. package/src/components/add-new-pattern/index.js +9 -17
  313. package/src/components/add-new-post/index.js +1 -1
  314. package/src/components/add-new-template/index.js +3 -5
  315. package/src/components/app/index.js +34 -35
  316. package/src/components/block-editor/use-editor-iframe-props.js +5 -4
  317. package/src/components/block-editor/use-navigate-to-entity-record.js +3 -1
  318. package/src/components/block-editor/use-site-editor-settings.js +6 -6
  319. package/src/components/dataviews-actions/index.js +1 -5
  320. package/src/components/editor/index.js +64 -29
  321. package/src/components/editor/use-editor-title.js +4 -0
  322. package/src/components/editor/use-resolve-edited-entity.js +17 -2
  323. package/src/components/global-styles/font-library-modal/font-collection.js +40 -27
  324. package/src/components/global-styles/font-library-modal/style.scss +12 -5
  325. package/src/components/global-styles/preview-colors.js +3 -3
  326. package/src/components/global-styles/preview-styles.js +3 -3
  327. package/src/components/global-styles/preview-typography.js +3 -3
  328. package/src/components/global-styles/{preview-iframe.js → preview-wrapper.js} +9 -35
  329. package/src/components/global-styles/style.scss +5 -1
  330. package/src/components/global-styles/typography-example.js +12 -1
  331. package/src/components/global-styles-sidebar/index.js +4 -4
  332. package/src/components/layout/index.js +43 -11
  333. package/src/components/page-patterns/delete-category-menu-item.js +3 -4
  334. package/src/components/page-patterns/fields.js +9 -65
  335. package/src/components/page-patterns/index.js +39 -25
  336. package/src/components/page-patterns/style.scss +0 -28
  337. package/src/components/page-templates/fields.js +3 -31
  338. package/src/components/page-templates/index.js +34 -51
  339. package/src/components/post-edit/header.js +88 -0
  340. package/src/components/post-edit/index.js +39 -7
  341. package/src/components/post-edit/style.scss +10 -0
  342. package/src/components/post-list/index.js +44 -40
  343. package/src/components/post-list/style.scss +0 -36
  344. package/src/components/posts-app/index.js +9 -18
  345. package/src/components/posts-app-routes/index.js +3 -14
  346. package/src/components/posts-app-routes/{posts-edit.js → post-item.js} +5 -9
  347. package/src/components/posts-app-routes/posts.js +66 -0
  348. package/src/components/resizable-frame/index.js +6 -7
  349. package/src/components/save-panel/index.js +11 -5
  350. package/src/components/sidebar-dataviews/add-new-view.js +9 -9
  351. package/src/components/sidebar-dataviews/dataview-item.js +5 -8
  352. package/src/components/sidebar-dataviews/default-views.js +7 -24
  353. package/src/components/sidebar-dataviews/index.js +2 -2
  354. package/src/components/sidebar-dataviews/style.scss +2 -2
  355. package/src/components/sidebar-global-styles-wrapper/index.js +24 -30
  356. package/src/components/sidebar-navigation-item/index.js +7 -5
  357. package/src/components/sidebar-navigation-item/style.scss +1 -2
  358. package/src/components/sidebar-navigation-screen/index.js +2 -2
  359. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  360. package/src/components/sidebar-navigation-screen-global-styles/content.js +7 -35
  361. package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -34
  362. package/src/components/sidebar-navigation-screen-main/index.js +6 -10
  363. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +3 -5
  364. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  365. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +6 -6
  366. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +9 -21
  367. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -20
  368. package/src/components/sidebar-navigation-screen-patterns/index.js +3 -4
  369. package/src/components/sidebar-navigation-screen-templates-browse/content.js +24 -18
  370. package/src/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  371. package/src/components/site-editor-routes/{home-view.js → home.js} +4 -5
  372. package/src/components/site-editor-routes/index.js +22 -34
  373. package/src/components/site-editor-routes/navigation-item.js +39 -0
  374. package/src/components/site-editor-routes/navigation.js +34 -0
  375. package/src/components/site-editor-routes/{pages-edit.js → page-item.js} +6 -14
  376. package/src/components/site-editor-routes/pages.js +66 -0
  377. package/src/components/site-editor-routes/pattern-item.js +15 -0
  378. package/src/components/site-editor-routes/patterns.js +15 -0
  379. package/src/components/site-editor-routes/styles.js +39 -0
  380. package/src/components/site-editor-routes/template-item.js +15 -0
  381. package/src/components/site-editor-routes/template-part-item.js +15 -0
  382. package/src/components/site-editor-routes/templates.js +26 -0
  383. package/src/components/site-hub/index.js +3 -6
  384. package/src/components/style-book/constants.ts +8 -19
  385. package/src/components/style-book/examples.tsx +47 -28
  386. package/src/components/style-book/index.js +28 -5
  387. package/src/components/style-book/types.ts +1 -1
  388. package/src/hooks/commands/use-common-commands.js +14 -72
  389. package/src/hooks/commands/use-set-command-context.js +2 -2
  390. package/src/store/private-actions.js +7 -0
  391. package/src/store/reducer.js +2 -0
  392. package/src/style.scss +1 -0
  393. package/src/utils/is-previewing-theme.js +1 -3
  394. package/src/utils/use-activate-theme.js +4 -3
  395. package/build/components/error-boundary/index.js +0 -47
  396. package/build/components/error-boundary/index.js.map +0 -1
  397. package/build/components/error-boundary/warning.js +0 -42
  398. package/build/components/error-boundary/warning.js.map +0 -1
  399. package/build/components/global-styles/preview-iframe.js.map +0 -1
  400. package/build/components/layout/router.js +0 -92
  401. package/build/components/layout/router.js.map +0 -1
  402. package/build/components/posts-app-routes/home.js.map +0 -1
  403. package/build/components/posts-app-routes/posts-edit.js.map +0 -1
  404. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +0 -63
  405. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  406. package/build/components/posts-app-routes/posts-list-view.js +0 -48
  407. package/build/components/posts-app-routes/posts-list-view.js.map +0 -1
  408. package/build/components/posts-app-routes/posts-view-quick-edit.js +0 -60
  409. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  410. package/build/components/posts-app-routes/posts-view.js +0 -41
  411. package/build/components/posts-app-routes/posts-view.js.map +0 -1
  412. package/build/components/routes/link.js +0 -69
  413. package/build/components/routes/link.js.map +0 -1
  414. package/build/components/site-editor-routes/home-edit.js.map +0 -1
  415. package/build/components/site-editor-routes/home-view.js.map +0 -1
  416. package/build/components/site-editor-routes/navigation-edit.js +0 -29
  417. package/build/components/site-editor-routes/navigation-edit.js.map +0 -1
  418. package/build/components/site-editor-routes/navigation-item-edit.js +0 -31
  419. package/build/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  420. package/build/components/site-editor-routes/navigation-item-view.js +0 -30
  421. package/build/components/site-editor-routes/navigation-item-view.js.map +0 -1
  422. package/build/components/site-editor-routes/navigation-view.js +0 -28
  423. package/build/components/site-editor-routes/navigation-view.js.map +0 -1
  424. package/build/components/site-editor-routes/pages-edit.js.map +0 -1
  425. package/build/components/site-editor-routes/pages-list-view-quick-edit.js +0 -64
  426. package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  427. package/build/components/site-editor-routes/pages-list-view.js +0 -47
  428. package/build/components/site-editor-routes/pages-list-view.js.map +0 -1
  429. package/build/components/site-editor-routes/pages-view-quick-edit.js +0 -61
  430. package/build/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  431. package/build/components/site-editor-routes/pages-view.js +0 -42
  432. package/build/components/site-editor-routes/pages-view.js.map +0 -1
  433. package/build/components/site-editor-routes/patterns-edit.js.map +0 -1
  434. package/build/components/site-editor-routes/patterns-view.js.map +0 -1
  435. package/build/components/site-editor-routes/styles-view.js.map +0 -1
  436. package/build/components/site-editor-routes/templates-edit.js.map +0 -1
  437. package/build/components/site-editor-routes/templates-list-view.js.map +0 -1
  438. package/build/components/site-editor-routes/templates-view.js +0 -29
  439. package/build/components/site-editor-routes/templates-view.js.map +0 -1
  440. package/build-module/components/error-boundary/index.js +0 -38
  441. package/build-module/components/error-boundary/index.js.map +0 -1
  442. package/build-module/components/error-boundary/warning.js +0 -35
  443. package/build-module/components/error-boundary/warning.js.map +0 -1
  444. package/build-module/components/global-styles/preview-iframe.js.map +0 -1
  445. package/build-module/components/layout/router.js +0 -84
  446. package/build-module/components/layout/router.js.map +0 -1
  447. package/build-module/components/posts-app-routes/home.js +0 -40
  448. package/build-module/components/posts-app-routes/home.js.map +0 -1
  449. package/build-module/components/posts-app-routes/posts-edit.js.map +0 -1
  450. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +0 -55
  451. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  452. package/build-module/components/posts-app-routes/posts-list-view.js +0 -40
  453. package/build-module/components/posts-app-routes/posts-list-view.js.map +0 -1
  454. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +0 -52
  455. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  456. package/build-module/components/posts-app-routes/posts-view.js +0 -33
  457. package/build-module/components/posts-app-routes/posts-view.js.map +0 -1
  458. package/build-module/components/routes/link.js +0 -61
  459. package/build-module/components/routes/link.js.map +0 -1
  460. package/build-module/components/site-editor-routes/home-edit.js.map +0 -1
  461. package/build-module/components/site-editor-routes/home-view.js +0 -17
  462. package/build-module/components/site-editor-routes/home-view.js.map +0 -1
  463. package/build-module/components/site-editor-routes/navigation-edit.js +0 -21
  464. package/build-module/components/site-editor-routes/navigation-edit.js.map +0 -1
  465. package/build-module/components/site-editor-routes/navigation-item-edit.js +0 -23
  466. package/build-module/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  467. package/build-module/components/site-editor-routes/navigation-item-view.js +0 -22
  468. package/build-module/components/site-editor-routes/navigation-item-view.js.map +0 -1
  469. package/build-module/components/site-editor-routes/navigation-view.js +0 -20
  470. package/build-module/components/site-editor-routes/navigation-view.js.map +0 -1
  471. package/build-module/components/site-editor-routes/pages-edit.js.map +0 -1
  472. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  473. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  474. package/build-module/components/site-editor-routes/pages-list-view.js +0 -39
  475. package/build-module/components/site-editor-routes/pages-list-view.js.map +0 -1
  476. package/build-module/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  477. package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  478. package/build-module/components/site-editor-routes/pages-view.js +0 -34
  479. package/build-module/components/site-editor-routes/pages-view.js.map +0 -1
  480. package/build-module/components/site-editor-routes/patterns-edit.js +0 -23
  481. package/build-module/components/site-editor-routes/patterns-edit.js.map +0 -1
  482. package/build-module/components/site-editor-routes/patterns-view.js.map +0 -1
  483. package/build-module/components/site-editor-routes/styles-view.js +0 -25
  484. package/build-module/components/site-editor-routes/styles-view.js.map +0 -1
  485. package/build-module/components/site-editor-routes/templates-edit.js.map +0 -1
  486. package/build-module/components/site-editor-routes/templates-list-view.js +0 -26
  487. package/build-module/components/site-editor-routes/templates-list-view.js.map +0 -1
  488. package/build-module/components/site-editor-routes/templates-view.js +0 -21
  489. package/build-module/components/site-editor-routes/templates-view.js.map +0 -1
  490. package/src/components/error-boundary/index.js +0 -44
  491. package/src/components/error-boundary/test/error-boundary.js +0 -40
  492. package/src/components/error-boundary/warning.js +0 -30
  493. package/src/components/layout/router.js +0 -86
  494. package/src/components/posts-app-routes/home.js +0 -36
  495. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +0 -52
  496. package/src/components/posts-app-routes/posts-list-view.js +0 -40
  497. package/src/components/posts-app-routes/posts-view-quick-edit.js +0 -49
  498. package/src/components/posts-app-routes/posts-view.js +0 -35
  499. package/src/components/routes/link.js +0 -68
  500. package/src/components/site-editor-routes/home-edit.js +0 -17
  501. package/src/components/site-editor-routes/navigation-edit.js +0 -22
  502. package/src/components/site-editor-routes/navigation-item-edit.js +0 -26
  503. package/src/components/site-editor-routes/navigation-item-view.js +0 -25
  504. package/src/components/site-editor-routes/navigation-view.js +0 -21
  505. package/src/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  506. package/src/components/site-editor-routes/pages-list-view.js +0 -44
  507. package/src/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  508. package/src/components/site-editor-routes/pages-view.js +0 -39
  509. package/src/components/site-editor-routes/patterns-edit.js +0 -24
  510. package/src/components/site-editor-routes/patterns-view.js +0 -22
  511. package/src/components/site-editor-routes/styles-view.js +0 -26
  512. package/src/components/site-editor-routes/templates-edit.js +0 -22
  513. package/src/components/site-editor-routes/templates-list-view.js +0 -28
  514. package/src/components/site-editor-routes/templates-view.js +0 -22
@@ -6,24 +6,20 @@ import { __ } from '@wordpress/i18n';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import PostList from '../post-list';
9
+ import Editor from '../editor';
10
10
  import DataViewsSidebarContent from '../sidebar-dataviews';
11
11
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
- import Editor from '../editor';
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
- export const postsEditRoute = {
15
- name: 'posts-edit',
16
- match: params => {
17
- return params.postType === 'post' && params.canvas === 'edit';
18
- },
13
+ export const postItemRoute = {
14
+ name: 'post-item',
15
+ path: '/post/:postId',
19
16
  areas: {
20
17
  sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
21
18
  title: __('Posts'),
22
19
  isRoot: true,
23
- content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {})
24
- }),
25
- content: /*#__PURE__*/_jsx(PostList, {
26
- postType: "post"
20
+ content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {
21
+ postType: "post"
22
+ })
27
23
  }),
28
24
  mobile: /*#__PURE__*/_jsx(Editor, {
29
25
  isPostsList: true
@@ -33,4 +29,4 @@ export const postsEditRoute = {
33
29
  })
34
30
  }
35
31
  };
36
- //# sourceMappingURL=posts-edit.js.map
32
+ //# sourceMappingURL=post-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__","Editor","DataViewsSidebarContent","SidebarNavigationScreen","jsx","_jsx","postItemRoute","name","path","areas","sidebar","title","isRoot","content","postType","mobile","isPostsList","preview"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/post-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nexport const postItemRoute = {\n\tname: 'post-item',\n\tpath: '/post/:postId',\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent postType=\"post\" /> }\n\t\t\t/>\n\t\t),\n\t\tmobile: <Editor isPostsList />,\n\t\tpreview: <Editor isPostsList />,\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,uBAAuB,MAAM,sBAAsB;AAC1D,OAAOC,uBAAuB,MAAM,8BAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnE,OAAO,MAAMC,aAAa,GAAG;EAC5BC,IAAI,EAAE,WAAW;EACjBC,IAAI,EAAE,eAAe;EACrBC,KAAK,EAAE;IACNC,OAAO,eACNL,IAAA,CAACF,uBAAuB;MACvBQ,KAAK,EAAGX,EAAE,CAAE,OAAQ,CAAG;MACvBY,MAAM;MACNC,OAAO,eAAGR,IAAA,CAACH,uBAAuB;QAACY,QAAQ,EAAC;MAAM,CAAE;IAAG,CACvD,CACD;IACDC,MAAM,eAAEV,IAAA,CAACJ,MAAM;MAACe,WAAW;IAAA,CAAE,CAAC;IAC9BC,OAAO,eAAEZ,IAAA,CAACJ,MAAM;MAACe,WAAW;IAAA,CAAE;EAC/B;AACD,CAAC","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
5
+ import { __ } from '@wordpress/i18n';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import Editor from '../editor';
11
+ import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
+ import DataViewsSidebarContent from '../sidebar-dataviews';
13
+ import PostList from '../post-list';
14
+ import { unlock } from '../../lock-unlock';
15
+ import { PostEdit } from '../post-edit';
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ const {
18
+ useLocation
19
+ } = unlock(routerPrivateApis);
20
+ function MobilePostsView() {
21
+ const {
22
+ query = {}
23
+ } = useLocation();
24
+ const {
25
+ canvas = 'view'
26
+ } = query;
27
+ return canvas === 'edit' ? /*#__PURE__*/_jsx(Editor, {}) : /*#__PURE__*/_jsx(PostList, {
28
+ postType: "post"
29
+ });
30
+ }
31
+ export const postsRoute = {
32
+ name: 'posts',
33
+ path: '/',
34
+ areas: {
35
+ sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
36
+ title: __('Posts'),
37
+ isRoot: true,
38
+ content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {
39
+ postType: "post"
40
+ })
41
+ }),
42
+ content: /*#__PURE__*/_jsx(PostList, {
43
+ postType: "post"
44
+ }),
45
+ preview({
46
+ query
47
+ }) {
48
+ const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true';
49
+ return isListView ? /*#__PURE__*/_jsx(Editor, {
50
+ isPostsList: true
51
+ }) : undefined;
52
+ },
53
+ mobile: /*#__PURE__*/_jsx(MobilePostsView, {}),
54
+ edit({
55
+ query
56
+ }) {
57
+ var _query$layout;
58
+ const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') === 'list' && !!query.quickEdit;
59
+ return hasQuickEdit ? /*#__PURE__*/_jsx(PostEdit, {
60
+ postType: "post",
61
+ postId: query.postId
62
+ }) : undefined;
63
+ }
64
+ },
65
+ widths: {
66
+ content({
67
+ query
68
+ }) {
69
+ const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true';
70
+ return isListView ? 380 : undefined;
71
+ },
72
+ edit({
73
+ query
74
+ }) {
75
+ var _query$layout2;
76
+ const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') === 'list' && !!query.quickEdit;
77
+ return hasQuickEdit ? 380 : undefined;
78
+ }
79
+ }
80
+ };
81
+ //# sourceMappingURL=posts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["privateApis","routerPrivateApis","__","Editor","SidebarNavigationScreen","DataViewsSidebarContent","PostList","unlock","PostEdit","jsx","_jsx","useLocation","MobilePostsView","query","canvas","postType","postsRoute","name","path","areas","sidebar","title","isRoot","content","preview","isListView","layout","isCustom","isPostsList","undefined","mobile","edit","_query$layout","hasQuickEdit","quickEdit","postId","widths","_query$layout2"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Editor from '../editor';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport PostList from '../post-list';\nimport { unlock } from '../../lock-unlock';\nimport { PostEdit } from '../post-edit';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nfunction MobilePostsView() {\n\tconst { query = {} } = useLocation();\n\tconst { canvas = 'view' } = query;\n\n\treturn canvas === 'edit' ? <Editor /> : <PostList postType=\"post\" />;\n}\n\nexport const postsRoute = {\n\tname: 'posts',\n\tpath: '/',\n\tareas: {\n\t\tsidebar: (\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Posts' ) }\n\t\t\t\tisRoot\n\t\t\t\tcontent={ <DataViewsSidebarContent postType=\"post\" /> }\n\t\t\t/>\n\t\t),\n\t\tcontent: <PostList postType=\"post\" />,\n\t\tpreview( { query } ) {\n\t\t\tconst isListView =\n\t\t\t\t( query.layout === 'list' || ! query.layout ) &&\n\t\t\t\tquery.isCustom !== 'true';\n\t\t\treturn isListView ? <Editor isPostsList /> : undefined;\n\t\t},\n\t\tmobile: <MobilePostsView />,\n\t\tedit( { query } ) {\n\t\t\tconst hasQuickEdit =\n\t\t\t\t( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;\n\t\t\treturn hasQuickEdit ? (\n\t\t\t\t<PostEdit postType=\"post\" postId={ query.postId } />\n\t\t\t) : undefined;\n\t\t},\n\t},\n\twidths: {\n\t\tcontent( { query } ) {\n\t\t\tconst isListView =\n\t\t\t\t( query.layout === 'list' || ! query.layout ) &&\n\t\t\t\tquery.isCustom !== 'true';\n\t\t\treturn isListView ? 380 : undefined;\n\t\t},\n\t\tedit( { query } ) {\n\t\t\tconst hasQuickEdit =\n\t\t\t\t( query.layout ?? 'list' ) === 'list' && !! query.quickEdit;\n\t\t\treturn hasQuickEdit ? 380 : undefined;\n\t\t},\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,uBAAuB,MAAM,sBAAsB;AAC1D,OAAOC,QAAQ,MAAM,cAAc;AACnC,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,QAAQ,QAAQ,cAAc;AAA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,MAAM,cAAAM,aAAA,cAAAA,aAAA,GAAI,MAAM,MAAO,MAAM,IAAI,CAAC,CAAEnB,KAAK,CAACqB,SAAS;MAC5D,OAAOD,YAAY,gBAClBvB,IAAA,CAACF,QAAQ;QAACO,QAAQ,EAAC,MAAM;QAACoB,MAAM,EAAGtB,KAAK,CAACsB;MAAQ,CAAE,CAAC,GACjDN,SAAS;IACd;EACD,CAAC;EACDO,MAAM,EAAE;IACPb,OAAOA,CAAE;MAAEV;IAAM,CAAC,EAAG;MACpB,MAAMY,UAAU,GACf,CAAEZ,KAAK,CAACa,MAAM,KAAK,MAAM,IAAI,CAAEb,KAAK,CAACa,MAAM,KAC3Cb,KAAK,CAACc,QAAQ,KAAK,MAAM;MAC1B,OAAOF,UAAU,GAAG,GAAG,GAAGI,SAAS;IACpC,CAAC;IACDE,IAAIA,CAAE;MAAElB;IAAM,CAAC,EAAG;MAAA,IAAAwB,cAAA;MACjB,MAAMJ,YAAY,GACjB,EAAAI,cAAA,GAAExB,KAAK,CAACa,MAAM,cAAAW,cAAA,cAAAA,cAAA,GAAI,MAAM,MAAO,MAAM,IAAI,CAAC,CAAExB,KAAK,CAACqB,SAAS;MAC5D,OAAOD,YAAY,GAAG,GAAG,GAAGJ,SAAS;IACtC;EACD;AACD,CAAC","ignoreList":[]}
@@ -16,6 +16,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
16
16
  * Internal dependencies
17
17
  */
18
18
  import { unlock } from '../../lock-unlock';
19
+ import { addQueryArgs } from '@wordpress/url';
19
20
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
20
21
  const {
21
22
  useLocation,
@@ -75,11 +76,12 @@ function ResizableFrame({
75
76
  }) {
76
77
  const history = useHistory();
77
78
  const {
78
- params
79
+ path,
80
+ query
79
81
  } = useLocation();
80
82
  const {
81
83
  canvas = 'view'
82
- } = params;
84
+ } = query;
83
85
  const disableMotion = useReducedMotion();
84
86
  const [frameSize, setFrameSize] = useState(INITIAL_FRAME_SIZE);
85
87
  // The width of the resizable frame when a new resize gesture starts.
@@ -133,10 +135,9 @@ function ResizableFrame({
133
135
  setFrameSize(INITIAL_FRAME_SIZE);
134
136
  } else {
135
137
  // Trigger full screen if the frame is resized far enough to the left.
136
- history.push({
137
- ...params,
138
+ history.navigate(addQueryArgs(path, {
138
139
  canvas: 'edit'
139
- }, undefined, {
140
+ }), {
140
141
  transition: 'canvas-mode-edit-transition'
141
142
  });
142
143
  }
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useReducedMotion","__","isRTL","privateApis","routerPrivateApis","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","useHistory","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","history","params","canvas","disableMotion","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","push","transition","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","as","div","initial","variants","animate","onAnimationComplete","definition","whileHover","scale","ease","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","text","button","role","className","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\thistory.push(\n\t\t\t\t{\n\t\t\t\t\t...params,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\t{\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvas === 'view'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvas === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE3C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGR,MAAM,CAAED,iBAAkB,CAAC;;AAE/D;AACA,MAAMU,sBAAsB,GAAG;EAC9BC,QAAQ,EAAEC,SAAS;EACnBC,UAAU,EAAED,SAAS;EACrBE,MAAM,EAAEF,SAAS;EACjBG,KAAK,EAAEH,SAAS;EAChBI,MAAM,EAAEJ,SAAS;EACjBK,GAAG,EAAEL,SAAS;EACdM,KAAK,EAAEN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EAAE3B,WAAW,IACxCzD,SACA;YACD,iBAAgBS,eAAiB;YACjC,iBAAgBsB,WAAW,CAAC5B,KAAO;YACnC2H,SAAS,EAAGnD,4BAA8B;YAC1CuB,OAAO,EAAC,QAAQ;YAChB6B,IAAI,EAAC,QAAQ;YACbC,UAAU,EAAC,QAAQ;YACnBzB,UAAU,EAAC;UAAQ,GArBf,QAsBJ;QAAC,CACM,CAAC,eACVhH,IAAA;UAAKmG,MAAM;UAACuC,EAAE,EAAG9E,qBAAuB;UAAArB,QAAA,EACrC7C,EAAE,CACH,gGACD;QAAC,CACG,CAAC;MAAA,CACL;IAEJ,CAAG;IACHiJ,aAAa,EAAG7E,iBAAmB;IACnC8E,QAAQ,EAAGzE,YAAc;IACzB0E,YAAY,EAAG/D,gBAAkB;IACjCwD,SAAS,EAAGrJ,IAAI,CAAE,kCAAkC,EAAE;MACrD,aAAa,EAAEiE;IAChB,CAAE,CAAG;IACL4F,UAAU,EAAG,KAAO,CAAC;IAAA;IAAAvG,QAAA,eAErBvC,IAAA;MACCsI,SAAS,EAAC,0CAA0C;MACpDS,KAAK,EAAGtG,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["clsx","useState","useRef","ResizableBox","Tooltip","__unstableMotion","motion","useInstanceId","useReducedMotion","__","isRTL","privateApis","routerPrivateApis","unlock","addQueryArgs","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","useHistory","HANDLE_STYLES_OVERRIDE","position","undefined","userSelect","cursor","width","height","top","right","bottom","left","FRAME_MIN_WIDTH","FRAME_REFERENCE_WIDTH","FRAME_TARGET_ASPECT_RATIO","SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD","INITIAL_FRAME_SIZE","calculateNewHeight","initialAspectRatio","lerp","a","b","amount","lerpFactor","Math","max","min","intermediateAspectRatio","ResizableFrame","isFullWidth","isOversized","setIsOversized","isReady","children","defaultSize","innerContentStyle","history","path","query","canvas","disableMotion","frameSize","setFrameSize","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","FRAME_TRANSITION","type","duration","frameRef","resizableHandleHelpId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","navigate","transition","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","as","div","initial","variants","animate","onAnimationComplete","definition","whileHover","scale","ease","size","enable","topRight","bottomRight","bottomLeft","topLeft","handleClasses","handleStyles","minWidth","maxWidth","maxHeight","onFocus","onBlur","onMouseOver","onMouseOut","handleComponent","text","button","role","className","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style"],"sources":["@wordpress/edit-site/src/components/resizable-frame/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { addQueryArgs } from '@wordpress/url';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst history = useHistory();\n\tconst { path, query } = useLocation();\n\tconst { canvas = 'view' } = query;\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} ),\n\t\t\t\t{\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvas === 'view'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvas === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t\t\t\t{ /* Disable reason: role=\"separator\" does in fact support aria-valuenow */ }\n\t\t\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }\n\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\tframeRef.current?.resizable?.offsetWidth ||\n\t\t\t\t\t\t\t\t\tundefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\tonKeyDown={ handleResizableHandleKeyDown }\n\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,OAAO,EACPC,gBAAgB,IAAIC,MAAM,QACpB,uBAAuB;AAC9B,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SAASC,EAAE,EAA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C;MACpDS,KAAK,EAAGvG,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAEA,eAAeL,cAAc","ignoreList":[]}
@@ -31,7 +31,8 @@ const {
31
31
  useLocation
32
32
  } = unlock(routerPrivateApis);
33
33
  const EntitiesSavedStatesForPreview = ({
34
- onClose
34
+ onClose,
35
+ renderDialog
35
36
  }) => {
36
37
  var _currentTheme$name$re, _previewingTheme$name;
37
38
  const isDirtyProps = useEntitiesSavedStatesIsDirty();
@@ -58,16 +59,18 @@ const EntitiesSavedStatesForPreview = ({
58
59
  close: onClose,
59
60
  onSave,
60
61
  saveEnabled: true,
61
- saveLabel: activateSaveLabel
62
+ saveLabel: activateSaveLabel,
63
+ renderDialog
62
64
  });
63
65
  };
64
66
  const _EntitiesSavedStates = ({
65
67
  onClose,
66
- renderDialog = undefined
68
+ renderDialog
67
69
  }) => {
68
70
  if (isPreviewingTheme()) {
69
71
  return /*#__PURE__*/_jsx(EntitiesSavedStatesForPreview, {
70
- onClose: onClose
72
+ onClose: onClose,
73
+ renderDialog: renderDialog
71
74
  });
72
75
  }
73
76
  return /*#__PURE__*/_jsx(EntitiesSavedStates, {
@@ -77,11 +80,11 @@ const _EntitiesSavedStates = ({
77
80
  };
78
81
  export default function SavePanel() {
79
82
  const {
80
- params
83
+ query
81
84
  } = useLocation();
82
85
  const {
83
86
  canvas = 'view'
84
- } = params;
87
+ } = query;
85
88
  const {
86
89
  isSaveViewOpen,
87
90
  isDirty,
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","store","coreStore","routerPrivateApis","useEffect","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","jsx","_jsx","jsxs","_jsxs","EntitiesSavedStatesExtensible","NavigableRegion","useLocation","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","children","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","renderDialog","undefined","SavePanel","params","canvas","isSaveViewOpen","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","__next40pxDefaultSize","variant","onClick","accessibleWhenDisabled"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible, NavigableRegion } =\n\tunlock( privateApis );\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: 1: The name of active theme, 2: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose, renderDialog = undefined } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn <EntitiesSavedStatesForPreview onClose={ onClose } />;\n\t}\n\treturn (\n\t\t<EntitiesSavedStates close={ onClose } renderDialog={ renderDialog } />\n\t);\n};\n\nexport default function SavePanel() {\n\tconst { params } = useLocation();\n\tconst { canvas = 'view' } = params;\n\tconst { isSaveViewOpen, isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t\tisResolving,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\tconst { isSaveViewOpened } = unlock( select( editSiteStore ) );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving:\n\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t) || isActivatingTheme,\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\tuseEffect( () => {\n\t\tsetIsSaveViewOpened( false );\n\t}, [ canvas, setIsSaveViewOpened ] );\n\n\tif ( canvas === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ clsx( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-editor__toggle-save-panel', {\n\t\t\t\t\t'screen-reader-text': isSaveViewOpen,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\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BAA6B;MACvCC,cAAc,EAAGzC,OAAS;MAC1B0C,wBAAwB;MACxBC,YAAY,EAAG9D,EAAE,CAChB,0CACD,CAAG;MAAA8B,QAAA,eAEHlB,IAAA,CAAC2B,oBAAoB;QAACpB,OAAO,EAAGA;MAAS,CAAE;IAAC,CACtC,CAAC,GACL,IAAI;EACT;EACA,MAAM4C,mBAAmB,GAAGrD,iBAAiB,CAAC,CAAC,IAAIc,OAAO;EAC1D,MAAMwC,QAAQ,GAAGlB,QAAQ,IAAI,CAAEiB,mBAAmB;EAClD,oBACCjD,KAAA,CAACE,eAAe;IACf2C,SAAS,EAAGnE,IAAI,CAAE,2BAA2B,EAAE;MAC9C,0BAA0B,EAAEqD;IAC7B,CAAE,CAAG;IACLoB,SAAS,EAAGjE,EAAE,CAAE,YAAa,CAAG;IAAA8B,QAAA,gBAEhClB,IAAA;MACC+C,SAAS,EAAGnE,IAAI,CAAE,qCAAqC,EAAE;QACxD,oBAAoB,EAAEqD;MACvB,CAAE,CAAG;MAAAf,QAAA,eAELlB,IAAA,CAACnB,MAAM;QACNyE,qBAAqB;QACrBC,OAAO,EAAC,WAAW;QACnBR,SAAS,EAAC,4CAA4C;QACtDS,OAAO,EAAGA,CAAA,KAAMV,mBAAmB,CAAE,IAAK,CAAG;QAC7C,iBAAc,QAAQ;QACtBM,QAAQ,EAAGA,QAAU;QACrBK,sBAAsB;QAAAvC,QAAA,EAEpB9B,EAAE,CAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CAAC,EACJ6C,cAAc,iBACfjC,IAAA,CAAC2B,oBAAoB;MAACpB,OAAO,EAAGA,OAAS;MAACqB,YAAY;IAAA,CAAE,CACxD;EAAA,CACe,CAAC;AAEpB","ignoreList":[]}
1
+ {"version":3,"names":["clsx","Button","Modal","EntitiesSavedStates","useEntitiesSavedStatesIsDirty","privateApis","useDispatch","useSelect","__","sprintf","store","coreStore","routerPrivateApis","useEffect","editSiteStore","unlock","useActivateTheme","useActualCurrentTheme","isPreviewingTheme","jsx","_jsx","jsxs","_jsxs","EntitiesSavedStatesExtensible","NavigableRegion","useLocation","EntitiesSavedStatesForPreview","onClose","renderDialog","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","activateSaveLabel","isDirty","currentTheme","previewingTheme","select","getCurrentTheme","additionalPrompt","children","name","rendered","activateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","SavePanel","query","canvas","isSaveViewOpen","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","length","some","record","kind","key","setIsSaveViewOpened","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","ariaLabel","__next40pxDefaultSize","variant","onClick","accessibleWhenDisabled"],"sources":["@wordpress/edit-site/src/components/save-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { Button, Modal } from '@wordpress/components';\nimport {\n\tEntitiesSavedStates,\n\tuseEntitiesSavedStatesIsDirty,\n\tprivateApis,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useActivateTheme } from '../../utils/use-activate-theme';\nimport { useActualCurrentTheme } from '../../utils/use-actual-current-theme';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nconst { EntitiesSavedStatesExtensible, NavigableRegion } =\n\tunlock( privateApis );\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst EntitiesSavedStatesForPreview = ( { onClose, renderDialog } ) => {\n\tconst isDirtyProps = useEntitiesSavedStatesIsDirty();\n\tlet activateSaveLabel;\n\tif ( isDirtyProps.isDirty ) {\n\t\tactivateSaveLabel = __( 'Activate & Save' );\n\t} else {\n\t\tactivateSaveLabel = __( 'Activate' );\n\t}\n\n\tconst currentTheme = useActualCurrentTheme();\n\n\tconst previewingTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\n\tconst additionalPrompt = (\n\t\t<p>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: 1: The name of active theme, 2: The name of theme to be activated. */\n\t\t\t\t__(\n\t\t\t\t\t'Saving your changes will change your active theme from %1$s to %2$s.'\n\t\t\t\t),\n\t\t\t\tcurrentTheme?.name?.rendered ?? '...',\n\t\t\t\tpreviewingTheme?.name?.rendered ?? '...'\n\t\t\t) }\n\t\t</p>\n\t);\n\n\tconst activateTheme = useActivateTheme();\n\tconst onSave = async ( values ) => {\n\t\tawait activateTheme();\n\t\treturn values;\n\t};\n\n\treturn (\n\t\t<EntitiesSavedStatesExtensible\n\t\t\t{ ...{\n\t\t\t\t...isDirtyProps,\n\t\t\t\tadditionalPrompt,\n\t\t\t\tclose: onClose,\n\t\t\t\tonSave,\n\t\t\t\tsaveEnabled: true,\n\t\t\t\tsaveLabel: activateSaveLabel,\n\t\t\t\trenderDialog,\n\t\t\t} }\n\t\t/>\n\t);\n};\n\nconst _EntitiesSavedStates = ( { onClose, renderDialog } ) => {\n\tif ( isPreviewingTheme() ) {\n\t\treturn (\n\t\t\t<EntitiesSavedStatesForPreview\n\t\t\t\tonClose={ onClose }\n\t\t\t\trenderDialog={ renderDialog }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<EntitiesSavedStates close={ onClose } renderDialog={ renderDialog } />\n\t);\n};\n\nexport default function SavePanel() {\n\tconst { query } = useLocation();\n\tconst { canvas = 'view' } = query;\n\tconst { isSaveViewOpen, isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t\tisResolving,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\tconst { isSaveViewOpened } = unlock( select( editSiteStore ) );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving:\n\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t\t) || isActivatingTheme,\n\t\t};\n\t}, [] );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst onClose = () => setIsSaveViewOpened( false );\n\tuseEffect( () => {\n\t\tsetIsSaveViewOpened( false );\n\t}, [ canvas, setIsSaveViewOpened ] );\n\n\tif ( canvas === 'view' ) {\n\t\treturn isSaveViewOpen ? (\n\t\t\t<Modal\n\t\t\t\tclassName=\"edit-site-save-panel__modal\"\n\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t__experimentalHideHeader\n\t\t\t\tcontentLabel={ __(\n\t\t\t\t\t'Save site, content, and template changes'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } />\n\t\t\t</Modal>\n\t\t) : null;\n\t}\n\tconst activateSaveEnabled = isPreviewingTheme() || isDirty;\n\tconst disabled = isSaving || ! activateSaveEnabled;\n\treturn (\n\t\t<NavigableRegion\n\t\t\tclassName={ clsx( 'edit-site-layout__actions', {\n\t\t\t\t'is-entity-save-view-open': isSaveViewOpen,\n\t\t\t} ) }\n\t\t\tariaLabel={ __( 'Save panel' ) }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName={ clsx( 'edit-site-editor__toggle-save-panel', {\n\t\t\t\t\t'screen-reader-text': isSaveViewOpen,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-site-editor__toggle-save-panel-button\"\n\t\t\t\t\tonClick={ () => setIsSaveViewOpened( true ) }\n\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{ isSaveViewOpen && (\n\t\t\t\t<_EntitiesSavedStates onClose={ onClose } renderDialog />\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,MAAM,EAAEC,KAAK,QAAQ,uBAAuB;AACrD,SACCC,mBAAmB,EACnBC,6BAA6B,EAC7BC,WAAW,QACL,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASN,WAAW,IAAIO,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,oBAAoB;;AAE9C;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,gBAAgB,QAAQ,gCAAgC;AACjE,SAASC,qBAAqB,QAAQ,sCAAsC;AAC5E,SAASC,iBAAiB,QAAQ,iCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpE,MAAM;EAAEC,6BAA6B;EAAEC;AAAgB,CAAC,GACvDT,MAAM,CAAEV,WAAY,CAAC;AACtB,MAAM;EAAEoB;AAAY,CAAC,GAAGV,MAAM,CAAEH,iBAAkB,CAAC;AAEnD,MAAMc,6BAA6B,GAAGA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MAACrB,OAAO,EAAGA,OAAS;MAACC,YAAY;IAAA,CAAE,CACxD;EAAA,CACe,CAAC;AAEpB","ignoreList":[]}
@@ -8,6 +8,7 @@ import { store as coreStore } from '@wordpress/core-data';
8
8
  import { useState } from '@wordpress/element';
9
9
  import { plus } from '@wordpress/icons';
10
10
  import { privateApis as routerPrivateApis } from '@wordpress/router';
11
+ import { addQueryArgs } from '@wordpress/url';
11
12
 
12
13
  /**
13
14
  * Internal dependencies
@@ -17,6 +18,7 @@ import { useDefaultViews } from './default-views';
17
18
  import { unlock } from '../../lock-unlock';
18
19
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
20
  const {
21
+ useLocation,
20
22
  useHistory
21
23
  } = unlock(routerPrivateApis);
22
24
  function AddNewItemModalContent({
@@ -24,6 +26,9 @@ function AddNewItemModalContent({
24
26
  setIsAdding
25
27
  }) {
26
28
  const history = useHistory();
29
+ const {
30
+ path
31
+ } = useLocation();
27
32
  const {
28
33
  saveEntityRecord
29
34
  } = useDispatch(coreStore);
@@ -59,16 +64,10 @@ function AddNewItemModalContent({
59
64
  wp_dataviews_type: dataViewTaxonomyId,
60
65
  content: JSON.stringify(defaultViews[0].view)
61
66
  });
62
- const {
63
- params: {
64
- postType
65
- }
66
- } = history.getLocationWithParams();
67
- history.push({
68
- postType,
67
+ history.navigate(addQueryArgs(path, {
69
68
  activeView: savedRecord.id,
70
69
  isCustom: 'true'
71
- });
70
+ }));
72
71
  setIsSaving(false);
73
72
  setIsAdding(false);
74
73
  },
@@ -1 +1 @@
1
- {"version":3,"names":["Modal","TextControl","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","__","useDispatch","resolveSelect","store","coreStore","useState","plus","privateApis","routerPrivateApis","SidebarNavigationItem","useDefaultViews","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useHistory","AddNewItemModalContent","type","setIsAdding","history","saveEntityRecord","title","setTitle","isSaving","setIsSaving","defaultViews","postType","onSubmit","event","preventDefault","getEntityRecords","dataViewTaxonomyId","dataViewTypeRecords","slug","length","id","record","name","savedRecord","status","wp_dataviews_type","content","JSON","stringify","view","params","getLocationWithParams","push","activeView","isCustom","children","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","className","justify","variant","onClick","isBusy","AddNewItem","isAdding","icon","onRequestClose"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/add-new-view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useDefaultViews } from './default-views';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction AddNewItemModalContent( { type, setIsAdding } ) {\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isSaving, setIsSaving ] = useState( false );\n\tconst defaultViews = useDefaultViews( { postType: type } );\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsSaving( true );\n\t\t\t\tconst { getEntityRecords } = resolveSelect( coreStore );\n\t\t\t\tlet dataViewTaxonomyId;\n\t\t\t\tconst dataViewTypeRecords = await getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t{ slug: type }\n\t\t\t\t);\n\t\t\t\tif ( dataViewTypeRecords && dataViewTypeRecords.length > 0 ) {\n\t\t\t\t\tdataViewTaxonomyId = dataViewTypeRecords[ 0 ].id;\n\t\t\t\t} else {\n\t\t\t\t\tconst record = await saveEntityRecord(\n\t\t\t\t\t\t'taxonomy',\n\t\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t\t{ name: type }\n\t\t\t\t\t);\n\t\t\t\t\tif ( record && record.id ) {\n\t\t\t\t\t\tdataViewTaxonomyId = record.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\twp_dataviews_type: dataViewTaxonomyId,\n\t\t\t\t\t\tcontent: JSON.stringify( defaultViews[ 0 ].view ),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tconst {\n\t\t\t\t\tparams: { postType },\n\t\t\t\t} = history.getLocationWithParams();\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType,\n\t\t\t\t\tactiveView: savedRecord.id,\n\t\t\t\t\tisCustom: 'true',\n\t\t\t\t} );\n\t\t\t\tsetIsSaving( false );\n\t\t\t\tsetIsAdding( false );\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ __( 'My view' ) }\n\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSaving }\n\t\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nexport default function AddNewItem( { type } ) {\n\tconst [ isAdding, setIsAdding ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsAdding( true );\n\t\t\t\t} }\n\t\t\t\tclassName=\"dataviews__siderbar-content-add-new-item\"\n\t\t\t>\n\t\t\t\t{ __( 'New view' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ isAdding && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Add new view' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AddNewItemModalContent\n\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\tsetIsAdding={ setIsAdding }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KAAK,EACLC,WAAW,EACXC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,QACA,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,aAAa,QAAQ,iBAAiB;AAC5D,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD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Stack","VStack","Button","__","useDispatch","resolveSelect","store","coreStore","useState","plus","privateApis","routerPrivateApis","addQueryArgs","SidebarNavigationItem","useDefaultViews","unlock","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","useLocation","useHistory","AddNewItemModalContent","type","setIsAdding","history","path","saveEntityRecord","title","setTitle","isSaving","setIsSaving","defaultViews","postType","onSubmit","event","preventDefault","getEntityRecords","dataViewTaxonomyId","dataViewTypeRecords","slug","length","id","record","name","savedRecord","status","wp_dataviews_type","content","JSON","stringify","view","navigate","activeView","isCustom","children","spacing","__next40pxDefaultSize","__nextHasNoMarginBottom","label","value","onChange","placeholder","className","justify","variant","onClick","isBusy","AddNewItem","isAdding","icon","onRequestClose"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/add-new-view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tModal,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, resolveSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { useDefaultViews } from './default-views';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction AddNewItemModalContent( { type, setIsAdding } ) {\n\tconst history = useHistory();\n\tconst { path } = useLocation();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst [ isSaving, setIsSaving ] = useState( false );\n\tconst defaultViews = useDefaultViews( { postType: type } );\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsSaving( true );\n\t\t\t\tconst { getEntityRecords } = resolveSelect( coreStore );\n\t\t\t\tlet dataViewTaxonomyId;\n\t\t\t\tconst dataViewTypeRecords = await getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t{ slug: type }\n\t\t\t\t);\n\t\t\t\tif ( dataViewTypeRecords && dataViewTypeRecords.length > 0 ) {\n\t\t\t\t\tdataViewTaxonomyId = dataViewTypeRecords[ 0 ].id;\n\t\t\t\t} else {\n\t\t\t\t\tconst record = await saveEntityRecord(\n\t\t\t\t\t\t'taxonomy',\n\t\t\t\t\t\t'wp_dataviews_type',\n\t\t\t\t\t\t{ name: type }\n\t\t\t\t\t);\n\t\t\t\t\tif ( record && record.id ) {\n\t\t\t\t\t\tdataViewTaxonomyId = record.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_dataviews',\n\t\t\t\t\t{\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\t\twp_dataviews_type: dataViewTaxonomyId,\n\t\t\t\t\t\tcontent: JSON.stringify( defaultViews[ 0 ].view ),\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tactiveView: savedRecord.id,\n\t\t\t\t\t\tisCustom: 'true',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\tsetIsSaving( false );\n\t\t\t\tsetIsAdding( false );\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\tplaceholder={ __( 'My view' ) }\n\t\t\t\t\tclassName=\"patterns-create-modal__name-input\"\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSaving }\n\t\t\t\t\t\tisBusy={ isSaving }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nexport default function AddNewItem( { type } ) {\n\tconst [ isAdding, setIsAdding ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ plus }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsAdding( true );\n\t\t\t\t} }\n\t\t\t\tclassName=\"dataviews__siderbar-content-add-new-item\"\n\t\t\t>\n\t\t\t\t{ __( 'New view' ) }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ isAdding && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Add new view' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsAdding( false );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AddNewItemModalContent\n\t\t\t\t\t\ttype={ type }\n\t\t\t\t\t\tsetIsAdding={ setIsAdding }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KAAK,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CAAA,KAAM;QACtB/C,WAAW,CAAE,KAAM,CAAC;MACrB,CAAG;MAAA+B,QAAA,eAEHxC,IAAA,CAACO,sBAAsB;QACtBC,IAAI,EAAGA,IAAM;QACbC,WAAW,EAAGA;MAAa,CAC3B;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -9,11 +9,11 @@ import clsx from 'clsx';
9
9
  import { privateApis as routerPrivateApis } from '@wordpress/router';
10
10
  import { __experimentalHStack as HStack } from '@wordpress/components';
11
11
  import { VIEW_LAYOUTS } from '@wordpress/dataviews';
12
+ import { addQueryArgs } from '@wordpress/url';
12
13
 
13
14
  /**
14
15
  * Internal dependencies
15
16
  */
16
- import { useLink } from '../routes/link';
17
17
  import SidebarNavigationItem from '../sidebar-navigation-item';
18
18
  import { unlock } from '../../lock-unlock';
19
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -31,21 +31,18 @@ export default function DataViewItem({
31
31
  suffix
32
32
  }) {
33
33
  const {
34
- params: {
35
- postType
36
- }
34
+ path
37
35
  } = useLocation();
38
36
  const iconToUse = icon || VIEW_LAYOUTS.find(v => v.type === type).icon;
39
37
  let activeView = isCustom ? customViewId : slug;
40
38
  if (activeView === 'all') {
41
39
  activeView = undefined;
42
40
  }
43
- const linkInfo = useLink({
44
- postType,
41
+ const query = {
45
42
  layout: type,
46
43
  activeView,
47
44
  isCustom: isCustom ? 'true' : undefined
48
- });
45
+ };
49
46
  return /*#__PURE__*/_jsxs(HStack, {
50
47
  justify: "flex-start",
51
48
  className: clsx('edit-site-sidebar-dataviews-dataview-item', {
@@ -53,7 +50,7 @@ export default function DataViewItem({
53
50
  }),
54
51
  children: [/*#__PURE__*/_jsx(SidebarNavigationItem, {
55
52
  icon: iconToUse,
56
- ...linkInfo,
53
+ to: addQueryArgs(path, query),
57
54
  "aria-current": isActive ? 'true' : undefined,
58
55
  children: title
59
56
  }), suffix]
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","privateApis","routerPrivateApis","__experimentalHStack","HStack","VIEW_LAYOUTS","useLink","SidebarNavigationItem","unlock","jsx","_jsx","jsxs","_jsxs","useLocation","DataViewItem","title","slug","customViewId","type","icon","isActive","isCustom","suffix","params","postType","iconToUse","find","v","activeView","undefined","linkInfo","layout","justify","className","children"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/dataview-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { VIEW_LAYOUTS } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\tcustomViewId,\n\ttype,\n\ticon,\n\tisActive,\n\tisCustom,\n\tsuffix,\n} ) {\n\tconst {\n\t\tparams: { postType },\n\t} = useLocation();\n\n\tconst iconToUse =\n\t\ticon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;\n\n\tlet activeView = isCustom ? customViewId : slug;\n\tif ( activeView === 'all' ) {\n\t\tactiveView = undefined;\n\t}\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tlayout: type,\n\t\tactiveView,\n\t\tisCustom: isCustom ? 'true' : undefined,\n\t} );\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'edit-site-sidebar-dataviews-dataview-item', {\n\t\t\t\t'is-selected': isActive,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\t{ ...linkInfo }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\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AE;MAC9D,aAAa,EAAEoB;IAChB,CAAE,CAAG;IAAAc,QAAA,gBAELxB,IAAA,CAACH,qBAAqB;MACrBY,IAAI,EAAGM,SAAW;MAAA,GACbK,QAAQ;MACb,gBAAeV,QAAQ,GAAG,MAAM,GAAGS,SAAW;MAAAK,QAAA,EAE5CnB;IAAK,CACe,CAAC,EACtBO,MAAM;EAAA,CACD,CAAC;AAEX","ignoreList":[]}
1
+ {"version":3,"names":["clsx","privateApis","routerPrivateApis","__experimentalHStack","HStack","VIEW_LAYOUTS","addQueryArgs","SidebarNavigationItem","unlock","jsx","_jsx","jsxs","_jsxs","useLocation","DataViewItem","title","slug","customViewId","type","icon","isActive","isCustom","suffix","path","iconToUse","find","v","activeView","undefined","query","layout","justify","className","children","to"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/dataview-item.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { VIEW_LAYOUTS } from '@wordpress/dataviews';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\tcustomViewId,\n\ttype,\n\ticon,\n\tisActive,\n\tisCustom,\n\tsuffix,\n} ) {\n\tconst { path } = useLocation();\n\n\tconst iconToUse =\n\t\ticon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;\n\n\tlet activeView = isCustom ? customViewId : slug;\n\tif ( activeView === 'all' ) {\n\t\tactiveView = undefined;\n\t}\n\tconst query = {\n\t\tlayout: type,\n\t\tactiveView,\n\t\tisCustom: isCustom ? 'true' : undefined,\n\t};\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'edit-site-sidebar-dataviews-dataview-item', {\n\t\t\t\t'is-selected': isActive,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\tto={ addQueryArgs( path, query ) }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAC3C,MAAM;EAAEC;AAAY,CAAC,GAAGL,MAAM,CAAEN,iBAAkB,CAAC;AAEnD,eAAe,SAASY,YAAYA,CAAE;EACrCC,KAAK;EACLC,IAAI;EACJC,YAAY;EACZC,IAAI;EACJC,IAAI;EACJC,QAAQ;EACRC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC;EAAK,CAAC,GAAGV,WAAW,CAAC,CAAC;EAE9B,MAAMW,SAAS,GACdL,IAAI,IAAId,YAAY,CAACoB,IAAI,CAAIC,CAAC,IAAMA,CAAC,CAACR,IAAI,KAAKA,IAAK,CAAC,CAACC,IAAI;EAE3D,IAAIQ,UAAU,GAAGN,QAAQ,GAAGJ,YAAY,GAAGD,IAAI;EAC/C,IAAKW,UAAU,KAAK,KAAK,EAAG;IAC3BA,UAAU,GAAGC,SAAS;EACvB;EACA,MAAMC,KAAK,GAAG;IACbC,MAAM,EAAEZ,IAAI;IACZS,UAAU;IACVN,QAAQ,EAAEA,QAAQ,GAAG,MAAM,GAAGO;EAC/B,CAAC;EACD,oBACChB,KAAA,CAACR,MAAM;IACN2B,OAAO,EAAC,YAAY;IACpBC,SAAS,EAAGhC,IAAI,CAAE,2CAA2C,EAAE;MAC9D,aAAa,EAAEoB;IAChB,CAAE,CAAG;IAAAa,QAAA,gBAELvB,IAAA,CAACH,qBAAqB;MACrBY,IAAI,EAAGK,SAAW;MAClBU,EAAE,EAAG5B,YAAY,CAAEiB,IAAI,EAAEM,KAAM,CAAG;MAClC,gBAAeT,QAAQ,GAAG,MAAM,GAAGQ,SAAW;MAAAK,QAAA,EAE5ClB;IAAK,CACe,CAAC,EACtBO,MAAM;EAAA,CACD,CAAC;AAEX","ignoreList":[]}
@@ -12,28 +12,9 @@ import { useMemo } from '@wordpress/element';
12
12
  */
13
13
  import { LAYOUT_LIST, LAYOUT_TABLE, LAYOUT_GRID, OPERATOR_IS_ANY } from '../../utils/constants';
14
14
  export const defaultLayouts = {
15
- [LAYOUT_TABLE]: {
16
- layout: {
17
- primaryField: 'title',
18
- styles: {
19
- title: {
20
- maxWidth: 300
21
- }
22
- }
23
- }
24
- },
25
- [LAYOUT_GRID]: {
26
- layout: {
27
- mediaField: 'featured_media',
28
- primaryField: 'title'
29
- }
30
- },
31
- [LAYOUT_LIST]: {
32
- layout: {
33
- primaryField: 'title',
34
- mediaField: 'featured_media'
35
- }
36
- }
15
+ [LAYOUT_TABLE]: {},
16
+ [LAYOUT_GRID]: {},
17
+ [LAYOUT_LIST]: {}
37
18
  };
38
19
  const DEFAULT_POST_BASE = {
39
20
  type: LAYOUT_LIST,
@@ -45,8 +26,10 @@ const DEFAULT_POST_BASE = {
45
26
  field: 'date',
46
27
  direction: 'desc'
47
28
  },
48
- fields: ['title', 'author', 'status'],
49
- layout: defaultLayouts[LAYOUT_LIST].layout
29
+ titleField: 'title',
30
+ mediaField: 'featured_media',
31
+ fields: ['author', 'status'],
32
+ ...defaultLayouts[LAYOUT_LIST]
50
33
  };
51
34
  export function useDefaultViews({
52
35
  postType