@wordpress/edit-site 5.3.6 → 5.5.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 (217) hide show
  1. package/CHANGELOG.md +4 -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 +5 -5
  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 +22 -6
  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 +41 -486
  20. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  21. package/build/components/global-styles/duotone-panel.js +78 -0
  22. package/build/components/global-styles/duotone-panel.js.map +1 -0
  23. package/build/components/global-styles/filter-utils.js +17 -0
  24. package/build/components/global-styles/filter-utils.js.map +1 -0
  25. package/build/components/global-styles/gradients-palette-panel.js +8 -3
  26. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  27. package/build/components/global-styles/header.js +3 -1
  28. package/build/components/global-styles/header.js.map +1 -1
  29. package/build/components/global-styles/hooks.js +14 -51
  30. package/build/components/global-styles/hooks.js.map +1 -1
  31. package/build/components/global-styles/palette.js +3 -1
  32. package/build/components/global-styles/palette.js.map +1 -1
  33. package/build/components/global-styles/preview.js +9 -5
  34. package/build/components/global-styles/preview.js.map +1 -1
  35. package/build/components/global-styles/screen-background-color.js +3 -2
  36. package/build/components/global-styles/screen-background-color.js.map +1 -1
  37. package/build/components/global-styles/screen-block-list.js +13 -6
  38. package/build/components/global-styles/screen-block-list.js.map +1 -1
  39. package/build/components/global-styles/screen-button-color.js +7 -5
  40. package/build/components/global-styles/screen-button-color.js.map +1 -1
  41. package/build/components/global-styles/screen-colors.js +8 -6
  42. package/build/components/global-styles/screen-colors.js.map +1 -1
  43. package/build/components/global-styles/screen-filters.js +46 -0
  44. package/build/components/global-styles/screen-filters.js.map +1 -0
  45. package/build/components/global-styles/screen-heading-color.js +8 -6
  46. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  47. package/build/components/global-styles/screen-layout.js +13 -5
  48. package/build/components/global-styles/screen-layout.js.map +1 -1
  49. package/build/components/global-styles/screen-link-color.js +3 -2
  50. package/build/components/global-styles/screen-link-color.js.map +1 -1
  51. package/build/components/global-styles/screen-text-color.js +3 -2
  52. package/build/components/global-styles/screen-text-color.js.map +1 -1
  53. package/build/components/global-styles/screen-typography.js +3 -1
  54. package/build/components/global-styles/screen-typography.js.map +1 -1
  55. package/build/components/global-styles/shadow-panel.js +2 -3
  56. package/build/components/global-styles/shadow-panel.js.map +1 -1
  57. package/build/components/global-styles/subtitle.js +3 -2
  58. package/build/components/global-styles/subtitle.js.map +1 -1
  59. package/build/components/global-styles/typography-panel.js +23 -303
  60. package/build/components/global-styles/typography-panel.js.map +1 -1
  61. package/build/components/global-styles/ui.js +6 -0
  62. package/build/components/global-styles/ui.js.map +1 -1
  63. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  64. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  65. package/build/components/keyboard-shortcuts/index.js +67 -0
  66. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  67. package/build/components/navigation-inspector/index.js +0 -29
  68. package/build/components/navigation-inspector/index.js.map +1 -1
  69. package/build/components/navigation-inspector/navigation-menu.js +22 -5
  70. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  71. package/build/components/sidebar-edit-mode/index.js +1 -1
  72. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  73. package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
  74. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  75. package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
  76. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  77. package/build/components/sidebar-navigation-screen-navigation-menus/index.js +9 -1
  78. package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  79. package/build/components/start-template-options/index.js +175 -0
  80. package/build/components/start-template-options/index.js.map +1 -0
  81. package/build/hooks/push-changes-to-global-styles/index.js +5 -4
  82. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  83. package/build/store/actions.js +2 -2
  84. package/build/store/actions.js.map +1 -1
  85. package/build-module/components/add-new-template/new-template.js +1 -18
  86. package/build-module/components/add-new-template/new-template.js.map +1 -1
  87. package/build-module/components/app/index.js.map +1 -1
  88. package/build-module/components/block-editor/editor-canvas.js +1 -0
  89. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  90. package/build-module/components/editor/index.js +2 -1
  91. package/build-module/components/editor/index.js.map +1 -1
  92. package/build-module/components/global-styles/border-panel.js +6 -6
  93. package/build-module/components/global-styles/border-panel.js.map +1 -1
  94. package/build-module/components/global-styles/color-palette-panel.js +5 -2
  95. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  96. package/build-module/components/global-styles/color-utils.js +2 -2
  97. package/build-module/components/global-styles/color-utils.js.map +1 -1
  98. package/build-module/components/global-styles/context-menu.js +20 -6
  99. package/build-module/components/global-styles/context-menu.js.map +1 -1
  100. package/build-module/components/global-styles/custom-css.js +1 -1
  101. package/build-module/components/global-styles/custom-css.js.map +1 -1
  102. package/build-module/components/global-styles/dimensions-panel.js +43 -479
  103. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  104. package/build-module/components/global-styles/duotone-panel.js +67 -0
  105. package/build-module/components/global-styles/duotone-panel.js.map +1 -0
  106. package/build-module/components/global-styles/filter-utils.js +9 -0
  107. package/build-module/components/global-styles/filter-utils.js.map +1 -0
  108. package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
  109. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  110. package/build-module/components/global-styles/header.js +3 -1
  111. package/build-module/components/global-styles/header.js.map +1 -1
  112. package/build-module/components/global-styles/hooks.js +12 -49
  113. package/build-module/components/global-styles/hooks.js.map +1 -1
  114. package/build-module/components/global-styles/palette.js +3 -1
  115. package/build-module/components/global-styles/palette.js.map +1 -1
  116. package/build-module/components/global-styles/preview.js +10 -6
  117. package/build-module/components/global-styles/preview.js.map +1 -1
  118. package/build-module/components/global-styles/screen-background-color.js +4 -3
  119. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  120. package/build-module/components/global-styles/screen-block-list.js +12 -5
  121. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  122. package/build-module/components/global-styles/screen-button-color.js +8 -6
  123. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  124. package/build-module/components/global-styles/screen-colors.js +9 -7
  125. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  126. package/build-module/components/global-styles/screen-filters.js +33 -0
  127. package/build-module/components/global-styles/screen-filters.js.map +1 -0
  128. package/build-module/components/global-styles/screen-heading-color.js +9 -7
  129. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  130. package/build-module/components/global-styles/screen-layout.js +11 -2
  131. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  132. package/build-module/components/global-styles/screen-link-color.js +4 -3
  133. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  134. package/build-module/components/global-styles/screen-text-color.js +4 -3
  135. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  136. package/build-module/components/global-styles/screen-typography.js +3 -1
  137. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  138. package/build-module/components/global-styles/shadow-panel.js +3 -4
  139. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  140. package/build-module/components/global-styles/subtitle.js +3 -2
  141. package/build-module/components/global-styles/subtitle.js.map +1 -1
  142. package/build-module/components/global-styles/typography-panel.js +24 -300
  143. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  144. package/build-module/components/global-styles/ui.js +5 -0
  145. package/build-module/components/global-styles/ui.js.map +1 -1
  146. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  147. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  148. package/build-module/components/keyboard-shortcuts/index.js +65 -0
  149. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  150. package/build-module/components/navigation-inspector/index.js +0 -27
  151. package/build-module/components/navigation-inspector/index.js.map +1 -1
  152. package/build-module/components/navigation-inspector/navigation-menu.js +25 -8
  153. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  154. package/build-module/components/sidebar-edit-mode/index.js +1 -1
  155. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  156. package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
  157. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  158. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
  159. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  160. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +9 -1
  161. package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
  162. package/build-module/components/start-template-options/index.js +156 -0
  163. package/build-module/components/start-template-options/index.js.map +1 -0
  164. package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
  165. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  166. package/build-module/store/actions.js +2 -2
  167. package/build-module/store/actions.js.map +1 -1
  168. package/build-style/style-rtl.css +73 -4
  169. package/build-style/style.css +73 -4
  170. package/package.json +31 -31
  171. package/src/components/add-new-template/new-template.js +1 -16
  172. package/src/components/app/index.js +0 -1
  173. package/src/components/block-editor/editor-canvas.js +1 -0
  174. package/src/components/editor/index.js +2 -0
  175. package/src/components/global-styles/border-panel.js +6 -6
  176. package/src/components/global-styles/color-palette-panel.js +3 -0
  177. package/src/components/global-styles/color-utils.js +2 -3
  178. package/src/components/global-styles/context-menu.js +25 -4
  179. package/src/components/global-styles/custom-css.js +1 -1
  180. package/src/components/global-styles/dimensions-panel.js +43 -573
  181. package/src/components/global-styles/duotone-panel.js +82 -0
  182. package/src/components/global-styles/filter-utils.js +9 -0
  183. package/src/components/global-styles/gradients-palette-panel.js +4 -1
  184. package/src/components/global-styles/header.js +7 -1
  185. package/src/components/global-styles/hooks.js +17 -90
  186. package/src/components/global-styles/palette.js +1 -1
  187. package/src/components/global-styles/preview.js +155 -140
  188. package/src/components/global-styles/screen-background-color.js +3 -2
  189. package/src/components/global-styles/screen-block-list.js +16 -5
  190. package/src/components/global-styles/screen-button-color.js +8 -6
  191. package/src/components/global-styles/screen-colors.js +7 -7
  192. package/src/components/global-styles/screen-filters.js +27 -0
  193. package/src/components/global-styles/screen-heading-color.js +9 -7
  194. package/src/components/global-styles/screen-layout.js +9 -2
  195. package/src/components/global-styles/screen-link-color.js +3 -2
  196. package/src/components/global-styles/screen-text-color.js +3 -2
  197. package/src/components/global-styles/screen-typography.js +1 -1
  198. package/src/components/global-styles/shadow-panel.js +6 -3
  199. package/src/components/global-styles/style.scss +5 -0
  200. package/src/components/global-styles/subtitle.js +5 -2
  201. package/src/components/global-styles/typography-panel.js +29 -395
  202. package/src/components/global-styles/ui.js +5 -0
  203. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  204. package/src/components/keyboard-shortcuts/index.js +70 -0
  205. package/src/components/navigation-inspector/index.js +0 -32
  206. package/src/components/navigation-inspector/navigation-menu.js +24 -6
  207. package/src/components/sidebar-edit-mode/index.js +1 -1
  208. package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
  209. package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
  210. package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
  211. package/src/components/sidebar-navigation-screen-navigation-menus/index.js +7 -1
  212. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  213. package/src/components/start-template-options/index.js +171 -0
  214. package/src/components/start-template-options/style.scss +76 -0
  215. package/src/hooks/push-changes-to-global-styles/index.js +26 -21
  216. package/src/store/actions.js +2 -2
  217. package/src/style.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MA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,iBAFF,CAEqBH,YAFrB,EAEmC;AAAE5B,QAAAA,IAAI,EAAE;AAAR,OAFnC;AAGA;AACD,GA5HD;AAAA,CADM;AA8HP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMuE,kBAAkB,GAC5BC,IAAF,IACA,SAAoB;AAAA,MAAlB;AAAE/E,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYZ,cADZ,EAEEyF,uBAFF,CAE2BpF,iBAF3B,EAE8CmF,IAF9C;AAGA,CANK;AAQP;AACA;AACA;;AACA,OAAO,MAAME,mBAAmB,GAC/B,MACA,SAAoB;AAAA,MAAlB;AAAEjF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACYZ,cADZ,EAEE2F,wBAFF,CAE4BtF,iBAF5B;AAGA,CANK;AAQP,OAAO,MAAMuF,gBAAgB,GAC1BC,IAAF,IACA,UAAoB;AAAA,MAAlB;AAAEpF,IAAAA;AAAF,GAAkB;AACnBA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEkF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EADmB,CAKnB;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBpF,IAAAA,QAAQ,CAACG,QAAT,CAAmBX,gBAAnB,EAAsC8F,kBAAtC;AACA;;AAED,MAAKF,IAAI,KAAK,QAAd,EAAyB;AACxB3F,IAAAA,KAAK,CAAEP,EAAE,CAAE,wBAAF,CAAJ,EAAkC,WAAlC,CAAL;AACA,GAFD,MAEO,IAAKkG,IAAI,KAAK,QAAd,EAAyB;AAC/B3F,IAAAA,KAAK,CAAEP,EAAE,CAAE,sBAAF,CAAJ,EAAgC,WAAhC,CAAL;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'mosaic' ) {\n\t\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t\t}\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","error","postType","id","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","createSuccessNotice","title","rendered","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","version","setEditedPostContext","setPage","page","path","postId","entity","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","setIsSaveViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChCjB,IAAAA,UAAU,CAAE,yDAAF,EAA6D;AACtEkB,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAA7D,CAAV;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYT,gBADZ,EAEEU,MAFF,CAEU,gBAFV,EAE4BL,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNC,IAAAA,IAAI,EAAE,yBADA;A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AL;AACA,GAFD,MAEO,IAAKkG,IAAI,KAAK,MAAd,EAAuB;AAC7B3F,IAAAA,KAAK,CAAEP,EAAE,CAAE,sBAAF,CAAJ,EAAgC,WAAhC,CAAL;AACA;AACD,CAjBK","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate =\n\t( templateId, templateSlug ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! templateSlug ) {\n\t\t\ttry {\n\t\t\t\tconst template = await registry\n\t\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\t\t\ttemplateSlug = template?.slug;\n\t\t\t} catch ( error ) {}\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: templateId,\n\t\t\tcontext: { templateSlug },\n\t\t} );\n\t};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: newTemplate.id,\n\t\t\tcontext: { templateSlug: newTemplate.slug },\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\ttemplate.title.rendered\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: 'wp_template_part',\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage =\n\t( page ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tif ( ! page.path && page.context?.postId ) {\n\t\t\tconst entity = await registry\n\t\t\t\t.resolveSelect( coreStore )\n\t\t\t\t.getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpage.context.postType || 'post',\n\t\t\t\t\tpage.context.postId\n\t\t\t\t);\n\t\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\t\tpage.path = getPathAndQueryString( entity?.link );\n\t\t}\n\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.__experimentalGetTemplateForLink( page.path );\n\n\t\tif ( ! template ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: 'wp_template',\n\t\t\tid: template.id,\n\t\t\tcontext: {\n\t\t\t\t...page.context,\n\t\t\t\ttemplateSlug: template.slug,\n\t\t\t},\n\t\t} );\n\n\t\treturn template.id;\n\t};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n"]}
