@wordpress/edit-site 6.12.1-next.082ed6819.0 → 6.13.1-next.cd6172eb0.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 (443) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-pattern/index.js +3 -16
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/add-new-template/index.js +1 -5
  5. package/build/components/add-new-template/index.js.map +1 -1
  6. package/build/components/app/index.js +31 -29
  7. package/build/components/app/index.js.map +1 -1
  8. package/build/components/block-editor/use-editor-iframe-props.js +8 -8
  9. package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
  10. package/build/components/block-editor/use-navigate-to-entity-record.js +1 -5
  11. package/build/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  12. package/build/components/block-editor/use-site-editor-settings.js +4 -4
  13. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  14. package/build/components/dataviews-actions/index.js +1 -5
  15. package/build/components/dataviews-actions/index.js.map +1 -1
  16. package/build/components/editor/index.js +38 -22
  17. package/build/components/editor/index.js.map +1 -1
  18. package/build/components/editor/use-editor-title.js +5 -0
  19. package/build/components/editor/use-editor-title.js.map +1 -1
  20. package/build/components/editor/use-resolve-edited-entity.js +19 -4
  21. package/build/components/editor/use-resolve-edited-entity.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/context.js +0 -1
  23. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/font-collection.js +36 -26
  25. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  29. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  30. package/build/components/global-styles-sidebar/index.js +5 -5
  31. package/build/components/global-styles-sidebar/index.js.map +1 -1
  32. package/build/components/layout/index.js +31 -13
  33. package/build/components/layout/index.js.map +1 -1
  34. package/build/components/page-patterns/delete-category-menu-item.js +1 -4
  35. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  36. package/build/components/page-patterns/fields.js +6 -11
  37. package/build/components/page-patterns/fields.js.map +1 -1
  38. package/build/components/page-patterns/index.js +14 -16
  39. package/build/components/page-patterns/index.js.map +1 -1
  40. package/build/components/page-templates/fields.js +8 -17
  41. package/build/components/page-templates/fields.js.map +1 -1
  42. package/build/components/page-templates/index.js +13 -12
  43. package/build/components/page-templates/index.js.map +1 -1
  44. package/build/components/post-edit/index.js +38 -3
  45. package/build/components/post-edit/index.js.map +1 -1
  46. package/build/components/post-list/index.js +25 -39
  47. package/build/components/post-list/index.js.map +1 -1
  48. package/build/components/posts-app/index.js +10 -16
  49. package/build/components/posts-app/index.js.map +1 -1
  50. package/build/components/posts-app-routes/index.js +3 -7
  51. package/build/components/posts-app-routes/index.js.map +1 -1
  52. package/build/components/posts-app-routes/{posts-edit.js → post-item.js} +9 -13
  53. package/build/components/posts-app-routes/post-item.js.map +1 -0
  54. package/build/components/posts-app-routes/posts.js +89 -0
  55. package/build/components/posts-app-routes/posts.js.map +1 -0
  56. package/build/components/resizable-frame/index.js +6 -5
  57. package/build/components/resizable-frame/index.js.map +1 -1
  58. package/build/components/save-panel/index.js +9 -6
  59. package/build/components/save-panel/index.js.map +1 -1
  60. package/build/components/sidebar-dataviews/add-new-view.js +7 -8
  61. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  62. package/build/components/sidebar-dataviews/dataview-item.js +5 -8
  63. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  64. package/build/components/sidebar-dataviews/index.js +4 -3
  65. package/build/components/sidebar-dataviews/index.js.map +1 -1
  66. package/build/components/sidebar-global-styles-wrapper/index.js +18 -18
  67. package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  68. package/build/components/sidebar-navigation-item/index.js +8 -5
  69. package/build/components/sidebar-navigation-item/index.js.map +1 -1
  70. package/build/components/sidebar-navigation-screen/index.js +2 -2
  71. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  72. package/build/components/sidebar-navigation-screen-global-styles/index.js +8 -19
  73. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  74. package/build/components/sidebar-navigation-screen-main/index.js +6 -14
  75. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  76. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  77. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  78. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  79. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  81. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  83. package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  85. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  86. package/build/components/sidebar-navigation-screen-patterns/index.js +4 -5
  87. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  88. package/build/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  89. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  90. package/build/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  91. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  92. package/build/components/site-editor-routes/{home-view.js → home.js} +7 -8
  93. package/build/components/site-editor-routes/home.js.map +1 -0
  94. package/build/components/site-editor-routes/index.js +12 -18
  95. package/build/components/site-editor-routes/index.js.map +1 -1
  96. package/build/components/site-editor-routes/navigation-item.js +49 -0
  97. package/build/components/site-editor-routes/navigation-item.js.map +1 -0
  98. package/build/components/{posts-app-routes/home.js → site-editor-routes/navigation.js} +16 -18
  99. package/build/components/site-editor-routes/navigation.js.map +1 -0
  100. package/build/components/site-editor-routes/{pages-edit.js → page-item.js} +10 -17
  101. package/build/components/site-editor-routes/page-item.js.map +1 -0
  102. package/build/components/site-editor-routes/pages.js +87 -0
  103. package/build/components/site-editor-routes/pages.js.map +1 -0
  104. package/build/components/site-editor-routes/{home-edit.js → pattern-item.js} +11 -11
  105. package/build/components/site-editor-routes/pattern-item.js.map +1 -0
  106. package/build/components/site-editor-routes/{patterns-view.js → patterns.js} +6 -9
  107. package/build/components/site-editor-routes/patterns.js.map +1 -0
  108. package/build/components/site-editor-routes/{styles-view.js → styles.js} +28 -9
  109. package/build/components/site-editor-routes/styles.js.map +1 -0
  110. package/build/components/site-editor-routes/{templates-edit.js → template-item.js} +6 -11
  111. package/build/components/site-editor-routes/template-item.js.map +1 -0
  112. package/build/components/site-editor-routes/{patterns-edit.js → template-part-item.js} +6 -11
  113. package/build/components/site-editor-routes/template-part-item.js.map +1 -0
  114. package/build/components/site-editor-routes/{templates-list-view.js → templates.js} +20 -13
  115. package/build/components/site-editor-routes/templates.js.map +1 -0
  116. package/build/components/site-hub/index.js +3 -3
  117. package/build/components/site-hub/index.js.map +1 -1
  118. package/build/components/style-book/constants.js +8 -19
  119. package/build/components/style-book/constants.js.map +1 -1
  120. package/build/components/style-book/index.js +5 -0
  121. package/build/components/style-book/index.js.map +1 -1
  122. package/build/hooks/commands/use-common-commands.js +12 -48
  123. package/build/hooks/commands/use-common-commands.js.map +1 -1
  124. package/build/hooks/commands/use-set-command-context.js +2 -2
  125. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  126. package/build/store/private-actions.js +7 -0
  127. package/build/store/private-actions.js.map +1 -1
  128. package/build/store/reducer.js +2 -0
  129. package/build/store/reducer.js.map +1 -1
  130. package/build/utils/is-previewing-theme.js +1 -1
  131. package/build/utils/is-previewing-theme.js.map +1 -1
  132. package/build/utils/use-activate-theme.js +9 -8
  133. package/build/utils/use-activate-theme.js.map +1 -1
  134. package/build-module/components/add-new-pattern/index.js +3 -16
  135. package/build-module/components/add-new-pattern/index.js.map +1 -1
  136. package/build-module/components/add-new-template/index.js +1 -5
  137. package/build-module/components/add-new-template/index.js.map +1 -1
  138. package/build-module/components/app/index.js +33 -31
  139. package/build-module/components/app/index.js.map +1 -1
  140. package/build-module/components/block-editor/use-editor-iframe-props.js +8 -8
  141. package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
  142. package/build-module/components/block-editor/use-navigate-to-entity-record.js +1 -5
  143. package/build-module/components/block-editor/use-navigate-to-entity-record.js.map +1 -1
  144. package/build-module/components/block-editor/use-site-editor-settings.js +4 -4
  145. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  146. package/build-module/components/dataviews-actions/index.js +1 -5
  147. package/build-module/components/dataviews-actions/index.js.map +1 -1
  148. package/build-module/components/editor/index.js +38 -22
  149. package/build-module/components/editor/index.js.map +1 -1
  150. package/build-module/components/editor/use-editor-title.js +5 -0
  151. package/build-module/components/editor/use-editor-title.js.map +1 -1
  152. package/build-module/components/editor/use-resolve-edited-entity.js +19 -4
  153. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -1
  154. package/build-module/components/global-styles/font-library-modal/context.js +0 -1
  155. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  156. package/build-module/components/global-styles/font-library-modal/font-collection.js +37 -27
  157. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  158. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +0 -1
  159. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  160. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +0 -1
  161. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  162. package/build-module/components/global-styles-sidebar/index.js +5 -5
  163. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  164. package/build-module/components/layout/index.js +33 -15
  165. package/build-module/components/layout/index.js.map +1 -1
  166. package/build-module/components/page-patterns/delete-category-menu-item.js +1 -4
  167. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  168. package/build-module/components/page-patterns/fields.js +6 -11
  169. package/build-module/components/page-patterns/fields.js.map +1 -1
  170. package/build-module/components/page-patterns/index.js +14 -16
  171. package/build-module/components/page-patterns/index.js.map +1 -1
  172. package/build-module/components/page-templates/fields.js +7 -14
  173. package/build-module/components/page-templates/fields.js.map +1 -1
  174. package/build-module/components/page-templates/index.js +13 -12
  175. package/build-module/components/page-templates/index.js.map +1 -1
  176. package/build-module/components/post-edit/index.js +38 -3
  177. package/build-module/components/post-edit/index.js.map +1 -1
  178. package/build-module/components/post-list/index.js +25 -39
  179. package/build-module/components/post-list/index.js.map +1 -1
  180. package/build-module/components/posts-app/index.js +11 -17
  181. package/build-module/components/posts-app/index.js.map +1 -1
  182. package/build-module/components/posts-app-routes/index.js +3 -7
  183. package/build-module/components/posts-app-routes/index.js.map +1 -1
  184. package/build-module/components/posts-app-routes/{posts-edit.js → post-item.js} +8 -12
  185. package/build-module/components/posts-app-routes/post-item.js.map +1 -0
  186. package/build-module/components/posts-app-routes/posts.js +81 -0
  187. package/build-module/components/posts-app-routes/posts.js.map +1 -0
  188. package/build-module/components/resizable-frame/index.js +6 -5
  189. package/build-module/components/resizable-frame/index.js.map +1 -1
  190. package/build-module/components/save-panel/index.js +9 -6
  191. package/build-module/components/save-panel/index.js.map +1 -1
  192. package/build-module/components/sidebar-dataviews/add-new-view.js +7 -8
  193. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  194. package/build-module/components/sidebar-dataviews/dataview-item.js +5 -8
  195. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  196. package/build-module/components/sidebar-dataviews/index.js +4 -3
  197. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  198. package/build-module/components/sidebar-global-styles-wrapper/index.js +18 -18
  199. package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -1
  200. package/build-module/components/sidebar-navigation-item/index.js +8 -5
  201. package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
  202. package/build-module/components/sidebar-navigation-screen/index.js +2 -2
  203. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  204. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +9 -20
  205. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  206. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -14
  207. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  208. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -5
  209. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  210. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -7
  211. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  212. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -6
  213. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  214. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +14 -20
  215. package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
  216. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +5 -7
  217. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  218. package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -5
  219. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  220. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +25 -16
  221. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  222. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  223. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  224. package/build-module/components/site-editor-routes/{home-edit.js → home.js} +5 -7
  225. package/build-module/components/site-editor-routes/home.js.map +1 -0
  226. package/build-module/components/site-editor-routes/index.js +12 -18
  227. package/build-module/components/site-editor-routes/index.js.map +1 -1
  228. package/build-module/components/site-editor-routes/navigation-item.js +41 -0
  229. package/build-module/components/site-editor-routes/navigation-item.js.map +1 -0
  230. package/build-module/components/site-editor-routes/navigation.js +38 -0
  231. package/build-module/components/site-editor-routes/navigation.js.map +1 -0
  232. package/build-module/components/site-editor-routes/{pages-edit.js → page-item.js} +9 -16
  233. package/build-module/components/site-editor-routes/page-item.js.map +1 -0
  234. package/build-module/components/site-editor-routes/pages.js +79 -0
  235. package/build-module/components/site-editor-routes/pages.js.map +1 -0
  236. package/build-module/components/site-editor-routes/pattern-item.js +18 -0
  237. package/build-module/components/site-editor-routes/pattern-item.js.map +1 -0
  238. package/build-module/components/site-editor-routes/{patterns-view.js → patterns.js} +5 -8
  239. package/build-module/components/site-editor-routes/patterns.js.map +1 -0
  240. package/build-module/components/site-editor-routes/styles.js +44 -0
  241. package/build-module/components/site-editor-routes/styles.js.map +1 -0
  242. package/build-module/components/site-editor-routes/{templates-edit.js → template-item.js} +5 -10
  243. package/build-module/components/site-editor-routes/template-item.js.map +1 -0
  244. package/build-module/components/site-editor-routes/template-part-item.js +18 -0
  245. package/build-module/components/site-editor-routes/template-part-item.js.map +1 -0
  246. package/build-module/components/site-editor-routes/templates.js +33 -0
  247. package/build-module/components/site-editor-routes/templates.js.map +1 -0
  248. package/build-module/components/site-hub/index.js +3 -3
  249. package/build-module/components/site-hub/index.js.map +1 -1
  250. package/build-module/components/style-book/constants.js +8 -19
  251. package/build-module/components/style-book/constants.js.map +1 -1
  252. package/build-module/components/style-book/index.js +5 -0
  253. package/build-module/components/style-book/index.js.map +1 -1
  254. package/build-module/hooks/commands/use-common-commands.js +12 -48
  255. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  256. package/build-module/hooks/commands/use-set-command-context.js +2 -2
  257. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  258. package/build-module/store/private-actions.js +6 -0
  259. package/build-module/store/private-actions.js.map +1 -1
  260. package/build-module/store/reducer.js +2 -0
  261. package/build-module/store/reducer.js.map +1 -1
  262. package/build-module/utils/is-previewing-theme.js +1 -1
  263. package/build-module/utils/is-previewing-theme.js.map +1 -1
  264. package/build-module/utils/use-activate-theme.js +9 -8
  265. package/build-module/utils/use-activate-theme.js.map +1 -1
  266. package/build-style/style-rtl.css +94 -12
  267. package/build-style/style.css +94 -12
  268. package/package.json +40 -40
  269. package/src/components/add-new-pattern/index.js +9 -17
  270. package/src/components/add-new-template/index.js +3 -5
  271. package/src/components/app/index.js +34 -35
  272. package/src/components/block-editor/use-editor-iframe-props.js +5 -4
  273. package/src/components/block-editor/use-navigate-to-entity-record.js +3 -1
  274. package/src/components/block-editor/use-site-editor-settings.js +6 -6
  275. package/src/components/dataviews-actions/index.js +1 -5
  276. package/src/components/editor/index.js +64 -29
  277. package/src/components/editor/use-editor-title.js +4 -0
  278. package/src/components/editor/use-resolve-edited-entity.js +17 -2
  279. package/src/components/global-styles/font-library-modal/font-collection.js +40 -27
  280. package/src/components/global-styles/font-library-modal/style.scss +12 -5
  281. package/src/components/global-styles/style.scss +4 -0
  282. package/src/components/global-styles-sidebar/index.js +4 -4
  283. package/src/components/layout/index.js +36 -6
  284. package/src/components/page-patterns/delete-category-menu-item.js +3 -4
  285. package/src/components/page-patterns/fields.js +12 -11
  286. package/src/components/page-patterns/index.js +16 -14
  287. package/src/components/page-templates/fields.js +4 -15
  288. package/src/components/page-templates/index.js +18 -13
  289. package/src/components/post-edit/index.js +36 -2
  290. package/src/components/post-list/index.js +43 -39
  291. package/src/components/posts-app/index.js +9 -18
  292. package/src/components/posts-app-routes/index.js +3 -14
  293. package/src/components/posts-app-routes/{posts-edit.js → post-item.js} +5 -9
  294. package/src/components/posts-app-routes/posts.js +66 -0
  295. package/src/components/resizable-frame/index.js +6 -7
  296. package/src/components/save-panel/index.js +11 -5
  297. package/src/components/sidebar-dataviews/add-new-view.js +9 -9
  298. package/src/components/sidebar-dataviews/dataview-item.js +5 -8
  299. package/src/components/sidebar-dataviews/index.js +2 -2
  300. package/src/components/sidebar-dataviews/style.scss +2 -2
  301. package/src/components/sidebar-global-styles-wrapper/index.js +24 -30
  302. package/src/components/sidebar-navigation-item/index.js +7 -5
  303. package/src/components/sidebar-navigation-item/style.scss +1 -2
  304. package/src/components/sidebar-navigation-screen/index.js +2 -2
  305. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  306. package/src/components/sidebar-navigation-screen-global-styles/index.js +13 -34
  307. package/src/components/sidebar-navigation-screen-main/index.js +6 -10
  308. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +3 -5
  309. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
  310. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +6 -6
  311. package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +9 -21
  312. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -20
  313. package/src/components/sidebar-navigation-screen-patterns/index.js +3 -4
  314. package/src/components/sidebar-navigation-screen-templates-browse/content.js +24 -18
  315. package/src/components/sidebar-navigation-screen-templates-browse/index.js +1 -14
  316. package/src/components/site-editor-routes/{home-view.js → home.js} +4 -5
  317. package/src/components/site-editor-routes/index.js +22 -34
  318. package/src/components/site-editor-routes/navigation-item.js +39 -0
  319. package/src/components/site-editor-routes/navigation.js +34 -0
  320. package/src/components/site-editor-routes/{pages-edit.js → page-item.js} +6 -14
  321. package/src/components/site-editor-routes/pages.js +66 -0
  322. package/src/components/site-editor-routes/pattern-item.js +15 -0
  323. package/src/components/site-editor-routes/patterns.js +15 -0
  324. package/src/components/site-editor-routes/styles.js +39 -0
  325. package/src/components/site-editor-routes/template-item.js +15 -0
  326. package/src/components/site-editor-routes/template-part-item.js +15 -0
  327. package/src/components/site-editor-routes/templates.js +26 -0
  328. package/src/components/site-hub/index.js +3 -6
  329. package/src/components/style-book/constants.ts +8 -19
  330. package/src/components/style-book/index.js +5 -0
  331. package/src/hooks/commands/use-common-commands.js +14 -72
  332. package/src/hooks/commands/use-set-command-context.js +2 -2
  333. package/src/store/private-actions.js +7 -0
  334. package/src/store/reducer.js +2 -0
  335. package/src/utils/is-previewing-theme.js +1 -3
  336. package/src/utils/use-activate-theme.js +4 -3
  337. package/build/components/layout/router.js +0 -92
  338. package/build/components/layout/router.js.map +0 -1
  339. package/build/components/posts-app-routes/home.js.map +0 -1
  340. package/build/components/posts-app-routes/posts-edit.js.map +0 -1
  341. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +0 -63
  342. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  343. package/build/components/posts-app-routes/posts-list-view.js +0 -48
  344. package/build/components/posts-app-routes/posts-list-view.js.map +0 -1
  345. package/build/components/posts-app-routes/posts-view-quick-edit.js +0 -60
  346. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  347. package/build/components/posts-app-routes/posts-view.js +0 -41
  348. package/build/components/posts-app-routes/posts-view.js.map +0 -1
  349. package/build/components/routes/link.js +0 -69
  350. package/build/components/routes/link.js.map +0 -1
  351. package/build/components/site-editor-routes/home-edit.js.map +0 -1
  352. package/build/components/site-editor-routes/home-view.js.map +0 -1
  353. package/build/components/site-editor-routes/navigation-edit.js +0 -29
  354. package/build/components/site-editor-routes/navigation-edit.js.map +0 -1
  355. package/build/components/site-editor-routes/navigation-item-edit.js +0 -31
  356. package/build/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  357. package/build/components/site-editor-routes/navigation-item-view.js +0 -30
  358. package/build/components/site-editor-routes/navigation-item-view.js.map +0 -1
  359. package/build/components/site-editor-routes/navigation-view.js +0 -28
  360. package/build/components/site-editor-routes/navigation-view.js.map +0 -1
  361. package/build/components/site-editor-routes/pages-edit.js.map +0 -1
  362. package/build/components/site-editor-routes/pages-list-view-quick-edit.js +0 -64
  363. package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  364. package/build/components/site-editor-routes/pages-list-view.js +0 -47
  365. package/build/components/site-editor-routes/pages-list-view.js.map +0 -1
  366. package/build/components/site-editor-routes/pages-view-quick-edit.js +0 -61
  367. package/build/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  368. package/build/components/site-editor-routes/pages-view.js +0 -42
  369. package/build/components/site-editor-routes/pages-view.js.map +0 -1
  370. package/build/components/site-editor-routes/patterns-edit.js.map +0 -1
  371. package/build/components/site-editor-routes/patterns-view.js.map +0 -1
  372. package/build/components/site-editor-routes/styles-view.js.map +0 -1
  373. package/build/components/site-editor-routes/templates-edit.js.map +0 -1
  374. package/build/components/site-editor-routes/templates-list-view.js.map +0 -1
  375. package/build/components/site-editor-routes/templates-view.js +0 -29
  376. package/build/components/site-editor-routes/templates-view.js.map +0 -1
  377. package/build-module/components/layout/router.js +0 -84
  378. package/build-module/components/layout/router.js.map +0 -1
  379. package/build-module/components/posts-app-routes/home.js +0 -40
  380. package/build-module/components/posts-app-routes/home.js.map +0 -1
  381. package/build-module/components/posts-app-routes/posts-edit.js.map +0 -1
  382. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +0 -55
  383. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +0 -1
  384. package/build-module/components/posts-app-routes/posts-list-view.js +0 -40
  385. package/build-module/components/posts-app-routes/posts-list-view.js.map +0 -1
  386. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +0 -52
  387. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +0 -1
  388. package/build-module/components/posts-app-routes/posts-view.js +0 -33
  389. package/build-module/components/posts-app-routes/posts-view.js.map +0 -1
  390. package/build-module/components/routes/link.js +0 -61
  391. package/build-module/components/routes/link.js.map +0 -1
  392. package/build-module/components/site-editor-routes/home-edit.js.map +0 -1
  393. package/build-module/components/site-editor-routes/home-view.js +0 -17
  394. package/build-module/components/site-editor-routes/home-view.js.map +0 -1
  395. package/build-module/components/site-editor-routes/navigation-edit.js +0 -21
  396. package/build-module/components/site-editor-routes/navigation-edit.js.map +0 -1
  397. package/build-module/components/site-editor-routes/navigation-item-edit.js +0 -23
  398. package/build-module/components/site-editor-routes/navigation-item-edit.js.map +0 -1
  399. package/build-module/components/site-editor-routes/navigation-item-view.js +0 -22
  400. package/build-module/components/site-editor-routes/navigation-item-view.js.map +0 -1
  401. package/build-module/components/site-editor-routes/navigation-view.js +0 -20
  402. package/build-module/components/site-editor-routes/navigation-view.js.map +0 -1
  403. package/build-module/components/site-editor-routes/pages-edit.js.map +0 -1
  404. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  405. package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +0 -1
  406. package/build-module/components/site-editor-routes/pages-list-view.js +0 -39
  407. package/build-module/components/site-editor-routes/pages-list-view.js.map +0 -1
  408. package/build-module/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  409. package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +0 -1
  410. package/build-module/components/site-editor-routes/pages-view.js +0 -34
  411. package/build-module/components/site-editor-routes/pages-view.js.map +0 -1
  412. package/build-module/components/site-editor-routes/patterns-edit.js +0 -23
  413. package/build-module/components/site-editor-routes/patterns-edit.js.map +0 -1
  414. package/build-module/components/site-editor-routes/patterns-view.js.map +0 -1
  415. package/build-module/components/site-editor-routes/styles-view.js +0 -25
  416. package/build-module/components/site-editor-routes/styles-view.js.map +0 -1
  417. package/build-module/components/site-editor-routes/templates-edit.js.map +0 -1
  418. package/build-module/components/site-editor-routes/templates-list-view.js +0 -26
  419. package/build-module/components/site-editor-routes/templates-list-view.js.map +0 -1
  420. package/build-module/components/site-editor-routes/templates-view.js +0 -21
  421. package/build-module/components/site-editor-routes/templates-view.js.map +0 -1
  422. package/src/components/layout/router.js +0 -86
  423. package/src/components/posts-app-routes/home.js +0 -36
  424. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +0 -52
  425. package/src/components/posts-app-routes/posts-list-view.js +0 -40
  426. package/src/components/posts-app-routes/posts-view-quick-edit.js +0 -49
  427. package/src/components/posts-app-routes/posts-view.js +0 -35
  428. package/src/components/routes/link.js +0 -68
  429. package/src/components/site-editor-routes/home-edit.js +0 -17
  430. package/src/components/site-editor-routes/navigation-edit.js +0 -22
  431. package/src/components/site-editor-routes/navigation-item-edit.js +0 -26
  432. package/src/components/site-editor-routes/navigation-item-view.js +0 -25
  433. package/src/components/site-editor-routes/navigation-view.js +0 -21
  434. package/src/components/site-editor-routes/pages-list-view-quick-edit.js +0 -56
  435. package/src/components/site-editor-routes/pages-list-view.js +0 -44
  436. package/src/components/site-editor-routes/pages-view-quick-edit.js +0 -53
  437. package/src/components/site-editor-routes/pages-view.js +0 -39
  438. package/src/components/site-editor-routes/patterns-edit.js +0 -24
  439. package/src/components/site-editor-routes/patterns-view.js +0 -22
  440. package/src/components/site-editor-routes/styles-view.js +0 -26
  441. package/src/components/site-editor-routes/templates-edit.js +0 -22
  442. package/src/components/site-editor-routes/templates-list-view.js +0 -28
  443. package/src/components/site-editor-routes/templates-view.js +0 -22
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = PostsApp;
8
- var _editor = require("@wordpress/editor");
9
8
  var _router = require("@wordpress/router");
