@wordpress/edit-site 5.3.3 → 5.4.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 (172) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +1 -20
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +1 -0
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/editor/index.js +3 -1
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/border-panel.js +4 -4
  10. package/build/components/global-styles/border-panel.js.map +1 -1
  11. package/build/components/global-styles/color-palette-panel.js +5 -2
  12. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  13. package/build/components/global-styles/color-utils.js +1 -1
  14. package/build/components/global-styles/color-utils.js.map +1 -1
  15. package/build/components/global-styles/context-menu.js +16 -3
  16. package/build/components/global-styles/context-menu.js.map +1 -1
  17. package/build/components/global-styles/custom-css.js +1 -1
  18. package/build/components/global-styles/custom-css.js.map +1 -1
  19. package/build/components/global-styles/dimensions-panel.js +8 -7
  20. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  21. package/build/components/global-styles/gradients-palette-panel.js +8 -3
  22. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  23. package/build/components/global-styles/header.js +3 -1
  24. package/build/components/global-styles/header.js.map +1 -1
  25. package/build/components/global-styles/hooks.js +14 -51
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/palette.js +3 -1
  28. package/build/components/global-styles/palette.js.map +1 -1
  29. package/build/components/global-styles/screen-background-color.js +3 -2
  30. package/build/components/global-styles/screen-background-color.js.map +1 -1
  31. package/build/components/global-styles/screen-block-list.js +14 -3
  32. package/build/components/global-styles/screen-block-list.js.map +1 -1
  33. package/build/components/global-styles/screen-button-color.js +7 -5
  34. package/build/components/global-styles/screen-button-color.js.map +1 -1
  35. package/build/components/global-styles/screen-colors.js +8 -6
  36. package/build/components/global-styles/screen-colors.js.map +1 -1
  37. package/build/components/global-styles/screen-heading-color.js +8 -6
  38. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  39. package/build/components/global-styles/screen-link-color.js +3 -2
  40. package/build/components/global-styles/screen-link-color.js.map +1 -1
  41. package/build/components/global-styles/screen-text-color.js +3 -2
  42. package/build/components/global-styles/screen-text-color.js.map +1 -1
  43. package/build/components/global-styles/screen-typography.js +3 -1
  44. package/build/components/global-styles/screen-typography.js.map +1 -1
  45. package/build/components/global-styles/shadow-panel.js +2 -3
  46. package/build/components/global-styles/shadow-panel.js.map +1 -1
  47. package/build/components/global-styles/subtitle.js +3 -2
  48. package/build/components/global-styles/subtitle.js.map +1 -1
  49. package/build/components/global-styles/typography-panel.js +23 -300
  50. package/build/components/global-styles/typography-panel.js.map +1 -1
  51. package/build/components/navigation-inspector/index.js +0 -29
  52. package/build/components/navigation-inspector/index.js.map +1 -1
  53. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  54. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  55. package/build/components/sidebar/index.js +1 -20
  56. package/build/components/sidebar/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/index.js +1 -1
  58. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
  60. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
  62. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  63. package/build/components/start-template-options/index.js +175 -0
  64. package/build/components/start-template-options/index.js.map +1 -0
  65. package/build/hooks/push-changes-to-global-styles/index.js +5 -4
  66. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  67. package/build-module/components/add-new-template/new-template.js +1 -18
  68. package/build-module/components/add-new-template/new-template.js.map +1 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/editor-canvas.js +1 -0
  71. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  72. package/build-module/components/editor/index.js +2 -1
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +5 -5
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-palette-panel.js +5 -2
  77. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  78. package/build-module/components/global-styles/color-utils.js +2 -2
  79. package/build-module/components/global-styles/color-utils.js.map +1 -1
  80. package/build-module/components/global-styles/context-menu.js +13 -2
  81. package/build-module/components/global-styles/context-menu.js.map +1 -1
  82. package/build-module/components/global-styles/custom-css.js +1 -1
  83. package/build-module/components/global-styles/custom-css.js.map +1 -1
  84. package/build-module/components/global-styles/dimensions-panel.js +9 -8
  85. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  86. package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
  87. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  88. package/build-module/components/global-styles/header.js +3 -1
  89. package/build-module/components/global-styles/header.js.map +1 -1
  90. package/build-module/components/global-styles/hooks.js +12 -49
  91. package/build-module/components/global-styles/hooks.js.map +1 -1
  92. package/build-module/components/global-styles/palette.js +3 -1
  93. package/build-module/components/global-styles/palette.js.map +1 -1
  94. package/build-module/components/global-styles/screen-background-color.js +4 -3
  95. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block-list.js +12 -3
  97. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  98. package/build-module/components/global-styles/screen-button-color.js +8 -6
  99. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  100. package/build-module/components/global-styles/screen-colors.js +9 -7
  101. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  102. package/build-module/components/global-styles/screen-heading-color.js +9 -7
  103. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  104. package/build-module/components/global-styles/screen-link-color.js +4 -3
  105. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  106. package/build-module/components/global-styles/screen-text-color.js +4 -3
  107. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  108. package/build-module/components/global-styles/screen-typography.js +3 -1
  109. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  110. package/build-module/components/global-styles/shadow-panel.js +3 -4
  111. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  112. package/build-module/components/global-styles/subtitle.js +3 -2
  113. package/build-module/components/global-styles/subtitle.js.map +1 -1
  114. package/build-module/components/global-styles/typography-panel.js +27 -300
  115. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  116. package/build-module/components/navigation-inspector/index.js +0 -27
  117. package/build-module/components/navigation-inspector/index.js.map +1 -1
  118. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  119. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  120. package/build-module/components/sidebar/index.js +1 -18
  121. package/build-module/components/sidebar/index.js.map +1 -1
  122. package/build-module/components/sidebar-edit-mode/index.js +1 -1
  123. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  124. package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
  125. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  126. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
  127. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  128. package/build-module/components/start-template-options/index.js +156 -0
  129. package/build-module/components/start-template-options/index.js.map +1 -0
  130. package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
  131. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  132. package/build-style/style-rtl.css +73 -4
  133. package/build-style/style.css +73 -4
  134. package/package.json +31 -31
  135. package/src/components/add-new-template/new-template.js +1 -16
  136. package/src/components/app/index.js +0 -1
  137. package/src/components/block-editor/editor-canvas.js +1 -0
  138. package/src/components/editor/index.js +2 -0
  139. package/src/components/global-styles/border-panel.js +5 -5
  140. package/src/components/global-styles/color-palette-panel.js +3 -0
  141. package/src/components/global-styles/color-utils.js +2 -3
  142. package/src/components/global-styles/context-menu.js +17 -2
  143. package/src/components/global-styles/custom-css.js +1 -1
  144. package/src/components/global-styles/dimensions-panel.js +12 -8
  145. package/src/components/global-styles/gradients-palette-panel.js +4 -1
  146. package/src/components/global-styles/header.js +7 -1
  147. package/src/components/global-styles/hooks.js +17 -90
  148. package/src/components/global-styles/palette.js +1 -1
  149. package/src/components/global-styles/screen-background-color.js +3 -2
  150. package/src/components/global-styles/screen-block-list.js +19 -3
  151. package/src/components/global-styles/screen-button-color.js +8 -6
  152. package/src/components/global-styles/screen-colors.js +7 -7
  153. package/src/components/global-styles/screen-heading-color.js +9 -7
  154. package/src/components/global-styles/screen-link-color.js +3 -2
  155. package/src/components/global-styles/screen-text-color.js +3 -2
  156. package/src/components/global-styles/screen-typography.js +1 -1
  157. package/src/components/global-styles/shadow-panel.js +6 -3
  158. package/src/components/global-styles/style.scss +5 -0
  159. package/src/components/global-styles/subtitle.js +5 -2
  160. package/src/components/global-styles/typography-panel.js +30 -394
  161. package/src/components/navigation-inspector/index.js +0 -32
  162. package/src/components/navigation-inspector/navigation-menu.js +8 -2
  163. package/src/components/sidebar/index.js +4 -17
  164. package/src/components/sidebar-edit-mode/index.js +1 -1
  165. package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
  166. package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
  167. package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
  168. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  169. package/src/components/start-template-options/index.js +171 -0
  170. package/src/components/start-template-options/style.scss +76 -0
  171. package/src/hooks/push-changes-to-global-styles/index.js +26 -21
  172. package/src/style.scss +1 -0