@@ -1003,6 +1003,10 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1003
1003
  padding: 0 16px;
1004
1004
  }
1005
1005
 
1006
+ .edit-site-global-styles-header {
1007
+ margin-bottom: 0 !important;
1008
+ }
1009
+
1006
1010
  .edit-site-global-styles-subtitle {
1007
1011
  margin-bottom: 0 !important;
1008
1012
  text-transform: uppercase;
@@ -1832,6 +1836,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1832
1836
  min-width: auto;
1833
1837
  }
1834
1838
 
1839
+ .edit-site-template-revisions {
1840
+ margin-right: -4px;
1841
+ }
1842
+
1835
1843
  h3.edit-site-template-card__template-areas-title {
1836
1844
  font-weight: 500;
1837
1845
  margin: 0 0 8px;
@@ -2083,6 +2091,71 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2083
2091
  vertical-align: text-top;
2084
2092
  }
2085
2093
 
2094
+ @media (min-width: 600px) {
2095
+ .edit-site-start-template-options__modal.components-modal__frame {
2096
+ width: calc(100% - 32px);
2097
+ height: calc(100% - 120px);
2098
+ }
2099
+ }
2100
+ @media (min-width: 782px) {
2101
+ .edit-site-start-template-options__modal.components-modal__frame {
2102
+ width: 50%;
2103
+ }
2104
+ }
2105
+ @media (min-width: 960px) {
2106
+ .edit-site-start-template-options__modal.components-modal__frame {
2107
+ height: -moz-fit-content;
2108
+ height: fit-content;
2109
+ }
2110
+ }
2111
+
2112
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
2113
+ display: grid;
2114
+ width: 100%;
2115
+ margin-top: 4px;
2116
+ gap: 24px;
2117
+ grid-template-columns: repeat(auto-fit, minmax(min(100% / 2, max(240px, 100% / 10)), 1fr));
2118
+ }
2119
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
2120
+ break-inside: avoid-column;
2121
+ margin-bottom: 0;
2122
+ width: 100%;
2123
+ aspect-ratio: 3/4;
2124
+ }
2125
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
2126
+ height: 100%;
2127
+ box-shadow: 0 0 0 1px #ddd;
2128
+ }
2129
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
2130
+ width: 100%;
2131
+ position: absolute;
2132
+ }
2133
+ .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 {
2134
+ display: none;
2135
+ }
2136
+ .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 {
2137
+ box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
2138
+ }
2139
+ .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 {
2140
+ box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
2141
+ outline: 2px solid transparent;
2142
+ }
2143
+ .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 {
2144
+ position: absolute;
2145
+ padding: 0;
2146
+ background: #f0f0f0;
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::after {
2149
+ width: 100%;
2150
+ top: 50%;
2151
+ margin-top: -1em;
2152
+ content: var(--wp-edit-site-start-template-options-start-blank);
2153
+ text-align: center;
2154
+ }
2155
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) iframe {
2156
+ display: none;
2157
+ }
2158
+
2086
2159
  .edit-site-keyboard-shortcut-help-modal__section {
2087
2160
  margin: 0 0 2rem 0;
2088
2161
  }
