@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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 (221) hide show
  1. package/build/components/add-new-template/utils.js +1 -2
  2. package/build/components/add-new-template/utils.js.map +1 -1
  3. package/build/components/app/index.js +0 -3
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/use-site-editor-settings.js +4 -12
  6. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  7. package/build/components/editor/index.js +18 -27
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/editor/use-editor-title.js +13 -5
  10. package/build/components/editor/use-editor-title.js.map +1 -1
  11. package/build/components/editor/use-resolve-edited-entity.js +133 -0
  12. package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
  13. package/build/components/editor-canvas-container/index.js +1 -1
  14. package/build/components/editor-canvas-container/index.js.map +1 -1
  15. package/build/components/global-styles/block-preview-panel.js +8 -10
  16. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  17. package/build/components/global-styles/screen-block.js +18 -5
  18. package/build/components/global-styles/screen-block.js.map +1 -1
  19. package/build/components/global-styles/screen-style-variations.js +11 -5
  20. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  21. package/build/components/global-styles/ui.js.map +1 -1
  22. package/build/components/global-styles-sidebar/index.js +17 -1
  23. package/build/components/global-styles-sidebar/index.js.map +1 -1
  24. package/build/components/page-patterns/header.js +2 -2
  25. package/build/components/page-patterns/header.js.map +1 -1
  26. package/build/components/page-patterns/use-patterns.js +4 -8
  27. package/build/components/page-patterns/use-patterns.js.map +1 -1
  28. package/build/components/post-edit/index.js +10 -12
  29. package/build/components/post-edit/index.js.map +1 -1
  30. package/build/components/post-list/index.js +3 -3
  31. package/build/components/post-list/index.js.map +1 -1
  32. package/build/components/posts-app/index.js +3 -4
  33. package/build/components/posts-app/index.js.map +1 -1
  34. package/build/components/posts-app-routes/home.js +48 -0
  35. package/build/components/posts-app-routes/home.js.map +1 -0
  36. package/build/components/posts-app-routes/index.js +37 -0
  37. package/build/components/posts-app-routes/index.js.map +1 -0
  38. package/build/components/posts-app-routes/posts-edit.js +44 -0
  39. package/build/components/posts-app-routes/posts-edit.js.map +1 -0
  40. package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
  41. package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  42. package/build/components/posts-app-routes/posts-list-view.js +48 -0
  43. package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
  44. package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
  45. package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  46. package/build/components/posts-app-routes/posts-view.js +41 -0
  47. package/build/components/posts-app-routes/posts-view.js.map +1 -0
  48. package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
  49. package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  50. package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  51. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  52. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  53. package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
  55. package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  56. package/build/components/site-editor-routes/index.js +1 -2
  57. package/build/components/site-editor-routes/index.js.map +1 -1
  58. package/build/components/style-book/examples.js +24 -2
  59. package/build/components/style-book/examples.js.map +1 -1
  60. package/build/index.js +0 -9
  61. package/build/index.js.map +1 -1
  62. package/build/store/actions.js +13 -0
  63. package/build/store/actions.js.map +1 -1
  64. package/build/store/selectors.js +21 -1
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/add-new-template/utils.js +1 -2
  67. package/build-module/components/add-new-template/utils.js.map +1 -1
  68. package/build-module/components/app/index.js +0 -3
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
  71. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  72. package/build-module/components/editor/index.js +18 -27
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/editor/use-editor-title.js +13 -5
  75. package/build-module/components/editor/use-editor-title.js.map +1 -1
  76. package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
  77. package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
  78. package/build-module/components/editor-canvas-container/index.js +1 -1
  79. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  80. package/build-module/components/global-styles/block-preview-panel.js +8 -10
  81. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  82. package/build-module/components/global-styles/screen-block.js +18 -5
  83. package/build-module/components/global-styles/screen-block.js.map +1 -1
  84. package/build-module/components/global-styles/screen-style-variations.js +11 -5
  85. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  86. package/build-module/components/global-styles/ui.js +1 -1
  87. package/build-module/components/global-styles/ui.js.map +1 -1
  88. package/build-module/components/global-styles-sidebar/index.js +18 -2
  89. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  90. package/build-module/components/page-patterns/header.js +2 -2
  91. package/build-module/components/page-patterns/header.js.map +1 -1
  92. package/build-module/components/page-patterns/use-patterns.js +4 -8
  93. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  94. package/build-module/components/post-edit/index.js +9 -11
  95. package/build-module/components/post-edit/index.js.map +1 -1
  96. package/build-module/components/post-list/index.js +2 -2
  97. package/build-module/components/post-list/index.js.map +1 -1
  98. package/build-module/components/posts-app/index.js +3 -4
  99. package/build-module/components/posts-app/index.js.map +1 -1
  100. package/build-module/components/posts-app-routes/home.js +40 -0
  101. package/build-module/components/posts-app-routes/home.js.map +1 -0
  102. package/build-module/components/posts-app-routes/index.js +30 -0
  103. package/build-module/components/posts-app-routes/index.js.map +1 -0
  104. package/build-module/components/posts-app-routes/posts-edit.js +36 -0
  105. package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
  106. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
  107. package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
  108. package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
  109. package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
  110. package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
  111. package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
  112. package/build-module/components/posts-app-routes/posts-view.js +33 -0
  113. package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
  114. package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
  115. package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
  116. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
  117. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  118. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  119. package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
  120. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
  121. package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
  122. package/build-module/components/site-editor-routes/index.js +1 -2
  123. package/build-module/components/site-editor-routes/index.js.map +1 -1
  124. package/build-module/components/style-book/examples.js +24 -2
  125. package/build-module/components/style-book/examples.js.map +1 -1
  126. package/build-module/index.js +1 -10
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/store/actions.js +13 -0
  129. package/build-module/store/actions.js.map +1 -1
  130. package/build-module/store/selectors.js +21 -1
  131. package/build-module/store/selectors.js.map +1 -1
  132. package/build-style/posts-rtl.css +59 -18
  133. package/build-style/posts.css +59 -18
  134. package/build-style/style-rtl.css +74 -57
  135. package/build-style/style.css +74 -57
  136. package/package.json +38 -38
  137. package/src/components/add-new-template/utils.js +2 -2
  138. package/src/components/app/index.js +0 -3
  139. package/src/components/block-editor/use-site-editor-settings.js +7 -21
  140. package/src/components/editor/index.js +22 -33
  141. package/src/components/editor/use-editor-title.js +17 -4
  142. package/src/components/editor/use-resolve-edited-entity.js +132 -0
  143. package/src/components/editor-canvas-container/index.js +1 -1
  144. package/src/components/global-styles/block-preview-panel.js +10 -10
  145. package/src/components/global-styles/screen-block.js +26 -8
  146. package/src/components/global-styles/screen-style-variations.js +14 -5
  147. package/src/components/global-styles/ui.js +1 -1
  148. package/src/components/global-styles-sidebar/index.js +16 -2
  149. package/src/components/page-patterns/header.js +3 -2
  150. package/src/components/page-patterns/use-patterns.js +9 -7
  151. package/src/components/page-templates/style.scss +1 -0
  152. package/src/components/post-edit/index.js +10 -13
  153. package/src/components/post-list/index.js +1 -2
  154. package/src/components/posts-app/index.js +3 -4
  155. package/src/components/posts-app-routes/home.js +36 -0
  156. package/src/components/posts-app-routes/index.js +36 -0
  157. package/src/components/posts-app-routes/posts-edit.js +31 -0
  158. package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
  159. package/src/components/posts-app-routes/posts-list-view.js +40 -0
  160. package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
  161. package/src/components/posts-app-routes/posts-view.js +35 -0
  162. package/src/components/sidebar-navigation-screen/style.scss +7 -2
  163. package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
  164. package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
  165. package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
  166. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
  167. package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
  168. package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
  169. package/src/components/site-editor-routes/README.md +2 -2
  170. package/src/components/site-editor-routes/index.js +0 -2
  171. package/src/components/site-hub/style.scss +1 -1
  172. package/src/components/style-book/examples.tsx +24 -2
  173. package/src/index.js +1 -13
  174. package/src/store/actions.js +15 -0
  175. package/src/store/selectors.js +24 -1
  176. package/src/style.scss +0 -2
  177. package/build/components/post-fields/index.js +0 -96
  178. package/build/components/post-fields/index.js.map +0 -1
  179. package/build/components/posts-app/router.js +0 -85
  180. package/build/components/posts-app/router.js.map +0 -1
  181. package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
  182. package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  183. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
  184. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  185. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
  186. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  187. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
  188. package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  189. package/build/components/site-editor-routes/styles-edit.js +0 -33
  190. package/build/components/site-editor-routes/styles-edit.js.map +0 -1
  191. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
  192. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  193. package/build-module/components/post-fields/index.js +0 -88
  194. package/build-module/components/post-fields/index.js.map +0 -1
  195. package/build-module/components/posts-app/router.js +0 -77
  196. package/build-module/components/posts-app/router.js.map +0 -1
  197. package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
  198. package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
  199. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  200. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
  201. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
  202. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
  203. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  204. package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
  205. package/build-module/components/site-editor-routes/styles-edit.js +0 -25
  206. package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
  207. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
  208. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
  209. package/src/components/post-fields/index.js +0 -107
  210. package/src/components/post-fields/style.scss +0 -3
  211. package/src/components/posts-app/router.js +0 -69
  212. package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
  213. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
  214. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
  215. package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
  216. package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
  217. package/src/components/site-editor-routes/styles-edit.js +0 -26
  218. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
  219. package/src/store/test/actions.js +0 -83
  220. package/src/store/test/reducer.js +0 -69
  221. package/src/store/test/selectors.js +0 -41