9
+ var _data = require("@wordpress/data");
10
10
  var _layout = _interopRequireDefault(require("../layout"));
11
11
  var _postsAppRoutes = require("../posts-app-routes");
12
12
  var _lockUnlock = require("../../lock-unlock");
13
- var _router2 = _interopRequireDefault(require("../layout/router"));
13
+ var _store = require("../../store");
14
14
  var _jsxRuntime = require("react/jsx-runtime");
15
15
  /**
16
16
  * WordPress dependencies
@@ -23,21 +23,15 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
  const {
24
24
  RouterProvider
25
25
  } = (0, _lockUnlock.unlock)(_router.privateApis);
26
- const {
27
- GlobalStylesProvider
28
- } = (0, _lockUnlock.unlock)(_editor.privateApis);
29
- function PostsLayout() {
30
- (0, _postsAppRoutes.useRegisterPostsAppRoutes)();
31
- const route = (0, _router2.default)();
32
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
33
- route: route
34
- });
35
- }
36
26
  function PostsApp() {
37
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GlobalStylesProvider, {
38
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.UnsavedChangesWarning, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterProvider, {
39
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PostsLayout, {})
40
- })]
27
+ (0, _postsAppRoutes.useRegisterPostsAppRoutes)();
28
+ const routes = (0, _data.useSelect)(select => {
29
+ return (0, _lockUnlock.unlock)(select(_store.store)).getRoutes();
30
+ }, []);
31
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterProvider, {
32
+ routes: routes,
33
+ pathArg: "p",
34
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {})
41
35
  });
42
36
  }
43
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_editor","require","_router","_layout","_interopRequireDefault","_postsAppRoutes","_lockUnlock","_router2","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","PostsLayout","useRegisterPostsAppRoutes","route","useActiveRoute","jsx","default","PostsApp","jsxs","children","UnsavedChangesWarning"],"sources":["@wordpress/edit-site/src/components/posts-app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { useRegisterPostsAppRoutes } from '../posts-app-routes';\nimport { unlock } from '../../lock-unlock';\nimport useActiveRoute from '../layout/router';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nfunction PostsLayout() {\n\tuseRegisterPostsAppRoutes();\n\tconst route = useActiveRoute();\n\treturn <Layout route={ route } />;\n}\n\nexport default function PostsApp() {\n\treturn (\n\t\t<GlobalStylesProvider>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<RouterProvider>\n\t\t\t\t<PostsLayout />\n\t\t\t</RouterProvider>\n\t\t</GlobalStylesProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAH,sBAAA,CAAAH,OAAA;AAA8C,IAAAO,WAAA,GAAAP,OAAA;AAf9C;AACA;AACA;;AAOA;AACA;AACA;;AAMA,MAAM;EAAEQ;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AACtD,MAAM;EAAEC;AAAqB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE5D,SAASC,WAAWA,CAAA,EAAG;EACtB,IAAAC,yCAAyB,EAAC,CAAC;EAC3B,MAAMC,KAAK,GAAG,IAAAC,gBAAc,EAAC,CAAC;EAC9B,oBAAO,IAAAT,WAAA,CAAAU,GAAA,EAACf,OAAA,CAAAgB,OAAM;IAACH,KAAK,EAAGA;EAAO,CAAE,CAAC;AAClC;AAEe,SAASI,QAAQA,CAAA,EAAG;EAClC,oBACC,IAAAZ,WAAA,CAAAa,IAAA,EAACT,oBAAoB;IAAAU,QAAA,gBACpB,IAAAd,WAAA,CAAAU,GAAA,EAAClB,OAAA,CAAAuB,qBAAqB,IAAE,CAAC,eACzB,IAAAf,WAAA,CAAAU,GAAA,EAACT,cAAc;MAAAa,QAAA,eACd,IAAAd,WAAA,CAAAU,GAAA,EAACJ,WAAW,IAAE;IAAC,CACA,CAAC;EAAA,CACI,CAAC;AAEzB","ignoreList":[]}
1
+ {"version":3,"names":["_router","require","_data","_layout","_interopRequireDefault","_postsAppRoutes","_lockUnlock","_store","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","PostsApp","useRegisterPostsAppRoutes","routes","useSelect","select","editSiteStore","getRoutes","jsx","pathArg","children","default"],"sources":["@wordpress/edit-site/src/components/posts-app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { useRegisterPostsAppRoutes } from '../posts-app-routes';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\n\nexport default function PostsApp() {\n\tuseRegisterPostsAppRoutes();\n\tconst routes = useSelect( ( select ) => {\n\t\treturn unlock( select( editSiteStore ) ).getRoutes();\n\t}, [] );\n\treturn (\n\t\t<RouterProvider routes={ routes } pathArg=\"p\">\n\t\t\t<Layout />\n\t\t</RouterProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAqD,IAAAO,WAAA,GAAAP,OAAA;AAZrD;AACA;AACA;;AAIA;AACA;AACA;;AAMA,MAAM;EAAEQ;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEvC,SAASC,QAAQA,CAAA,EAAG;EAClC,IAAAC,yCAAyB,EAAC,CAAC;EAC3B,MAAMC,MAAM,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACvC,OAAO,IAAAN,kBAAM,EAAEM,MAAM,CAAEC,YAAc,CAAE,CAAC,CAACC,SAAS,CAAC,CAAC;EACrD,CAAC,EAAE,EAAG,CAAC;EACP,oBACC,IAAAV,WAAA,CAAAW,GAAA,EAACV,cAAc;IAACK,MAAM,EAAGA,MAAQ;IAACM,OAAO,EAAC,GAAG;IAAAC,QAAA,eAC5C,IAAAb,WAAA,CAAAW,GAAA,EAAChB,OAAA,CAAAmB,OAAM,IAAE;EAAC,CACK,CAAC;AAEnB","ignoreList":[]}
@@ -8,12 +8,8 @@ var _data = require("@wordpress/data");
8
8
  var _element = require("@wordpress/element");
9
9
  var _lockUnlock = require("../../lock-unlock");
10
10
  var _store = require("../../store");
11
- var _home = require("./home");
12
- var _postsListViewQuickEdit = require("./posts-list-view-quick-edit");
13
- var _postsListView = require("./posts-list-view");
14
- var _postsViewQuickEdit = require("./posts-view-quick-edit");
15
- var _postsView = require("./posts-view");
16
- var _postsEdit = require("./posts-edit");
11
+ var _posts = require("./posts");
12
+ var _postItem = require("./post-item");
17
13
  /**
18
14
  * WordPress dependencies
19
15
  */
