@wordpress/edit-site 6.1.0 → 6.3.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 (290) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/build/components/add-new-pattern/index.js +31 -16
  3. package/build/components/add-new-pattern/index.js.map +1 -1
  4. package/build/components/{add-new-page → add-new-post}/index.js +28 -16
  5. package/build/components/add-new-post/index.js.map +1 -0
  6. package/build/components/block-editor/use-site-editor-settings.js +5 -3
  7. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  8. package/build/components/editor/index.js +32 -7
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +18 -7
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/background-panel.js +0 -5
  13. package/build/components/global-styles/background-panel.js.map +1 -1
  14. package/build/components/global-styles/font-families.js +17 -17
  15. package/build/components/global-styles/font-families.js.map +1 -1
  16. package/build/components/global-styles/font-library-modal/context.js +2 -2
  17. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  18. package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
  19. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  20. package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  21. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  22. package/build/components/global-styles/hooks.js +0 -40
  23. package/build/components/global-styles/hooks.js.map +1 -1
  24. package/build/components/global-styles/preview-typography.js +47 -0
  25. package/build/components/global-styles/preview-typography.js.map +1 -0
  26. package/build/components/global-styles/screen-block.js +14 -0
  27. package/build/components/global-styles/screen-block.js.map +1 -1
  28. package/build/components/global-styles/screen-layout.js +5 -1
  29. package/build/components/global-styles/screen-layout.js.map +1 -1
  30. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  31. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  32. package/build/components/global-styles/shadows-edit-panel.js +1 -2
  33. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  34. package/build/components/global-styles/style-variations-container.js +5 -5
  35. package/build/components/global-styles/style-variations-container.js.map +1 -1
  36. package/build/components/global-styles/typography-elements.js +0 -2
  37. package/build/components/global-styles/typography-elements.js.map +1 -1
  38. package/build/components/global-styles/variations/variation.js +28 -22
  39. package/build/components/global-styles/variations/variation.js.map +1 -1
  40. package/build/components/global-styles/variations/variations-color.js +5 -3
  41. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  42. package/build/components/global-styles/variations/variations-typography.js +14 -27
  43. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  44. package/build/components/global-styles-sidebar/index.js +2 -2
  45. package/build/components/global-styles-sidebar/index.js.map +1 -1
  46. package/build/components/layout/index.js +16 -8
  47. package/build/components/layout/index.js.map +1 -1
  48. package/build/components/layout/router.js +20 -41
  49. package/build/components/layout/router.js.map +1 -1
  50. package/build/components/page-patterns/index.js +51 -41
  51. package/build/components/page-patterns/index.js.map +1 -1
  52. package/build/components/page-patterns/rename-category-menu-item.js +3 -1
  53. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  54. package/build/components/page-patterns/search-items.js +29 -4
  55. package/build/components/page-patterns/search-items.js.map +1 -1
  56. package/build/components/page-patterns/use-patterns.js +22 -55
  57. package/build/components/page-patterns/use-patterns.js.map +1 -1
  58. package/build/components/page-templates/index.js +27 -21
  59. package/build/components/page-templates/index.js.map +1 -1
  60. package/build/components/pagination/index.js +4 -4
  61. package/build/components/pagination/index.js.map +1 -1
  62. package/build/components/posts-app/index.js +11 -17
  63. package/build/components/posts-app/index.js.map +1 -1
  64. package/build/components/{page-pages/index.js → posts-app/posts-list.js} +165 -38
  65. package/build/components/posts-app/posts-list.js.map +1 -0
  66. package/build/components/posts-app/router.js +85 -0
  67. package/build/components/posts-app/router.js.map +1 -0
  68. package/build/components/revisions/index.js +10 -7
  69. package/build/components/revisions/index.js.map +1 -1
  70. package/build/components/save-panel/index.js +1 -1
  71. package/build/components/save-panel/index.js.map +1 -1
  72. package/build/components/sidebar-dataviews/add-new-view.js +4 -1
  73. package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
  74. package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  75. package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  76. package/build/components/sidebar-dataviews/default-views.js +98 -84
  77. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  78. package/build/components/sidebar-dataviews/index.js +4 -1
  79. package/build/components/sidebar-dataviews/index.js.map +1 -1
  80. package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  81. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  82. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
  83. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  84. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  85. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  86. package/build/components/site-hub/index.js +81 -1
  87. package/build/components/site-hub/index.js.map +1 -1
  88. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  89. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  90. package/build/deprecated.js +11 -0
  91. package/build/deprecated.js.map +1 -1
  92. package/build/hooks/commands/use-set-command-context.js +11 -0
  93. package/build/hooks/commands/use-set-command-context.js.map +1 -1
  94. package/build/hooks/push-changes-to-global-styles/index.js +1 -1
  95. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  96. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
  97. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  98. package/build/index.js +6 -0
  99. package/build/index.js.map +1 -1
  100. package/build/lock-unlock.js +1 -1
  101. package/build/lock-unlock.js.map +1 -1
  102. package/build/posts.js +57 -2
  103. package/build/posts.js.map +1 -1
  104. package/build/store/private-actions.js +7 -2
  105. package/build/store/private-actions.js.map +1 -1
  106. package/build-module/components/add-new-pattern/index.js +31 -16
  107. package/build-module/components/add-new-pattern/index.js.map +1 -1
  108. package/build-module/components/{add-new-page → add-new-post}/index.js +28 -16
  109. package/build-module/components/add-new-post/index.js.map +1 -0
  110. package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
  111. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  112. package/build-module/components/editor/index.js +33 -8
  113. package/build-module/components/editor/index.js.map +1 -1
  114. package/build-module/components/editor-canvas-container/index.js +19 -8
  115. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  116. package/build-module/components/global-styles/background-panel.js +0 -5
  117. package/build-module/components/global-styles/background-panel.js.map +1 -1
  118. package/build-module/components/global-styles/font-families.js +18 -18
  119. package/build-module/components/global-styles/font-families.js.map +1 -1
  120. package/build-module/components/global-styles/font-library-modal/context.js +2 -2
  121. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  122. package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
  123. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  124. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  125. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  126. package/build-module/components/global-styles/hooks.js +0 -38
  127. package/build-module/components/global-styles/hooks.js.map +1 -1
  128. package/build-module/components/global-styles/preview-typography.js +39 -0
  129. package/build-module/components/global-styles/preview-typography.js.map +1 -0
  130. package/build-module/components/global-styles/screen-block.js +15 -0
  131. package/build-module/components/global-styles/screen-block.js.map +1 -1
  132. package/build-module/components/global-styles/screen-layout.js +5 -1
  133. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  134. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  135. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  136. package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
  137. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  138. package/build-module/components/global-styles/style-variations-container.js +6 -6
  139. package/build-module/components/global-styles/style-variations-container.js.map +1 -1
  140. package/build-module/components/global-styles/typography-elements.js +0 -2
  141. package/build-module/components/global-styles/typography-elements.js.map +1 -1
  142. package/build-module/components/global-styles/variations/variation.js +29 -23
  143. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  144. package/build-module/components/global-styles/variations/variations-color.js +5 -3
  145. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  146. package/build-module/components/global-styles/variations/variations-typography.js +16 -28
  147. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  148. package/build-module/components/global-styles-sidebar/index.js +2 -2
  149. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  150. package/build-module/components/layout/index.js +14 -8
  151. package/build-module/components/layout/index.js.map +1 -1
  152. package/build-module/components/layout/router.js +20 -41
  153. package/build-module/components/layout/router.js.map +1 -1
  154. package/build-module/components/page-patterns/index.js +52 -42
  155. package/build-module/components/page-patterns/index.js.map +1 -1
  156. package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
  157. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  158. package/build-module/components/page-patterns/search-items.js +28 -4
  159. package/build-module/components/page-patterns/search-items.js.map +1 -1
  160. package/build-module/components/page-patterns/use-patterns.js +23 -56
  161. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  162. package/build-module/components/page-templates/index.js +27 -21
  163. package/build-module/components/page-templates/index.js.map +1 -1
  164. package/build-module/components/pagination/index.js +4 -4
  165. package/build-module/components/pagination/index.js.map +1 -1
  166. package/build-module/components/posts-app/index.js +11 -17
  167. package/build-module/components/posts-app/index.js.map +1 -1
  168. package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +164 -37
  169. package/build-module/components/posts-app/posts-list.js.map +1 -0
  170. package/build-module/components/posts-app/router.js +77 -0
  171. package/build-module/components/posts-app/router.js.map +1 -0
  172. package/build-module/components/revisions/index.js +10 -7
  173. package/build-module/components/revisions/index.js.map +1 -1
  174. package/build-module/components/save-panel/index.js +1 -1
  175. package/build-module/components/save-panel/index.js.map +1 -1
  176. package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
  177. package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
  178. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  179. package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
  180. package/build-module/components/sidebar-dataviews/default-views.js +97 -84
  181. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  182. package/build-module/components/sidebar-dataviews/index.js +5 -2
  183. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  184. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
  185. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  186. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
  187. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  188. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
  189. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  190. package/build-module/components/site-hub/index.js +81 -1
  191. package/build-module/components/site-hub/index.js.map +1 -1
  192. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
  193. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  194. package/build-module/deprecated.js +11 -0
  195. package/build-module/deprecated.js.map +1 -1
  196. package/build-module/hooks/commands/use-set-command-context.js +11 -0
  197. package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
  198. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
  199. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  200. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
  201. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  202. package/build-module/index.js +7 -2
  203. package/build-module/index.js.map +1 -1
  204. package/build-module/lock-unlock.js +1 -1
  205. package/build-module/lock-unlock.js.map +1 -1
  206. package/build-module/posts.js +57 -2
  207. package/build-module/posts.js.map +1 -1
  208. package/build-module/store/private-actions.js +7 -2
  209. package/build-module/store/private-actions.js.map +1 -1
  210. package/build-style/posts-rtl.css +108 -28
  211. package/build-style/posts.css +108 -28
  212. package/build-style/style-rtl.css +127 -157
  213. package/build-style/style.css +127 -157
  214. package/lib/inflate.js +3188 -3937
  215. package/lib/lib-font.browser.js +32 -2
  216. package/lib/unbrotli.js +1818 -2458
  217. package/package.json +41 -41
  218. package/src/components/add-new-pattern/index.js +38 -23
  219. package/src/components/{add-new-page → add-new-post}/index.js +42 -18
  220. package/src/components/block-editor/style.scss +0 -11
  221. package/src/components/block-editor/use-site-editor-settings.js +33 -28
  222. package/src/components/editor/index.js +34 -20
  223. package/src/components/editor-canvas-container/index.js +20 -8
  224. package/src/components/global-styles/background-panel.js +0 -8
  225. package/src/components/global-styles/font-families.js +28 -19
  226. package/src/components/global-styles/font-library-modal/context.js +2 -2
  227. package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
  228. package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
  229. package/src/components/global-styles/font-library-modal/style.scss +17 -10
  230. package/src/components/global-styles/hooks.js +0 -41
  231. package/src/components/global-styles/preview-typography.js +39 -0
  232. package/src/components/global-styles/screen-block.js +22 -0
  233. package/src/components/global-styles/screen-layout.js +5 -1
  234. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  235. package/src/components/global-styles/shadows-edit-panel.js +1 -2
  236. package/src/components/global-styles/style-variations-container.js +10 -7
  237. package/src/components/global-styles/style.scss +2 -1
  238. package/src/components/global-styles/typography-elements.js +0 -4
  239. package/src/components/global-styles/variations/variation.js +41 -26
  240. package/src/components/global-styles/variations/variations-color.js +6 -3
  241. package/src/components/global-styles/variations/variations-typography.js +16 -32
  242. package/src/components/global-styles-sidebar/index.js +2 -2
  243. package/src/components/layout/index.js +13 -4
  244. package/src/components/layout/router.js +20 -36
  245. package/src/components/layout/style.scss +12 -0
  246. package/src/components/page-patterns/index.js +55 -58
  247. package/src/components/page-patterns/rename-category-menu-item.js +2 -0
  248. package/src/components/page-patterns/search-items.js +37 -3
  249. package/src/components/page-patterns/style.scss +1 -8
  250. package/src/components/page-patterns/use-patterns.js +43 -82
  251. package/src/components/page-templates/index.js +26 -21
  252. package/src/components/page-templates/style.scss +1 -6
  253. package/src/components/pagination/index.js +4 -4
  254. package/src/components/posts-app/index.js +9 -11
  255. package/src/components/{page-pages/index.js → posts-app/posts-list.js} +163 -42
  256. package/src/components/posts-app/router.js +69 -0
  257. package/src/components/{page-pages → posts-app}/style.scss +22 -8
  258. package/src/components/revisions/index.js +9 -1
  259. package/src/components/save-panel/index.js +1 -1
  260. package/src/components/sidebar/style.scss +6 -0
  261. package/src/components/sidebar-dataviews/add-new-view.js +2 -1
  262. package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
  263. package/src/components/sidebar-dataviews/default-views.js +119 -98
  264. package/src/components/sidebar-dataviews/index.js +3 -3
  265. package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
  266. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +8 -2
  267. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
  268. package/src/components/site-hub/index.js +84 -1
  269. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
  270. package/src/deprecated.js +14 -0
  271. package/src/hooks/commands/use-set-command-context.js +12 -0
  272. package/src/hooks/push-changes-to-global-styles/index.js +1 -1
  273. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
  274. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
  275. package/src/index.js +8 -1
  276. package/src/lock-unlock.js +1 -1
  277. package/src/posts.js +63 -2
  278. package/src/posts.scss +9 -0
  279. package/src/store/private-actions.js +7 -3
  280. package/src/style.scss +14 -2
  281. package/build/components/add-new-page/index.js.map +0 -1
  282. package/build/components/page-pages/index.js.map +0 -1
  283. package/build/components/table/index.js +0 -35
  284. package/build/components/table/index.js.map +0 -1
  285. package/build-module/components/add-new-page/index.js.map +0 -1
  286. package/build-module/components/page-pages/index.js.map +0 -1
  287. package/build-module/components/table/index.js +0 -30
  288. package/build-module/components/table/index.js.map +0 -1
  289. package/src/components/table/index.js +0 -33
  290. package/src/components/table/style.scss +0 -38
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_compose","_blockEditor","_components","_i18n","_blocks","_element","_data","_notices","_coreData","_hooks2","_lockUnlock","_cloneDeep","_interopRequireDefault","_setNestedValue","_jsxRuntime","cleanEmptyObject","GlobalStylesContext","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","useCallback","length","blockStyles","newBlockStyles","cloneDeep","newUserConfig","setNestedValue","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","jsxs","BaseControl","className","help","children","jsx","VisualLabel","Button","__next40pxDefaultSize","variant","__experimentalIsFocusable","disabled","PushChangesToGlobalStyles","props","blockEditingMode","useBlockEditingMode","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","supportsStyles","some","feature","hasBlockSupport","isDisplayed","InspectorAdvancedControls","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","Fragment","isSelected","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\t__experimentalIsFocusable\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA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,iBAAI,IAAA3H,WAAA,CAAAgG,GAAA,EAACO,yBAAyB;IAAA,GAAMC;EAAK,CAAI,CAAC;AAAA,CAC/D,CAEJ,CAAC;AAED,IAAAoB,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CL,6BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_hooks","require","_compose","_blockEditor","_components","_i18n","_blocks","_element","_data","_notices","_coreData","_hooks2","_lockUnlock","_cloneDeep","_interopRequireDefault","_setNestedValue","_jsxRuntime","cleanEmptyObject","GlobalStylesContext","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","useCallback","length","blockStyles","newBlockStyles","cloneDeep","newUserConfig","setNestedValue","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","jsxs","BaseControl","className","help","children","jsx","VisualLabel","Button","__next40pxDefaultSize","variant","accessibleWhenDisabled","disabled","PushChangesToGlobalStyles","props","blockEditingMode","useBlockEditingMode","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","supportsStyles","some","feature","hasBlockSupport","isDisplayed","InspectorAdvancedControls","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","Fragment","isSelected","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,SAA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kB,EAClB,8CAA8C,EAC9CL,6BACD,CAAC","ignoreList":[]}
@@ -4,9 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.filterObjectByProperty = void 0;
8
- exports.isVariationWithSingleProperty = isVariationWithSingleProperty;
9
- exports.removePropertyFromObject = removePropertyFromObject;
7
+ exports.filterObjectByProperties = void 0;
8
+ exports.isVariationWithProperties = isVariationWithProperties;
9
+ exports.removePropertiesFromObject = removePropertiesFromObject;
10
10
  exports.useCurrentMergeThemeStyleVariationsWithUserConfig = useCurrentMergeThemeStyleVariationsWithUserConfig;