@@ -21,7 +21,7 @@ import { store as noticesStore } from '@wordpress/notices';
21
21
  * Internal dependencies
22
22
  */
23
23
 
24
- import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
24
+ import { useSupportedStyles } from '../../components/global-styles/hooks';
25
25
  import { unlock } from '../../private-apis';
26
26
  const {
27
27
  GlobalStylesContext
@@ -84,8 +84,9 @@ const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {
84
84
  'typography.fontFamily': 'fontFamily'
85
85
  };
86
86
 
87
- function getChangesToPush(name, attributes) {
88
- return getSupportedGlobalStylesPanels(name).flatMap(key => {
87
+ function useChangesToPush(name, attributes) {
88
+ const supports = useSupportedStyles(name);
89
+ return useMemo(() => supports.flatMap(key => {
89
90
  if (!STYLE_PROPERTY[key]) {
90
91
  return [];
91
92
  }
@@ -100,7 +101,7 @@ function getChangesToPush(name, attributes) {
100
101
  path,
101
102
  value
102
103
  }] : [];
103
- });
104
+ }), [supports, name, attributes]);
104
105
  }
105
106
 
106
107
  function cloneDeep(object) {
@@ -113,7 +114,7 @@ function PushChangesToGlobalStylesControl(_ref) {
113
114
  attributes,
114
115
  setAttributes
115
116
  } = _ref;
116
- const changes = useMemo(() => getChangesToPush(name, attributes), [name, attributes]);
117
+ const changes = useChangesToPush(name, attributes);
117
118
  const {
118
119
  user: userConfig,
119
120
  setUserConfig
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","getSupportedGlobalStylesPanels","unlock","GlobalStylesContext","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","getChangesToPush","name","attributes","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,6BAA6B,IAAIC,cADlC,EAECC,YAFD,QAGO,mBAHP;AAIA,SAASC,UAAT,EAAqBC,OAArB,EAA8BC,WAA9B,QAAiD,oBAAjD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASd,KAAK,IAAIe,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,QAA+C,sCAA/C;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAA0BD,MAAM,CAAEd,sBAAF,CAAtC,C,CAEA;AACA;AACA;;AACA,MAAMgB,2BAA2B,GAAG;AACnC,sBAAoB,OADe;AAEnC,gBAAc,OAFqB;AAGnC,8BAA4B,OAHO;AAInC,qCAAmC,OAJA;AAKnC,yCAAuC,aALJ;AAMnC,uCAAqC,WANF;AAOnC,gCAA8B,OAPK;AAQnC,sCAAoC,OARD;AASnC,2CAAyC,aATN;AAUnC,yCAAuC,WAVJ;AAWnC,4BAA0B,OAXS;AAYnC,uCAAqC,OAZF;AAanC,4CAA0C,aAbP;AAcnC,+BAA6B,UAdM;AAenC,qCAAmC,UAfA;AAgBnC,uBAAqB,OAhBc;AAiBnC,kCAAgC,OAjBG;AAkBnC,uCAAqC,aAlBF;A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,CAAqB8B,KALR;AAFf,KAUC,cAAC,WAAD,CAAa,WAAb,QACG9C,EAAE,CAAE,QAAF,CADL,CAVD,EAaC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,QAAQ,EAAGiC,OAAO,CAACO,MAAR,KAAmB,CAF/B;AAGC,IAAA,OAAO,EAAGD;AAHX,KAKGvC,EAAE,CAAE,gBAAF,CALL,CAbD,CADD;AAuBA;;AAED,MAAMmD,6BAA6B,GAAG3D,0BAA0B,CAC7D4D,SAAF,IAAmBC,KAAF,IAEf,8BACC,cAAC,SAAD,EAAgBA,KAAhB,CADD,EAEC,cAAC,yBAAD,QACC,cAAC,gCAAD,EAAuCA,KAAvC,CADD,CAFD,CAH6D,CAAhE;AAYA9D,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR4D,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';\nimport { unlock } from '../../private-apis';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction getChangesToPush( name, attributes ) {\n\treturn getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {\n\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\treturn [];\n\t\t}\n\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\tconst presetAttributeKey = path.join( '.' );\n\t\tconst presetAttributeValue =\n\t\t\tattributes[\n\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t];\n\t\tconst value = presetAttributeValue\n\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t: get( attributes.style, path );\n\t\treturn value ? [ { path, value } ] : [];\n\t} );\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useMemo(\n\t\t() => getChangesToPush( name, attributes ),\n\t\t[ name, attributes ]\n\t);\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"names":["get","set","addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","STYLE_PROPERTY","getBlockType","useContext","useMemo","useCallback","useDispatch","noticesStore","useSupportedStyles","unlock","GlobalStylesContext","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","useChangesToPush","name","attributes","supports","flatMap","key","value","path","presetAttributeKey","join","presetAttributeValue","style","cloneDeep","object","JSON","parse","stringify","PushChangesToGlobalStylesControl","setAttributes","changes","user","userConfig","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","newUserConfig","undefined","undoIgnore","title","type","actions","label","onClick","withPushChangesToGlobalStyles","BlockEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,QAAyB,QAAzB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SACCC,yBADD,EAECC,KAAK,IAAIC,gBAFV,EAGCC,WAAW,IAAIC,sBAHhB,QAIO,yBAJP;AAKA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAC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,yBAAD,QACC,cAAC,gCAAD,EAAuCA,KAAvC,CADD,CAFD,CAH6D,CAAhE;AAYA/D,SAAS,CACR,kBADQ,EAER,8CAFQ,EAGR6D,6BAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { get, set } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../private-apis';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nfunction useChangesToPush( name, attributes ) {\n\tconst supports = useSupportedStyles( name );\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupports.flatMap( ( key ) => {\n\t\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\t\tconst presetAttributeValue =\n\t\t\t\t\tattributes[\n\t\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[\n\t\t\t\t\t\t\tpresetAttributeKey\n\t\t\t\t\t\t]\n\t\t\t\t\t];\n\t\t\t\tconst value = presetAttributeValue\n\t\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t\t: get( attributes.style, path );\n\t\t\t\treturn value ? [ { path, value } ] : [];\n\t\t\t} ),\n\t\t[ supports, name, attributes ]\n\t);\n}\n\nfunction cloneDeep( object ) {\n\treturn ! object ? {} : JSON.parse( JSON.stringify( object ) );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst changes = useChangesToPush( name, attributes );\n\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { style: blockStyles } = attributes;\n\n\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\tfor ( const { path, value } of changes ) {\n\t\t\tset( newBlockStyles, path, undefined );\n\t\t\tset( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );\n\t\t}\n\n\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t// tracking and implement our own Undo button in the snackbar\n\t\t// notification.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { style: newBlockStyles } );\n\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tactions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\tsetAttributes( { style: blockStyles } );\n\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t}, [ changes, attributes, userConfig, name ] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) =>\n\t\t(\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t<InspectorAdvancedControls>\n\t\t\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t\t\t</InspectorAdvancedControls>\n\t\t\t</>\n\t\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"]}
@@ -1005,6 +1005,10 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1005
1005
  padding: 0 16px;
1006
1006
  }
1007
1007
 
1008
+ .edit-site-global-styles-header {
1009
+ margin-bottom: 0 !important;
1010
+ }
1011
+
1008
1012
  .edit-site-global-styles-subtitle {
1009
1013
  margin-bottom: 0 !important;
1010
1014
  text-transform: uppercase;
@@ -1833,6 +1837,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1833
1837
  min-width: auto;
1834
1838
  }
1835
1839
 
1840
+ .edit-site-template-revisions {
1841
+ margin-right: -4px;
1842
+ }
1843
+
1836
1844
  h3.edit-site-template-card__template-areas-title {
1837
1845
  font-weight: 500;
1838
1846
  margin: 0 0 8px;
@@ -2088,6 +2096,71 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2088
2096
  vertical-align: text-top;
2089
2097
  }
2090
2098
 
2099
+ @media (min-width: 600px) {
2100
+ .edit-site-start-template-options__modal.components-modal__frame {
2101
+ width: calc(100% - 32px);
2102
+ height: calc(100% - 120px);
2103
+ }
2104
+ }
2105
+ @media (min-width: 782px) {
2106
+ .edit-site-start-template-options__modal.components-modal__frame {
2107
+ width: 50%;
2108
+ }
2109
+ }
2110
+ @media (min-width: 960px) {
2111
+ .edit-site-start-template-options__modal.components-modal__frame {
2112
+ height: -moz-fit-content;
2113
+ height: fit-content;
2114
+ }
2115
+ }
2116
+
2117
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
2118
+ display: grid;
2119
+ width: 100%;
2120
+ margin-top: 4px;
2121
+ gap: 24px;
2122
+ grid-template-columns: repeat(auto-fit, minmax(min(100% / 2, max(240px, 100% / 10)), 1fr));
2123
+ }
2124
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
2125
+ break-inside: avoid-column;
2126
+ margin-bottom: 0;
2127
+ width: 100%;
2128
+ aspect-ratio: 3/4;
2129
+ }
2130
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
2131
+ height: 100%;
2132
+ box-shadow: 0 0 0 1px #ddd;
2133
+ }
2134
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
2135
+ width: 100%;
2136
+ position: absolute;
2137
+ }
2138
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-patterns-list__item-title {
2139
+ display: none;
2140
+ }
2141
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:hover .block-editor-block-preview__container {
2142
+ box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
2143
+ }
2144
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:focus .block-editor-block-preview__container {
2145
+ box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
2146
+ outline: 2px solid transparent;
2147
+ }
2148
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) .block-editor-block-preview__container {
2149
+ position: absolute;
2150
+ padding: 0;
2151
+ background: #f0f0f0;
2152
+ }
2153
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) .block-editor-block-preview__container::after {
2154
+ width: 100%;
2155
+ top: 50%;
2156
+ margin-top: -1em;
2157
+ content: var(--wp-edit-site-start-template-options-start-blank);
2158
+ text-align: center;
2159
+ }
2160
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) iframe {
2161
+ display: none;
2162
+ }
2163
+
2091
2164
  .edit-site-keyboard-shortcut-help-modal__section {
2092
2165
  margin: 0 0 2rem 0;
2093
2166
  }