@@ -22,7 +18,7 @@ var _postsEdit = require("./posts-edit");
22
18
  * Internal dependencies
23
19
  */
24
20
 
25
- const routes = [_postsListViewQuickEdit.postsListViewQuickEditRoute, _postsListView.postsListViewRoute, _postsViewQuickEdit.postsViewQuickEditRoute, _postsView.postsViewRoute, _postsEdit.postsEditRoute, _home.homeRoute];
21
+ const routes = [_postItem.postItemRoute, _posts.postsRoute];
26
22
  function useRegisterPostsAppRoutes() {
27
23
  const registry = (0, _data.useRegistry)();
28
24
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_element","_lockUnlock","_store","_home","_postsListViewQuickEdit","_postsListView","_postsViewQuickEdit","_postsView","_postsEdit","routes","postsListViewQuickEditRoute","postsListViewRoute","postsViewQuickEditRoute","postsViewRoute","postsEditRoute","homeRoute","useRegisterPostsAppRoutes","registry","useRegistry","registerRoute","unlock","useDispatch","siteEditorStore","useEffect","batch","forEach"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { homeRoute } from './home';\nimport { postsListViewQuickEditRoute } from './posts-list-view-quick-edit';\nimport { postsListViewRoute } from './posts-list-view';\nimport { postsViewQuickEditRoute } from './posts-view-quick-edit';\nimport { postsViewRoute } from './posts-view';\nimport { postsEditRoute } from './posts-edit';\n\nconst routes = [\n\tpostsListViewQuickEditRoute,\n\tpostsListViewRoute,\n\tpostsViewQuickEditRoute,\n\tpostsViewRoute,\n\tpostsEditRoute,\n\thomeRoute,\n];\n\nexport function useRegisterPostsAppRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAhBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA,MAAMU,MAAM,GAAG,CACdC,mDAA2B,EAC3BC,iCAAkB,EAClBC,2CAAuB,EACvBC,yBAAc,EACdC,yBAAc,EACdC,eAAS,CACT;AAEM,SAASC,yBAAyBA,CAAA,EAAG;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,EAAEC,YAAgB,CAAE,CAAC;EAClE,IAAAC,kBAAS,EAAE,MAAM;IAChBN,QAAQ,CAACO,KAAK,CAAE,MAAM;MACrBf,MAAM,CAACgB,OAAO,CAAEN,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEF,QAAQ,EAAEE,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_element","_lockUnlock","_store","_posts","_postItem","routes","postItemRoute","postsRoute","useRegisterPostsAppRoutes","registry","useRegistry","registerRoute","unlock","useDispatch","siteEditorStore","useEffect","batch","forEach"],"sources":["@wordpress/edit-site/src/components/posts-app-routes/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRegistry, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as siteEditorStore } from '../../store';\nimport { postsRoute } from './posts';\nimport { postItemRoute } from './post-item';\n\nconst routes = [ postItemRoute, postsRoute ];\n\nexport function useRegisterPostsAppRoutes() {\n\tconst registry = useRegistry();\n\tconst { registerRoute } = unlock( useDispatch( siteEditorStore ) );\n\tuseEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\troutes.forEach( registerRoute );\n\t\t} );\n\t}, [ registry, registerRoute ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAIA;AACA;AACA;;AAMA,MAAMM,MAAM,GAAG,CAAEC,uBAAa,EAAEC,iBAAU,CAAE;AAErC,SAASC,yBAAyBA,CAAA,EAAG;EAC3C,MAAMC,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,kBAAM,EAAE,IAAAC,iBAAW,EAAEC,YAAgB,CAAE,CAAC;EAClE,IAAAC,kBAAS,EAAE,MAAM;IAChBN,QAAQ,CAACO,KAAK,CAAE,MAAM;MACrBX,MAAM,CAACY,OAAO,CAAEN,aAAc,CAAC;IAChC,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEF,QAAQ,EAAEE,aAAa,CAAG,CAAC;AACjC","ignoreList":[]}
@@ -4,12 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.postsEditRoute = void 0;
7
+ exports.postItemRoute = void 0;
8
8
  var _i18n = require("@wordpress/i18n");