@@ -2492,10 +2565,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2492
2565
  overflow: hidden;
2493
2566
  }
2494
2567
 
2495
- .edit-site-sidebar-navigation-screen-navigation-menus .block-editor-list-view-block__menu-edit,
2496
- .edit-site-sidebar-navigation-screen-navigation-menus .edit-site-navigation-inspector__select-menu {
2497
- display: none;
2498
- }
2499
2568
  .edit-site-sidebar-navigation-screen-navigation-menus .offcanvas-editor-list-view-leaf {
2500
2569
  max-width: calc(100% - 4px);
2501
2570
  }
@@ -1003,6 +1003,10 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
1003
1003
  padding: 0 16px;
1004
1004
  }
1005
1005
 
1006
+ .edit-site-global-styles-header {
1007
+ margin-bottom: 0 !important;
1008
+ }
1009
+
1006
1010
  .edit-site-global-styles-subtitle {
1007
1011
  margin-bottom: 0 !important;
1008
1012
  text-transform: uppercase;
@@ -1832,6 +1836,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1832
1836
  min-width: auto;
1833
1837
  }
1834
1838
 
1839
+ .edit-site-template-revisions {
1840
+ margin-left: -4px;
1841
+ }
1842
+
1835
1843
  h3.edit-site-template-card__template-areas-title {
1836
1844
  font-weight: 500;
1837
1845
  margin: 0 0 8px;
@@ -2083,6 +2091,71 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2083
2091
  vertical-align: text-top;
2084
2092
  }
