@wordpress/edit-site 5.30.0 → 5.32.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 (470) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-editor/editor-canvas.js +24 -4
  3. package/build/components/block-editor/editor-canvas.js.map +1 -1
  4. package/build/components/block-editor/site-editor-canvas.js +15 -4
  5. package/build/components/block-editor/site-editor-canvas.js.map +1 -1
  6. package/build/components/block-editor/use-site-editor-settings.js +1 -1
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/editor/index.js +12 -3
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +1 -2
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +38 -0
  13. package/build/components/global-styles/background-panel.js.map +1 -0
  14. package/build/components/global-styles/color-palette-panel.js +0 -9
  15. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  16. package/build/components/global-styles/font-families.js +1 -1
  17. package/build/components/global-styles/font-families.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/context.js +53 -17
  19. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
  21. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  22. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  23. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  24. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  25. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  26. package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  27. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  28. package/build/components/global-styles/font-library-modal/utils/index.js +22 -4
  29. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  30. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  31. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  32. package/build/components/global-styles/header.js +1 -1
  33. package/build/components/global-styles/header.js.map +1 -1
  34. package/build/components/global-styles/hooks.js +50 -1
  35. package/build/components/global-styles/hooks.js.map +1 -1
  36. package/build/components/global-styles/palette.js +3 -1
  37. package/build/components/global-styles/palette.js.map +1 -1
  38. package/build/components/global-styles/preview-colors.js +2 -2
  39. package/build/components/global-styles/preview-colors.js.map +1 -1
  40. package/build/components/global-styles/preview-iframe.js +0 -1
  41. package/build/components/global-styles/preview-iframe.js.map +1 -1
  42. package/build/components/global-styles/preview-styles.js +2 -2
  43. package/build/components/global-styles/preview-styles.js.map +1 -1
  44. package/build/components/global-styles/root-menu.js +8 -2
  45. package/build/components/global-styles/root-menu.js.map +1 -1
  46. package/build/components/global-styles/screen-background.js +34 -0
  47. package/build/components/global-styles/screen-background.js.map +1 -0
  48. package/build/components/global-styles/screen-color-palette.js +2 -2
  49. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  50. package/build/components/global-styles/screen-colors.js +5 -10
  51. package/build/components/global-styles/screen-colors.js.map +1 -1
  52. package/build/components/global-styles/screen-style-variations.js +3 -37
  53. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  54. package/build/components/global-styles/screen-typography.js +6 -11
  55. package/build/components/global-styles/screen-typography.js.map +1 -1
  56. package/build/components/global-styles/style-variations-container.js +5 -2
  57. package/build/components/global-styles/style-variations-container.js.map +1 -1
  58. package/build/components/global-styles/typography-elements.js +3 -1
  59. package/build/components/global-styles/typography-elements.js.map +1 -1
  60. package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  61. package/build/components/global-styles/typography-example.js.map +1 -0
  62. package/build/components/global-styles/typography-preview.js +3 -1
  63. package/build/components/global-styles/typography-preview.js.map +1 -1
  64. package/build/components/global-styles/ui.js +4 -1
  65. package/build/components/global-styles/ui.js.map +1 -1
  66. package/build/components/global-styles/utils.js +1 -1
  67. package/build/components/global-styles/utils.js.map +1 -1
  68. package/build/components/global-styles/variations/variations-color.js +13 -7
  69. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  70. package/build/components/global-styles/variations/variations-typography.js +34 -37
  71. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  72. package/build/components/header-edit-mode/index.js +2 -1
  73. package/build/components/header-edit-mode/index.js.map +1 -1
  74. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  75. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  76. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  77. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  78. package/build/components/keyboard-shortcuts/global.js +17 -3
  79. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  80. package/build/components/layout/animation.js +129 -0
  81. package/build/components/layout/animation.js.map +1 -0
  82. package/build/components/layout/index.js +9 -17
  83. package/build/components/layout/index.js.map +1 -1
  84. package/build/components/layout/router.js +22 -22
  85. package/build/components/layout/router.js.map +1 -1
  86. package/build/components/page-pages/index.js +24 -27
  87. package/build/components/page-pages/index.js.map +1 -1
  88. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  89. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  90. package/build/components/page-patterns/index.js +19 -32
  91. package/build/components/page-patterns/index.js.map +1 -1
  92. package/build/components/page-patterns/search-items.js +16 -58
  93. package/build/components/page-patterns/search-items.js.map +1 -1
  94. package/build/components/page-patterns/use-patterns.js +9 -9
  95. package/build/components/page-patterns/use-patterns.js.map +1 -1
  96. package/build/components/page-templates-template-parts/actions.js +54 -41
  97. package/build/components/page-templates-template-parts/actions.js.map +1 -1
  98. package/build/components/page-templates-template-parts/index.js +31 -69
  99. package/build/components/page-templates-template-parts/index.js.map +1 -1
  100. package/build/components/plugin-template-setting-panel/index.js +12 -1
  101. package/build/components/plugin-template-setting-panel/index.js.map +1 -1
  102. package/build/components/save-button/index.js +45 -16
  103. package/build/components/save-button/index.js.map +1 -1
  104. package/build/components/save-hub/index.js +8 -112
  105. package/build/components/save-hub/index.js.map +1 -1
  106. package/build/components/save-panel/index.js +14 -9
  107. package/build/components/save-panel/index.js.map +1 -1
  108. package/build/components/sidebar/index.js +3 -8
  109. package/build/components/sidebar/index.js.map +1 -1
  110. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  111. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  112. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  113. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  114. package/build/components/sidebar-dataviews/default-views.js +3 -3
  115. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  116. package/build/components/sidebar-dataviews/index.js +5 -4
  117. package/build/components/sidebar-dataviews/index.js.map +1 -1
  118. package/build/components/sidebar-edit-mode/index.js +1 -2
  119. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  120. package/build/components/sidebar-edit-mode/page-panels/index.js +7 -17
  121. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  122. package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  123. package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  124. package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
  125. package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  126. package/build/components/sidebar-edit-mode/template-panel/index.js +32 -18
  127. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  128. package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  129. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -1
  131. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  133. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  134. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  135. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  136. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  137. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
  139. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-template/index.js +5 -1
  141. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  143. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  144. package/build/components/style-book/index.js +1 -1
  145. package/build/components/style-book/index.js.map +1 -1
  146. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  147. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  148. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  149. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  150. package/build/components/template-actions/index.js +44 -27
  151. package/build/components/template-actions/index.js.map +1 -1
  152. package/build/components/welcome-guide/editor.js +11 -2
  153. package/build/components/welcome-guide/editor.js.map +1 -1
  154. package/build/hooks/index.js +0 -1
  155. package/build/hooks/index.js.map +1 -1
  156. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  157. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  158. package/build/store/selectors.js +1 -9
  159. package/build/store/selectors.js.map +1 -1
  160. package/build/utils/constants.js +5 -3
  161. package/build/utils/constants.js.map +1 -1
  162. package/build/utils/get-is-list-page.js +1 -1
  163. package/build/utils/get-is-list-page.js.map +1 -1
  164. package/build/utils/math.js +98 -0
  165. package/build/utils/math.js.map +1 -0
  166. package/build-module/components/block-editor/editor-canvas.js +24 -4
  167. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  168. package/build-module/components/block-editor/site-editor-canvas.js +15 -4
  169. package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
  170. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  171. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  172. package/build-module/components/editor/index.js +13 -4
  173. package/build-module/components/editor/index.js.map +1 -1
  174. package/build-module/components/editor-canvas-container/index.js +1 -2
  175. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  176. package/build-module/components/global-styles/background-panel.js +31 -0
  177. package/build-module/components/global-styles/background-panel.js.map +1 -0
  178. package/build-module/components/global-styles/color-palette-panel.js +0 -8
  179. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  180. package/build-module/components/global-styles/font-families.js +1 -1
  181. package/build-module/components/global-styles/font-families.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/context.js +54 -18
  183. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  184. package/build-module/components/global-styles/font-library-modal/font-collection.js +4 -3
  185. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  186. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  187. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  188. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  189. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  190. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
  191. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  192. package/build-module/components/global-styles/font-library-modal/utils/index.js +22 -4
  193. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  194. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
  195. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  196. package/build-module/components/global-styles/header.js +1 -1
  197. package/build-module/components/global-styles/header.js.map +1 -1
  198. package/build-module/components/global-styles/hooks.js +48 -1
  199. package/build-module/components/global-styles/hooks.js.map +1 -1
  200. package/build-module/components/global-styles/palette.js +3 -1
  201. package/build-module/components/global-styles/palette.js.map +1 -1
  202. package/build-module/components/global-styles/preview-colors.js +2 -2
  203. package/build-module/components/global-styles/preview-colors.js.map +1 -1
  204. package/build-module/components/global-styles/preview-iframe.js +0 -1
  205. package/build-module/components/global-styles/preview-iframe.js.map +1 -1
  206. package/build-module/components/global-styles/preview-styles.js +2 -2
  207. package/build-module/components/global-styles/preview-styles.js.map +1 -1
  208. package/build-module/components/global-styles/root-menu.js +9 -3
  209. package/build-module/components/global-styles/root-menu.js.map +1 -1
  210. package/build-module/components/global-styles/screen-background.js +26 -0
  211. package/build-module/components/global-styles/screen-background.js.map +1 -0
  212. package/build-module/components/global-styles/screen-color-palette.js +2 -2
  213. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  214. package/build-module/components/global-styles/screen-colors.js +5 -10
  215. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  216. package/build-module/components/global-styles/screen-style-variations.js +4 -38
  217. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  218. package/build-module/components/global-styles/screen-typography.js +6 -11
  219. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  220. package/build-module/components/global-styles/style-variations-container.js +5 -2
  221. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  222. package/build-module/components/global-styles/typography-elements.js +3 -1
  223. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  224. package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
  225. package/build-module/components/global-styles/typography-example.js.map +1 -0
  226. package/build-module/components/global-styles/typography-preview.js +3 -1
  227. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  228. package/build-module/components/global-styles/ui.js +4 -1
  229. package/build-module/components/global-styles/ui.js.map +1 -1
  230. package/build-module/components/global-styles/utils.js +1 -1
  231. package/build-module/components/global-styles/utils.js.map +1 -1
  232. package/build-module/components/global-styles/variations/variations-color.js +13 -7
  233. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  234. package/build-module/components/global-styles/variations/variations-typography.js +35 -38
  235. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  236. package/build-module/components/header-edit-mode/index.js +2 -1
  237. package/build-module/components/header-edit-mode/index.js.map +1 -1
  238. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  239. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  240. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  241. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  242. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  243. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  244. package/build-module/components/layout/animation.js +122 -0
  245. package/build-module/components/layout/animation.js.map +1 -0
  246. package/build-module/components/layout/index.js +9 -17
  247. package/build-module/components/layout/index.js.map +1 -1
  248. package/build-module/components/layout/router.js +22 -22
  249. package/build-module/components/layout/router.js.map +1 -1
  250. package/build-module/components/page-pages/index.js +25 -28
  251. package/build-module/components/page-pages/index.js.map +1 -1
  252. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  253. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  254. package/build-module/components/page-patterns/index.js +21 -34
  255. package/build-module/components/page-patterns/index.js.map +1 -1
  256. package/build-module/components/page-patterns/search-items.js +14 -55
  257. package/build-module/components/page-patterns/search-items.js.map +1 -1
  258. package/build-module/components/page-patterns/use-patterns.js +9 -9
  259. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  260. package/build-module/components/page-templates-template-parts/actions.js +54 -40
  261. package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
  262. package/build-module/components/page-templates-template-parts/index.js +34 -72
  263. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  264. package/build-module/components/plugin-template-setting-panel/index.js +12 -1
  265. package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
  266. package/build-module/components/save-button/index.js +46 -17
  267. package/build-module/components/save-button/index.js.map +1 -1
  268. package/build-module/components/save-hub/index.js +10 -114
  269. package/build-module/components/save-hub/index.js.map +1 -1
  270. package/build-module/components/save-panel/index.js +14 -9
  271. package/build-module/components/save-panel/index.js.map +1 -1
  272. package/build-module/components/sidebar/index.js +3 -8
  273. package/build-module/components/sidebar/index.js.map +1 -1
  274. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  275. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  276. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  277. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  278. package/build-module/components/sidebar-dataviews/default-views.js +4 -4
  279. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  280. package/build-module/components/sidebar-dataviews/index.js +5 -4
  281. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  282. package/build-module/components/sidebar-edit-mode/index.js +1 -2
  283. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  284. package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -20
  285. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  286. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
  287. package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
  288. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  289. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  290. package/build-module/components/sidebar-edit-mode/template-panel/index.js +33 -19
  291. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  292. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
  293. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  294. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -2
  295. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  296. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  297. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  298. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  299. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  300. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  301. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  302. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
  303. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  304. package/build-module/components/sidebar-navigation-screen-template/index.js +5 -1
  305. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  306. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  307. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  308. package/build-module/components/style-book/index.js +1 -1
  309. package/build-module/components/style-book/index.js.map +1 -1
  310. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  311. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  312. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  313. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  314. package/build-module/components/template-actions/index.js +44 -27
  315. package/build-module/components/template-actions/index.js.map +1 -1
  316. package/build-module/components/welcome-guide/editor.js +11 -2
  317. package/build-module/components/welcome-guide/editor.js.map +1 -1
  318. package/build-module/hooks/index.js +0 -1
  319. package/build-module/hooks/index.js.map +1 -1
  320. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
  321. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  322. package/build-module/store/selectors.js +1 -9
  323. package/build-module/store/selectors.js.map +1 -1
  324. package/build-module/utils/constants.js +4 -2
  325. package/build-module/utils/constants.js.map +1 -1
  326. package/build-module/utils/get-is-list-page.js +1 -1
  327. package/build-module/utils/get-is-list-page.js.map +1 -1
  328. package/build-module/utils/math.js +92 -0
  329. package/build-module/utils/math.js.map +1 -0
  330. package/build-style/style-rtl.css +146 -130
  331. package/build-style/style.css +146 -130
  332. package/package.json +44 -44
  333. package/src/components/block-editor/editor-canvas.js +34 -9
  334. package/src/components/block-editor/site-editor-canvas.js +10 -7
  335. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  336. package/src/components/editor/index.js +11 -4
  337. package/src/components/editor-canvas-container/index.js +0 -1
  338. package/src/components/global-styles/background-panel.js +34 -0
  339. package/src/components/global-styles/color-palette-panel.js +0 -11
  340. package/src/components/global-styles/font-families.js +1 -1
  341. package/src/components/global-styles/font-library-modal/context.js +77 -31
  342. package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
  343. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  344. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
  345. package/src/components/global-styles/font-library-modal/style.scss +15 -6
  346. package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
  347. package/src/components/global-styles/font-library-modal/utils/index.js +21 -8
  348. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
  349. package/src/components/global-styles/header.js +1 -1
  350. package/src/components/global-styles/hooks.js +68 -1
  351. package/src/components/global-styles/palette.js +3 -1
  352. package/src/components/global-styles/preview-colors.js +2 -2
  353. package/src/components/global-styles/preview-iframe.js +0 -1
  354. package/src/components/global-styles/preview-styles.js +2 -2
  355. package/src/components/global-styles/root-menu.js +12 -1
  356. package/src/components/global-styles/screen-background.js +29 -0
  357. package/src/components/global-styles/screen-color-palette.js +2 -2
  358. package/src/components/global-styles/screen-colors.js +4 -15
  359. package/src/components/global-styles/screen-style-variations.js +4 -36
  360. package/src/components/global-styles/screen-typography.js +6 -20
  361. package/src/components/global-styles/style-variations-container.js +2 -1
  362. package/src/components/global-styles/style.scss +15 -10
  363. package/src/components/global-styles/typography-elements.js +5 -1
  364. package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
  365. package/src/components/global-styles/typography-preview.js +3 -1
  366. package/src/components/global-styles/ui.js +5 -0
  367. package/src/components/global-styles/utils.js +1 -1
  368. package/src/components/global-styles/variations/style.scss +32 -23
  369. package/src/components/global-styles/variations/variations-color.js +12 -6
  370. package/src/components/global-styles/variations/variations-typography.js +41 -60
  371. package/src/components/header-edit-mode/index.js +1 -0
  372. package/src/components/header-edit-mode/style.scss +28 -17
  373. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  374. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  375. package/src/components/keyboard-shortcuts/global.js +16 -4
  376. package/src/components/layout/animation.js +122 -0
  377. package/src/components/layout/index.js +12 -27
  378. package/src/components/layout/router.js +26 -25
  379. package/src/components/layout/style.scss +2 -0
  380. package/src/components/page-pages/index.js +33 -54
  381. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  382. package/src/components/page-patterns/index.js +22 -31
  383. package/src/components/page-patterns/search-items.js +13 -58
  384. package/src/components/page-patterns/use-patterns.js +17 -10
  385. package/src/components/page-templates-template-parts/actions.js +106 -91
  386. package/src/components/page-templates-template-parts/index.js +41 -93
  387. package/src/components/page-templates-template-parts/style.scss +5 -0
  388. package/src/components/plugin-template-setting-panel/index.js +14 -1
  389. package/src/components/save-button/index.js +55 -26
  390. package/src/components/save-hub/index.js +20 -164
  391. package/src/components/save-panel/index.js +24 -17
  392. package/src/components/sidebar/index.js +2 -8
  393. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  394. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  395. package/src/components/sidebar-dataviews/default-views.js +12 -4
  396. package/src/components/sidebar-dataviews/index.js +5 -4
  397. package/src/components/sidebar-edit-mode/index.js +0 -2
  398. package/src/components/sidebar-edit-mode/page-panels/index.js +31 -62
  399. package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
  400. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  401. package/src/components/sidebar-edit-mode/template-panel/index.js +33 -24
  402. package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
  403. package/src/components/sidebar-navigation-screen/style.scss +21 -9
  404. package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
  405. package/src/components/sidebar-navigation-screen-global-styles/index.js +29 -2
  406. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
  407. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  408. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  409. package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
  410. package/src/components/sidebar-navigation-screen-template/index.js +6 -1
  411. package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
  412. package/src/components/style-book/index.js +1 -3
  413. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
  414. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  415. package/src/components/template-actions/index.js +63 -46
  416. package/src/components/welcome-guide/editor.js +9 -6
  417. package/src/hooks/index.js +0 -1
  418. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
  419. package/src/store/selectors.js +3 -15
  420. package/src/style.scss +0 -2
  421. package/src/utils/constants.js +4 -2
  422. package/src/utils/get-is-list-page.js +1 -1
  423. package/src/utils/math.js +93 -0
  424. package/build/components/actions/index.js +0 -321
  425. package/build/components/actions/index.js.map +0 -1
  426. package/build/components/global-styles/preview-typography.js.map +0 -1
  427. package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -42
  428. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  429. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  430. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  431. package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
  432. package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  433. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  434. package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
  435. package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  436. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  437. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  438. package/build/hooks/template-part-edit.js +0 -82
  439. package/build/hooks/template-part-edit.js.map +0 -1
  440. package/build/store/utils.js +0 -71
  441. package/build/store/utils.js.map +0 -1
  442. package/build-module/components/actions/index.js +0 -310
  443. package/build-module/components/actions/index.js.map +0 -1
  444. package/build-module/components/global-styles/preview-typography.js.map +0 -1
  445. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  446. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
  447. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  448. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  449. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
  450. package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
  451. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  452. package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
  453. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
  454. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  455. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  456. package/build-module/hooks/template-part-edit.js +0 -75
  457. package/build-module/hooks/template-part-edit.js.map +0 -1
  458. package/build-module/store/utils.js +0 -64
  459. package/build-module/store/utils.js.map +0 -1
  460. package/src/components/actions/index.js +0 -411
  461. package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
  462. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -37
  463. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  464. package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
  465. package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
  466. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  467. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
  468. package/src/hooks/template-part-edit.js +0 -89
  469. package/src/store/test/utils.js +0 -191
  470. package/src/store/utils.js +0 -69
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","mergeBaseAndUserConfigs","cloneDeep","unlock","GlobalStylesContext","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variations","select","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","useThemeStyleVariationsByProperty","filterObjectByProperty","newObject","forEach","newFilter","clonedBaseVariation","processedStyleVariations","map","variation","result","title","description"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from '../../components/global-styles/global-styles-provider';\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif ( typeof object !== 'object' || ! Object.keys( object ).length ) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst variations = useSelect( ( select ) => {\n\t\treturn select(\n\t\t\tcoreStore\n\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.map( ( variation ) => {\n\t\t\tlet result = {\n\t\t\t\t...filterObjectByProperty( cloneDeep( variation ), property ),\n\t\t\t\ttitle: variation?.title,\n\t\t\t\tdescription: variation?.description,\n\t\t\t};\n\n\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t/*\n\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t */\n\t\t\t\tresult = mergeBaseAndUserConfigs( clonedBaseVariation, result );\n\t\t\t}\n\t\t\treturn result;\n\t\t} );\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAAS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,MAAMU,mBAAmB,GACxB,OAAON,aAAa,KAAK,QAAQ,IACjCV,MAAM,CAACC,IAAI,CAAES,aAAc,CAAC,CAACR,MAAM,GAAG,CAAC,GACpCR,SAAS,CAAEgB,aAAc,CAAC,GAC1B,IAAI;IAER,IAAIO,wBAAwB,GAAGX,UAAU,CAACY,GAAG,CAAIC,SAAS,IAAM;MAC/D,IAAIC,MAAM,GAAG;QACZ,GAAGR,sBAAsB,CAAElB,SAAS,CAAEyB,SAAU,CAAC,EAAEpB,QAAS,CAAC;QAC7DsB,KAAK,EAAEF,SAAS,EAAEE,KAAK;QACvBC,WAAW,EAAEH,SAAS,EAAEG;MACzB,CAAC;MAED,IAAKN,mBAAmB,EAAG;QAC1B;AACJ;AACA;AACA;QACII,MAAM,GAAG3B,uBAAuB,CAAEuB,mBAAmB,EAAEI,MAAO,CAAC;MAChE;MACA,OAAOA,MAAM;IACd,CAAE,CAAC;IAEH,IAAK,UAAU,KAAK,OAAOf,MAAM,EAAG;MACnCY,wBAAwB,GACvBA,wBAAwB,CAACZ,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOY,wBAAwB;EAChC,CAAC,EAAE,CAAEX,UAAU,EAAEP,QAAQ,EAAEW,aAAa,EAAEL,MAAM,CAAG,CAAC;AACrD"}
1
+ {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","__","mergeBaseAndUserConfigs","cloneDeep","unlock","GlobalStylesContext","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","variations","title","settings","styles","useThemeStyleVariationsByProperty","filterObjectByProperty","newObject","forEach","newFilter","clonedBaseVariation","processedStyleVariations","map","variation","result","description"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from '../../components/global-styles/global-styles-provider';\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif ( typeof object !== 'object' || ! Object.keys( object ).length ) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\tconst variations = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variationsFromTheme,\n\t\t];\n\t}, [ variationsFromTheme ] );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.map( ( variation ) => {\n\t\t\tlet result = {\n\t\t\t\t...filterObjectByProperty( cloneDeep( variation ), property ),\n\t\t\t\ttitle: variation?.title,\n\t\t\t\tdescription: variation?.description,\n\t\t\t};\n\n\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t/*\n\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t */\n\t\t\t\tresult = mergeBaseAndUserConfigs( clonedBaseVariation, result );\n\t\t\t}\n\t\t\treturn result;\n\t\t} );\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,uDAAuD;AAC/F,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAoB,CAAC,GAAGD,MAAM,CAAEJ,sBAAuB,CAAC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ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AAmB,GACxB,OAAOV,aAAa,KAAK,QAAQ,IACjCX,MAAM,CAACC,IAAI,CAAEU,aAAc,CAAC,CAACT,MAAM,GAAG,CAAC,GACpCR,SAAS,CAAEiB,aAAc,CAAC,GAC1B,IAAI;IAER,IAAIW,wBAAwB,GAAGV,UAAU,CAACW,GAAG,CAAIC,SAAS,IAAM;MAC/D,IAAIC,MAAM,GAAG;QACZ,GAAGR,sBAAsB,CAAEvB,SAAS,CAAE8B,SAAU,CAAC,EAAEzB,QAAS,CAAC;QAC7Dc,KAAK,EAAEW,SAAS,EAAEX,KAAK;QACvBa,WAAW,EAAEF,SAAS,EAAEE;MACzB,CAAC;MAED,IAAKL,mBAAmB,EAAG;QAC1B;AACJ;AACA;AACA;QACII,MAAM,GAAGhC,uBAAuB,CAAE4B,mBAAmB,EAAEI,MAAO,CAAC;MAChE;MACA,OAAOA,MAAM;IACd,CAAE,CAAC;IAEH,IAAK,UAAU,KAAK,OAAOpB,MAAM,EAAG;MACnCiB,wBAAwB,GACvBA,wBAAwB,CAACjB,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOiB,wBAAwB;EAChC,CAAC,EAAE,CAAEV,UAAU,EAAEb,QAAQ,EAAEY,aAAa,EAAEN,MAAM,CAAG,CAAC;AACrD"}
@@ -6,14 +6,11 @@ import { createRegistrySelector } from '@wordpress/data';
6
6
  import deprecated from '@wordpress/deprecated';