9
- var _postList = _interopRequireDefault(require("../post-list"));
9
+ var _editor = _interopRequireDefault(require("../editor"));
10
10
  var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
11
11
  var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
12
- var _editor = _interopRequireDefault(require("../editor"));
13
12
  var _jsxRuntime = require("react/jsx-runtime");
14
13
  /**
15
14
  * WordPress dependencies
@@ -19,19 +18,16 @@ var _jsxRuntime = require("react/jsx-runtime");
19
18
  * Internal dependencies
20
19
  */
21
20
 
22
- const postsEditRoute = exports.postsEditRoute = {
23
- name: 'posts-edit',
24
- match: params => {
25
- return params.postType === 'post' && params.canvas === 'edit';
26
- },
21
+ const postItemRoute = exports.postItemRoute = {
22
+ name: 'post-item',
23
+ path: '/post/:postId',
27
24
  areas: {
28
25
  sidebar: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreen.default, {
29
26
  title: (0, _i18n.__)('Posts'),
30
27
  isRoot: true,
31
- content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarDataviews.default, {})
32
- }),
33
- content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postList.default, {
34
- postType: "post"
28
+ content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarDataviews.default, {
29
+ postType: "post"
30
+ })
35
31
  }),
36
32
  mobile: /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
37
33
  isPostsList: true