11
11
  var _data = require("@wordpress/data");
12
12
  var _coreData = require("@wordpress/core-data");
@@ -25,47 +25,64 @@ var _lockUnlock = require("../../lock-unlock");
25
25
  */
26
26
 
27
27
  const {
28
- GlobalStylesContext
28
+ GlobalStylesContext,
29
+ areGlobalStyleConfigsEqual
29
30
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
30
31
  const {
31
32
  mergeBaseAndUserConfigs
32
33
  } = (0, _lockUnlock.unlock)(_editor.privateApis);
33
34
 
34
35
  /**
35
- * Removes all instances of a property from an object.
36
+ * Removes all instances of properties from an object.
36
37
  *
37
- * @param {Object} object The object to remove the property from.
38
- * @param {string} property The property to remove.
38
+ * @param {Object} object The object to remove the properties from.
39
+ * @param {string[]} properties The properties to remove.
39
40
  * @return {Object} The modified object.
40
41
  */
41
- function removePropertyFromObject(object, property) {
42
- if (!property || typeof property !== 'string') {
42
+ function removePropertiesFromObject(object, properties) {
43
+ if (!properties?.length) {
43
44
  return object;
44
45
  }
45
46
  if (typeof object !== 'object' || !object || !Object.keys(object).length) {
46
47
  return object;
47
48
  }
48
49
  for (const key in object) {
49
- if (key === property) {
50
+ if (properties.includes(key)) {
50
51
  delete object[key];
51
52
  } else if (typeof object[key] === 'object') {
52
- removePropertyFromObject(object[key], property);
53
+ removePropertiesFromObject(object[key], properties);
53
54
  }
54
55
  }
55
56
  return object;
56
57
  }
57
58
 
58
59
  /**
59
- * Fetches the current theme style variations that contain only the specified property
60
+ * Checks whether a style variation is empty.
61
+ *
62
+ * @param {Object} variation A style variation object.
63
+ * @param {string} variation.title The title of the variation.
64
+ * @param {Object} variation.settings The settings of the variation.
65
+ * @param {Object} variation.styles The styles of the variation.
66
+ * @return {boolean} Whether the variation is empty.
67
+ */
68
+ function hasThemeVariation({
69
+ title,
70
+ settings,
71
+ styles
72
+ }) {
73
+ return title === (0, _i18n.__)('Default') ||
74
+ // Always preserve the default variation.
75
+ Object.keys(settings).length > 0 || Object.keys(styles).length > 0;
76
+ }
77
+
78
+ /**
79
+ * Fetches the current theme style variations that contain only the specified properties
60
80
  * and merges them with the user config.
61
81
  *
62
- * @param {Object} props Object of hook args.
63
- * @param {string} props.property The property to filter by.
82
+ * @param {string[]} properties The properties to filter by.
64
83
  * @return {Object[]|*} The merged object.
65
84
  */
66
- function useCurrentMergeThemeStyleVariationsWithUserConfig({
67
- property
68
- }) {
85
+ function useCurrentMergeThemeStyleVariationsWithUserConfig(properties = []) {
69
86
  const {
70
87
  variationsFromTheme
71
88
  } = (0, _data.useSelect)(select => {
@@ -77,41 +94,47 @@ function useCurrentMergeThemeStyleVariationsWithUserConfig({
77
94
  const {
78
95
  user: userVariation
79
96
  } = (0, _element.useContext)(GlobalStylesContext);
97
+ const propertiesAsString = properties.toString();
80
98
  return (0, _element.useMemo)(() => {
81
99
  const clonedUserVariation = (0, _cloneDeep.default)(userVariation);
82
100
 
83
101
  // Get user variation and remove the settings for the given property.
84
- const userVariationWithoutProperty = removePropertyFromObject(clonedUserVariation, property);
85
- userVariationWithoutProperty.title = (0, _i18n.__)('Default');
86
- const variationsWithSinglePropertyAndBase = variationsFromTheme.filter(variation => {
87
- return isVariationWithSingleProperty(variation, property);
102
+ const userVariationWithoutProperties = removePropertiesFromObject(clonedUserVariation, properties);
103
+ userVariationWithoutProperties.title = (0, _i18n.__)('Default');
104
+ const variationsWithPropertiesAndBase = variationsFromTheme.filter(variation => {
105
+ return isVariationWithProperties(variation, properties);
88
106
  }).map(variation => {
89
- return mergeBaseAndUserConfigs(userVariationWithoutProperty, variation);
107
+ return mergeBaseAndUserConfigs(userVariationWithoutProperties, variation);
90
108
  });
91
- return [userVariationWithoutProperty, ...variationsWithSinglePropertyAndBase];
92
- }, [property, userVariation, variationsFromTheme]);
109
+ const variationsByProperties = [userVariationWithoutProperties, ...variationsWithPropertiesAndBase];
110
+
111
+ /*
112
+ * Filter out variations with no settings or styles.
113
+ */
114
+ return variationsByProperties?.length ? variationsByProperties.filter(hasThemeVariation) : [];
115
+ }, [propertiesAsString, userVariation, variationsFromTheme]);
93
116
  }
94
117
 
95
118
  /**
96
- * Returns a new object, with properties specified in `property`,
119
+ * Returns a new object, with properties specified in `properties` array.,
97
120
  * maintain the original object tree structure.
98
- * The function is recursive, so it will perform a deep search for the given property.
99
- * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.
121
+ * The function is recursive, so it will perform a deep search for the given properties.
122
+ * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.
100
123
  *
101
- * @param {Object} object The object to filter
102
- * @param {Object} property The property to filter by
124
+ * @param {Object} object The object to filter
125
+ * @param {string[]} properties The properties to filter by
103
126
  * @return {Object} The merged object.
104
127
  */
105
- const filterObjectByProperty = (object, property) => {
106
- if (!object) {
128
+ const filterObjectByProperties = (object, properties) => {
129
+ if (!object || !properties?.length) {
107
130
  return {};
108
131
  }
109
132
  const newObject = {};
110
133
  Object.keys(object).forEach(key => {
111
- if (key === property) {
134
+ if (properties.includes(key)) {
112
135
  newObject[key] = object[key];
113
136
  } else if (typeof object[key] === 'object') {
114
- const newFilter = filterObjectByProperty(object[key], property);
137
+ const newFilter = filterObjectByProperties(object[key], properties);
115
138
  if (Object.keys(newFilter).length) {
116
139
  newObject[key] = newFilter;
117
140
  }
@@ -121,16 +144,16 @@ const filterObjectByProperty = (object, property) => {
121
144
  };
122
145
 
123
146
  /**
124
- * Compares a style variation to the same variation filtered by a single property.
125
- * Returns true if the variation contains only the property specified.
147
+ * Compares a style variation to the same variation filtered by the specified properties.
148
+ * Returns true if the variation contains only the properties specified.
126
149
  *
127
- * @param {Object} variation The variation to compare.
128
- * @param {string} property The property to compare.
129
- * @return {boolean} Whether the variation contains only a single property.
150
+ * @param {Object} variation The variation to compare.
151
+ * @param {string[]} properties The properties to compare.
152
+ * @return {boolean} Whether the variation contains only the specified properties.
130
153
  */
131
- exports.filterObjectByProperty = filterObjectByProperty;
132
- function isVariationWithSingleProperty(variation, property) {
133
- const variationWithProperty = filterObjectByProperty((0, _cloneDeep.default)(variation), property);
134
- return JSON.stringify(variationWithProperty?.styles) === JSON.stringify(variation?.styles) && JSON.stringify(variationWithProperty?.settings) === JSON.stringify(variation?.settings);
154
+ exports.filterObjectByProperties = filterObjectByProperties;
155
+ function isVariationWithProperties(variation, properties) {
156
+ const variationWithProperties = filterObjectByProperties((0, _cloneDeep.default)(variation), properties);
157
+ return areGlobalStyleConfigsEqual(variationWithProperties, variation);
135
158
  }
136
159
  //# sourceMappingURL=use-theme-style-variations-by-property.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_editor","_i18n","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","useContext","useMemo","clonedUserVariation","cloneDeep","userVariationWithoutProperty","title","__","variationsWithSinglePropertyAndBase","filter","variation","isVariationWithSingleProperty","map","filterObjectByProperty","newObject","forEach","newFilter","exports","variationWithProperty","JSON","stringify","styles","settings"],"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 { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\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 (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\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 * Fetches the current theme style variations that contain only the specified property\n * and merges them with the user config.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\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: userVariation } = useContext( GlobalStylesContext );\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperty = removePropertyFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperty\n\t\t);\n\t\tuserVariationWithoutProperty.title = __( 'Default' );\n\n\t\tconst variationsWithSinglePropertyAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithSingleProperty( variation, property );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperty,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\treturn [\n\t\t\tuserVariationWithoutProperty,\n\t\t\t...variationsWithSinglePropertyAndBase,\n\t\t];\n\t}, [ property, userVariation, variationsFromTheme ] );\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 * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAQA;AACA;AACA;;AAIA,MAAM;EAAES;AAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAChE,MAAM;EAAEC;AAAwB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC5D,IAAK,CAAEA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IACjD,OAAOD,MAAM;EACd;EAEA,IACC,OAAOA,MAAM,KAAK,QAAQ,IAC1B,CAAEA,MAAM,IACR,CAAEE,MAAM,CAACC,IAAI,CAAEH,MAAO,CAAC,CAACI,MAAM,EAC7B;IACD,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,QAAQ,EAAG;MAC/CN,wBAAwB,CAAEC,MAAM,CAA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Q,KAAM;EAC7D,IAAK,CAAED,MAAM,EAAG;IACf,OAAO,CAAC,CAAC;EACV;EAEA,MAAM4B,SAAS,GAAG,CAAC,CAAC;EACpB1B,MAAM,CAACC,IAAI,CAAEH,MAAO,CAAC,CAAC6B,OAAO,CAAIxB,GAAG,IAAM;IACzC,IAAKA,GAAG,KAAKJ,QAAQ,EAAG;MACvB2B,SAAS,CAAEvB,GAAG,CAAE,GAAGL,MAAM,CAAEK,GAAG,CAAE;IACjC,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QAAQ,EAAG;MAC/C,MAAMyB,SAAS,GAAGH,sBAAsB,CAAE3B,MAAM,CAAEK,GAAG,CAAE,EAAEJ,QAAS,CAAC;MACnE,IAAKC,MAAM,CAACC,IAAI,CAAE2B,SAAU,CAAC,CAAC1B,MAAM,EAAG;QACtCwB,SAAS,CAAEvB,GAAG,CAAE,GAAGyB,SAAS;MAC7B;IACD;EACD,CAAE,CAAC;EACH,OAAOF,SAAS;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAG,OAAA,CAAAJ,sBAAA,GAAAA,sBAAA;AAQO,SAASF,6BAA6BA,CAAED,SAAS,EAAEvB,QAAQ,EAAG;EACpE,MAAM+B,qBAAqB,GAAGL,sBAAsB,CACnD,IAAAT,kBAAS,EAAEM,SAAU,CAAC,EACtBvB,QACD,CAAC;EAED,OACCgC,IAAI,CAACC,SAAS,CAAEF,qBAAqB,EAAEG,MAAO,CAAC,KAC9CF,IAAI,CAACC,SAAS,CAAEV,SAAS,EAAEW,MAAO,CAAC,IACpCF,IAAI,CAACC,SAAS,CAAEF,qBAAqB,EAAEI,QAAS,CAAC,KAChDH,IAAI,CAACC,SAAS,CAAEV,SAAS,EAAEY,QAAS,CAAC;AAExC","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_blockEditor","_editor","_i18n","_cloneDeep","_interopRequireDefault","_lockUnlock","GlobalStylesContext","areGlobalStyleConfigsEqual","unlock","blockEditorPrivateApis","mergeBaseAndUserConfigs","editorPrivateApis","removePropertiesFromObject","object","properties","length","Object","keys","key","includes","hasThemeVariation","title","settings","styles","__","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","useSelect","select","_variationsFromTheme","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","useContext","propertiesAsString","toString","useMemo","clonedUserVariation","cloneDeep","userVariationWithoutProperties","variationsWithPropertiesAndBase","filter","variation","isVariationWithProperties","map","variationsByProperties","filterObjectByProperties","newObject","forEach","newFilter","exports","variationWithProperties"],"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 { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param {Object} object The object to remove the properties from.\n * @param {string[]} properties The properties to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertiesFromObject( object, properties ) {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Checks whether a style variation is empty.\n *\n * @param {Object} variation A style variation object.\n * @param {string} variation.title The title of the variation.\n * @param {Object} variation.settings The settings of the variation.\n * @param {Object} variation.styles The styles of the variation.\n * @return {boolean} Whether the variation is empty.\n */\nfunction hasThemeVariation( { title, settings, styles } ) {\n\treturn (\n\t\ttitle === __( 'Default' ) || // Always preserve the default variation.\n\t\tObject.keys( settings ).length > 0 ||\n\t\tObject.keys( styles ).length > 0\n\t);\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified properties\n * and merges them with the user config.\n *\n * @param {string[]} properties The properties to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig(\n\tproperties = []\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: userVariation } = useContext( GlobalStylesContext );\n\n\tconst propertiesAsString = properties.toString();\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperties = removePropertiesFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperties\n\t\t);\n\t\tuserVariationWithoutProperties.title = __( 'Default' );\n\n\t\tconst variationsWithPropertiesAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithProperties( variation, properties );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperties,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\tconst variationsByProperties = [\n\t\t\tuserVariationWithoutProperties,\n\t\t\t...variationsWithPropertiesAndBase,\n\t\t];\n\n\t\t/*\n\t\t * Filter out variations with no settings or styles.\n\t\t */\n\t\treturn variationsByProperties?.length\n\t\t\t? variationsByProperties.filter( hasThemeVariation )\n\t\t\t: [];\n\t}, [ propertiesAsString, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param {Object} object The object to filter\n * @param {string[]} properties The properties to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperties = ( object, properties ) => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\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 * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string[]} properties The properties to compare.\n * @return {boolean} Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties( variation, properties ) {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tcloneDeep( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStyleConfigsEqual( variationWithProperties, variation );\n}\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,O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e,kBAAkB,EAAEF,aAAa,EAAEP,mBAAmB,CAAG,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMqB,wBAAwB,GAAGA,CAAElC,MAAM,EAAEC,UAAU,KAAM;EACjE,IAAK,CAAED,MAAM,IAAI,CAAEC,UAAU,EAAEC,MAAM,EAAG;IACvC,OAAO,CAAC,CAAC;EACV;EAEA,MAAMiC,SAAS,GAAG,CAAC,CAAC;EACpBhC,MAAM,CAACC,IAAI,CAAEJ,MAAO,CAAC,CAACoC,OAAO,CAAI/B,GAAG,IAAM;IACzC,IAAKJ,UAAU,CAACK,QAAQ,CAAED,GAAI,CAAC,EAAG;MACjC8B,SAAS,CAAE9B,GAAG,CAAE,GAAGL,MAAM,CAAEK,GAAG,CAAE;IACjC,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QAAQ,EAAG;MAC/C,MAAMgC,SAAS,GAAGH,wBAAwB,CACzClC,MAAM,CAAEK,GAAG,CAAE,EACbJ,UACD,CAAC;MACD,IAAKE,MAAM,CAACC,IAAI,CAAEiC,SAAU,CAAC,CAACnC,MAAM,EAAG;QACtCiC,SAAS,CAAE9B,GAAG,CAAE,GAAGgC,SAAS;MAC7B;IACD;EACD,CAAE,CAAC;EACH,OAAOF,SAAS;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPAG,OAAA,CAAAJ,wBAAA,GAAAA,wBAAA;AAQO,SAASH,yBAAyBA,CAAED,SAAS,EAAE7B,UAAU,EAAG;EAClE,MAAMsC,uBAAuB,GAAGL,wBAAwB,CACvD,IAAAR,kBAAS,EAAEI,SAAU,CAAC,EACtB7B,UACD,CAAC;EAED,OAAOP,0BAA0B,CAAE6C,uBAAuB,EAAET,SAAU,CAAC;AACxE","ignoreList":[]}
package/build/index.js CHANGED
@@ -41,6 +41,7 @@ var _preferences = require("@wordpress/preferences");
41
41
  var _widgets = require("@wordpress/widgets");
42
42
  require("./hooks");
43
43
  var _store = require("./store");
44
+ var _lockUnlock = require("./lock-unlock");
44
45
  var _app = _interopRequireDefault(require("./components/app"));
45
46
  var _jsxRuntime = require("react/jsx-runtime");
46
47
  var _pluginTemplateSettingPanel = _interopRequireDefault(require("./components/plugin-template-setting-panel"));
@@ -65,6 +66,10 @@ var _posts = require("./posts");
65
66
  * Internal dependencies
66
67
  */
67
68
 
69
+ const {
70
+ registerDefaultActions
71
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
72
+
68
73
  /**
69
74
  * Initializes the site editor screen.
70
75
  *
@@ -91,6 +96,7 @@ function initializeEditor(id, settings) {
91
96
  enableFSEBlocks: true
92
97
  });
93
98
  }
99
+ registerDefaultActions();
94
100
 
95
101
  // We dispatch actions and update the store synchronously before rendering
96
102
  // so that we won't trigger unnecessary re-renders with useEffect.
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,Q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AAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE3C,IAAI,CAAC4C,MAAM,eACV,IAAAlE,WAAA,CAAAmE,GAAA,EAACzE,QAAA,CAAA0E,UAAU;IAAAC,QAAA,eACV,IAAArE,WAAA,CAAAmE,GAAA,EAACpE,IAAA,CAAAuE,OAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOhD,IAAI;AACZ;AAEO,SAASiD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAMA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_lockUnlock","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","registerDefaultActions","unlock","editorPrivateApis","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport { unlock } from './lock-unlock';\nimport App from './components/app';\n\nconst { registerDefaultActions } = unlock( editorPrivateApis );\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\tregisterDefaultActions();\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAA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AwB,EAAE3C,QAAQ,CAAC2C;EACpC,CAAE,CAAC;;EAEH;EACAC,MAAM,CAACC,gBAAgB,CAAE,UAAU,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE3C,IAAI,CAAC4C,MAAM,eACV,IAAArE,WAAA,CAAAsE,GAAA,EAAC7E,QAAA,CAAA8E,UAAU;IAAAC,QAAA,eACV,IAAAxE,WAAA,CAAAsE,GAAA,EAACvE,IAAA,CAAA0E,OAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOhD,IAAI;AACZ;AAEO,SAASiD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAMA;AACA","ignoreList":[]}
@@ -12,7 +12,7 @@ var _privateApis = require("@wordpress/private-apis");
12
12
  const {
13
13
  lock,
14
14
  unlock
15
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-site');
15
+ } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site');
16
16
  exports.unlock = unlock;
17
17
  exports.lock = lock;
18
18
  //# sourceMappingURL=lock-unlock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
package/build/posts.js CHANGED
@@ -5,7 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.initializePostsDashboard = initializePostsDashboard;
8
+ var _blocks = require("@wordpress/blocks");
9
+ var _blockLibrary = require("@wordpress/block-library");
10
+ var _data = require("@wordpress/data");
8
11
  var _element = require("@wordpress/element");
12
+ var _preferences = require("@wordpress/preferences");
13
+ var _widgets = require("@wordpress/widgets");
14
+ require("./hooks");
15
+ var _store = require("./store");
9
16
  var _postsApp = _interopRequireDefault(require("./components/posts-app"));
10
17
  var _jsxRuntime = require("react/jsx-runtime");
11
18
  /**
@@ -16,16 +23,64 @@ var _jsxRuntime = require("react/jsx-runtime");
16
23
  * Internal dependencies
17
24
  */
18
25
 
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+
19
30
  /**
20
31
  * Initializes the "Posts Dashboard"
21
- * @param {string} id DOM element id.
32
+ * @param {string} id ID of the root element to render the screen in.
33
+ * @param {Object} settings Editor settings.
22
34
  */
23
- function initializePostsDashboard(id) {
35
+ function initializePostsDashboard(id, settings) {
24
36
  if (!globalThis.IS_GUTENBERG_PLUGIN) {
25
37
  return;
26
38
  }
27
39
  const target = document.getElementById(id);
28
40
  const root = (0, _element.createRoot)(target);
41
+ (0, _data.dispatch)(_blocks.store).reapplyBlockTypeFilters();
42
+ const coreBlocks = (0, _blockLibrary.__experimentalGetCoreBlocks)().filter(({
43
+ name
44
+ }) => name !== 'core/freeform');
45
+ (0, _blockLibrary.registerCoreBlocks)(coreBlocks);
46
+ (0, _data.dispatch)(_blocks.store).setFreeformFallbackBlockName('core/html');
47
+ (0, _widgets.registerLegacyWidgetBlock)({
48
+ inserter: false
49
+ });
50
+ (0, _widgets.registerWidgetGroupBlock)({
51
+ inserter: false
52
+ });
53
+ if (globalThis.IS_GUTENBERG_PLUGIN) {
54
+ (0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
55
+ enableFSEBlocks: true
56
+ });
57
+ }
58
+
59
+ // We dispatch actions and update the store synchronously before rendering
60
+ // so that we won't trigger unnecessary re-renders with useEffect.
61
+ (0, _data.dispatch)(_preferences.store).setDefaults('core/edit-site', {
62
+ welcomeGuide: true,
63
+ welcomeGuideStyles: true,
64
+ welcomeGuidePage: true,
65
+ welcomeGuideTemplate: true
66
+ });
67
+ (0, _data.dispatch)(_preferences.store).setDefaults('core', {
68
+ allowRightClickOverrides: true,
69
+ distractionFree: false,
70
+ editorMode: 'visual',
71
+ fixedToolbar: false,
72
+ focusMode: false,
73
+ inactivePanels: [],
74
+ keepCaretInsideBlock: false,
75
+ openPanels: ['post-status'],
76
+ showBlockBreadcrumbs: true,
77
+ showListViewByDefault: false
78
+ });
79
+ (0, _data.dispatch)(_store.store).updateSettings(settings);
80
+
81
+ // Prevent the default browser action for files dropped outside of dropzones.
82
+ window.addEventListener('dragover', e => e.preventDefault(), false);
83
+ window.addEventListener('drop', e => e.preventDefault(), false);
29
84
  root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
30
85
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsApp.default, {})
31
86
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_postsApp","_interopRequireDefault","_jsxRuntime","initializePostsDashboard","id","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","createRoot","render","jsx","StrictMode","children","default"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id DOM element id.\n */\nexport function initializePostsDashboard( id ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8C,IAAAG,WAAA,GAAAH,OAAA;AAR9C;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,SAASI,wBAAwBA,CAAEC,EAAE,EAAG;EAC9C,IAAK,CAAEC,UAAU,CAACC,mBAAmB,EAAG;IACvC;EACD;EACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEL,EAAG,CAAC;EAC5C,MAAMM,IAAI,GAAG,IAAAC,mBAAU,EAAEJ,MAAO,CAAC;EAEjCG,IAAI,CAACE,MAAM,eACV,IAAAV,WAAA,CAAAW,GAAA,EAACf,QAAA,CAAAgB,UAAU;IAAAC,QAAA,eACV,IAAAb,WAAA,CAAAW,GAAA,EAACb,SAAA,CAAAgB,OAAQ,IAAE;EAAC,CACD,CACb,CAAC;EAED,OAAON,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_blockLibrary","_data","_element","_preferences","_widgets","_store","_postsApp","_interopRequireDefault","_jsxRuntime","initializePostsDashboard","id","settings","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","window","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializePostsDashboard( id, settings ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAQAA,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAKA,IAAAO,SAAA,GAAAC,sBAAA,CAAAR,OAAA;AAA8C,IAAAS,WAAA,GAAAT,OAAA;AA1B9C;AACA;AACA;;AAeA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,SAASU,wBAAwBA,CAAEC,EAAE,EAAEC,QAAQ,EAAG;EACxD,IAAK,CAAEC,UAAU,CAACC,mBAAmB,EAAG;IACvC;EACD;EACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEN,EAAG,CAAC;EAC5C,MAAMO,IAAI,GAAG,IAAAC,mBAAU,EAAEJ,MAAO,CAAC;EAEjC,IAAAK,cAAQ,EAAEC,aAAY,CAAC,CAACC,uBAAuB,CAAC,CAAC;EACjD,MAAMC,UAAU,GAAG,IAAAC,yCAA2B,EAAC,CAAC,CAACC,MAAM,CACtD,CAAE;IAAEC;EAAK,CAAC,KAAMA,IAAI,KAAK,eAC1B,CAAC;EACD,IAAAC,gCAAkB,EAAEJ,UAAW,CAAC;EAChC,IAAAH,cAAQ,EAAEC,aAAY,CAAC,CAACO,4BAA4B,CAAE,WAAY,CAAC;EACnE,IAAAC,kCAAyB,EAAE;IAAEC,QAAQ,EAAE;EAAM,CAAE,CAAC;EAChD,IAAAC,iCAAwB,EAAE;IAAED,QAAQ,EAAE;EAAM,CAAE,C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20,9 @@ const setCanvasMode = mode => ({
20
20
  registry,
21
21
  dispatch
22
22
  }) => {
23
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
23
24
  const switchCanvasMode = () => {
24
25
  registry.batch(() => {
25
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
26
26
  registry.dispatch(_blockEditor.store).clearSelectedBlock();
27
27
  registry.dispatch(_editor.store).setDeviceType('Desktop');
28
28
  registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
@@ -47,7 +47,12 @@ const setCanvasMode = mode => ({
47
47
  registry.dispatch(_editor.store).setIsInserterOpened(false);
48
48
  });
49
49
  };
50
- if (!document.startViewTransition) {
50
+
51
+ /*
52
+ * Skip transition in mobile, otherwise it crashes the browser.
53
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
54
+ */
55
+ if (!isMediumOrBigger || !document.startViewTransition) {
51
56
  switchCanvasMode();
52
57
  } else {
53
58
  document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BF,QAAQ,CAACG,KAAK,CAAE,MAAM;MACrB,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;MAClDP,QAAQ,CAACC,QAAQ,CAAEO,kBAAiB,CAAC,CAACC,kBAAkB,CAAC,CAAC;MAC1DT,QAAQ,CAACC,QAAQ,CAAES,aAAY,CAAC,CAACC,aAAa,CAAE,SAAU,CAAC;MAC3DX,QAAQ,CACNC,QAAQ,CAAEO,kBAAiB,CAAC,CAC5BI,uBAAuB,CAAE,MAAO,CAAC;MACnC,MAAMC,sBAAsB,GAAGb,QAAQ,CACrCc,MAAM,CAAEJ,aAAY,CAAC,CACrBG,sBAAsB,CAAC,CAAC;MAC1BZ,QAAQ,CAAE;QACTc,IAAI,EAAE,iBAA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AA,GAAAA,aAAA;AAKO,MAAMkC,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEhC;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTc,IAAI,EAAE,kCAAkC;IACxCkB;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","switchCanvasMode","batch","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\t/*\n\t\t * Skip transition in mobile, otherwise it crashes the browser.\n\t\t * See: https://github.com/WordPress/gutenberg/pull/63002.\n\t\t */\n\t\tif ( ! isMediumOrBigger || ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\n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