7
7
  import { Platform } from '@wordpress/element';
8
8
  import { store as preferencesStore } from '@wordpress/preferences';
9
- import { store as blockEditorStore } from '@wordpress/block-editor';
10
9
  import { store as editorStore } from '@wordpress/editor';
11
10
 
12
11
  /**
13
12
  * Internal dependencies
14
13
  */
15
- import { getFilteredTemplatePartBlocks } from './utils';
16
- import { TEMPLATE_PART_POST_TYPE } from '../utils/constants';
17
14
  import { unlock } from '../lock-unlock';
18
15
 
19
16
  /**
@@ -221,12 +218,7 @@ export function isSaveViewOpened(state) {
221
218
  * @return {Array} Template parts and their blocks in an array.
222
219
  */
223
220
  export const getCurrentTemplateTemplateParts = createRegistrySelector(select => () => {
224
- const templateParts = select(coreDataStore).getEntityRecords('postType', TEMPLATE_PART_POST_TYPE, {
225
- per_page: -1
226
- });
227
- const clientIds = select(blockEditorStore).getBlocksByName('core/template-part');
228
- const blocks = select(blockEditorStore).getBlocksByClientId(clientIds);
229
- return getFilteredTemplatePartBlocks(blocks, templateParts);
221
+ return unlock(select(editorStore)).getCurrentTemplateTemplateParts();
230
222
  });