@@ -41,4 +37,4 @@ const postsEditRoute = exports.postsEditRoute = {
41
37
  })
42
38
  }
43
39
  };
44
- //# sourceMappingURL=posts-edit.js.map
40
+ //# sourceMappingURL=post-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_editor","_interopRequireDefault","_sidebarDataviews","_sidebarNavigationScreen","_jsxRuntime","postItemRoute","exports","name","path","areas","sidebar","jsx","default","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,wBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAmE,IAAAK,WAAA,GAAAL,OAAA;AAVnE;AACA;AACA;;AAGA;AACA;AACA;;AAKO,MAAMM,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC5BE,IAAI,EAAE,WAAW;EACjBC,IAAI,EAAE,eAAe;EACrBC,KAAK,EAAE;IACNC,OAAO,eACN,IAAAN,WAAA,CAAAO,GAAA,EAACR,wBAAA,CAAAS,OAAuB;MACvBC,KAAK,EAAG,IAAAC,QAAE,EAAE,OAAQ,CAAG;MACvBC,MAAM;MACNC,OAAO,eAAG,IAAAZ,WAAA,CAAAO,GAAA,EAACT,iBAAA,CAAAU,OAAuB;QAACK,QAAQ,EAAC;MAAM,CAAE;IAAG,CACvD,CACD;IACDC,MAAM,eAAE,IAAAd,WAAA,CAAAO,GAAA,EAACX,OAAA,CAAAY,OAAM;MAACO,WAAW;IAAA,CAAE,CAAC;IAC9BC,OAAO,eAAE,IAAAhB,WAAA,CAAAO,GAAA,EAACX,OAAA,CAAAY,OAAM;MAACO,WAAW;IAAA,CAAE;EAC/B;AACD,CAAC","ignoreList":[]}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.postsRoute = void 0;
8
+ var _router = require("@wordpress/router");
9
+ var _i18n = require("@wordpress/i18n");
10
+ var _editor = _interopRequireDefault(require("../editor"));
11
+ var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
12
+ var _sidebarDataviews = _interopRequireDefault(require("../sidebar-dataviews"));
13
+ var _postList = _interopRequireDefault(require("../post-list"));
14
+ var _lockUnlock = require("../../lock-unlock");
15
+ var _postEdit = require("../post-edit");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ /**
18
+ * WordPress dependencies
19
+ */
20
+
21
+ /**
22
+ * Internal dependencies
23
+ */
24
+
25
+ const {
26
+ useLocation
27
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
28
+ function MobilePostsView() {
29
+ const {
30
+ query = {}
31
+ } = useLocation();
32
+ const {
33
+ canvas = 'view'
34
+ } = query;
35
+ return canvas === 'edit' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_postList.default, {
36
+ postType: "post"
37
+ });
38
+ }
39
+ const postsRoute = exports.postsRoute = {
40
+ name: 'posts',
41
+ path: '/',
42
+ areas: {
43
+ sidebar: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarNavigationScreen.default, {
44
+ title: (0, _i18n.__)('Posts'),
45
+ isRoot: true,
46
+ content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sidebarDataviews.default, {
47
+ postType: "post"
48
+ })
49
+ }),
50
+ content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postList.default, {
51
+ postType: "post"
52
+ }),
53
+ preview({
54
+ query
55
+ }) {
56
+ const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true';
57
+ return isListView ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.default, {
58
+ isPostsList: true
59
+ }) : undefined;
60
+ },
61
+ mobile: /*#__PURE__*/(0, _jsxRuntime.jsx)(MobilePostsView, {}),
62
+ edit({
63
+ query
64
+ }) {
65
+ var _query$layout;
66
+ const hasQuickEdit = ((_query$layout = query.layout) !== null && _query$layout !== void 0 ? _query$layout : 'list') === 'list' && !!query.quickEdit;
67
+ return hasQuickEdit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_postEdit.PostEdit, {
68
+ postType: "post",
69
+ postId: query.postId
70
+ }) : undefined;
71
+ }
72
+ },
73
+ widths: {
74
+ content({
75
+ query
76
+ }) {
77
+ const isListView = (query.layout === 'list' || !query.layout) && query.isCustom !== 'true';
78
+ return isListView ? 380 : undefined;
79
+ },
80
+ edit({
81
+ query
82
+ }) {
83
+ var _query$layout2;
84
+ const hasQuickEdit = ((_query$layout2 = query.layout) !== null && _query$layout2 !== void 0 ? _query$layout2 : 'list') === 'list' && !!query.quickEdit;
85
+ return hasQuickEdit ? 380 : undefined;
86
+ }
87
+ }
88
+ };
89
+ //# sourceMappingURL=posts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_router","require","_i18n","_editor","_interopRequireDefault","_sidebarNavigationScreen","_sidebarDataviews","_postList","_lockUnlock","_postEdit","_jsxRuntime","useLocation","unlock","routerPrivateApis","MobilePostsView","query","canvas","jsx","default","postType","postsRoute","exports","name","path","areas","sidebar","title","__","isRoot","content","preview","isListView","layout","isCustom","isPostsList","undefined","mobile","edit","_query$layout","hasQuickEdit","quickEdit","PostEdit","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":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,SAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAAwC,IAAAS,WAAA,GAAAT,OAAA;AAdxC;AACA;AACA;;AAIA;AACA;AACA;;AAQA,MAAM;EAAEU;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEnD,SAASC,eAAeA,CAAA,EAAG;EAC1B,MAAM;IAAEC,KAAK,GAAG,CAAC;EAAE,CAAC,GAAGJ,WAAW,CAAC,CAAC;EACpC,MAAM;IAAEK,MAAM,GAAG;EAAO,CAAC,GAAGD,KAAK;EAEjC,OAAOC,MAAM,KAAK,MAAM,gBAAG,IAAAN,WAAA,CAAAO,GAAA,EAACd,OAAA,CAAAe,OAAM,IAAE,CAAC,gBAAG,IAAAR,WA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AA,CAAAO,GAAA,EAACR,SAAA,CAAAgC,QAAQ;QAACtB,QAAQ,EAAC,MAAM;QAACuB,MAAM,EAAG3B,KAAK,CAAC2B;MAAQ,CAAE,CAAC,GACjDP,SAAS;IACd;EACD,CAAC;EACDQ,MAAM,EAAE;IACPd,OAAOA,CAAE;MAAEd;IAAM,CAAC,EAAG;MACpB,MAAMgB,UAAU,GACf,CAAEhB,KAAK,CAACiB,MAAM,KAAK,MAAM,IAAI,CAAEjB,KAAK,CAACiB,MAAM,KAC3CjB,KAAK,CAACkB,QAAQ,KAAK,MAAM;MAC1B,OAAOF,UAAU,GAAG,GAAG,GAAGI,SAAS;IACpC,CAAC;IACDE,IAAIA,CAAE;MAAEtB;IAAM,CAAC,EAAG;MAAA,IAAA6B,cAAA;MACjB,MAAML,YAAY,GACjB,EAAAK,cAAA,GAAE7B,KAAK,CAACiB,MAAM,cAAAY,cAAA,cAAAA,cAAA,GAAI,MAAM,MAAO,MAAM,IAAI,CAAC,CAAE7B,KAAK,CAACyB,SAAS;MAC5D,OAAOD,YAAY,GAAG,GAAG,GAAGJ,SAAS;IACtC;EACD;AACD,CAAC","ignoreList":[]}
@@ -12,6 +12,7 @@ var _compose = require("@wordpress/compose");
12
12
  var _i18n = require("@wordpress/i18n");