@@ -8,10 +8,11 @@ exports.default = void 0;
8
8
  var _i18n = require("@wordpress/i18n");
9
9
  var _data = require("@wordpress/data");
10
10
  var _coreData = require("@wordpress/core-data");
11
- var _editor = require("@wordpress/editor");
12
11
  var _htmlEntities = require("@wordpress/html-entities");
12
+ var _editor = require("@wordpress/editor");
13
13
  var _useTitle = _interopRequireDefault(require("../routes/use-title"));
14
14
  var _constants = require("../../utils/constants");
15
+ var _lockUnlock = require("../../lock-unlock");
15
16
  /**
16
17
  * WordPress dependencies
17
18
  */
@@ -20,21 +21,28 @@ var _constants = require("../../utils/constants");
20
21
  * Internal dependencies
21
22
  */
22
23
 
24
+ const {
25
+ getTemplateInfo
26
+ } = (0, _lockUnlock.unlock)(_editor.privateApis);
23
27
  function useEditorTitle(postType, postId) {
24
28
  const {
25
29
  title,
26
30
  isLoaded
27
31
  } = (0, _data.useSelect)(select => {
32
+ var _select$getEntityReco;
28
33
  const {
29
34
  getEditedEntityRecord,
30
35
  hasFinishedResolution
31
36
  } = select(_coreData.store);
32
- const {
33
- __experimentalGetTemplateInfo: getTemplateInfo
34
- } = select(_editor.store);
35
37
  const _record = getEditedEntityRecord('postType', postType, postId);
38
+ const {
39
+ default_template_types: templateTypes = []
40
+ } = (_select$getEntityReco = select(_coreData.store).getEntityRecord('root', '__unstableBase')) !== null && _select$getEntityReco !== void 0 ? _select$getEntityReco : {};
41
+ const templateInfo = getTemplateInfo({
42
+ template: _record,
43
+ templateTypes
44
+ });
36
45
  const _isLoaded = hasFinishedResolution('getEditedEntityRecord', ['postType', postType, postId]);
37
- const templateInfo = getTemplateInfo(_record);
38
46
  return {
39
47
  title: templateInfo.title,
40
48
  isLoaded: _isLoaded
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_data","_coreData","_editor","_htmlEntities","_useTitle","_interopRequireDefault","_constants","useEditorTitle","postType","postId","title","isLoaded","useSelect","select","getEditedEntityRecord","hasFinishedResolution","coreStore","__experimentalGetTemplateInfo","getTemplateInfo","editorStore","_record","_isLoaded","templateInfo","editorTitle","_POST_TYPE_LABELS$pos","sprintf","_x","decodeEntities","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useTitle","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAKA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AAc","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_data","_coreData","_htmlEntities","_editor","_useTitle","_interopRequireDefault","_constants","_lockUnlock","getTemplateInfo","unlock","editorPrivateApis","useEditorTitle","postType","postId","title","isLoaded","useSelect","select","_select$getEntityReco","getEditedEntityRecord","hasFinishedResolution","coreStore","_record","default_template_types","templateTypes","getEntityRecord","templateInfo","template","_isLoaded","editorTitle","_POST_TYPE_LABELS$pos","sprintf","_x","decodeEntities","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","useTitle","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor/use-editor-title.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useTitle from '../routes/use-title';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\n\nconst { getTemplateInfo } = unlock( editorPrivateApis );\n\nfunction useEditorTitle( postType, postId ) {\n\tconst { title, isLoaded } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\tconst { default_template_types: templateTypes = [] } =\n\t\t\t\tselect( coreStore ).getEntityRecord(\n\t\t\t\t\t'root',\n\t\t\t\t\t'__unstableBase'\n\t\t\t\t) ?? {};\n\n\t\t\tconst templateInfo = getTemplateInfo( {\n\t\t\t\ttemplate: _record,\n\t\t\t\ttemplateTypes,\n\t\t\t} );\n\n\t\t\tconst _isLoaded = hasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\n\t\t\treturn {\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tlet editorTitle;\n\tif ( isLoaded ) {\n\t\teditorTitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. 1: title of template being edited, 2: type of template (Template or Template Part).\n\t\t\t_x( '%1$s ‹ %2$s', 'breadcrumb trail' ),\n\t\t\tdecodeEntities( title ),\n\t\t\tPOST_TYPE_LABELS[ postType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( isLoaded && editorTitle );\n}\n\nexport default useEditorTitle;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,SAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAdA;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAM;EAAES;AAAgB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEvD,SAASC,cAAcA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EAC3C,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAClCC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACb,MAAM;MAAEC,qBAAqB;MAAEC;IAAsB,CAAC,GACrDH,MAAM,CAAEI,eAAU,CAAC;IAEpB,MAAMC,OAAO,GAAGH,qBAAqB,CACpC,UAAU,EACVP,QAAQ,EACRC,MACD,CAAC;IAED,MAAM;MAAEU,sBAAsB,EAAEC,aAAa,GAAG;IAAG,CAAC,IAAAN,qBAAA,GACnDD,MAAM,CAAEI,eAAU,CAAC,CAACI,eAAe,CAClC,MAAM,EACN,gBACD,CAAC,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC;IAER,MAAMQ,YAAY,GAAGlB,eAAe,CAAE;MACrCmB,QAAQ,EAAEL,OAAO;MACjBE;IACD,CAAE,CAAC;IAEH,MAAMI,SAAS,GAAGR,qBAAqB,CAAE,uBAAuB,EAAE,CACjE,UAAU,EACVR,QAAQ,EACRC,MAAM,CACL,CAAC;IAEH,OAAO;MACNC,KAAK,EAAEY,YAAY,CAACZ,KAAK;MACzBC,QAAQ,EAAEa;IACX,CAAC;EACF,CAAC,EACD,CAAEhB,QAAQ,EAAEC,MAAM,CACnB,CAAC;EAED,IAAIgB,WAAW;EACf,IAAKd,QAAQ,EAAG;IAAA,IAAAe,qBAAA;IACfD,WAAW,GAAG,IAAAE,aAAO;IACpB;IACA,IAAAC,QAAE,EAAE,aAAa,EAAE,kBAAmB,CAAC,EACvC,IAAAC,4BAAc,EAAEnB,KAAM,CAAC,GAAAgB,qBAAA,GACvBI,2BAAgB,CAAEtB,QAAQ,CAAE,cAAAkB,qBAAA,cAAAA,qBAAA,GAC3BI,2BAAgB,CAAEC,6BAAkB,CACtC,CAAC;EACF;;EAEA;EACA;EACA,IAAAC,iBAAQ,EAAErB,QAAQ,IAAIc,WAAY,CAAC;AACpC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc5B,cAAc","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useResolveEditedEntity = useResolveEditedEntity;
7
+ exports.useSyncDeprecatedEntityIntoState = useSyncDeprecatedEntityIntoState;
8
+ var _element = require("@wordpress/element");
9
+ var _data = require("@wordpress/data");
10
+ var _coreData = require("@wordpress/core-data");
11
+ var _router = require("@wordpress/router");
12
+ var _store = require("../../store");
13
+ var _lockUnlock = require("../../lock-unlock");
14
+ var _constants = require("../../utils/constants");
15
+ /**
16
+ * WordPress dependencies
17
+ */
18
+
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+
23
+ const {
24
+ useLocation
25
+ } = (0, _lockUnlock.unlock)(_router.privateApis);
26
+ const postTypesWithoutParentTemplate = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.NAVIGATION_POST_TYPE, _constants.PATTERN_TYPES.user];
27
+ const authorizedPostTypes = ['page', 'post'];
28
+ function useResolveEditedEntity() {
29
+ const {
30
+ params = {}
31
+ } = useLocation();
32
+ const {
33
+ postId,
34
+ postType
35
+ } = params;
36
+ const homePage = (0, _data.useSelect)(select => {
37
+ const {
38
+ getHomePage
39
+ } = (0, _lockUnlock.unlock)(select(_coreData.store));
40
+ return getHomePage();
41
+ }, []);
42
+
43
+ /**
44
+ * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId
45
+ * in order to match the frontend as closely as possible in the site editor.
46
+ *
47
+ * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.
48
+ */
49
+ const resolvedTemplateId = (0, _data.useSelect)(select => {
50
+ // If we're rendering a post type that doesn't have a template
51
+ // no need to resolve its template.
52
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
53
+ return;
54
+ }
55
+
56
+ // Don't trigger resolution for multi-selected posts.
57
+ if (postId && postId.includes(',')) {
58
+ return;
59
+ }
60
+ const {
61
+ getTemplateId
62
+ } = (0, _lockUnlock.unlock)(select(_coreData.store));
63
+
64
+ // If we're rendering a specific page, we need to resolve its template.
65
+ // The site editor only supports pages for now, not other CPTs.
66
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
67
+ return getTemplateId(postType, postId);
68
+ }
69
+
70
+ // If we're rendering the home page, and we have a static home page, resolve its template.
71
+ if (homePage?.postType === 'page') {
72
+ return getTemplateId('page', homePage?.postId);
73
+ }
74
+ if (homePage?.postType === 'wp_template') {
75
+ return homePage?.postId;
76
+ }
77
+ }, [homePage, postId, postType]);
78
+ const context = (0, _element.useMemo)(() => {
79
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
80
+ return {};
81
+ }
82
+ if (postType && postId && authorizedPostTypes.includes(postType)) {
83
+ return {
84
+ postType,
85
+ postId
86
+ };
87
+ }
88
+ // TODO: for post types lists we should probably not render the front page, but maybe a placeholder
89
+ // with a message like "Select a page" or something similar.
90
+ if (homePage?.postType === 'page') {
91
+ return {
92
+ postType: 'page',
93
+ postId: homePage?.postId
94
+ };
95
+ }
96
+ return {};
97
+ }, [homePage, postType, postId]);
98
+ if (postTypesWithoutParentTemplate.includes(postType) && postId) {
99
+ return {
100
+ isReady: true,
101
+ postType,
102
+ postId,
103
+ context
104
+ };
105
+ }
106
+ if (!!homePage) {
107
+ return {
108
+ isReady: resolvedTemplateId !== undefined,
109
+ postType: _constants.TEMPLATE_POST_TYPE,
110
+ postId: resolvedTemplateId,
111
+ context
112
+ };
113
+ }
114
+ return {
115
+ isReady: false
116
+ };
117
+ }
118
+ function useSyncDeprecatedEntityIntoState({
119
+ postType,
120
+ postId,
121
+ context,
122
+ isReady
123
+ }) {
124
+ const {
125
+ setEditedEntity
126
+ } = (0, _data.useDispatch)(_store.store);
127
+ (0, _element.useEffect)(() => {
128
+ if (isReady) {
129
+ setEditedEntity(postType, postId, context);
130
+ }
131
+ }, [isReady, postType, postId, context, setEditedEntity]);
132
+ }
133
+ //# sourceMappingURL=use-resolve-edited-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_data","_coreData","_router","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","postTypesWithoutParentTemplate","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","user","authorizedPostTypes","useResolveEditedEntity","params","postId","postType","homePage","useSelect","select","getHomePage","coreDataStore","resolvedTemplateId","includes","getTemplateId","context","useMemo","isReady","undefined","useSyncDeprecatedEntityIntoState","setEditedEntity","useDispatch","editSiteStore","useEffect"],"sources":["@wordpress/edit-site/src/components/editor/use-resolve-edited-entity.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nconst authorizedPostTypes = [ 'page', 'post' ];\n\nexport function useResolveEditedEntity() {\n\tconst { params = {} } = useLocation();\n\tconst { postId, postType } = params;\n\tconst homePage = useSelect( ( select ) => {\n\t\tconst { getHomePage } = unlock( select( coreDataStore ) );\n\t\treturn getHomePage();\n\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif (\n\t\t\t\tpostTypesWithoutParentTemplate.includes( postType ) &&\n\t\t\t\tpostId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Don't trigger resolution for multi-selected posts.\n\t\t\tif ( postId && postId.includes( ',' ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { getTemplateId } = unlock( select( coreDataStore ) );\n\n\t\t\t// If we're rendering a specific page, we need to resolve its template.\n\t\t\t// The site editor only supports pages for now, not other CPTs.\n\t\t\tif (\n\t\t\t\tpostType &&\n\t\t\t\tpostId &&\n\t\t\t\tauthorizedPostTypes.includes( postType )\n\t\t\t) {\n\t\t\t\treturn getTemplateId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homePage?.postType === 'page' ) {\n\t\t\t\treturn getTemplateId( 'page', homePage?.postId );\n\t\t\t}\n\n\t\t\tif ( homePage?.postType === 'wp_template' ) {\n\t\t\t\treturn homePage?.postId;\n\t\t\t}\n\t\t},\n\t\t[ homePage, postId, postType ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId && authorizedPostTypes.includes( postType ) ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\t\t// TODO: for post types lists we should probably not render the front page, but maybe a placeholder\n\t\t// with a message like \"Select a page\" or something similar.\n\t\tif ( homePage?.postType === 'page' ) {\n\t\t\treturn { postType: 'page', postId: homePage?.postId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homePage, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) && postId ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( !! homePage ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport function useSyncDeprecatedEntityIntoState( {\n\tpostType,\n\tpostId,\n\tcontext,\n\tisReady,\n} ) {\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AACA;;AAUA,MAAM;EAAEO;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEnD,MAAMC,8BAA8B,GAAG,CACtCC,6BAAkB,EAClBC,kCAAuB,EACvBC,+BAAoB,EACpBC,wBAAa,CAACC,IAAI,CAClB;AAED,MAAMC,mBAAmB,GAAG,CAAE,MAAM,EAAE,MAAM,CAAE;AAEvC,SAASC,sBAAsBA,CAAA,EAAG;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGX,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEY,MAAM;IAAEC;EAAS,CAAC,GAAGF,MAAM;EACnC,MAAMG,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAY,CAAC,GAAG,IAAAhB,kBAAM,EAAEe,MAAM,CAAEE,eAAc,CAAE,CAAC;IACzD,OAAOD,WAAW,CAAC,CAAC;EACrB,CAAC,EAAE,EAAG,CAAC;;EAEP;AACD;AACA;AACA;AACA;AACA;EACC,MAAME,kBAAkB,GAAG,IAAAJ,eAAS,EACjCC,MAAM,IAAM;IACb;IACA;IACA,IACCb,8BAA8B,CAACiB,QAAQ,CAAEP,QAAS,CAAC,IACnDD,MAAM,EACL;MACD;IACD;;IAEA;I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,OAAO;MAAEY,OAAO,EAAE,IAAI;MAAEX,QAAQ;MAAED,MAAM;MAAEU;IAAQ,CAAC;EACpD;EAEA,IAAK,CAAC,CAAER,QAAQ,EAAG;IAClB,OAAO;MACNU,OAAO,EAAEL,kBAAkB,KAAKM,SAAS;MACzCZ,QAAQ,EAAET,6BAAkB;MAC5BQ,MAAM,EAAEO,kBAAkB;MAC1BG;IACD,CAAC;EACF;EAEA,OAAO;IAAEE,OAAO,EAAE;EAAM,CAAC;AAC1B;AAEO,SAASE,gCAAgCA,CAAE;EACjDb,QAAQ;EACRD,MAAM;EACNU,OAAO;EACPE;AACD,CAAC,EAAG;EACH,MAAM;IAAEG;EAAgB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAc,CAAC;EAExD,IAAAC,kBAAS,EAAE,MAAM;IAChB,IAAKN,OAAO,EAAG;MACdG,eAAe,CAAEd,QAAQ,EAAED,MAAM,EAAEU,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEE,OAAO,EAAEX,QAAQ,EAAED,MAAM,EAAEU,OAAO,EAAEK,eAAe,CAAG,CAAC;AAC7D","ignoreList":[]}
@@ -122,7 +122,7 @@ function EditorCanvasContainer({
122
122
  });
123
123
  }
124
124
  function useHasEditorCanvasContainer() {
125
- const fills = (0, _components.__experimentalUseSlotFills)(EditorContentSlotFill.privateKey);
125
+ const fills = (0, _components.__experimentalUseSlotFills)(EditorContentSlotFill.name);
126
126
  return !!fills?.length;
127
127
  }
128
128
  var _default = exports.default = EditorCanvasContainer;
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_jsxRuntime","EditorContentSlotFill","ResizableEditor","unlock","editorPrivateApis","getEditorCanvasContainerTitle","view","__","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","title","shouldShowCloseButton","jsx","Fill","className","jsxs","onKeyDown","Button","size","icon","closeSmall","label","onClick","useHasEditorCanvasContainer","fills","useSlotFills","privateKey","length","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst title = getEditorCanvasContainerTitle( editorCanvasContainerView );\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorContentSlotFill.Fill>\n\t\t\t<div className=\"edit-site-editor-canvas-container\">\n\t\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t\t<section\n\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__section\"\n\t\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t\t</section>\n\t\t\t\t</ResizableEditor>\n\t\t\t</div>\n\t\t</EditorContentSlotFill.Fill>\n\t);\n}\n\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( EditorContentSlotFill.privateKey );\n\treturn !! fills?.length;\n}\n\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAQA,IAAAS,WAAA,GAAAT,OAAA;AAC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nD,eAAe;QAACU,cAAc,EAAGA,cAAgB;QAAAH,QAAA,eAEjD,IAAAT,WAAA,CAAAwD,IAAA;UACCD,SAAS,EAAC,4CAA4C;UACtDL,GAAG,EAAGE,qBAAqB,GAAGtB,eAAe,GAAG,IAAM;UACtD2B,SAAS,EAAGrB,aAAe;UAC3B,cAAae,KAAO;UAAA1C,QAAA,GAElB2C,qBAAqB,iBACtB,IAAApD,WAAA,CAAAqD,GAAA,EAAC/D,WAAA,CAAAoE,MAAM;YACNC,IAAI,EAAC,SAAS;YACdJ,SAAS,EAAC,iDAAiD;YAC3DK,IAAI,EAAGC,iBAAY;YACnBC,KAAK,EAAGpD,gBAAgB,IAAI,IAAAH,QAAE,EAAE,OAAQ,CAAG;YAC3CwD,OAAO,EAAG7B;UAAkB,CAC5B,CACD,EACCQ,iBAAiB;QAAA,CACX;MAAC,CACM;IAAC,CACd;EAAC,CACqB,CAAC;AAE/B;AAEA,SAASsB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEjE,qBAAqB,CAACkE,UAAW,CAAC;EAC9D,OAAO,CAAC,CAAEF,KAAK,EAAEG,MAAM;AACxB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/D,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_components","_keycodes","_i18n","_data","_icons","_compose","_preferences","_editor","_lockUnlock","_store","_jsxRuntime","EditorContentSlotFill","ResizableEditor","unlock","editorPrivateApis","getEditorCanvasContainerTitle","view","__","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","useSelect","select","_editorCanvasContainerView","editSiteStore","getEditorCanvasContainerView","_showListViewByDefault","preferencesStore","get","isClosed","setIsClosed","useState","setEditorCanvasContainerView","useDispatch","setIsListViewOpened","editorStore","focusOnMountRef","useFocusOnMount","sectionFocusReturnRef","useFocusReturn","onCloseContainer","undefined","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","Children","map","child","index","cloneElement","ref","title","shouldShowCloseButton","jsx","Fill","className","jsxs","onKeyDown","Button","size","icon","closeSmall","label","onClick","useHasEditorCanvasContainer","fills","useSlotFills","name","length","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nconst { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst title = getEditorCanvasContainerTitle( editorCanvasContainerView );\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorContentSlotFill.Fill>\n\t\t\t<div className=\"edit-site-editor-canvas-container\">\n\t\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t\t<section\n\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__section\"\n\t\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t\t</section>\n\t\t\t\t</ResizableEditor>\n\t\t\t</div>\n\t\t</EditorContentSlotFill.Fill>\n\t);\n}\n\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( EditorContentSlotFill.name );\n\treturn !! fills?.length;\n}\n\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAQA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAAqD,IAAAW,WAAA,GAAAX,OAAA;AAvBrD;AACA;AACA;;AAiBA;AACA;AACA;;AAIA,MAAM;EAAEY,qBAAqB;EAAEC;AAAgB,CAAC,GAAG,IAA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G,IAAM;UACtD2B,SAAS,EAAGrB,aAAe;UAC3B,cAAae,KAAO;UAAA1C,QAAA,GAElB2C,qBAAqB,iBACtB,IAAApD,WAAA,CAAAqD,GAAA,EAAC/D,WAAA,CAAAoE,MAAM;YACNC,IAAI,EAAC,SAAS;YACdJ,SAAS,EAAC,iDAAiD;YAC3DK,IAAI,EAAGC,iBAAY;YACnBC,KAAK,EAAGpD,gBAAgB,IAAI,IAAAH,QAAE,EAAE,OAAQ,CAAG;YAC3CwD,OAAO,EAAG7B;UAAkB,CAC5B,CACD,EACCQ,iBAAiB;QAAA,CACX;MAAC,CACM;IAAC,CACd;EAAC,CACqB,CAAC;AAE/B;AAEA,SAASsB,2BAA2BA,CAAA,EAAG;EACtC,MAAMC,KAAK,GAAG,IAAAC,sCAAY,EAAEjE,qBAAqB,CAACkE,IAAK,CAAC;EACxD,OAAO,CAAC,CAAEF,KAAK,EAAEG,MAAM;AACxB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/D,qBAAqB","ignoreList":[]}
@@ -28,16 +28,14 @@ const BlockPreviewPanel = ({
28
28
  if (!blockExample) {
29
29
  return null;
30
30
  }
31
- let example = blockExample;
32
- if (variation) {
33
- example = {
34
- ...example,
35
- attributes: {
36
- ...example.attributes,
37
- className: (0, _utils.getVariationClassName)(variation)
38
- }
39
- };
40
- }
31
+ const example = {
32
+ ...blockExample,
33
+ attributes: {
34
+ ...blockExample.attributes,
35
+ style: undefined,
36
+ className: variation ? (0, _utils.getVariationClassName)(variation) : blockExample.attributes?.className
37
+ }
38
+ };
41
39
  return (0, _blocks.getBlockFromExample)(name, example);
42
40
  }, [name, blockExample, variation]);
43
41
  const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : 500;
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_blocks","_components","_element","_utils","_jsxRuntime","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","getBlockType","example","blocks","useMemo","attributes","className","getVariationClassName","getBlockFromExample","viewportWidth","previewHeight","sidebarWidth","scale","minHeight","jsx","__experimentalSpacer","marginX","marginBottom","children","style","maxHeight","boxSizing","BlockPreview","additionalStyles","css","Math","round","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getVariationClassName } from './utils';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet example = blockExample;\n\t\tif ( variation ) {\n\t\t\texample = {\n\t\t\t\t...example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...example.attributes,\n\t\t\t\t\tclassName: getVariationClassName( variation ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? 500;\n\t// Same as height of InserterPreviewPanel.\n\tconst previewHeight = 144;\n\tconst sidebarWidth = 235;\n\tconst scale = sidebarWidth / viewportWidth;\n\tconst minHeight =\n\t\tscale !== 0 && scale < 1 && previewHeight\n\t\t\t? previewHeight / scale\n\t\t\t: previewHeight;\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={\n\t\t\t\t\t\t//We want this CSS to be in sync with the one in InserterPreviewPanel.\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${ Math.round( minHeight ) }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\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</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAXhD;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,iBAAiB,GAAGA,CAAE;EAAEC,IAAI;EAAEC,SAAS,GAAG;AAAG,CAAC,KAAM;EAAA,IAAAC,qBAAA;EACzD,MAAMC,YAAY,GAAG,IAAAC,oBAAY,EAAEJ,IAAK,CAAC,EAAEK,OAAO;EAClD,MAAMC,MAAM,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC7B,IAAK,CAAEJ,YAAY,EAAG;MACrB,OAAO,IAAI;IACZ;IAEA,IAAIE,OAAO,GAAGF,YAAY;IAC1B,IAAKF,SAAS,EAAG;MAChBI,OAAO,GAAG;QACT,GAAGA,OAAO;QACVG,U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E;EAAC,CACC,CAAC;AAEX,CAAC;AAAC,IAAAc,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEajC,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_blocks","_components","_element","_utils","_jsxRuntime","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","getBlockType","example","blocks","useMemo","attributes","style","undefined","className","getVariationClassName","getBlockFromExample","viewportWidth","previewHeight","sidebarWidth","scale","minHeight","jsx","__experimentalSpacer","marginX","marginBottom","children","maxHeight","boxSizing","BlockPreview","additionalStyles","css","Math","round","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getVariationClassName } from './utils';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst example = {\n\t\t\t...blockExample,\n\t\t\tattributes: {\n\t\t\t\t...blockExample.attributes,\n\t\t\t\tstyle: undefined,\n\t\t\t\tclassName: variation\n\t\t\t\t\t? getVariationClassName( variation )\n\t\t\t\t\t: blockExample.attributes?.className,\n\t\t\t},\n\t\t};\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? 500;\n\t// Same as height of InserterPreviewPanel.\n\tconst previewHeight = 144;\n\tconst sidebarWidth = 235;\n\tconst scale = sidebarWidth / viewportWidth;\n\tconst minHeight =\n\t\tscale !== 0 && scale < 1 && previewHeight\n\t\t\t? previewHeight / scale\n\t\t\t: previewHeight;\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={\n\t\t\t\t\t\t//We want this CSS to be in sync with the one in InserterPreviewPanel.\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tpadding: 24px;\n\t\t\t\t\t\t\t\t\tmin-height:${ Math.round( minHeight ) }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;\n\t\t\t\t\t\t\t\t\talign-items:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t.is-root-container { width: 100%; }\n\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</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAgD,IAAAK,WAAA,GAAAL,OAAA;AAXhD;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAMM,iBAAiB,GAAGA,CAAE;EAAEC,IAAI;EAAEC,SAAS,GAAG;AAAG,CAAC,KAAM;EAAA,IAAAC,qBAAA;EACzD,MAAMC,YAAY,GAAG,IAAAC,oBAAY,EAAEJ,IAAK,CAAC,EAAEK,OA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AAM,EAAGA,MAAQ;QACjBQ,aAAa,EAAGA,aAAe;QAC/BI,SAAS,EAAGH,aAAe;QAC3BY,gBAAgB;QACf;QACA,CACC;UACCC,GAAG,EAAE;AACb;AACA;AACA,sBAAuBC,IAAI,CAACC,KAAK,CAAEZ,SAAU,CAAC;AAC9C;AACA;AACA;AACA;AACA;QACO,CAAC;MAEF,CACD;IAAC,CACE;EAAC,CACC,CAAC;AAEX,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEalC,iBAAiB","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -98,12 +99,13 @@ function ScreenBlock({
98
99
  });
99
100
  const [userSettings] = useGlobalSetting('', name, 'user');
100
101
  const [rawSettings, setSettings] = useGlobalSetting('', name);
101
- const settings = useSettingsForBlockElement(rawSettings, name);
102
+ const settingsForBlockElement = useSettingsForBlockElement(rawSettings, name);
102
103
  const blockType = (0, _blocks.getBlockType)(name);
103
104
 
104
105
  // Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
105
- if (settings?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.__experimentalSkipSerialization === true || blockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) {
106
- settings.spacing.blockGap = false;
106
+ let disableBlockGap = false;
107
+ if (settingsForBlockElement?.spacing?.blockGap && blockType?.supports?.spacing?.blockGap && (blockType?.supports?.spacing?.skipSerialization === true || blockType?.supports?.spacing?.skipSerialization?.some?.(spacingType => spacingType === 'blockGap'))) {
108
+ disableBlockGap = true;
107
109
  }
108
110
 
109
111
  // Only allow `aspectRatio` support if the block is not the grouping block.
@@ -112,9 +114,20 @@ function ScreenBlock({
112
114
  // for all three at once. Until there is the ability to set a different aspect
113
115
  // ratio for each variation, we disable the aspect ratio controls for the
114
116
  // grouping block in global styles.
115
- if (settings?.dimensions?.aspectRatio && name === 'core/group') {
116
- settings.dimensions.aspectRatio = false;
117
+ let disableAspectRatio = false;
118
+ if (settingsForBlockElement?.dimensions?.aspectRatio && name === 'core/group') {
119
+ disableAspectRatio = true;
117
120
  }
121
+ const settings = (0, _element.useMemo)(() => {
122
+ const updatedSettings = structuredClone(settingsForBlockElement);
123
+ if (disableBlockGap) {
124
+ updatedSettings.spacing.blockGap = false;
125
+ }
126
+ if (disableAspectRatio) {
127
+ updatedSettings.dimensions.aspectRatio = false;
128
+ }
129
+ return updatedSettings;
130
+ }, [settingsForBlockElement, disableBlockGap, disableAspectRatio]);
118
131
  const blockVariations = (0, _variationsPanel.useBlockVariations)(name);
119
132
  const hasBackgroundPanel = useHasBackgroundPanel(settings);
120
133
  const hasTypographyPanel = useHasTypographyPanel(settings);
@@ -1 +1 @@
1
- {"version":3,"names":["_blocks","require","_blockEditor","_element","_data","_coreData","_components","_i18n","_header","_interopRequireDefault","_blockPreviewPanel","_lockUnlock","_subtitle","_variationsPanel","_jsxRuntime","BACKGROUND_BLOCK_DEFAULT_VALUES","backgroundSize","backgroundPosition","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","hasSplitBorders","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","useHasBackgroundPanel","BackgroundPanel","StylesBackgroundPanel","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","unlock","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settings","blockType","getBlockType","spacing","blockGap","supports","__experimentalSkipSerialization","some","spacingType","dimensions","aspectRatio","blockVariations","useBlockVariations","hasBackgroundPanel","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","useSelect","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","useMemo","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","jsxs","Fragment","children","jsx","default","title","label","className","__experimentalVStack","__","VariationsPanel","inheritedValue","value","onChange","defaultValues","includeLayoutControls","PanelBody","initialOpen","sprintf","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\n\n// Initial control values.\nconst BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tuseHasBackgroundPanel,\n\tBackgroundPanel: StylesBackgroundPanel,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settings = useSettingsForBlockElement( rawSettings, name );\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tif (\n\t\tsettings?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.__experimentalSkipSerialization ===\n\t\t\ttrue ||\n\t\t\tblockType?.supports?.spacing?.__experimentalSkipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tsettings.spacing.blockGap = false;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tif ( settings?.dimensions?.aspectRatio && name === 'core/group' ) {\n\t\tsettings.dimensions.aspectRatio = false;\n\t}\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle?.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBackgroundPanel && (\n\t\t\t\t<StylesBackgroundPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,gBAAA,GAAAZ,OAAA;AAGuC,IAAAa,WAAA,GAAAb,OAAA;AAzBvC;AACA;AACA;;AAaA;AACA;AACA;;AAUA;AACA,MAAMc,+BAA+B,GAAG;EACvCC,cAAc,EAAE,OAAO;EACvBC,kBAAkB,EAAE,SAAS,CAAE;AAChC,CAAC;AAED,SAASC,kBAAkBA,CAAEC,MAAM,EAAG;EACrC,IAAK,CAAEA,MAAM,EAAG;IACf,OAAOA,MAAM;EACd;EAEA,MAAMC,eAAe,GAAGD,MAAM,CAACE,KAAK,IAAIF,MAAM,CAACG,KAAK;EAEpD,IAAK,CAAEH,MAAM,CAACI,KAAK,IAAIH,eAAe,EAAG;IACxC,OAAO;MAAE,GAAGD,MAAM;MAAEI,K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GjE,QAAU;MACrBI,QAAQ,EAAGA,QAAU;MACrB+D,qBAAqB;IAAA,CACrB,CACD,EACC5C,qBAAqB,iBACtB,IAAA5E,WAAA,CAAA4G,GAAA,EAACrE,kBAAkB;MAClB+E,QAAQ,EAAGpB,gBAAkB;MAC7BmB,KAAK,EAAG/D,YAAc;MACtB8D,cAAc,EAAG3D;IAAU,CAC3B,CACD,EAECsB,UAAU,iBACX,IAAA/E,WAAA,CAAAyG,IAAA,EAACjH,WAAA,CAAAiI,SAAS;MAACX,KAAK,EAAG,IAAAI,QAAE,EAAE,UAAW,CAAG;MAACQ,WAAW,EAAG,KAAO;MAAAf,QAAA,gBAC1D,IAAA3G,WAAA,CAAA4G,GAAA;QAAAD,QAAA,EACG,IAAAgB,aAAO;QACR;QACA,IAAAT,QAAE,EACD,2IACD,CAAC,EACDxD,SAAS,EAAEoD,KACZ;MAAC,CACC,CAAC,eACJ,IAAA9G,WAAA,CAAA4G,GAAA,EAACnE,mBAAmB;QACnB4E,KAAK,EAAG5G,KAAO;QACf6G,QAAQ,EAAGjE,QAAU;QACrB+D,cAAc,EAAGhE;MAAgB,CACjC,CAAC;IAAA,CACQ,CACX;EAAA,CACA,CAAC;AAEL;AAAC,IAAAwE,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEcjE,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["_blocks","require","_blockEditor","_element","_data","_coreData","_components","_i18n","_header","_interopRequireDefault","_blockPreviewPanel","_lockUnlock","_subtitle","_variationsPanel","_jsxRuntime","BACKGROUND_BLOCK_DEFAULT_VALUES","backgroundSize","backgroundPosition","applyFallbackStyle","border","hasColorOrWidth","color","width","style","undefined","applyAllFallbackStyles","hasSplitBorders","top","right","bottom","left","useHasDimensionsPanel","useHasTypographyPanel","useHasBorderPanel","useGlobalSetting","useSettingsForBlockElement","useHasColorPanel","useHasFiltersPanel","useHasImageSettingsPanel","useGlobalStyle","useHasBackgroundPanel","BackgroundPanel","StylesBackgroundPanel","BorderPanel","StylesBorderPanel","ColorPanel","StylesColorPanel","TypographyPanel","StylesTypographyPanel","DimensionsPanel","StylesDimensionsPanel","FiltersPanel","StylesFiltersPanel","ImageSettingsPanel","AdvancedPanel","StylesAdvancedPanel","unlock","blockEditorPrivateApis","ScreenBlock","name","variation","prefixParts","concat","prefix","join","shouldDecodeEncode","inheritedStyle","setStyle","userSettings","rawSettings","setSettings","settingsForBlockElement","blockType","getBlockType","disableBlockGap","spacing","blockGap","supports","skipSerialization","some","spacingType","disableAspectRatio","dimensions","aspectRatio","settings","useMemo","updatedSettings","structuredClone","blockVariations","useBlockVariations","hasBackgroundPanel","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasDimensionsPanel","hasFiltersPanel","hasImageSettingsPanel","hasVariationsPanel","length","canEditCSS","useSelect","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","coreStore","globalStylesId","globalStyles","_links","currentBlockStyle","find","s","inheritedStyleWithLayout","layout","styleWithLayout","onChangeDimensions","newStyle","updatedStyle","onChangeLightbox","newSetting","lightbox","onChangeBorders","radius","newBorder","updatedBorder","jsxs","Fragment","children","jsx","default","title","label","className","__experimentalVStack","__","VariationsPanel","inheritedValue","value","onChange","defaultValues","includeLayoutControls","PanelBody","initialOpen","sprintf","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-block.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport BlockPreviewPanel from './block-preview-panel';\nimport { unlock } from '../../lock-unlock';\nimport Subtitle from './subtitle';\nimport {\n\tuseBlockVariations,\n\tVariationsPanel,\n} from './variations/variations-panel';\n\n// Initial control values.\nconst BACKGROUND_BLOCK_DEFAULT_VALUES = {\n\tbackgroundSize: 'cover',\n\tbackgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.\n};\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tconst hasColorOrWidth = border.color || border.width;\n\n\tif ( ! border.style && hasColorOrWidth ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\tif ( border.style && ! hasColorOrWidth ) {\n\t\treturn undefined;\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nconst {\n\tuseHasDimensionsPanel,\n\tuseHasTypographyPanel,\n\tuseHasBorderPanel,\n\tuseGlobalSetting,\n\tuseSettingsForBlockElement,\n\tuseHasColorPanel,\n\tuseHasFiltersPanel,\n\tuseHasImageSettingsPanel,\n\tuseGlobalStyle,\n\tuseHasBackgroundPanel,\n\tBackgroundPanel: StylesBackgroundPanel,\n\tBorderPanel: StylesBorderPanel,\n\tColorPanel: StylesColorPanel,\n\tTypographyPanel: StylesTypographyPanel,\n\tDimensionsPanel: StylesDimensionsPanel,\n\tFiltersPanel: StylesFiltersPanel,\n\tImageSettingsPanel,\n\tAdvancedPanel: StylesAdvancedPanel,\n} = unlock( blockEditorPrivateApis );\n\nfunction ScreenBlock( { name, variation } ) {\n\tlet prefixParts = [];\n\tif ( variation ) {\n\t\tprefixParts = [ 'variations', variation ].concat( prefixParts );\n\t}\n\tconst prefix = prefixParts.join( '.' );\n\n\tconst [ style ] = useGlobalStyle( prefix, name, 'user', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {\n\t\tshouldDecodeEncode: false,\n\t} );\n\tconst [ userSettings ] = useGlobalSetting( '', name, 'user' );\n\tconst [ rawSettings, setSettings ] = useGlobalSetting( '', name );\n\tconst settingsForBlockElement = useSettingsForBlockElement(\n\t\trawSettings,\n\t\tname\n\t);\n\tconst blockType = getBlockType( name );\n\n\t// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.\n\tlet disableBlockGap = false;\n\tif (\n\t\tsettingsForBlockElement?.spacing?.blockGap &&\n\t\tblockType?.supports?.spacing?.blockGap &&\n\t\t( blockType?.supports?.spacing?.skipSerialization === true ||\n\t\t\tblockType?.supports?.spacing?.skipSerialization?.some?.(\n\t\t\t\t( spacingType ) => spacingType === 'blockGap'\n\t\t\t) )\n\t) {\n\t\tdisableBlockGap = true;\n\t}\n\n\t// Only allow `aspectRatio` support if the block is not the grouping block.\n\t// The grouping block allows the user to use Group, Row and Stack variations,\n\t// and it is highly likely that the user will not want to set an aspect ratio\n\t// for all three at once. Until there is the ability to set a different aspect\n\t// ratio for each variation, we disable the aspect ratio controls for the\n\t// grouping block in global styles.\n\tlet disableAspectRatio = false;\n\tif (\n\t\tsettingsForBlockElement?.dimensions?.aspectRatio &&\n\t\tname === 'core/group'\n\t) {\n\t\tdisableAspectRatio = true;\n\t}\n\n\tconst settings = useMemo( () => {\n\t\tconst updatedSettings = structuredClone( settingsForBlockElement );\n\t\tif ( disableBlockGap ) {\n\t\t\tupdatedSettings.spacing.blockGap = false;\n\t\t}\n\t\tif ( disableAspectRatio ) {\n\t\t\tupdatedSettings.dimensions.aspectRatio = false;\n\t\t}\n\t\treturn updatedSettings;\n\t}, [ settingsForBlockElement, disableBlockGap, disableAspectRatio ] );\n\n\tconst blockVariations = useBlockVariations( name );\n\tconst hasBackgroundPanel = useHasBackgroundPanel( settings );\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( settings );\n\tconst hasBorderPanel = useHasBorderPanel( settings );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( settings );\n\tconst hasFiltersPanel = useHasFiltersPanel( settings );\n\tconst hasImageSettingsPanel = useHasImageSettingsPanel(\n\t\tname,\n\t\tuserSettings,\n\t\tsettings\n\t);\n\tconst hasVariationsPanel = !! blockVariations?.length && ! variation;\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS: !! globalStyles?._links?.[ 'wp:action-edit-css' ],\n\t\t};\n\t}, [] );\n\tconst currentBlockStyle = variation\n\t\t? blockVariations.find( ( s ) => s.name === variation )\n\t\t: null;\n\n\t// These intermediary objects are needed because the \"layout\" property is stored\n\t// in settings rather than styles.\n\tconst inheritedStyleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...inheritedStyle,\n\t\t\tlayout: settings.layout,\n\t\t};\n\t}, [ inheritedStyle, settings.layout ] );\n\tconst styleWithLayout = useMemo( () => {\n\t\treturn {\n\t\t\t...style,\n\t\t\tlayout: userSettings.layout,\n\t\t};\n\t}, [ style, userSettings.layout ] );\n\tconst onChangeDimensions = ( newStyle ) => {\n\t\tconst updatedStyle = { ...newStyle };\n\t\tdelete updatedStyle.layout;\n\t\tsetStyle( updatedStyle );\n\n\t\tif ( newStyle.layout !== userSettings.layout ) {\n\t\t\tsetSettings( {\n\t\t\t\t...userSettings,\n\t\t\t\tlayout: newStyle.layout,\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeLightbox = ( newSetting ) => {\n\t\t// If the newSetting is undefined, this means that the user has deselected\n\t\t// (reset) the lightbox setting.\n\t\tif ( newSetting === undefined ) {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: undefined,\n\t\t\t} );\n\n\t\t\t// Otherwise, we simply set the lightbox setting to the new value but\n\t\t\t// taking care of not overriding the other lightbox settings.\n\t\t} else {\n\t\t\tsetSettings( {\n\t\t\t\t...rawSettings,\n\t\t\t\tlightbox: {\n\t\t\t\t\t...rawSettings.lightbox,\n\t\t\t\t\t...newSetting,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t};\n\tconst onChangeBorders = ( newStyle ) => {\n\t\tif ( ! newStyle?.border ) {\n\t\t\tsetStyle( newStyle );\n\t\t\treturn;\n\t\t}\n\n\t\t// As Global Styles can't conditionally generate styles based on if\n\t\t// other style properties have been set, we need to force split\n\t\t// border definitions for user set global border styles. Border\n\t\t// radius is derived from the same property i.e. `border.radius` if\n\t\t// it is a string that is used. The longhand border radii styles are\n\t\t// only generated if that property is an object.\n\t\t//\n\t\t// For borders (color, style, and width) those are all properties on\n\t\t// the `border` style property. This means if the theme.json defined\n\t\t// split borders and the user condenses them into a flat border or\n\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\tconst { radius, ...newBorder } = newStyle.border;\n\t\tconst border = applyAllFallbackStyles( newBorder );\n\t\tconst updatedBorder = ! hasSplitBorders( border )\n\t\t\t? {\n\t\t\t\t\ttop: border,\n\t\t\t\t\tright: border,\n\t\t\t\t\tbottom: border,\n\t\t\t\t\tleft: border,\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tcolor: null,\n\t\t\t\t\tstyle: null,\n\t\t\t\t\twidth: null,\n\t\t\t\t\t...border,\n\t\t\t };\n\n\t\tsetStyle( { ...newStyle, border: { ...updatedBorder, radius } } );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ variation ? currentBlockStyle?.label : blockType.title }\n\t\t\t/>\n\t\t\t<BlockPreviewPanel name={ name } variation={ variation } />\n\t\t\t{ hasVariationsPanel && (\n\t\t\t\t<div className=\"edit-site-global-styles-screen-variations\">\n\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t<Subtitle>{ __( 'Style Variations' ) }</Subtitle>\n\t\t\t\t\t\t<VariationsPanel name={ name } />\n\t\t\t\t\t</VStack>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<StylesColorPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBackgroundPanel && (\n\t\t\t\t<StylesBackgroundPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tdefaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<StylesTypographyPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<StylesDimensionsPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ onChangeDimensions }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<StylesBorderPanel\n\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\tvalue={ style }\n\t\t\t\t\tonChange={ onChangeBorders }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasFiltersPanel && (\n\t\t\t\t<StylesFiltersPanel\n\t\t\t\t\tinheritedValue={ inheritedStyleWithLayout }\n\t\t\t\t\tvalue={ styleWithLayout }\n\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tincludeLayoutControls\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasImageSettingsPanel && (\n\t\t\t\t<ImageSettingsPanel\n\t\t\t\t\tonChange={ onChangeLightbox }\n\t\t\t\t\tvalue={ userSettings }\n\t\t\t\t\tinheritedValue={ settings }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ canEditCSS && (\n\t\t\t\t<PanelBody title={ __( 'Advanced' ) } initialOpen={ false }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t// translators: %s: is the name of a block e.g., 'Image' or 'Table'.\n\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t'Add your own CSS to customize the appearance of the %s block. You do not need to include a CSS selector, just add the property and value.'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tblockType?.title\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<StylesAdvancedPanel\n\t\t\t\t\t\tvalue={ style }\n\t\t\t\t\t\tonChange={ setStyle }\n\t\t\t\t\t\tinheritedValue={ inheritedStyle }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default ScreenBlock;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAKA,IAAAM,KAAA,GAAAN,OAAA;AA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c;MACtBmE,cAAc,EAAGnD;IAAU,CAC3B,CACD,EAECe,UAAU,iBACX,IAAArF,WAAA,CAAA8G,IAAA,EAACtH,WAAA,CAAAsI,SAAS;MAACX,KAAK,EAAG,IAAAI,QAAE,EAAE,UAAW,CAAG;MAACQ,WAAW,EAAG,KAAO;MAAAf,QAAA,gBAC1D,IAAAhH,WAAA,CAAAiH,GAAA;QAAAD,QAAA,EACG,IAAAgB,aAAO;QACR;QACA,IAAAT,QAAE,EACD,2IACD,CAAC,EACD7D,SAAS,EAAEyD,KACZ;MAAC,CACC,CAAC,eACJ,IAAAnH,WAAA,CAAAiH,GAAA,EAACxE,mBAAmB;QACnBiF,KAAK,EAAGjH,KAAO;QACfkH,QAAQ,EAAGtE,QAAU;QACrBoE,cAAc,EAAGrE;MAAgB,CACjC,CAAC;IAAA,CACQ,CACX;EAAA,CACA,CAAC;AAEL;AAAC,IAAA6E,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEctE,WAAW","ignoreList":[]}
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _components = require("@wordpress/components");
9
- var _i18n = require("@wordpress/i18n");
10
8
  var _blockEditor = require("@wordpress/block-editor");
9
+ var _components = require("@wordpress/components");
11
10
  var _data = require("@wordpress/data");
11
+ var _i18n = require("@wordpress/i18n");
12
12
  var _editor = require("@wordpress/editor");
13
+ var _element = require("@wordpress/element");
13
14
  var _header = _interopRequireDefault(require("./header"));
14
15
  var _content = _interopRequireDefault(require("../sidebar-navigation-screen-global-styles/content"));
15
16
  var _lockUnlock = require("../../lock-unlock");
@@ -27,13 +28,18 @@ const {
27
28
  } = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
28
29
  function ScreenStyleVariations() {
29
30
  // Style Variations should only be previewed in with
30
- // - a "zoomed out" editor
31
+ // - a "zoomed out" editor (but not when in preview mode)
31
32
  // - "Desktop" device preview
33
+ const isPreviewMode = (0, _data.useSelect)(select => {
34
+ return select(_blockEditor.store).getSettings().isPreviewMode;
35
+ }, []);
32
36
  const {
33
37
  setDeviceType
34
38
  } = (0, _data.useDispatch)(_editor.store);
35
- useZoomOut();
36
- setDeviceType('desktop');
39
+ useZoomOut(!isPreviewMode);
40
+ (0, _element.useEffect)(() => {
41
+ setDeviceType('desktop');
42
+ }, [setDeviceType]);
37
43
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
38
44
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_header.default, {
39
45
  title: (0, _i18n.__)('Browse styles'),
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_blockEditor","_data","_editor","_header","_interopRequireDefault","_content","_lockUnlock","_jsxRuntime","useZoomOut","unlock","blockEditorPrivateApis","ScreenStyleVariations","setDeviceType","useDispatch","editorStore","jsxs","Fragment","children","jsx","default","title","__","description","Card","size","isBorderless","className","CardBody","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-style-variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Card, CardBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport SidebarNavigationScreenGlobalStylesContent from '../sidebar-navigation-screen-global-styles/content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useZoomOut } = unlock( blockEditorPrivateApis );\n\nfunction ScreenStyleVariations() {\n\t// Style Variations should only be previewed in with\n\t// - a \"zoomed out\" editor\n\t// - \"Desktop\" device preview\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tuseZoomOut();\n\tsetDeviceType( 'desktop' );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Browse styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a variation to change the look of the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<Card\n\t\t\t\tsize=\"small\"\n\t\t\t\tisBorderless\n\t\t\t\tclassName=\"edit-site-global-styles-screen-style-variations\"\n\t\t\t>\n\t\t\t\t<CardBody>\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesContent />\n\t\t\t\t</CardBody>\n\t\t\t</Card>\n\t\t</>\n\t);\n}\n\nexport default ScreenStyleVariations;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,QAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAA2C,IAAAS,WAAA,GAAAT,OAAA;AAd3C;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAM;EAAEU;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEvD,SAASC,qBAAqBA,CAAA,EAAG;EAChC;EACA;EACA;EACA,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEC,aAAY,CAAC;EACpDN,UAAU,CAAC,CAAC;EACZI,aAAa,CAAE,SAAU,CAAC;EAE1B,oBACC,IAAAL,WAAA,CAAAQ,IAAA,EAAAR,WAAA,CAAAS,QAAA;IAAAC,QAAA,gBACC,IAAAV,WAAA,CAAAW,GAAA,EAACf,OAAA,CAAAgB,OAAY;MACZC,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;MAC/BC,WAAW,EAAG,IAAAD,QAAE,EACf,oDACD;IAAG,CACH,CAAC,eAEF,IAAAd,WAAA,CAAAW,GAAA,EAACrB,WAAA,CAAA0B,IAAI;MACJC,IAAI,EAAC,OAAO;MACZC,YAAY;MACZC,SAAS,EAAC,iDAAiD;MAAAT,QAAA,eAE3D,IAAAV,WAAA,CAAAW,GAAA,EAACrB,WAAA,CAAA8B,QAAQ;QAAAV,QAAA,eACR,IAAAV,WAAA,CAAAW,GAAA,EAACb,QAAA,CAAAc,OAA0C,IAAE;MAAC,CACrC;IAAC,CACN,CAAC;EAAA,CACN,CAAC;AAEL;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAV,OAAA,GAEcR,qBAAqB","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_components","_data","_i18n","_editor","_element","_header","_interopRequireDefault","_content","_lockUnlock","_jsxRuntime","useZoomOut","unlock","blockEditorPrivateApis","ScreenStyleVariations","isPreviewMode","useSelect","select","blockEditorStore","getSettings","setDeviceType","useDispatch","editorStore","useEffect","jsxs","Fragment","children","jsx","default","title","__","description","Card","size","isBorderless","className","CardBody","_default","exports"],"sources":["@wordpress/edit-site/src/components/global-styles/screen-style-variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Card, CardBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport SidebarNavigationScreenGlobalStylesContent from '../sidebar-navigation-screen-global-styles/content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useZoomOut } = unlock( blockEditorPrivateApis );\n\nfunction ScreenStyleVariations() {\n\t// Style Variations should only be previewed in with\n\t// - a \"zoomed out\" editor (but not when in preview mode)\n\t// - \"Desktop\" device preview\n\tconst isPreviewMode = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getSettings().isPreviewMode;\n\t}, [] );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tuseZoomOut( ! isPreviewMode );\n\tuseEffect( () => {\n\t\tsetDeviceType( 'desktop' );\n\t}, [ setDeviceType ] );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Browse styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a variation to change the look of the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<Card\n\t\t\t\tsize=\"small\"\n\t\t\t\tisBorderless\n\t\t\t\tclassName=\"edit-site-global-styles-screen-style-variations\"\n\t\t\t>\n\t\t\t\t<CardBody>\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesContent />\n\t\t\t\t</CardBody>\n\t\t\t</Card>\n\t\t</>\n\t);\n}\n\nexport default ScreenStyleVariations;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,OAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAlB3C;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAM;EAAEW;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEvD,SAASC,qBAAqBA,CAAA,EAAG;EAChC;EACA;EACA;EACA,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9C,OAAOA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,WAAW,CAAC,CAAC,CAACJ,aAAa;EAC9D,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEK;EAAc,CAAC,GAAG,IAAAC,iBAAW,EA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