231
223
 
232
224
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["store","coreDataStore","createRegistrySelector","deprecated","Platform","preferencesStore","blockEditorStore","editorStore","getFilteredTemplatePartBlocks","TEMPLATE_PART_POST_TYPE","unlock","isFeatureActive","select","_","featureName","since","alternative","get","__experimentalGetPreviewDeviceType","version","getDeviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","clientIds","getBlocksByName","blocks","getBlocksByClientId","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,sBAAsB,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,wBAAwB;AAClE,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,yBAAyB;AACnE,SAASN,KAAK,IAAIO,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,6BAA6B,QAAQ,SAAS;AACvD,SAASC,uBAAuB,QAAQ,oBAAoB;AAC5D,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;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,MAAM,CAAEP,gBAAiB,CAAC,CAACY,GAAG,CAAE,MAAM,EAAE,YAAa,CAAC;AAC9D,CAAE,CAAC;;AAEH;AACA;AACA;AACA,OAAO,SAASoC,wCAAwCA,CAAA,EAAG;EAC1DlD,UAAU,CACT,uEAAuE,EACvE;IACCY,KAAK,EAAE,KAAK;IACZI,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACA,OAAO,SAASmC,4BAA4BA,CAAA,EAAG;EAC9CnD,UAAU,CAAE,2DAA2D,EAAE;IACxEY,KAAK,EAAE,KAAK;IACZI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA,OAAO,SAASoC,kBAAkBA,CAAA,EAAG;EACpCpD,UAAU,CAAE,iDAAiD,EAAE;IAC9DY,KAAK,EAAE,KAAK;IACZI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASqC,MAAMA,CAAE3B,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEmB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EACrCvD,UAAU,CAAG,gDAA+C,EAAE;IAC7DY,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
1
+ {"version":3,"names":["store","coreDataStore","createRegistrySelector","deprecated","Platform","preferencesStore","editorStore","unlock","isFeatureActive","select","_","featureName","since","alternative","get","__experimentalGetPreviewDeviceType","version","getDeviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn unlock(\n\t\t\tselect( editorStore )\n\t\t).getCurrentTemplateTemplateParts();\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,sBAAsB,QAAQ,iBAAiB;AACxD,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASJ,KAAK,IAAIK,gBAAgB,QAAQ,wBAAwB;AAClE,SAASL,KAAK,IAAIM,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;;AAE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A;AACA;AACA,OAAO,SAAS8B,4BAA4BA,CAAA,EAAG;EAC9C3C,UAAU,CAAE,2DAA2D,EAAE;IACxES,KAAK,EAAE,KAAK;IACZI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA,OAAO,SAAS+B,kBAAkBA,CAAA,EAAG;EACpC5C,UAAU,CAAE,iDAAiD,EAAE;IAC9DS,KAAK,EAAE,KAAK;IACZI,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASgC,MAAMA,CAAEtB,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEc,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EACrC/C,UAAU,CAAG,gDAA+C,EAAE;IAC7DS,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
@@ -45,6 +45,8 @@ export const LAYOUT_GRID = 'grid';
45
45
  export const LAYOUT_TABLE = 'table';
46
46
  export const LAYOUT_LIST = 'list';
47
47
  export const ENUMERATION_TYPE = 'enumeration';
48
- export const OPERATOR_IN = 'in';
49
- export const OPERATOR_NOT_IN = 'notIn';
48
+ export const OPERATOR_IS = 'is';
49
+ export const OPERATOR_IS_NOT = 'isNot';
50
+ export const OPERATOR_IS_ANY = 'isAny';
51
+ export const OPERATOR_IS_NONE = 'isNone';
50
52
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","privateApis","patternPrivateApis","unlock","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IN","OPERATOR_NOT_IN"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IN = 'in';\nexport const OPERATOR_NOT_IN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ateApis","unlock","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IS","OPERATOR_IS_NOT","OPERATOR_IS_ANY","OPERATOR_IS_NONE"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IS = 'is';\nexport const OPERATOR_IS_NOT = 'isNot';\nexport const OPERATOR_IS_ANY = 'isAny';\nexport const OPERATOR_IS_NONE = 'isNone';\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,IAAIC,kBAAkB,QAAQ,qBAAqB;;AAEvE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,gBAAgB;;AAEvC;AACA,OAAO,MAAMC,oBAAoB,GAAG,eAAe;;AAEnD;AACA,OAAO,MAAMC,kBAAkB,GAAG,aAAa;AAC/C,OAAO,MAAMC,uBAAuB,GAAG,kBAAkB;AACzD,OAAO,MAAMC,gBAAgB,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACD,OAAO,MAAMC,mCAAmC,GAAG,eAAe;;AAElE;AACA,OAAO,MAAM;EACZC,aAAa;EACbC,wBAAwB;EACxBC,qBAAqB;EACrBC,wBAAwB;EACxBC;AACD,CAAC,GAAGb,MAAM,CAAED,kBAAmB,CAAC;;AAEhC;AACA,OAAO,MAAMe,kBAAkB,GAAG,CACjCX,uBAAuB,EACvBF,oBAAoB,EACpBQ,aAAa,CAACM,IAAI,CAClB;AAED,OAAO,MAAMC,gBAAgB,GAAG;EAC/B,CAAEd,kBAAkB,GAAIL,EAAE,CAAE,UAAW,CAAC;EACxC,CAAEM,uBAAuB,GAAIN,EAAE,CAAE,eAAgB,CAAC;EAClD,CAAEY,aAAa,CAACM,IAAI,GAAIlB,EAAE,CAAE,SAAU,CAAC;EACvC,CAAEI,oBAAoB,GAAIJ,EAAE,CAAE,YAAa;AAC5C,CAAC;;AAED;AACA,OAAO,MAAMoB,WAAW,GAAG,MAAM;AACjC,OAAO,MAAMC,YAAY,GAAG,OAAO;AACnC,OAAO,MAAMC,WAAW,GAAG,MAAM;AACjC,OAAO,MAAMC,gBAAgB,GAAG,aAAa;AAC7C,OAAO,MAAMC,WAAW,GAAG,IAAI;AAC/B,OAAO,MAAMC,eAAe,GAAG,OAAO;AACtC,OAAO,MAAMC,eAAe,GAAG,OAAO;AACtC,OAAO,MAAMC,gBAAgB,GAAG,QAAQ"}
@@ -14,7 +14,7 @@ export default function getIsListPage({
14
14
  categoryType,
15
15
  categoryId
16
16
  }, isMobileViewport) {
17
- return ['/wp_template/all', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
17
+ return ['/wp_template', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
18
18
  // Don't treat "/patterns" without categoryType and categoryId as a
19
19
  // list page in mobile because the sidebar covers the whole page.
20
20
  !isMobileViewport || !!categoryType && !!categoryId);
@@ -1 +1 @@
1
- {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CACjEJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
1
+ {"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,cAAc,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAC7DJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @typedef {Object} WPPoint
3
+ * @property {number} x The horizontal coordinate.
4
+ * @property {number} y The vertical coordinate.
5
+ */
6
+
7
+ /**
8
+ * Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.
9
+ *
10
+ * @param {number} min Minimum range.
11
+ * @param {number} value Value to clamp.
12
+ * @param {number} max Maximum range.
13
+ *
14
+ * @return {number} Clamped value.
15
+ */
16
+ function clamp(min, value, max) {
17
+ return Math.max(min, Math.min(value, max));
18
+ }
19
+
20
+ /**
21
+ * Evaluates a linear function passing through two points at the given x value.
22
+ *
23
+ * Example:
24
+ * f(x)
25
+ * │ ╲
26
+ * │ * (p0)
27
+ * │ ╲
28
+ * │ ╲
29
+ * │ (p1) *
30
+ * │ ╲
31
+ * └──────────── x
32
+ *
33
+ * @param {WPPoint} p0 First point.
34
+ * @param {WPPoint} p1 Second point.
35
+ * @param {number} x Value to evaluate at.
36
+ *
37
+ * @return {number} Result of the two-point linear function at x.
38
+ */
39
+ function twoPointLinearFn(p0, p1, x) {
40
+ return (p1.y - p0.y) / (p1.x - p0.x) * (x - p0.x) + p0.y;
41
+ }
42
+
43
+ /**
44
+ * Evaluates a two-point linear function at a given x value, clamped to the range of the points.
45
+ *
46
+ * Example:
47
+ * f(x)
48
+ * │ ───* (p0)
49
+ * │ ╲
50
+ * │ ╲
51
+ * │ (p1) *───
52
+ * └──────────── x
53
+ *
54
+ * @param {WPPoint} p0 First point.
55
+ * @param {WPPoint} p1 Second point.
56
+ * @param {number} x Value to evaluate at.
57
+ *
58
+ * @return {number} Result of the two-point linear function clamped to the range of the points.
59
+ */
60
+ function clampedTwoPointLinearFn(p0, p1, x) {
61
+ return clamp(Math.min(p0.y, p1.y), twoPointLinearFn(p0, p1, x), Math.max(p0.y, p1.y));
62
+ }
63
+
64
+ /**
65
+ * Computes the iframe scale using a start and end width/scale pair and the current width.
66
+ *
67
+ * The scale is clamped outside the points and is linearly interpolated between.
68
+ *
69
+ * Example:
70
+ * scale
71
+ * │ ───* (start)
72
+ * │ ╲
73
+ * │ ╲
74
+ * │ (end) *───
75
+ * └──────────── width
76
+ *
77
+ * @param {Object} start First width and scale pair.
78
+ * @param {Object} end Second width and scale pair.
79
+ * @param {number} currentWidth Current width.
80
+ *
81
+ * @return {number} The scale of the current width between the two points.
82
+ */
83
+ export function computeIFrameScale(start, end, currentWidth) {
84
+ return clampedTwoPointLinearFn({
85
+ x: start.width,
86
+ y: start.scale
87
+ }, {
88
+ x: end.width,
89
+ y: end.scale
90
+ }, currentWidth);
91
+ }
92
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["clamp","min","value","max","Math","twoPointLinearFn","p0","p1","x","y","clampedTwoPointLinearFn","computeIFrameScale","start","end","currentWidth","width","scale"],"sources":["@wordpress/edit-site/src/utils/math.js"],"sourcesContent":["/**\n * @typedef {Object} WPPoint\n * @property {number} x The horizontal coordinate.\n * @property {number} y The vertical coordinate.\n */\n\n/**\n * Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.\n *\n * @param {number} min Minimum range.\n * @param {number} value Value to clamp.\n * @param {number} max Maximum range.\n *\n * @return {number} Clamped value.\n */\nfunction clamp( min, value, max ) {\n\treturn Math.max( min, Math.min( value, max ) );\n}\n\n/**\n * Evaluates a linear function passing through two points at the given x value.\n *\n * Example:\n * f(x)\n * │ ╲\n * │ * (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *\n * │ ╲\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function at x.\n */\nfunction twoPointLinearFn( p0, p1, x ) {\n\treturn ( ( p1.y - p0.y ) / ( p1.x - p0.x ) ) * ( x - p0.x ) + p0.y;\n}\n\n/**\n * Evaluates a two-point linear function at a given x value, clamped to the range of the points.\n *\n * Example:\n * f(x)\n * │ ───* (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *───\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function clamped to the range of the points.\n */\nfunction clampedTwoPointLinearFn( p0, p1, x ) {\n\treturn clamp(\n\t\tMath.min( p0.y, p1.y ),\n\t\ttwoPointLinearFn( p0, p1, x ),\n\t\tMath.max( p0.y, p1.y )\n\t);\n}\n\n/**\n * Computes the iframe scale using a start and end width/scale pair and the current width.\n *\n * The scale is clamped outside the points and is linearly interpolated between.\n *\n * Example:\n * scale\n * │ ───* (start)\n * │ ╲\n * │ ╲\n * │ (end) *───\n * └──────────── width\n *\n * @param {Object} start First width and scale pair.\n * @param {Object} end Second width and scale pair.\n * @param {number} currentWidth Current width.\n *\n * @return {number} The scale of the current width between the two points.\n */\nexport function computeIFrameScale( start, end, currentWidth ) {\n\treturn clampedTwoPointLinearFn(\n\t\t{ x: start.width, y: start.scale },\n\t\t{ x: end.width, y: end.scale },\n\t\tcurrentWidth\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAAEC,GAAG,EAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,OAAOC,IAAI,CAACD,GAAG,CAAEF,GAAG,EAAEG,IAAI,CAACH,GAAG,CAAEC,KAAK,EAAEC,GAAI,CAAE,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CAAEC,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EACtC,OAAS,CAAED,EAAE,CAACE,CAAC,GAAGH,EAAE,CAACG,CAAC,KAAOF,EAAE,CAACC,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,IAAOA,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