13
13
  var _router = require("@wordpress/router");
14
14
  var _lockUnlock = require("../../lock-unlock");
15
+ var _url = require("@wordpress/url");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  /**
17
18
  * External dependencies
@@ -83,11 +84,12 @@ function ResizableFrame({
83
84
  }) {
84
85
  const history = useHistory();
85
86
  const {
86
- params
87
+ path,
88
+ query
87
89
  } = useLocation();
88
90
  const {
89
91
  canvas = 'view'
90
- } = params;
92
+ } = query;
91
93
  const disableMotion = (0, _compose.useReducedMotion)();
92
94
  const [frameSize, setFrameSize] = (0, _element.useState)(INITIAL_FRAME_SIZE);
93
95
  // The width of the resizable frame when a new resize gesture starts.
@@ -141,10 +143,9 @@ function ResizableFrame({
141
143
  setFrameSize(INITIAL_FRAME_SIZE);
142
144
  } else {
143
145
  // Trigger full screen if the frame is resized far enough to the left.
144
- history.push({
145
- ...params,
146
+ history.navigate((0, _url.addQueryArgs)(path, {
146
147
  canvas: 'edit'
147
- }, undefined, {
148
+ }), {
148
149
  transition: 'canvas-mode-edit-transition'
149
150
  });
150
151
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_compose","_i18n","_router","_lockUnlock","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","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","useReducedMotion","frameSize","setFrameSize","useState","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","FRAME_TRANSITION","type","duration","frameRef","useRef","resizableHandleHelpId","useInstanceId","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","isRTL","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","jsx","ResizableBox","as","motion","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","jsxs","Fragment","Tooltip","text","__","__unstableMotion","button","role","className","clsx","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style","_default","exports"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAKA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AArB3C;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AAGA,MAAM;EAAEQ,WAAW;EAAEC;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;;AAE/D;AACA,MAAMC,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,SAAS;EAChBO,MAAM,EAAEP,SAAS;EACjBQ,IAAI,EAAER;AACP,CAAC;;AAED;AACA,MAAMS,eAAe,GAAG,GAAG;AAC3B;AACA,MAAMC,qBAAqB,GAAG,IAAI;AAClC;AACA,MAAMC,yBA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oBAAmBhF,qBAAuB;YAC1C,iBACCF,QAAQ,CAACoC,OAAO,EAAEC,SAAS,EAAE5B,WAAW,IACxC7D,SACA;YACD,iBAAgBS,eAAiB;YACjC,iBAAgBsB,WAAW,CAAC5B,KAAO;YACnCyI,SAAS,EAAG7D,4BAA8B;YAC1C2B,OAAO,EAAC,QAAQ;YAChBmC,IAAI,EAAC,QAAQ;YACbC,UAAU,EAAC,QAAQ;YACnB/B,UAAU,EAAC;UAAQ,GArBf,QAsBJ;QAAC,CACM,CAAC,eACV,IAAAtH,WAAA,CAAA4G,GAAA;UAAKN,MAAM;UAACgD,EAAE,EAAGzF,qBAAuB;UAAAxB,QAAA,EACrC,IAAAwG,QAAE,EACH,gGACD;QAAC,CACG,CAAC;MAAA,CACL;IAEJ,CAAG;IACHU,aAAa,EAAGvF,iBAAmB;IACnCwF,QAAQ,EAAGnF,YAAc;IACzBoF,YAAY,EAAGzE,gBAAkB;IACjCiE,SAAS,EAAG,IAAAC,aAAI,EAAE,kCAAkC,EAAE;MACrD,aAAa,EAAEhG;IAChB,CAAE,CAAG;IACLwG,UAAU,EAAG,KAAO,CAAC;IAAA;IAAArH,QAAA,eAErB,IAAArC,WAAA,CAAA4G,GAAA;MACCqC,SAAS,EAAC,0CAA0C;MACpDU,KAAK,EAAGpH,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAAC,IAAAuH,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAEclE,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_components","_compose","_i18n","_router","_lockUnlock","_url","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","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","useReducedMotion","frameSize","setFrameSize","useState","startingWidth","setStartingWidth","isResizing","setIsResizing","shouldShowHandle","setShouldShowHandle","resizeRatio","setResizeRatio","FRAME_TRANSITION","type","duration","frameRef","useRef","resizableHandleHelpId","useInstanceId","defaultAspectRatio","handleResizeStart","_event","_direction","ref","offsetWidth","handleResize","_ref","delta","normalizedDelta","deltaAbs","abs","maxDoubledDelta","deltaToDouble","doubleSegment","singleSegment","updatedWidth","handleResizeStop","remainingWidth","ownerDocument","documentElement","navigate","addQueryArgs","transition","handleResizableHandleKeyDown","event","includes","key","preventDefault","step","shiftKey","isRTL","newWidth","current","resizable","frameAnimationVariants","default","flexGrow","fullWidth","resizeHandleVariants","hidden","opacity","visible","active","scaleY","currentResizeHandleVariant","jsx","ResizableBox","as","motion","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","jsxs","Fragment","Tooltip","text","__","__unstableMotion","button","role","className","clsx","onKeyDown","exit","whileFocus","id","onResizeStart","onResize","onResizeStop","showHandle","style","_default","exports"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA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EACH,gGACD;QAAC,CACG,CAAC;MAAA,CACL;IAEJ,CAAG;IACHU,aAAa,EAAGxF,iBAAmB;IACnCyF,QAAQ,EAAGpF,YAAc;IACzBqF,YAAY,EAAG1E,gBAAkB;IACjCkE,SAAS,EAAG,IAAAC,aAAI,EAAE,kCAAkC,EAAE;MACrD,aAAa,EAAEjG;IAChB,CAAE,CAAG;IACLyG,UAAU,EAAG,KAAO,CAAC;IAAA;IAAAvH,QAAA,eAErB,IAAArC,WAAA,CAAA8G,GAAA;MACCqC,SAAS,EAAC,0CAA0C;MACpDU,KAAK,EAAGtH,iBAAmB;MAAAF,QAAA,EAEzBA;IAAQ,CACN;EAAC,CACO,CAAC;AAEjB;AAAC,IAAAyH,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAEcpE,cAAc","ignoreList":[]}
@@ -39,7 +39,8 @@ const {
39
39
  useLocation
40
40
  } = (0, _lockUnlock.unlock)(_router.privateApis);
41
41
  const EntitiesSavedStatesForPreview = ({
42
- onClose
42
+ onClose,
43
+ renderDialog
43
44
  }) => {
44
45
  var _currentTheme$name$re, _previewingTheme$name;
45
46
  const isDirtyProps = (0, _editor.useEntitiesSavedStatesIsDirty)();
@@ -66,16 +67,18 @@ const EntitiesSavedStatesForPreview = ({
66
67
  close: onClose,
67
68
  onSave,
68
69
  saveEnabled: true,
69
- saveLabel: activateSaveLabel
70
+ saveLabel: activateSaveLabel,
71
+ renderDialog
70
72
  });
71
73
  };
72
74
  const _EntitiesSavedStates = ({
73
75
  onClose,
74
- renderDialog = undefined
76
+ renderDialog
75
77
  }) => {
76
78
  if ((0, _isPreviewingTheme.isPreviewingTheme)()) {
77
79
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(EntitiesSavedStatesForPreview, {
78
- onClose: onClose
80
+ onClose: onClose,
81
+ renderDialog: renderDialog
79
82
  });
80
83
  }
81
84
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.EntitiesSavedStates, {
@@ -85,11 +88,11 @@ const _EntitiesSavedStates = ({
85
88
  };
86
89
  function SavePanel() {
87
90
  const {
88
- params
91
+ query
89
92
  } = useLocation();
90
93
  const {
91
94
  canvas = 'view'
92
- } = params;
95
+ } = query;
93
96
  const {
94
97
  isSaveViewOpen,
95
98
  isDirty,
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_editor","_data","_i18n","_coreData","_router","_element","_store","_lockUnlock","_useActivateTheme","_useActualCurrentTheme","_isPreviewingTheme","_jsxRuntime","EntitiesSavedStatesExtensible","NavigableRegion","unlock","privateApis","useLocation","routerPrivateApis","EntitiesSavedStatesForPreview","onClose","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","useEntitiesSavedStatesIsDirty","activateSaveLabel","isDirty","__","currentTheme","useActualCurrentTheme","previewingTheme","useSelect","select","coreStore","getCurrentTheme","additionalPrompt","jsx","children","sprintf","name","rendered","activateTheme","useActivateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","renderDialog","undefined","isPreviewingTheme","EntitiesSavedStates","SavePanel","params","canvas","isSaveViewOpen","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","editSiteStore","length","some","record","kind","key","setIsSaveViewOpened","useDispatch","useEffect","Modal","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","jsxs","clsx","ariaLabel","Button","__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\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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAZ,OAAA;AAAoE,IAAAa,WAAA,GAAAb,OAAA;AA3BpE;AACA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AAA,CAAAwB,GAAA;MACCsC,SAAS,EAAG,IAAAO,aAAI,EAAE,qCAAqC,EAAE;QACxD,oBAAoB,EAAEzB;MACvB,CAAE,CAAG;MAAAnB,QAAA,eAEL,IAAAzB,WAAA,CAAAwB,GAAA,EAACpC,WAAA,CAAAmF,MAAM;QACNC,qBAAqB;QACrBC,OAAO,EAAC,WAAW;QACnBX,SAAS,EAAC,4CAA4C;QACtDY,OAAO,EAAGA,CAAA,KAAMhB,mBAAmB,CAAE,IAAK,CAAG;QAC7C,iBAAc,QAAQ;QACtBS,QAAQ,EAAGA,QAAU;QACrBQ,sBAAsB;QAAAlD,QAAA,EAEpB,IAAAV,QAAE,EAAE,iBAAkB;MAAC,CAClB;IAAC,CACL,CAAC,EACJ6B,cAAc,iBACf,IAAA5C,WAAA,CAAAwB,GAAA,EAACY,oBAAoB;MAAC5B,OAAO,EAAGA,OAAS;MAAC6B,YAAY;IAAA,CAAE,CACxD;EAAA,CACe,CAAC;AAEpB","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_editor","_data","_i18n","_coreData","_router","_element","_store","_lockUnlock","_useActivateTheme","_useActualCurrentTheme","_isPreviewingTheme","_jsxRuntime","EntitiesSavedStatesExtensible","NavigableRegion","unlock","privateApis","useLocation","routerPrivateApis","EntitiesSavedStatesForPreview","onClose","renderDialog","_currentTheme$name$re","_previewingTheme$name","isDirtyProps","useEntitiesSavedStatesIsDirty","activateSaveLabel","isDirty","__","currentTheme","useActualCurrentTheme","previewingTheme","useSelect","select","coreStore","getCurrentTheme","additionalPrompt","jsx","children","sprintf","name","rendered","activateTheme","useActivateTheme","onSave","values","close","saveEnabled","saveLabel","_EntitiesSavedStates","isPreviewingTheme","EntitiesSavedStates","SavePanel","query","canvas","isSaveViewOpen","isSaving","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","isResolving","dirtyEntityRecords","isActivatingTheme","isSaveViewOpened","editSiteStore","length","some","record","kind","key","setIsSaveViewOpened","useDispatch","useEffect","Modal","className","onRequestClose","__experimentalHideHeader","contentLabel","activateSaveEnabled","disabled","jsxs","clsx","ariaLabel","Button","__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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data");
12
12
  var _element = require("@wordpress/element");
13
13
  var _icons = require("@wordpress/icons");
14
14
  var _router = require("@wordpress/router");
15
+ var _url = require("@wordpress/url");
15
16
  var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigation-item"));
16
17
  var _defaultViews = require("./default-views");
17
18
  var _lockUnlock = require("../../lock-unlock");
@@ -25,6 +26,7 @@ var _jsxRuntime = require("react/jsx-runtime");
25
26
  */