2085
2093
 
2094
+ @media (min-width: 600px) {
2095
+ .edit-site-start-template-options__modal.components-modal__frame {
2096
+ width: calc(100% - 32px);
2097
+ height: calc(100% - 120px);
2098
+ }
2099
+ }
2100
+ @media (min-width: 782px) {
2101
+ .edit-site-start-template-options__modal.components-modal__frame {
2102
+ width: 50%;
2103
+ }
2104
+ }
2105
+ @media (min-width: 960px) {
2106
+ .edit-site-start-template-options__modal.components-modal__frame {
2107
+ height: -moz-fit-content;
2108
+ height: fit-content;
2109
+ }
2110
+ }
2111
+
2112
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list {
2113
+ display: grid;
2114
+ width: 100%;
2115
+ margin-top: 4px;
2116
+ gap: 24px;
2117
+ grid-template-columns: repeat(auto-fit, minmax(min(100% / 2, max(240px, 100% / 10)), 1fr));
2118
+ }
2119
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
2120
+ break-inside: avoid-column;
2121
+ margin-bottom: 0;
2122
+ width: 100%;
2123
+ aspect-ratio: 3/4;
2124
+ }
2125
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
2126
+ height: 100%;
2127
+ box-shadow: 0 0 0 1px #ddd;
2128
+ }
2129
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
2130
+ width: 100%;
2131
+ position: absolute;
2132
+ }
2133
+ .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 {
2134
+ display: none;
2135
+ }
2136
+ .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 {
2137
+ box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
2138
+ }
2139
+ .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 {
2140
+ box-shadow: inset 0 0 0 1px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
2141
+ outline: 2px solid transparent;
2142
+ }
2143
+ .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 {
2144
+ position: absolute;
2145
+ padding: 0;
2146
+ background: #f0f0f0;
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::after {
2149
+ width: 100%;
2150
+ top: 50%;
2151
+ margin-top: -1em;
2152
+ content: var(--wp-edit-site-start-template-options-start-blank);
2153
+ text-align: center;
2154
+ }
2155
+ .edit-site-start-template-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item:nth-last-child(2) iframe {
2156
+ display: none;
2157
+ }
2158
+
2086
2159
  .edit-site-keyboard-shortcut-help-modal__section {
2087
2160
  margin: 0 0 2rem 0;
2088
2161
  }
@@ -2492,10 +2565,6 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2492
2565
  overflow: hidden;
2493
2566
  }
