@wordpress/edit-site 5.29.0 → 5.31.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 (511) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/actions/index.js +3 -5
  3. package/build/components/actions/index.js.map +1 -1
  4. package/build/components/block-editor/editor-canvas.js +18 -6
  5. package/build/components/block-editor/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 +1 -15
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  11. package/build/components/global-styles/font-families.js +1 -1
  12. package/build/components/global-styles/font-families.js.map +1 -1
  13. package/build/components/global-styles/font-library-modal/collection-font-variant.js +2 -2
  14. package/build/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  15. package/build/components/global-styles/font-library-modal/context.js +70 -59
  16. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  17. package/build/components/global-styles/font-library-modal/font-card.js +10 -15
  18. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/font-collection.js +121 -78
  20. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/font-demo.js +29 -8
  22. package/build/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  23. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
  24. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  25. package/build/components/global-styles/font-library-modal/index.js +19 -6
  26. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  27. package/build/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  28. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  29. package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
  30. package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  31. package/build/components/global-styles/font-library-modal/upload-fonts.js +51 -23
  32. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  33. package/build/components/global-styles/font-library-modal/utils/index.js +39 -5
  34. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  35. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
  36. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  37. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  38. package/build/components/global-styles/header.js +2 -2
  39. package/build/components/global-styles/header.js.map +1 -1
  40. package/build/components/global-styles/highlighted-colors.js +50 -0
  41. package/build/components/global-styles/highlighted-colors.js.map +1 -0
  42. package/build/components/global-styles/hooks.js +50 -1
  43. package/build/components/global-styles/hooks.js.map +1 -1
  44. package/build/components/global-styles/preview-colors.js +62 -0
  45. package/build/components/global-styles/preview-colors.js.map +1 -0
  46. package/build/components/global-styles/preview-iframe.js +130 -0
  47. package/build/components/global-styles/preview-iframe.js.map +1 -0
  48. package/build/components/global-styles/preview-styles.js +163 -0
  49. package/build/components/global-styles/preview-styles.js.map +1 -0
  50. package/build/components/global-styles/screen-block-list.js +1 -1
  51. package/build/components/global-styles/screen-block-list.js.map +1 -1
  52. package/build/components/global-styles/screen-block.js +1 -1
  53. package/build/components/global-styles/screen-block.js.map +1 -1
  54. package/build/components/global-styles/screen-colors.js +3 -2
  55. package/build/components/global-styles/screen-colors.js.map +1 -1
  56. package/build/components/global-styles/screen-revisions/index.js +2 -2
  57. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  58. package/build/components/global-styles/screen-root.js +2 -2
  59. package/build/components/global-styles/screen-root.js.map +1 -1
  60. package/build/components/global-styles/screen-typography.js +5 -2
  61. package/build/components/global-styles/screen-typography.js.map +1 -1
  62. package/build/components/global-styles/style-variations-container.js +12 -84
  63. package/build/components/global-styles/style-variations-container.js.map +1 -1
  64. package/build/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
  65. package/build/components/global-styles/typography-elements.js.map +1 -0
  66. package/build/components/global-styles/typography-example.js +67 -0
  67. package/build/components/global-styles/typography-example.js.map +1 -0
  68. package/build/components/global-styles/typography-preview.js +3 -1
  69. package/build/components/global-styles/typography-preview.js.map +1 -1
  70. package/build/components/global-styles/ui.js +27 -2
  71. package/build/components/global-styles/ui.js.map +1 -1
  72. package/build/components/global-styles/utils.js +22 -0
  73. package/build/components/global-styles/utils.js.map +1 -1
  74. package/build/components/global-styles/variations/variation.js +90 -0
  75. package/build/components/global-styles/variations/variation.js.map +1 -0
  76. package/build/components/global-styles/variations/variations-color.js +35 -0
  77. package/build/components/global-styles/variations/variations-color.js.map +1 -0
  78. package/build/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  79. package/build/components/global-styles/variations/variations-panel.js.map +1 -0
  80. package/build/components/global-styles/variations/variations-typography.js +54 -0
  81. package/build/components/global-styles/variations/variations-typography.js.map +1 -0
  82. package/build/components/header-edit-mode/index.js +14 -12
  83. package/build/components/header-edit-mode/index.js.map +1 -1
  84. package/build/components/header-edit-mode/more-menu/index.js +10 -2
  85. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  86. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  87. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  88. package/build/components/keyboard-shortcuts/global.js +17 -3
  89. package/build/components/keyboard-shortcuts/global.js.map +1 -1
  90. package/build/components/layout/index.js +4 -1
  91. package/build/components/layout/index.js.map +1 -1
  92. package/build/components/layout/router.js +2 -5
  93. package/build/components/layout/router.js.map +1 -1
  94. package/build/components/page-pages/index.js +6 -11
  95. package/build/components/page-pages/index.js.map +1 -1
  96. package/build/components/page-patterns/delete-category-menu-item.js +6 -1
  97. package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
  98. package/build/components/page-patterns/index.js +15 -18
  99. package/build/components/page-patterns/index.js.map +1 -1
  100. package/build/components/page-patterns/use-patterns.js +9 -9
  101. package/build/components/page-patterns/use-patterns.js.map +1 -1
  102. package/build/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -61
  103. package/build/components/page-templates-template-parts/hooks.js.map +1 -0
  104. package/build/components/page-templates-template-parts/index.js +25 -22
  105. package/build/components/page-templates-template-parts/index.js.map +1 -1
  106. package/build/components/resizable-frame/index.js +2 -1
  107. package/build/components/resizable-frame/index.js.map +1 -1
  108. package/build/components/revisions/index.js.map +1 -1
  109. package/build/components/save-panel/index.js +31 -11
  110. package/build/components/save-panel/index.js.map +1 -1
  111. package/build/components/sidebar/index.js +3 -4
  112. package/build/components/sidebar/index.js.map +1 -1
  113. package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  114. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  115. package/build/components/sidebar-dataviews/dataview-item.js +2 -2
  116. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  117. package/build/components/sidebar-dataviews/default-views.js +4 -2
  118. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  119. package/build/components/sidebar-dataviews/index.js +4 -3
  120. package/build/components/sidebar-dataviews/index.js.map +1 -1
  121. package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
  122. package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  123. package/build/components/sidebar-edit-mode/page-panels/page-status.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/sidebar-card/index.js +12 -6
  127. package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  128. package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
  129. package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  130. package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
  131. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  132. package/build/components/sidebar-navigation-screen-main/index.js +1 -2
  133. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  134. package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
  135. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  136. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  137. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  138. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  139. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  140. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  141. package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  142. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  143. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  144. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +2 -2
  145. package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  146. package/build/components/sidebar-navigation-screen-template/index.js +7 -3
  147. package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
  148. package/build/components/sidebar-navigation-screen-templates-browse/content.js +6 -6
  149. package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  150. package/build/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  151. package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  152. package/build/components/start-template-options/index.js.map +1 -1
  153. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  154. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  155. package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  156. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  157. package/build/components/template-actions/index.js +44 -27
  158. package/build/components/template-actions/index.js.map +1 -1
  159. package/build/components/welcome-guide/editor.js +11 -2
  160. package/build/components/welcome-guide/editor.js.map +1 -1
  161. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +78 -0
  162. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  163. package/build/utils/constants.js +5 -3
  164. package/build/utils/constants.js.map +1 -1
  165. package/build/utils/get-is-list-page.js +1 -1
  166. package/build/utils/get-is-list-page.js.map +1 -1
  167. package/build/utils/math.js +98 -0
  168. package/build/utils/math.js.map +1 -0
  169. package/build-module/components/actions/index.js +4 -6
  170. package/build-module/components/actions/index.js.map +1 -1
  171. package/build-module/components/block-editor/editor-canvas.js +18 -6
  172. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  173. package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
  174. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  175. package/build-module/components/editor/index.js +2 -16
  176. package/build-module/components/editor/index.js.map +1 -1
  177. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  178. package/build-module/components/global-styles/font-families.js +1 -1
  179. package/build-module/components/global-styles/font-families.js.map +1 -1
  180. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js +4 -4
  181. package/build-module/components/global-styles/font-library-modal/collection-font-variant.js.map +1 -1
  182. package/build-module/components/global-styles/font-library-modal/context.js +72 -61
  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-card.js +11 -16
  185. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  186. package/build-module/components/global-styles/font-library-modal/font-collection.js +124 -81
  187. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  188. package/build-module/components/global-styles/font-library-modal/font-demo.js +30 -9
  189. package/build-module/components/global-styles/font-library-modal/font-demo.js.map +1 -1
  190. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
  191. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  192. package/build-module/components/global-styles/font-library-modal/index.js +19 -6
  193. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  194. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +151 -79
  195. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  196. package/build-module/components/global-styles/font-library-modal/library-font-variant.js +4 -4
  197. package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
  198. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +52 -24
  199. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  200. package/build-module/components/global-styles/font-library-modal/utils/index.js +38 -5
  201. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  202. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -1
  203. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  204. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  205. package/build-module/components/global-styles/header.js +2 -2
  206. package/build-module/components/global-styles/header.js.map +1 -1
  207. package/build-module/components/global-styles/highlighted-colors.js +43 -0
  208. package/build-module/components/global-styles/highlighted-colors.js.map +1 -0
  209. package/build-module/components/global-styles/hooks.js +48 -1
  210. package/build-module/components/global-styles/hooks.js.map +1 -1
  211. package/build-module/components/global-styles/preview-colors.js +54 -0
  212. package/build-module/components/global-styles/preview-colors.js.map +1 -0
  213. package/build-module/components/global-styles/preview-iframe.js +123 -0
  214. package/build-module/components/global-styles/preview-iframe.js.map +1 -0
  215. package/build-module/components/global-styles/preview-styles.js +155 -0
  216. package/build-module/components/global-styles/preview-styles.js.map +1 -0
  217. package/build-module/components/global-styles/screen-block-list.js +1 -1
  218. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  219. package/build-module/components/global-styles/screen-block.js +1 -1
  220. package/build-module/components/global-styles/screen-block.js.map +1 -1
  221. package/build-module/components/global-styles/screen-colors.js +3 -2
  222. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  223. package/build-module/components/global-styles/screen-revisions/index.js +2 -2
  224. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  225. package/build-module/components/global-styles/screen-root.js +2 -2
  226. package/build-module/components/global-styles/screen-root.js.map +1 -1
  227. package/build-module/components/global-styles/screen-typography.js +5 -2
  228. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  229. package/build-module/components/global-styles/style-variations-container.js +13 -85
  230. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  231. package/build-module/components/global-styles/{typogrphy-elements.js → typography-elements.js} +4 -2
  232. package/build-module/components/global-styles/typography-elements.js.map +1 -0
  233. package/build-module/components/global-styles/typography-example.js +60 -0
  234. package/build-module/components/global-styles/typography-example.js.map +1 -0
  235. package/build-module/components/global-styles/typography-preview.js +3 -1
  236. package/build-module/components/global-styles/typography-preview.js.map +1 -1
  237. package/build-module/components/global-styles/ui.js +27 -2
  238. package/build-module/components/global-styles/ui.js.map +1 -1
  239. package/build-module/components/global-styles/utils.js +21 -0
  240. package/build-module/components/global-styles/utils.js.map +1 -1
  241. package/build-module/components/global-styles/variations/variation.js +82 -0
  242. package/build-module/components/global-styles/variations/variation.js.map +1 -0
  243. package/build-module/components/global-styles/variations/variations-color.js +27 -0
  244. package/build-module/components/global-styles/variations/variations-color.js.map +1 -0
  245. package/build-module/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  246. package/build-module/components/global-styles/variations/variations-panel.js.map +1 -0
  247. package/build-module/components/global-styles/variations/variations-typography.js +46 -0
  248. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -0
  249. package/build-module/components/header-edit-mode/index.js +15 -13
  250. package/build-module/components/header-edit-mode/index.js.map +1 -1
  251. package/build-module/components/header-edit-mode/more-menu/index.js +13 -5
  252. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  253. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  254. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  255. package/build-module/components/keyboard-shortcuts/global.js +17 -3
  256. package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
  257. package/build-module/components/layout/index.js +4 -1
  258. package/build-module/components/layout/index.js.map +1 -1
  259. package/build-module/components/layout/router.js +2 -5
  260. package/build-module/components/layout/router.js.map +1 -1
  261. package/build-module/components/page-pages/index.js +7 -12
  262. package/build-module/components/page-pages/index.js.map +1 -1
  263. package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
  264. package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
  265. package/build-module/components/page-patterns/index.js +16 -19
  266. package/build-module/components/page-patterns/index.js.map +1 -1
  267. package/build-module/components/page-patterns/use-patterns.js +9 -9
  268. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  269. package/build-module/components/{list/added-by.js → page-templates-template-parts/hooks.js} +2 -59
  270. package/build-module/components/page-templates-template-parts/hooks.js.map +1 -0
  271. package/build-module/components/page-templates-template-parts/index.js +25 -22
  272. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  273. package/build-module/components/resizable-frame/index.js +2 -1
  274. package/build-module/components/resizable-frame/index.js.map +1 -1
  275. package/build-module/components/revisions/index.js.map +1 -1
  276. package/build-module/components/save-panel/index.js +31 -11
  277. package/build-module/components/save-panel/index.js.map +1 -1
  278. package/build-module/components/sidebar/index.js +3 -4
  279. package/build-module/components/sidebar/index.js.map +1 -1
  280. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  281. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  282. package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
  283. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  284. package/build-module/components/sidebar-dataviews/default-views.js +6 -4
  285. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  286. package/build-module/components/sidebar-dataviews/index.js +4 -3
  287. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  288. package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
  289. package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
  290. package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
  291. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +4 -2
  292. package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
  293. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
  294. package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
  295. package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
  296. package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
  297. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
  298. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  299. package/build-module/components/sidebar-navigation-screen-main/index.js +1 -2
  300. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  301. package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  302. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
  303. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
  304. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  305. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -3
  306. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  307. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
  308. package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
  309. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  310. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  311. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  312. package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
  313. package/build-module/components/sidebar-navigation-screen-template/index.js +6 -2
  314. package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
  315. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
  316. package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
  317. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -5
  318. package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
  319. package/build-module/components/start-template-options/index.js.map +1 -1
  320. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  321. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  322. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -11
  323. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  324. package/build-module/components/template-actions/index.js +44 -27
  325. package/build-module/components/template-actions/index.js.map +1 -1
  326. package/build-module/components/welcome-guide/editor.js +11 -2
  327. package/build-module/components/welcome-guide/editor.js.map +1 -1
  328. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +76 -1
  329. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  330. package/build-module/utils/constants.js +4 -2
  331. package/build-module/utils/constants.js.map +1 -1
  332. package/build-module/utils/get-is-list-page.js +1 -1
  333. package/build-module/utils/get-is-list-page.js.map +1 -1
  334. package/build-module/utils/math.js +92 -0
  335. package/build-module/utils/math.js.map +1 -0
  336. package/build-style/style-rtl.css +196 -315
  337. package/build-style/style.css +196 -315
  338. package/package.json +42 -42
  339. package/src/components/actions/index.js +4 -6
  340. package/src/components/block-editor/editor-canvas.js +20 -6
  341. package/src/components/block-editor/style.scss +0 -3
  342. package/src/components/block-editor/use-site-editor-settings.js +0 -2
  343. package/src/components/editor/index.js +0 -20
  344. package/src/components/global-styles/color-palette-panel.js +0 -1
  345. package/src/components/global-styles/font-families.js +1 -1
  346. package/src/components/global-styles/font-library-modal/collection-font-variant.js +5 -5
  347. package/src/components/global-styles/font-library-modal/context.js +136 -107
  348. package/src/components/global-styles/font-library-modal/font-card.js +11 -26
  349. package/src/components/global-styles/font-library-modal/font-collection.js +298 -218
  350. package/src/components/global-styles/font-library-modal/font-demo.js +38 -4
  351. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
  352. package/src/components/global-styles/font-library-modal/index.js +23 -16
  353. package/src/components/global-styles/font-library-modal/installed-fonts.js +243 -114
  354. package/src/components/global-styles/font-library-modal/library-font-variant.js +5 -5
  355. package/src/components/global-styles/font-library-modal/style.scss +27 -11
  356. package/src/components/global-styles/font-library-modal/upload-fonts.js +70 -27
  357. package/src/components/global-styles/font-library-modal/utils/index.js +45 -5
  358. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +6 -1
  359. package/src/components/global-styles/font-library-modal/utils/test/getDisplaySrcFromFontFace.spec.js +7 -18
  360. package/src/components/global-styles/gradients-palette-panel.js +2 -2
  361. package/src/components/global-styles/header.js +2 -2
  362. package/src/components/global-styles/highlighted-colors.js +39 -0
  363. package/src/components/global-styles/hooks.js +68 -1
  364. package/src/components/global-styles/preview-colors.js +61 -0
  365. package/src/components/global-styles/preview-iframe.js +152 -0
  366. package/src/components/global-styles/preview-styles.js +185 -0
  367. package/src/components/global-styles/screen-block-list.js +1 -1
  368. package/src/components/global-styles/screen-block.js +4 -1
  369. package/src/components/global-styles/screen-colors.js +3 -2
  370. package/src/components/global-styles/screen-revisions/index.js +5 -2
  371. package/src/components/global-styles/screen-root.js +2 -2
  372. package/src/components/global-styles/screen-typography.js +8 -2
  373. package/src/components/global-styles/style-variations-container.js +14 -92
  374. package/src/components/global-styles/style.scss +4 -35
  375. package/src/components/global-styles/{typogrphy-elements.js → typography-elements.js} +5 -1
  376. package/src/components/global-styles/typography-example.js +64 -0
  377. package/src/components/global-styles/typography-preview.js +3 -1
  378. package/src/components/global-styles/ui.js +26 -2
  379. package/src/components/global-styles/utils.js +37 -0
  380. package/src/components/global-styles/variations/style.scss +38 -0
  381. package/src/components/global-styles/variations/variation.js +93 -0
  382. package/src/components/global-styles/variations/variations-color.js +34 -0
  383. package/src/components/global-styles/{variations-panel.js → variations/variations-panel.js} +1 -1
  384. package/src/components/global-styles/variations/variations-typography.js +63 -0
  385. package/src/components/header-edit-mode/index.js +21 -27
  386. package/src/components/header-edit-mode/more-menu/index.js +17 -8
  387. package/src/components/header-edit-mode/style.scss +4 -0
  388. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  389. package/src/components/keyboard-shortcuts/global.js +16 -4
  390. package/src/components/layout/index.js +5 -0
  391. package/src/components/layout/router.js +2 -7
  392. package/src/components/page-pages/index.js +8 -13
  393. package/src/components/page-patterns/delete-category-menu-item.js +7 -0
  394. package/src/components/page-patterns/index.js +23 -24
  395. package/src/components/page-patterns/use-patterns.js +17 -10
  396. package/src/components/{list/added-by.js → page-templates-template-parts/hooks.js} +1 -66
  397. package/src/components/page-templates-template-parts/index.js +34 -25
  398. package/src/components/page-templates-template-parts/style.scss +48 -0
  399. package/src/components/resizable-frame/index.js +1 -0
  400. package/src/components/revisions/index.js +1 -1
  401. package/src/components/save-panel/index.js +56 -27
  402. package/src/components/sidebar/index.js +3 -4
  403. package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
  404. package/src/components/sidebar-dataviews/dataview-item.js +2 -2
  405. package/src/components/sidebar-dataviews/default-views.js +14 -4
  406. package/src/components/sidebar-dataviews/index.js +4 -3
  407. package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
  408. package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -1
  409. package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
  410. package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
  411. package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
  412. package/src/components/sidebar-edit-mode/template-panel/index.js +25 -6
  413. package/src/components/sidebar-navigation-screen/style.scss +10 -1
  414. package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
  415. package/src/components/sidebar-navigation-screen-main/index.js +0 -2
  416. package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
  417. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
  418. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +0 -2
  419. package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
  420. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
  421. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +1 -1
  422. package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
  423. package/src/components/sidebar-navigation-screen-template/index.js +7 -2
  424. package/src/components/sidebar-navigation-screen-templates-browse/content.js +5 -5
  425. package/src/components/sidebar-navigation-screen-templates-browse/index.js +5 -3
  426. package/src/components/start-template-options/index.js +1 -1
  427. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
  428. package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
  429. package/src/components/template-actions/index.js +63 -46
  430. package/src/components/welcome-guide/editor.js +9 -6
  431. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +173 -0
  432. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +85 -1
  433. package/src/style.scss +2 -3
  434. package/src/utils/constants.js +4 -2
  435. package/src/utils/get-is-list-page.js +1 -1
  436. package/src/utils/math.js +93 -0
  437. package/build/components/global-styles/font-library-modal/collection-font-details.js +0 -50
  438. package/build/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  439. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -30
  440. package/build/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  441. package/build/components/global-styles/font-library-modal/library-font-card.js +0 -39
  442. package/build/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  443. package/build/components/global-styles/font-library-modal/tab-panel-layout.js +0 -67
  444. package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  445. package/build/components/global-styles/preview.js +0 -271
  446. package/build/components/global-styles/preview.js.map +0 -1
  447. package/build/components/global-styles/typogrphy-elements.js.map +0 -1
  448. package/build/components/global-styles/variations-panel.js.map +0 -1
  449. package/build/components/list/added-by.js.map +0 -1
  450. package/build/components/list/header.js +0 -55
  451. package/build/components/list/header.js.map +0 -1
  452. package/build/components/list/index.js +0 -80
  453. package/build/components/list/index.js.map +0 -1
  454. package/build/components/list/table.js +0 -94
  455. package/build/components/list/table.js.map +0 -1
  456. package/build/components/list/use-register-shortcuts.js +0 -51
  457. package/build/components/list/use-register-shortcuts.js.map +0 -1
  458. package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
  459. package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  460. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +0 -36
  461. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  462. package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  463. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -36
  464. package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  465. package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
  466. package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  467. package/build-module/components/global-styles/font-library-modal/collection-font-details.js +0 -42
  468. package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +0 -1
  469. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -23
  470. package/build-module/components/global-styles/font-library-modal/confirm-delete-dialog.js.map +0 -1
  471. package/build-module/components/global-styles/font-library-modal/library-font-card.js +0 -31
  472. package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +0 -1
  473. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +0 -60
  474. package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +0 -1
  475. package/build-module/components/global-styles/preview.js +0 -264
  476. package/build-module/components/global-styles/preview.js.map +0 -1
  477. package/build-module/components/global-styles/typogrphy-elements.js.map +0 -1
  478. package/build-module/components/global-styles/variations-panel.js.map +0 -1
  479. package/build-module/components/list/added-by.js.map +0 -1
  480. package/build-module/components/list/header.js +0 -47
  481. package/build-module/components/list/header.js.map +0 -1
  482. package/build-module/components/list/index.js +0 -72
  483. package/build-module/components/list/index.js.map +0 -1
  484. package/build-module/components/list/table.js +0 -86
  485. package/build-module/components/list/table.js.map +0 -1
  486. package/build-module/components/list/use-register-shortcuts.js +0 -45
  487. package/build-module/components/list/use-register-shortcuts.js.map +0 -1
  488. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
  489. package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
  490. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +0 -29
  491. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +0 -1
  492. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
  493. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -27
  494. package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +0 -1
  495. package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
  496. package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
  497. package/src/components/global-styles/font-library-modal/collection-font-details.js +0 -56
  498. package/src/components/global-styles/font-library-modal/confirm-delete-dialog.js +0 -33
  499. package/src/components/global-styles/font-library-modal/library-font-card.js +0 -34
  500. package/src/components/global-styles/font-library-modal/tab-panel-layout.js +0 -85
  501. package/src/components/global-styles/preview.js +0 -327
  502. package/src/components/list/header.js +0 -48
  503. package/src/components/list/index.js +0 -87
  504. package/src/components/list/style.scss +0 -188
  505. package/src/components/list/table.js +0 -140
  506. package/src/components/list/use-register-shortcuts.js +0 -49
  507. package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
  508. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +0 -34
  509. package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +0 -22
  510. package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
  511. package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","mergeBaseAndUserConfigs","cloneDeep","filterObjectByProperty","object","property","newObject","Object","keys","forEach","key","newFilter","length","useThemeStyleVariationsByProperty","variations","filter","baseVariation","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 { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { mergeBaseAndUserConfigs } from '../../components/global-styles/global-styles-provider';\nimport cloneDeep from '../../utils/clone-deep';\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 *\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,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SAASC,uBAAuB,QAAQ,uDAAuD;AAC/F,OAAOC,SAAS,MAAM,wBAAwB;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CAAEC,MAAM,EAAEC,QAAQ,KAAM;EAC7D,IAAK,CAAED,MAAM,EAAG;IACf,OAAO,CAAC,CAAC;EACV;EAEA,MAAME,SAAS,GAAG,CAAC,CAAC;EACp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AED,IAAKN,mBAAmB,EAAG;QAC1B;AACJ;AACA;AACA;QACII,MAAM,GAAGpB,uBAAuB,CAAEgB,mBAAmB,EAAEI,MAAO,CAAC;MAChE;MACA,OAAOA,MAAM;IACd,CAAE,CAAC;IAEH,IAAK,UAAU,KAAK,OAAON,MAAM,EAAG;MACnCG,wBAAwB,GACvBA,wBAAwB,CAACH,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOG,wBAAwB;EAChC,CAAC,EAAE,CAAEJ,UAAU,EAAET,QAAQ,EAAEW,aAAa,EAAED,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,EAAG;EAC5D,IAAK,CAAEA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACjD,OAAOD,MAAM;EACd;EAEA,IAAK,OAAOA,MAAM,KAAK,QAAQ,IAAI,CAAEE,MAAM,CAACC,IAAI,CAAEH,MAAO,CAAC,CAACI,MAAM,EAAG;IACnE,OAAOJ,MAAM;EACd;EAEA,KAAM,MAAMK,GAAG,IAAIL,MAAM,EAAG;IAC3B,IAAKK,GAAG,KAAKJ,QAAQ,EAAG;MACvB,OAAOD,MAAM,CAAEK,GAAG,CAAE;IACrB,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QA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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"}
@@ -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 = 'notIn';\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"}
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_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';\nex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MC,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,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,GAAGF,EAAE,CAACG,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,uBAAuBA,CAAEJ,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EAC7C,OAAOR,KAAK,CACXI,IAAI,CAACH,GAAG,CAAEK,EAA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