26
27
 
27
28
  const {
29
+ useLocation,
28
30
  useHistory
29
31
  } = (0, _lockUnlock.unlock)(_router.privateApis);
30
32
  function AddNewItemModalContent({
@@ -32,6 +34,9 @@ function AddNewItemModalContent({
32
34
  setIsAdding
33
35
  }) {
34
36
  const history = useHistory();
37
+ const {
38
+ path
39
+ } = useLocation();
35
40
  const {
36
41
  saveEntityRecord
37
42
  } = (0, _data.useDispatch)(_coreData.store);
@@ -67,16 +72,10 @@ function AddNewItemModalContent({
67
72
  wp_dataviews_type: dataViewTaxonomyId,
68
73
  content: JSON.stringify(defaultViews[0].view)
69
74
  });
70
- const {
71
- params: {
72
- postType
73
- }
74
- } = history.getLocationWithParams();
75
- history.push({
76
- postType,
75
+ history.navigate((0, _url.addQueryArgs)(path, {
77
76
  activeView: savedRecord.id,
78
77
  isCustom: 'true'
79
- });
78
+ }));
80
79
  setIsSaving(false);
81
80
  setIsAdding(false);
82
81
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_icons","_router","_sidebarNavigationItem","_interopRequireDefault","_defaultViews","_lockUnlock","_jsxRuntime","useHistory","unlock","routerPrivateApis","AddNewItemModalContent","type","setIsAdding","history","saveEntityRecord","useDispatch","coreStore","title","setTitle","useState","isSaving","setIsSaving","defaultViews","useDefaultViews","postType","jsx","onSubmit","event","preventDefault","getEntityRecords","resolveSelect","dataViewTaxonomyId","dataViewTypeRecords","slug","length","id","record","name","savedRecord","status","wp_dataviews_type","content","JSON","stringify","view","params","getLocationWithParams","push","activeView","isCustom","children","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","__","value","onChange","placeholder","className","__experimentalHStack","justify","Button","variant","onClick","isBusy","AddNewItem","isAdding","Fragment","default","icon","plus","Modal","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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,sBAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;A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EAAGA;MAAa,CAC3B;IAAC,CACI,CACP;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_coreData","_element","_icons","_router","_url","_sidebarNavigationItem","_interopRequireDefault","_defaultViews","_lockUnlock","_jsxRuntime","useLocation","useHistory","unlock","routerPrivateApis","AddNewItemModalContent","type","setIsAdding","history","path","saveEntityRecord","useDispatch","coreStore","title","setTitle","useState","isSaving","setIsSaving","defaultViews","useDefaultViews","postType","jsx","onSubmit","event","preventDefault","getEntityRecords","resolveSelect","dataViewTaxonomyId","dataViewTypeRecords","slug","length","id","record","name","savedRecord","status","wp_dataviews_type","content","JSON","stringify","view","navigate","addQueryArgs","activeView","isCustom","children","jsxs","__experimentalVStack","spacing","TextControl","__next40pxDefaultSize","__nextHasNoMarginBottom","label","__","value","onChange","placeholder","className","__experimentalHStack","justify","Button","variant","onClick","isBusy","AddNewItem","isAdding","Fragment","default","icon","plus","Modal","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\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