2494
2567
 
2495
- .edit-site-sidebar-navigation-screen-navigation-menus .block-editor-list-view-block__menu-edit,
2496
- .edit-site-sidebar-navigation-screen-navigation-menus .edit-site-navigation-inspector__select-menu {
2497
- display: none;
2498
- }
2499
2568
  .edit-site-sidebar-navigation-screen-navigation-menus .offcanvas-editor-list-view-leaf {
2500
2569
  max-width: calc(100% - 4px);
2501
2570
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.3.6",
3
+ "version": "5.5.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.6",
33
- "@wordpress/block-library": "^8.3.6",
34
- "@wordpress/blocks": "^12.3.3",
35
- "@wordpress/components": "^23.3.5",
36
- "@wordpress/compose": "^6.3.3",
37
- "@wordpress/core-data": "^6.3.3",
38
- "@wordpress/data": "^8.3.3",
39
- "@wordpress/deprecated": "^3.26.1",
40
- "@wordpress/editor": "^13.3.6",
41
- "@wordpress/element": "^5.3.2",
42
- "@wordpress/hooks": "^3.26.1",
43
- "@wordpress/html-entities": "^3.26.1",
44
- "@wordpress/i18n": "^4.26.1",
45
- "@wordpress/icons": "^9.17.2",
46
- "@wordpress/interface": "^5.3.6",
47
- "@wordpress/keyboard-shortcuts": "^4.3.3",
48
- "@wordpress/keycodes": "^3.26.2",
49
- "@wordpress/media-utils": "^4.17.2",
50
- "@wordpress/notices": "^3.26.3",
51
- "@wordpress/plugins": "^5.3.3",
52
- "@wordpress/preferences": "^3.3.5",
53
- "@wordpress/private-apis": "^0.8.1",
54
- "@wordpress/reusable-blocks": "^4.3.6",
55
- "@wordpress/style-engine": "^1.9.1",
56
- "@wordpress/url": "^3.27.1",
57
- "@wordpress/viewport": "^5.3.3",
58
- "@wordpress/widgets": "^3.3.6",
30
+ "@wordpress/a11y": "^3.28.0",
31
+ "@wordpress/api-fetch": "^6.25.0",
32
+ "@wordpress/block-editor": "^11.5.0",
33
+ "@wordpress/block-library": "^8.5.0",
34
+ "@wordpress/blocks": "^12.5.0",
35
+ "@wordpress/components": "^23.5.0",
36
+ "@wordpress/compose": "^6.5.0",
37
+ "@wordpress/core-data": "^6.5.0",
38
+ "@wordpress/data": "^8.5.0",
39
+ "@wordpress/deprecated": "^3.28.0",
40
+ "@wordpress/editor": "^13.5.0",
41
+ "@wordpress/element": "^5.5.0",
42
+ "@wordpress/hooks": "^3.28.0",
43
+ "@wordpress/html-entities": "^3.28.0",
44
+ "@wordpress/i18n": "^4.28.0",
45
+ "@wordpress/icons": "^9.19.0",
46
+ "@wordpress/interface": "^5.5.0",
47
+ "@wordpress/keyboard-shortcuts": "^4.5.0",
48
+ "@wordpress/keycodes": "^3.28.0",
49
+ "@wordpress/media-utils": "^4.19.0",
50
+ "@wordpress/notices": "^3.28.0",
51
+ "@wordpress/plugins": "^5.5.0",
52
+ "@wordpress/preferences": "^3.5.0",
53
+ "@wordpress/private-apis": "^0.10.0",
54
+ "@wordpress/reusable-blocks": "^4.5.0",
55
+ "@wordpress/style-engine": "^1.11.0",
56
+ "@wordpress/url": "^3.29.0",
57
+ "@wordpress/viewport": "^5.5.0",
58
+ "@wordpress/widgets": "^3.5.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": "35f10c183655e9196d4ea12b8fa499a8ecbb7b6a"
76
+ "gitHead": "d5e03a74b79e3ca84afda24375474a103a063ee4"
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 KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';
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';
@@ -159,6 +160,7 @@ export default function Editor() {
159
160
  <GlobalStylesProvider>
160
161
  <BlockContextProvider value={ blockContext }>
161
162
  <SidebarComplementaryAreaFills />
163
+ { isEditMode && <StartTemplateOptions /> }
162
164
  <InterfaceSkeleton
163
165
  enableRegionNavigation={ false }
164
166
  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' )
@@ -170,7 +170,7 @@ export default function BorderPanel( { name, variation = '' } ) {
170
170
  // global styles are saved.
171
171
  setBorder( { radius: border?.radius, ...updatedBorder } );
172
172
  },
173
- [ setBorder ]
173
+ [ setBorder, border?.radius ]
174
174
  );
175
175
 
176
176
  return (
@@ -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' ) ||
@@ -12,6 +12,7 @@ import {
12
12
  import {
13
13
  typography,
14
14
  border,
15
+ filter,
15
16
  shadow,
16
17
  color,
17
18
  layout,
@@ -21,26 +22,37 @@ import {
21
22
  import { isRTL, __ } from '@wordpress/i18n';
22
23
  import { useSelect } from '@wordpress/data';
23
24
  import { store as coreStore } from '@wordpress/core-data';
25
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
24
26
 
25
27
  /**
26
28
  * Internal dependencies
27
29
  */
28
30
  import { useHasBorderPanel } from './border-panel';
29
31
  import { useHasColorPanel } from './color-utils';
30
- import { useHasDimensionsPanel } from './dimensions-panel';
31
- import { useHasTypographyPanel } from './typography-panel';
32
+ import { useHasFilterPanel } from './filter-utils';
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
+
40
+ const {
41
+ useHasDimensionsPanel,
42
+ useHasTypographyPanel,
43
+ useGlobalSetting,
44
+ useSettingsForBlockElement,
45
+ } = unlock( blockEditorPrivateApis );
37
46
 
38
47
  function ContextMenu( { name, parentMenu = '' } ) {
39
- const hasTypographyPanel = useHasTypographyPanel( name );
48
+ const [ rawSettings ] = useGlobalSetting( '', name );
49
+ const settings = useSettingsForBlockElement( rawSettings, name );
50
+ const hasTypographyPanel = useHasTypographyPanel( settings );
40
51
  const hasColorPanel = useHasColorPanel( name );
41
52
  const hasBorderPanel = useHasBorderPanel( name );
42
53
  const hasEffectsPanel = useHasShadowControl( name );
43
- const hasDimensionsPanel = useHasDimensionsPanel( name );
54
+ const hasFilterPanel = useHasFilterPanel( name );
55
+ const hasDimensionsPanel = useHasDimensionsPanel( settings );
44
56
  const hasLayoutPanel = hasDimensionsPanel;
45
57
  const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
46
58
 
@@ -102,6 +114,15 @@ function ContextMenu( { name, parentMenu = '' } ) {
102
114
  { __( 'Shadow' ) }
103
115
  </NavigationButtonAsItem>
104
116
  ) }
117
+ { hasFilterPanel && (
118
+ <NavigationButtonAsItem
119
+ icon={ filter }
120
+ path={ parentMenu + '/filters' }
121
+ aria-label={ __( 'Filters styles' ) }
122
+ >
123
+ { __( 'Filters' ) }
124
+ </NavigationButtonAsItem>
125
+ ) }
105
126
  { hasLayoutPanel && (
106
127
  <NavigationButtonAsItem
107
128
  icon={ layout }