@@ -2489,10 +2562,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2489
2562
  overflow: hidden;
2490
2563
  }
2491
2564
 
2492
- .edit-site-sidebar-navigation-screen-navigation-menus .block-editor-list-view-block__menu-edit,
2493
- .edit-site-sidebar-navigation-screen-navigation-menus .edit-site-navigation-inspector__select-menu {
2494
- display: none;
2495
- }
2496
2565
  .edit-site-sidebar-navigation-screen-navigation-menus .offcanvas-editor-list-view-leaf {
2497
2566
  max-width: calc(100% - 4px);
2498
2567
  }
@@ -1005,6 +1005,10 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1005
1005
  padding: 0 16px;
1006
1006
  }
1007
1007
 
1008
+ .edit-site-global-styles-header {
1009
+ margin-bottom: 0 !important;
1010
+ }
1011
+
1008
1012
  .edit-site-global-styles-subtitle {
1009
1013
  margin-bottom: 0 !important;
1010
1014
  text-transform: uppercase;
@@ -1833,6 +1837,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1833
1837
  min-width: auto;
1834
1838
  }
1835
1839
 
1840
+ .edit-site-template-revisions {
1841
+ margin-left: -4px;
1842
+ }
1843
+
1836
1844
  h3.edit-site-template-card__template-areas-title {
1837
1845
  font-weight: 500;
1838
1846
  margin: 0 0 8px;
@@ -2088,6 +2096,71 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2088
2096
  vertical-align: text-top;
2089
2097
  }
2090
2098
 
2099
+ @media (min-width: 600px) {
2100
+ .edit-site-start-template-options__modal.components-modal__frame {
2101
+ width: calc(100% - 32px);
2102
+ height: calc(100% - 120px);
2103
+ }
2104
+ }
2105
+ @media (min-width: 782px) {
2106
+ .edit-site-start-template-options__modal.components-modal__frame {
2107
+ width: 50%;
2108
+ }
2109
+ }
2110
+ @media (min-width: 960px) {
2111
+ .edit-site-start-template-options__modal.components-modal__frame {
2112
+ height: -moz-fit-content;
2113
+ height: fit-content;
2114
+ }
2115
+ }
2116
+
2117
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
2118
+ display: grid;
2119
+ width: 100%;
2120
+ margin-top: 4px;
2121
+ gap: 24px;
2122
+ grid-template-columns: repeat(auto-fit, minmax(min(100% / 2, max(240px, 100% / 10)), 1fr));
2123
+ }
2124
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
2125
+ break-inside: avoid-column;
2126
+ margin-bottom: 0;
2127
+ width: 100%;
2128
+ aspect-ratio: 3/4;
2129
+ }
2130
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
2131
+ height: 100%;
2132
+ box-shadow: 0 0 0 1px #ddd;
2133
+ }
2134
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
2135
+ width: 100%;
2136
+ position: absolute;
2137
+ }
2138
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-patterns-list__item-title {
2139
+ display: none;
2140
+ }
2141
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:hover .block-editor-block-preview__container {
2142
+ box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
2143
+ }
2144
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:focus .block-editor-block-preview__container {
2145
+ box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
2146
+ outline: 2px solid transparent;
2147
+ }
2148
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) .block-editor-block-preview__container {
2149
+ position: absolute;
2150
+ padding: 0;
2151
+ background: #f0f0f0;
2152
+ }
2153
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) .block-editor-block-preview__container::after {
2154
+ width: 100%;
2155
+ top: 50%;
2156
+ margin-top: -1em;
2157
+ content: var(--wp-edit-site-start-template-options-start-blank);
2158
+ text-align: center;
2159
+ }
2160
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) iframe {
2161
+ display: none;
2162
+ }
2163
+
2091
2164
  .edit-site-keyboard-shortcut-help-modal__section {
2092
2165
  margin: 0 0 2rem 0;
2093
2166
  }
@@ -2489,10 +2562,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2489
2562
  overflow: hidden;
2490
2563
  }
2491
2564
 
2492
- .edit-site-sidebar-navigation-screen-navigation-menus .block-editor-list-view-block__menu-edit,
2493
- .edit-site-sidebar-navigation-screen-navigation-menus .edit-site-navigation-inspector__select-menu {
2494
- display: none;
2495
- }
2496
2565
  .edit-site-sidebar-navigation-screen-navigation-menus .offcanvas-editor-list-view-leaf {
2497
2566
  max-width: calc(100% - 4px);
2498
2567
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.3.3",
3
+ "version": "5.4.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,35 +27,35 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.26.1",
31
- "@wordpress/api-fetch": "^6.23.1",
32
- "@wordpress/block-editor": "^11.3.3",
33
- "@wordpress/block-library": "^8.3.3",
34
- "@wordpress/blocks": "^12.3.2",
35
- "@wordpress/components": "^23.3.2",
36
- "@wordpress/compose": "^6.3.2",
37
- "@wordpress/core-data": "^6.3.2",
38
- "@wordpress/data": "^8.3.2",
39
- "@wordpress/deprecated": "^3.26.1",
40
- "@wordpress/editor": "^13.3.3",
41
- "@wordpress/element": "^5.3.1",
42
- "@wordpress/hooks": "^3.26.1",
43
- "@wordpress/html-entities": "^3.26.1",
44
- "@wordpress/i18n": "^4.26.1",
45
- "@wordpress/icons": "^9.17.1",
46
- "@wordpress/interface": "^5.3.3",
47
- "@wordpress/keyboard-shortcuts": "^4.3.2",
48
- "@wordpress/keycodes": "^3.26.2",
49
- "@wordpress/media-utils": "^4.17.1",
50
- "@wordpress/notices": "^3.26.2",
51
- "@wordpress/plugins": "^5.3.2",
52
- "@wordpress/preferences": "^3.3.2",
53
- "@wordpress/private-apis": "^0.8.1",
54
- "@wordpress/reusable-blocks": "^4.3.3",
55
- "@wordpress/style-engine": "^1.9.1",
56
- "@wordpress/url": "^3.27.1",
57
- "@wordpress/viewport": "^5.3.2",
58
- "@wordpress/widgets": "^3.3.3",
30
+ "@wordpress/a11y": "^3.27.0",
31
+ "@wordpress/api-fetch": "^6.24.0",
32
+ "@wordpress/block-editor": "^11.4.0",
33
+ "@wordpress/block-library": "^8.4.0",
34
+ "@wordpress/blocks": "^12.4.0",
35
+ "@wordpress/components": "^23.4.0",
36
+ "@wordpress/compose": "^6.4.0",
37
+ "@wordpress/core-data": "^6.4.0",
38
+ "@wordpress/data": "^8.4.0",
39
+ "@wordpress/deprecated": "^3.27.0",
40
+ "@wordpress/editor": "^13.4.0",
41
+ "@wordpress/element": "^5.4.0",
42
+ "@wordpress/hooks": "^3.27.0",
43
+ "@wordpress/html-entities": "^3.27.0",
44
+ "@wordpress/i18n": "^4.27.0",
45
+ "@wordpress/icons": "^9.18.0",
46
+ "@wordpress/interface": "^5.4.0",
47
+ "@wordpress/keyboard-shortcuts": "^4.4.0",
48
+ "@wordpress/keycodes": "^3.27.0",
49
+ "@wordpress/media-utils": "^4.18.0",
50
+ "@wordpress/notices": "^3.27.0",
51
+ "@wordpress/plugins": "^5.4.0",
52
+ "@wordpress/preferences": "^3.4.0",
53
+ "@wordpress/private-apis": "^0.9.0",
54
+ "@wordpress/reusable-blocks": "^4.4.0",
55
+ "@wordpress/style-engine": "^1.10.0",
56
+ "@wordpress/url": "^3.28.0",
57
+ "@wordpress/viewport": "^5.4.0",
58
+ "@wordpress/widgets": "^3.4.0",
59
59
  "classnames": "^2.3.1",
60
60
  "colord": "^2.9.2",
61
61
  "downloadjs": "^1.4.7",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "1bf01c01a8238ce3a681ad1e517f86033818b78d"
76
+ "gitHead": "c25ff895413bad4354c55c0c2d732552618b0d56"
77
77
  }
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import apiFetch from '@wordpress/api-fetch';
5
- import { addQueryArgs } from '@wordpress/url';
6
4
  import {
7
5
  DropdownMenu,
8
6
  MenuGroup,
@@ -108,19 +106,7 @@ export default function NewTemplate( {
108
106
  }
109
107
  setIsCreatingTemplate( true );
110
108
  try {
111
- const { title, description, slug, templatePrefix } = template;
112
- let templateContent = template.content;
113
- // Try to find fallback content from existing templates.
114
- if ( ! templateContent ) {
115
- const fallbackTemplate = await apiFetch( {
116
- path: addQueryArgs( '/wp/v2/templates/lookup', {
117
- slug,
118
- is_custom: ! isWPSuggestion,
119
- template_prefix: templatePrefix,
120
- } ),
121
- } );
122
- templateContent = fallbackTemplate.content.raw;
123
- }
109
+ const { title, description, slug } = template;
124
110
  const newTemplate = await saveEntityRecord(
125
111
  'postType',
126
112
  'wp_template',
@@ -130,7 +116,6 @@ export default function NewTemplate( {
130
116
  slug: slug.toString(),
131
117
  status: 'publish',
132
118
  title,
133
- content: templateContent,
134
119
  // This adds a post meta field in template that is part of `is_custom` value calculation.
135
120
  is_wp_suggestion: isWPSuggestion,
136
121
  },
@@ -35,7 +35,6 @@ export default function App() {
35
35
  <SlotFillProvider>
36
36
  <Popover.Slot />
37
37
  <UnsavedChangesWarning />
38
-
39
38
  <Routes>
40
39
  <Layout />
41
40
  <PluginArea onError={ onPluginAreaError } />
@@ -33,6 +33,7 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
33
33
  const mouseMoveTypingRef = useMouseMoveTypingReset();
34
34
  return (
35
35
  <Iframe
36
+ expand={ isZoomOutMode }
36
37
  scale={ ( isZoomOutMode && 0.45 ) || undefined }
37
38
  frameSize={ isZoomOutMode ? 100 : undefined }
38
39
  style={ enableResizing ? {} : deviceStyles }
@@ -29,6 +29,7 @@ import KeyboardShortcuts from '../keyboard-shortcuts';
29
29
  import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
30
30
  import ListViewSidebar from '../secondary-sidebar/list-view-sidebar';
31
31
  import WelcomeGuide from '../welcome-guide';
32
+ import StartTemplateOptions from '../start-template-options';
32
33
  import { store as editSiteStore } from '../../store';
33
34
  import { GlobalStylesRenderer } from '../global-styles-renderer';
34
35
  import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
@@ -160,6 +161,7 @@ export default function Editor() {
160
161
  <GlobalStylesProvider>
161
162
  <BlockContextProvider value={ blockContext }>
162
163
  <SidebarComplementaryAreaFills />
164
+ { isEditMode && <StartTemplateOptions /> }
163
165
  <InterfaceSkeleton
164
166
  enableRegionNavigation={ false }
165
167
  className={
@@ -18,7 +18,7 @@ import { __ } from '@wordpress/i18n';
18
18
  /**
19
19
  * Internal dependencies
20
20
  */
21
- import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
21
+ import { useSupportedStyles, useColorsPerOrigin } from './hooks';
22
22
  import { unlock } from '../../private-apis';
23
23
 
24
24
  const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
@@ -35,7 +35,7 @@ export function useHasBorderPanel( name ) {
35
35
  }
36
36
 
37
37
  function useHasBorderColorControl( name ) {
38
- const supports = getSupportedGlobalStylesPanels( name );
38
+ const supports = useSupportedStyles( name );
39
39
  return (
40
40
  useGlobalSetting( 'border.color', name )[ 0 ] &&
41
41
  supports.includes( 'borderColor' )
@@ -43,7 +43,7 @@ function useHasBorderColorControl( name ) {
43
43
  }
44
44
 
45
45
  function useHasBorderRadiusControl( name ) {
46
- const supports = getSupportedGlobalStylesPanels( name );
46
+ const supports = useSupportedStyles( name );
47
47
  return (
48
48
  useGlobalSetting( 'border.radius', name )[ 0 ] &&
49
49
  supports.includes( 'borderRadius' )
@@ -51,7 +51,7 @@ function useHasBorderRadiusControl( name ) {
51
51
  }
52
52
 
53
53
  function useHasBorderStyleControl( name ) {
54
- const supports = getSupportedGlobalStylesPanels( name );
54
+ const supports = useSupportedStyles( name );
55
55
  return (
56
56
  useGlobalSetting( 'border.style', name )[ 0 ] &&
57
57
  supports.includes( 'borderStyle' )
@@ -59,7 +59,7 @@ function useHasBorderStyleControl( name ) {
59
59
  }
60
60
 
61
61
  function useHasBorderWidthControl( name ) {
62
- const supports = getSupportedGlobalStylesPanels( name );
62
+ const supports = useSupportedStyles( name );
63
63
  return (
64
64
  useGlobalSetting( 'border.width', name )[ 0 ] &&
65
65
  supports.includes( 'borderWidth' )
@@ -55,6 +55,7 @@ export default function ColorPalettePanel( { name } ) {
55
55
  colors={ themeColors }
56
56
  onChange={ setThemeColors }
57
57
  paletteLabel={ __( 'Theme' ) }
58
+ paletteLabelHeadingLevel={ 3 }
58
59
  />
59
60
  ) }
60
61
  { !! defaultColors &&
@@ -66,12 +67,14 @@ export default function ColorPalettePanel( { name } ) {
66
67
  colors={ defaultColors }
67
68
  onChange={ setDefaultColors }
68
69
  paletteLabel={ __( 'Default' ) }
70
+ paletteLabelHeadingLevel={ 3 }
69
71
  />
70
72
  ) }
71
73
  <PaletteEdit
72
74
  colors={ customColors }
73
75
  onChange={ setCustomColors }
74
76
  paletteLabel={ __( 'Custom' ) }
77
+ paletteLabelHeadingLevel={ 3 }
75
78
  emptyMessage={ __(
76
79
  'Custom colors are empty! Add some colors to create your own color palette.'
77
80
  ) }
@@ -1,11 +1,10 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
-
5
- import { getSupportedGlobalStylesPanels } from './hooks';
4
+ import { useSupportedStyles } from './hooks';
6
5
 
7
6
  export function useHasColorPanel( name ) {
8
- const supports = getSupportedGlobalStylesPanels( name );
7
+ const supports = useSupportedStyles( name );
9
8
  return (
10
9
  supports.includes( 'color' ) ||
11
10
  supports.includes( 'backgroundColor' ) ||
@@ -21,6 +21,8 @@ import {
21
21
  import { isRTL, __ } from '@wordpress/i18n';
22
22
  import { useSelect } from '@wordpress/data';
23
23
  import { store as coreStore } from '@wordpress/core-data';
24
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
25
+ import { useMemo } from '@wordpress/element';
24
26
 
25
27
  /**
26
28
  * Internal dependencies
@@ -28,15 +30,28 @@ import { store as coreStore } from '@wordpress/core-data';
28
30
  import { useHasBorderPanel } from './border-panel';
29
31
  import { useHasColorPanel } from './color-utils';
30
32
  import { useHasDimensionsPanel } from './dimensions-panel';
31
- import { useHasTypographyPanel } from './typography-panel';
32
33
  import { useHasVariationsPanel } from './variations-panel';
33
34
  import { NavigationButtonAsItem } from './navigation-button';
34
35
  import { IconWithCurrentColor } from './icon-with-current-color';
35
36
  import { ScreenVariations } from './screen-variations';
36
37
  import { useHasShadowControl } from './shadow-panel';
38
+ import { unlock } from '../../private-apis';
39
+ import { useSupportedStyles } from './hooks';
40
+
41
+ const {
42
+ useHasTypographyPanel,
43
+ useGlobalSetting,
44
+ overrideSettingsWithSupports,
45
+ } = unlock( blockEditorPrivateApis );
37
46
 
38
47
  function ContextMenu( { name, parentMenu = '' } ) {
39
- const hasTypographyPanel = useHasTypographyPanel( name );
48
+ const [ rawSettings ] = useGlobalSetting( '', name );
49
+ const supports = useSupportedStyles( name );
50
+ const settings = useMemo(
51
+ () => overrideSettingsWithSupports( rawSettings, supports ),
52
+ [ rawSettings, supports ]
53
+ );
54
+ const hasTypographyPanel = useHasTypographyPanel( settings );
40
55
  const hasColorPanel = useHasColorPanel( name );
41
56
  const hasBorderPanel = useHasBorderPanel( name );
42
57
  const hasEffectsPanel = useHasShadowControl( name );
@@ -101,7 +101,7 @@ function CustomCSSControl( { blockName } ) {
101
101
  </Panel>
102
102
  ) }
103
103
  <VStack spacing={ 3 }>
104
- <Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
104
+ <Subtitle>{ __( 'Additional CSS' ) }</Subtitle>
105
105
  <TextareaControl
106
106
  __nextHasNoMarginBottom
107
107
  value={