@wordpress/edit-site 3.0.10 → 3.0.14

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 (186) hide show
  1. package/build/components/add-new-template/new-template-part.js +34 -18
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/add-new-template/new-template.js +41 -23
  4. package/build/components/add-new-template/new-template.js.map +1 -1
  5. package/build/components/block-editor/index.js +3 -1
  6. package/build/components/block-editor/index.js.map +1 -1
  7. package/build/components/editor/index.js +12 -6
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/color-palette-panel.js +29 -6
  10. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  11. package/build/components/global-styles/global-styles-provider.js +5 -43
  12. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  13. package/build/components/global-styles/gradients-palette-panel.js +71 -0
  14. package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
  15. package/build/components/global-styles/hooks.js +5 -5
  16. package/build/components/global-styles/hooks.js.map +1 -1
  17. package/build/components/global-styles/palette.js +11 -5
  18. package/build/components/global-styles/palette.js.map +1 -1
  19. package/build/components/global-styles/screen-background-color.js +3 -1
  20. package/build/components/global-styles/screen-background-color.js.map +1 -1
  21. package/build/components/global-styles/screen-color-palette.js +23 -3
  22. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  23. package/build/components/global-styles/screen-link-color.js +3 -1
  24. package/build/components/global-styles/screen-link-color.js.map +1 -1
  25. package/build/components/global-styles/screen-text-color.js +3 -1
  26. package/build/components/global-styles/screen-text-color.js.map +1 -1
  27. package/build/components/global-styles/screen-typography-element.js +54 -0
  28. package/build/components/global-styles/screen-typography-element.js.map +1 -0
  29. package/build/components/global-styles/screen-typography.js +74 -6
  30. package/build/components/global-styles/screen-typography.js.map +1 -1
  31. package/build/components/global-styles/typography-panel.js +28 -8
  32. package/build/components/global-styles/typography-panel.js.map +1 -1
  33. package/build/components/global-styles/ui.js +12 -0
  34. package/build/components/global-styles/ui.js.map +1 -1
  35. package/build/components/global-styles/use-global-styles-output.js +2 -2
  36. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  37. package/build/components/global-styles/utils.js +1 -1
  38. package/build/components/global-styles/utils.js.map +1 -1
  39. package/build/components/keyboard-shortcuts/index.js +26 -0
  40. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  41. package/build/components/list/actions/index.js +104 -0
  42. package/build/components/list/actions/index.js.map +1 -0
  43. package/build/components/list/actions/rename-menu-item.js +112 -0
  44. package/build/components/list/actions/rename-menu-item.js.map +1 -0
  45. package/build/components/list/added-by.js +180 -0
  46. package/build/components/list/added-by.js.map +1 -0
  47. package/build/components/list/index.js +54 -7
  48. package/build/components/list/index.js.map +1 -1
  49. package/build/components/list/table.js +58 -68
  50. package/build/components/list/table.js.map +1 -1
  51. package/build/components/list/use-register-shortcuts.js +52 -0
  52. package/build/components/list/use-register-shortcuts.js.map +1 -0
  53. package/build/components/navigation-sidebar/index.js +24 -9
  54. package/build/components/navigation-sidebar/index.js.map +1 -1
  55. package/build/components/navigation-sidebar/navigation-panel/index.js +35 -17
  56. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  57. package/build/components/navigation-sidebar/navigation-toggle/index.js +14 -5
  58. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  59. package/build/components/template-details/edit-template-title.js +33 -0
  60. package/build/components/template-details/edit-template-title.js.map +1 -0
  61. package/build/components/template-details/index.js +8 -4
  62. package/build/components/template-details/index.js.map +1 -1
  63. package/build/components/template-details/template-areas.js +1 -1
  64. package/build/components/template-details/template-areas.js.map +1 -1
  65. package/build/index.js +8 -2
  66. package/build/index.js.map +1 -1
  67. package/build/store/actions.js +47 -18
  68. package/build/store/actions.js.map +1 -1
  69. package/build/store/selectors.js +25 -5
  70. package/build/store/selectors.js.map +1 -1
  71. package/build-module/components/add-new-template/new-template-part.js +30 -17
  72. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  73. package/build-module/components/add-new-template/new-template.js +40 -24
  74. package/build-module/components/add-new-template/new-template.js.map +1 -1
  75. package/build-module/components/block-editor/index.js +2 -1
  76. package/build-module/components/block-editor/index.js.map +1 -1
  77. package/build-module/components/editor/index.js +13 -7
  78. package/build-module/components/editor/index.js.map +1 -1
  79. package/build-module/components/global-styles/color-palette-panel.js +29 -7
  80. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  81. package/build-module/components/global-styles/global-styles-provider.js +6 -39
  82. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  83. package/build-module/components/global-styles/gradients-palette-panel.js +60 -0
  84. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
  85. package/build-module/components/global-styles/hooks.js +5 -5
  86. package/build-module/components/global-styles/hooks.js.map +1 -1
  87. package/build-module/components/global-styles/palette.js +12 -5
  88. package/build-module/components/global-styles/palette.js.map +1 -1
  89. package/build-module/components/global-styles/screen-background-color.js +3 -1
  90. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  91. package/build-module/components/global-styles/screen-color-palette.js +22 -3
  92. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  93. package/build-module/components/global-styles/screen-link-color.js +3 -1
  94. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  95. package/build-module/components/global-styles/screen-text-color.js +3 -1
  96. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  97. package/build-module/components/global-styles/screen-typography-element.js +41 -0
  98. package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
  99. package/build-module/components/global-styles/screen-typography.js +70 -6
  100. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  101. package/build-module/components/global-styles/typography-panel.js +28 -8
  102. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  103. package/build-module/components/global-styles/ui.js +11 -0
  104. package/build-module/components/global-styles/ui.js.map +1 -1
  105. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  106. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  107. package/build-module/components/global-styles/utils.js +1 -1
  108. package/build-module/components/global-styles/utils.js.map +1 -1
  109. package/build-module/components/keyboard-shortcuts/index.js +26 -0
  110. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  111. package/build-module/components/list/actions/index.js +85 -0
  112. package/build-module/components/list/actions/index.js.map +1 -0
  113. package/build-module/components/list/actions/rename-menu-item.js +101 -0
  114. package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
  115. package/build-module/components/list/added-by.js +166 -0
  116. package/build-module/components/list/added-by.js.map +1 -0
  117. package/build-module/components/list/index.js +49 -8
  118. package/build-module/components/list/index.js.map +1 -1
  119. package/build-module/components/list/table.js +60 -70
  120. package/build-module/components/list/table.js.map +1 -1
  121. package/build-module/components/list/use-register-shortcuts.js +41 -0
  122. package/build-module/components/list/use-register-shortcuts.js.map +1 -0
  123. package/build-module/components/navigation-sidebar/index.js +22 -10
  124. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  125. package/build-module/components/navigation-sidebar/navigation-panel/index.js +33 -18
  126. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  127. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +14 -6
  128. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  129. package/build-module/components/template-details/edit-template-title.js +23 -0
  130. package/build-module/components/template-details/edit-template-title.js.map +1 -0
  131. package/build-module/components/template-details/index.js +7 -4
  132. package/build-module/components/template-details/index.js.map +1 -1
  133. package/build-module/components/template-details/template-areas.js +1 -1
  134. package/build-module/components/template-details/template-areas.js.map +1 -1
  135. package/build-module/index.js +8 -3
  136. package/build-module/index.js.map +1 -1
  137. package/build-module/store/actions.js +48 -19
  138. package/build-module/store/actions.js.map +1 -1
  139. package/build-module/store/selectors.js +21 -3
  140. package/build-module/store/selectors.js.map +1 -1
  141. package/build-style/style-rtl.css +146 -21
  142. package/build-style/style.css +146 -21
  143. package/package.json +10 -8
  144. package/src/components/add-new-template/new-template-part.js +32 -18
  145. package/src/components/add-new-template/new-template.js +39 -20
  146. package/src/components/block-editor/index.js +2 -0
  147. package/src/components/editor/index.js +17 -6
  148. package/src/components/global-styles/color-palette-panel.js +64 -7
  149. package/src/components/global-styles/global-styles-provider.js +3 -33
  150. package/src/components/global-styles/gradients-palette-panel.js +99 -0
  151. package/src/components/global-styles/hooks.js +4 -4
  152. package/src/components/global-styles/palette.js +30 -10
  153. package/src/components/global-styles/screen-background-color.js +2 -0
  154. package/src/components/global-styles/screen-color-palette.js +30 -3
  155. package/src/components/global-styles/screen-link-color.js +2 -0
  156. package/src/components/global-styles/screen-text-color.js +2 -0
  157. package/src/components/global-styles/screen-typography-element.js +39 -0
  158. package/src/components/global-styles/screen-typography.js +84 -3
  159. package/src/components/global-styles/style.scss +45 -6
  160. package/src/components/global-styles/test/use-global-styles-output.js +1 -1
  161. package/src/components/global-styles/test/utils.js +1 -1
  162. package/src/components/global-styles/typography-panel.js +37 -7
  163. package/src/components/global-styles/ui.js +9 -0
  164. package/src/components/global-styles/use-global-styles-output.js +2 -2
  165. package/src/components/global-styles/utils.js +1 -1
  166. package/src/components/keyboard-shortcuts/index.js +32 -0
  167. package/src/components/list/actions/index.js +95 -0
  168. package/src/components/list/actions/rename-menu-item.js +134 -0
  169. package/src/components/list/added-by.js +179 -0
  170. package/src/components/list/index.js +63 -5
  171. package/src/components/list/style.scss +106 -11
  172. package/src/components/list/table.js +65 -76
  173. package/src/components/list/use-register-shortcuts.js +45 -0
  174. package/src/components/navigation-sidebar/index.js +21 -12
  175. package/src/components/navigation-sidebar/navigation-panel/index.js +32 -15
  176. package/src/components/navigation-sidebar/navigation-toggle/index.js +29 -17
  177. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
  178. package/src/components/sidebar/style.scss +2 -1
  179. package/src/components/template-details/edit-template-title.js +28 -0
  180. package/src/components/template-details/index.js +15 -10
  181. package/src/components/template-details/template-areas.js +1 -1
  182. package/src/index.js +10 -2
  183. package/src/store/actions.js +82 -34
  184. package/src/store/selectors.js +22 -4
  185. package/src/store/test/actions.js +0 -24
  186. package/src/store/test/selectors.js +24 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","force","setTemplatePart","templatePartId","pushTemplatePart","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","goBack","showHomepage","show_on_front","showOnFront","page_on_front","frontpageId","siteUrl","select","homeTemplate","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","error","errorMessage","message","code","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;A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AE,CAAE,oBAAF,CAHG,EAIL;AACCU,MAAAA,IAAI,EAAE,UADP;AAEC8D,MAAAA,OAAO,EAAE,CACR;AACCC,QAAAA,KAAK,EAAEzE,EAAE,CAAE,MAAF,CADV;AAEC0E,QAAAA,OAAO,EAAEJ;AAFV,OADQ;AAFV,KAJK,CAAN;AAcA,GAvGD,CAuGE,OAAQK,KAAR,EAAgB;AACjB,UAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG7E,EAAE,CAAE,wCAAF,CAHN;AAIA,UAAML,QAAQ,CAACC,QAAT,CACLM,YADK,EAEL,mBAFK,EAGL0E,YAHK,EAIL;AAAElE,MAAAA,IAAI,EAAE;AAAR,KAJK,CAAN;AAMA;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUqE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMrF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAIL0E,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAMtF,QAAQ,CAACC,QAAT,CACLQ,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __ } 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';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle 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 * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * 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 function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template.\n *\n * @param {Object} template The template object.\n */\nexport function* removeTemplate( template ) {\n\tyield controls.dispatch(\n\t\tcoreStore,\n\t\t'deleteEntityRecord',\n\t\t'postType',\n\t\ttemplate.type,\n\t\ttemplate.id,\n\t\t{ force: true }\n\t);\n}\n\n/**\n * Returns an action object used to set 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_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Returns an action object used to push a template part to navigation history.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function pushTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'PUSH_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\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 function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst { id: templateId, slug: templateSlug } = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Go back to the current editing page.\n */\nexport function goBack() {\n\treturn {\n\t\ttype: 'GO_BACK',\n\t};\n}\n\n/**\n * Displays the site homepage for editing in the editor.\n */\nexport function* showHomepage() {\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getEntityRecord',\n\t\t'root',\n\t\t'site'\n\t);\n\n\tconst { siteUrl } = yield controls.select(\n\t\teditSiteStoreName,\n\t\t'getSettings'\n\t);\n\n\tconst page = {\n\t\tpath: siteUrl,\n\t\tcontext:\n\t\t\tshowOnFront === 'page'\n\t\t\t\t? {\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: frontpageId,\n\t\t\t\t }\n\t\t\t\t: {},\n\t};\n\n\tconst homeTemplate = yield* setPage( page );\n\tyield setHomeTemplateId( homeTemplate );\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close 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 * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n */\nexport function* revertTemplate( template ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tconst undoRevert = async () => {\n\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\tedited.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\tsource: 'custom',\n\t\t\t\t}\n\t\t\t);\n\t\t};\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\t__( 'Template reverted.' ),\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: undoRevert,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["parse","__unstableSerializeAndClean","controls","dispatch","apiFetch","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","resolveSelect","slug","page","context","addTemplate","newTemplate","content","id","blocks","undoIgnore","removeTemplate","force","lastError","select","title","rendered","error","errorMessage","message","code","setTemplatePart","templatePartId","pushTemplatePart","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","goBack","showHomepage","show_on_front","showOnFront","page_on_front","frontpageId","siteUrl","homeTemplate","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","allowUndo","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","openGeneralSidebar","name","closeGeneralSidebar"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,iBAAnC;AACA,SAASC,QAAT,QAAyB,0BAAzB;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;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,OAAxB,EAAkC;AACxC,SAAO;AACNC,IAAAA,IAAI,EAAE,gBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE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C,YAHK,EAIL;AAAEzB,MAAAA,IAAI,EAAE;AAAR,KAJK,CAAN;AAMA;AACD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUyE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAM1F,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,yBAFK,EAGLE,iBAHK,EAIL8E,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,UAAUC,mBAAV,GAAgC;AACtC,QAAM3F,QAAQ,CAACC,QAAT,CACLS,cADK,EAEL,0BAFK,EAGLE,iBAHK,CAAN;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { controls, dispatch } from '@wordpress/data';\nimport { apiFetch } from '@wordpress/data-controls';\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';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Returns an action object used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n *\n * @return {Object} Action object.\n */\nexport function toggleFeature( feature ) {\n\treturn {\n\t\ttype: 'TOGGLE_FEATURE',\n\t\tfeature,\n\t};\n}\n\n/**\n * Returns an action object used to toggle 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 * Returns an action object used to set a template.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport function* setTemplate( templateId, templateSlug ) {\n\tconst pageContext = { templateSlug };\n\tif ( ! templateSlug ) {\n\t\tconst template = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplateId\n\t\t);\n\t\tpageContext.templateSlug = template?.slug;\n\t}\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: pageContext },\n\t};\n}\n\n/**\n * 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 function* addTemplate( template ) {\n\tconst newTemplate = yield controls.dispatch(\n\t\tcoreStore,\n\t\t'saveEntityRecord',\n\t\t'postType',\n\t\t'wp_template',\n\t\ttemplate\n\t);\n\n\tif ( template.content ) {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\tnewTemplate.id,\n\t\t\t{ blocks: parse( template.content ) },\n\t\t\t{ undoIgnore: true }\n\t\t);\n\t}\n\n\treturn {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t};\n}\n\n/**\n * Removes a template.\n *\n * @param {Object} template The template object.\n */\nexport function* removeTemplate( template ) {\n\ttry {\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'deleteEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{ force: true }\n\t\t);\n\n\t\tconst lastError = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getLastEntityDeleteError',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\n\t\tif ( lastError ) {\n\t\t\tthrow lastError;\n\t\t}\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createSuccessNotice',\n\t\t\tsprintf(\n\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t__( '\"%s\" removed.' ),\n\t\t\t\ttemplate.title.rendered\n\t\t\t),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n\n/**\n * Returns an action object used to set 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_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Returns an action object used to push a template part to navigation history.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function pushTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'PUSH_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Updates the homeTemplateId state with the templateId of the page resolved\n * from the given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\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 function* setPage( page ) {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = yield controls.resolveSelect(\n\t\t\tcoreStore,\n\t\t\t'getEntityRecord',\n\t\t\t'postType',\n\t\t\tpage.context.postType || 'post',\n\t\t\tpage.context.postId\n\t\t);\n\n\t\tpage.path = getPathAndQueryString( entity.link );\n\t}\n\tconst { id: templateId, slug: templateSlug } = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'__experimentalGetTemplateForLink',\n\t\tpage.path\n\t);\n\tyield {\n\t\ttype: 'SET_PAGE',\n\t\tpage: ! templateSlug\n\t\t\t? page\n\t\t\t: {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug,\n\t\t\t\t\t},\n\t\t\t },\n\t\ttemplateId,\n\t};\n\treturn templateId;\n}\n\n/**\n * Go back to the current editing page.\n */\nexport function goBack() {\n\treturn {\n\t\ttype: 'GO_BACK',\n\t};\n}\n\n/**\n * Displays the site homepage for editing in the editor.\n */\nexport function* showHomepage() {\n\tconst {\n\t\tshow_on_front: showOnFront,\n\t\tpage_on_front: frontpageId,\n\t} = yield controls.resolveSelect(\n\t\tcoreStore,\n\t\t'getEntityRecord',\n\t\t'root',\n\t\t'site'\n\t);\n\n\tconst { siteUrl } = yield controls.select(\n\t\teditSiteStoreName,\n\t\t'getSettings'\n\t);\n\n\tconst page = {\n\t\tpath: siteUrl,\n\t\tcontext:\n\t\t\tshowOnFront === 'page'\n\t\t\t\t? {\n\t\t\t\t\t\tpostType: 'page',\n\t\t\t\t\t\tpostId: frontpageId,\n\t\t\t\t }\n\t\t\t\t: {},\n\t};\n\n\tconst homeTemplate = yield* setPage( page );\n\tyield setHomeTemplateId( homeTemplate );\n}\n\n/**\n * Returns an action object used to set the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Returns an action object used to open/close 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 * 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 function* revertTemplate( template, { allowUndo = true } = {} ) {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\t__( 'This template is not revertable.' ),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEntity',\n\t\t\t'postType',\n\t\t\ttemplate.type\n\t\t);\n\t\tif ( ! templateEntity ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\t\tconst fileTemplate = yield apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createErrorNotice',\n\t\t\t\t__(\n\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar' }\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\t\tconst edited = yield controls.select(\n\t\t\tcoreStore,\n\t\t\t'getEditedEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id\n\t\t);\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // required to make the `undo` behave correctly\n\t\t\t\tblocks: edited.blocks, // required to revert the blocks in the editor\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // required to merge this edit with the last undo level\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tyield controls.dispatch(\n\t\t\tcoreStore,\n\t\t\t'editEntityRecord',\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\tfileTemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t}\n\t\t);\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = async () => {\n\t\t\t\tawait dispatch( coreStore ).editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\tedited.id,\n\t\t\t\t\t{\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\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} else {\n\t\t\tyield controls.dispatch(\n\t\t\t\tnoticesStore,\n\t\t\t\t'createSuccessNotice',\n\t\t\t\t__( 'Template reverted.' )\n\t\t\t);\n\t\t}\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tyield controls.dispatch(\n\t\t\tnoticesStore,\n\t\t\t'createErrorNotice',\n\t\t\terrorMessage,\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t}\n}\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n *\n * @yield {Object} Action object.\n */\nexport function* openGeneralSidebar( name ) {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'enableComplementaryArea',\n\t\teditSiteStoreName,\n\t\tname\n\t);\n}\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n *\n * @yield {Object} Action object.\n */\nexport function* closeGeneralSidebar() {\n\tyield controls.dispatch(\n\t\tinterfaceStore,\n\t\t'disableComplementaryArea',\n\t\teditSiteStoreName\n\t);\n}\n"]}
@@ -11,6 +11,7 @@ import { store as coreDataStore } from '@wordpress/core-data';
11
11
  import { createRegistrySelector } from '@wordpress/data';
12
12
  import { uploadMedia } from '@wordpress/media-utils';
13
13
  import { isTemplatePart } from '@wordpress/blocks';
14
+ import { Platform } from '@wordpress/element';
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
@@ -53,6 +54,20 @@ export function __experimentalGetPreviewDeviceType(state) {
53
54
  */
54
55
 
55
56
  export const getCanUserCreateMedia = createRegistrySelector(select => () => select(coreDataStore).canUser('create', 'media'));
57
+ /**
58
+ * Returns any available Reusable blocks.
59
+ *
60
+ * @param {Object} state Global application state.
61
+ *
62
+ * @return {Array} The available reusable blocks.
63
+ */
64
+
65
+ export const getReusableBlocks = createRegistrySelector(select => () => {
66
+ const isWeb = Platform.OS === 'web';
67
+ return isWeb ? select(coreDataStore).getEntityRecords('postType', 'wp_block', {
68
+ per_page: -1
69
+ }) : [];
70
+ });
56
71
  /**
57
72
  * Returns the settings, taking into account active features and permissions.
58
73
  *
@@ -67,7 +82,8 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
67
82
  outlineMode: true,
68
83
  focusMode: isFeatureActive(state, 'focusMode'),
69
84
  hasFixedToolbar: isFeatureActive(state, 'fixedToolbar'),
70
- __experimentalSetIsInserterOpened: setIsInserterOpen
85
+ __experimentalSetIsInserterOpened: setIsInserterOpen,
86
+ __experimentalReusableBlocks: getReusableBlocks(state)
71
87
  };
72
88
  const canUserCreateMedia = getCanUserCreateMedia(state);
73
89
 
@@ -93,7 +109,7 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
93
109
  };
94
110
 
95
111
  return settings;
96
- }, state => [getCanUserCreateMedia(state), state.settings, isFeatureActive(state, 'focusMode'), isFeatureActive(state, 'fixedToolbar')]);
112
+ }, state => [getCanUserCreateMedia(state), state.settings, isFeatureActive(state, 'focusMode'), isFeatureActive(state, 'fixedToolbar'), getReusableBlocks(state)]);
97
113
  /**
98
114
  * Returns the current home template ID.
99
115
  *
@@ -279,7 +295,9 @@ export const getCurrentTemplateTemplateParts = createRegistrySelector(select =>
279
295
  const templateType = getEditedPostType(state);
280
296
  const templateId = getEditedPostId(state);
281
297
  const template = select(coreDataStore).getEditedEntityRecord('postType', templateType, templateId);
282
- const templateParts = select(coreDataStore).getEntityRecords('postType', 'wp_template_part');
298
+ const templateParts = select(coreDataStore).getEntityRecords('postType', 'wp_template_part', {
299
+ per_page: -1
300
+ });
283
301
  const templatePartsById = keyBy(templateParts, templatePart => templatePart.id);
284
302
  return ((_template$blocks = template.blocks) !== null && _template$blocks !== void 0 ? _template$blocks : []).filter(block => isTemplatePart(block)).map(block => {
285
303
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["get","map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","uploadMedia","isTemplatePart","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","canUser","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","length","getPreviousEditedPost","getEditedPostType","type","getEditedPostId","id","getPreviousEditedPostType","getPreviousEditedPostId","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","getEntityRecords","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,EAAmBC,KAAnB,QAAgC,QAAhC;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AAEA;AACA;AACA;;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,qBAHD,EAICC,wBAJD,QAKO,6DALP;AAMA,SACCC,mBADD,EAECC,oBAFD,QAGO,sEAHP;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA2C;AACjD,SAAOjB,GAAG,CAAEgB,KAAK,CAACE,WAAN,CAAkBC,QAApB,EAA8B,CAAEF,OAAF,CAA9B,EAA2C,KAA3C,CAAV;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,kCAAT,CAA6CJ,KAA7C,EAAqD;AAC3D,SAAOA,KAAK,CAACK,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAGhB,sBAAsB,CAAIiB,MAAF,IAAc,MAC1EA,MAAM,CAAElB,aAAF,CAAN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EEqF,KAAF,IAAa;AAClB,UAAM;AACLC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,KAAF;AAASnB,QAAAA;AAAT;AADP,QAEFiB,KAFJ;AAGA,UAAMG,cAAc,GAAI,GAAGD,KAAO,KAAKnB,IAAM,EAA7C;AACA,UAAMc,YAAY,GAAGD,iBAAiB,CAAEO,cAAF,CAAtC;AAEA,WAAO;AACNN,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAlCmE,CAA9D","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 1 ] || {};\n}\n\nfunction getPreviousEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 2 ] || {};\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the previous edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getPreviousEditedPostType( state ) {\n\treturn getPreviousEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the previous edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getPreviousEditedPostId( state ) {\n\treturn getPreviousEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template_part'\n\t\t);\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["get","map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","uploadMedia","isTemplatePart","Platform","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","isFeatureActive","state","feature","preferences","features","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","select","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","length","getPreviousEditedPost","getEditedPostType","type","getEditedPostId","id","getPreviousEditedPostType","getPreviousEditedPostId","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,GAAd,EAAmBC,KAAnB,QAAgC,QAAhC;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AAEA;AACA;AACA;;AACA,SACCC,SADD,EAECC,mBAFD,EAGCC,qBAHD,EAICC,wBAJD,QAKO,6DALP;AAMA,SACCC,mBADD,EAECC,oBAFD,QAGO,sEAHP;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CAA0BC,KAA1B,EAAiCC,OAAjC,EAA2C;AACjD,SAAOlB,GAAG,CAAEiB,KAAK,CAACE,WAAN,CAAkBC,QAApB,EAA8B,CAAEF,OAAF,CAA9B,EAA2C,KAA3C,CAAV;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,kCAAT,CAA6CJ,KAA7C,EAAqD;AAC3D,SAAOA,KAAK,CAACK,UAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,qBAAqB,GAAGjB,sBAAsB,CAAIkB,MAAF,IAAc,MAC1EA,MAAM,CAAEnB,aAAF,CAAN,CAAwBoB,OAAxB,CAAiC,QAAjC,EAA2C,OAA3C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F,CAAN,CAAwBoE,qBAAxB,CAChB,UADgB,EAEhBT,YAFgB,EAGhBC,UAHgB,CAAjB;AAMA,QAAMsB,aAAa,GAAG/D,MAAM,CAC3BnB,aAD2B,CAAN,CAEpBwB,gBAFoB,CAEF,UAFE,EAEU,kBAFV,EAE8B;AAAEC,IAAAA,QAAQ,EAAE,CAAC;AAAb,GAF9B,CAAtB;AAGA,QAAM0D,iBAAiB,GAAGtF,KAAK,CAC9BqF,aAD8B,EAE5BE,YAAF,IAAoBA,YAAY,CAAClC,EAFH,CAA/B;AAKA,SAAO,qBAAEW,QAAQ,CAACwB,MAAX,+DAAqB,EAArB,EACLC,MADK,CACKC,KAAF,IAAapF,cAAc,CAAEoF,KAAF,CAD9B,EAEL3F,GAFK,CAEE2F,KAAF,IAAa;AAClB,UAAM;AACLC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,KAAF;AAASnB,QAAAA;AAAT;AADP,QAEFiB,KAFJ;AAGA,UAAMG,cAAc,GAAI,GAAGD,KAAO,KAAKnB,IAAM,EAA7C;AACA,UAAMc,YAAY,GAAGD,iBAAiB,CAAEO,cAAF,CAAtC;AAEA,WAAO;AACNN,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAjCmE,CAA9D","sourcesContent":["/**\n * External dependencies\n */\nimport { get, map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} feature Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, feature ) {\n\treturn get( state.preferences.features, [ feature ], false );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: isFeatureActive( state, 'focusMode' ),\n\t\t\thasFixedToolbar: isFeatureActive( state, 'fixedToolbar' ),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\tisFeatureActive( state, 'focusMode' ),\n\t\tisFeatureActive( state, 'fixedToolbar' ),\n\t\tgetReusableBlocks( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 1 ] || {};\n}\n\nfunction getPreviousEditedPost( state ) {\n\treturn state.editedPost[ state.editedPost.length - 2 ] || {};\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the previous edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getPreviousEditedPostType( state ) {\n\treturn getPreviousEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the previous edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getPreviousEditedPostId( state ) {\n\treturn getPreviousEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select(\n\t\t\tcoreDataStore\n\t\t).getEntityRecords( 'postType', 'wp_template_part', { per_page: -1 } );\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n"]}
@@ -535,6 +535,30 @@ body.is-fullscreen-mode .interface-interface-skeleton {
535
535
  padding: 0;
536
536
  }
537
537
 
538
+ .edit-site-typography-panel__preview {
539
+ display: flex;
540
+ align-items: center;
541
+ justify-content: center;
542
+ min-height: 100px;
543
+ margin-bottom: 16px;
544
+ background: #f0f0f0;
545
+ border-radius: 2px;
546
+ }
547
+
548
+ .edit-site-global-styles-screen-typography {
549
+ margin: 16px;
550
+ }
551
+
552
+ .edit-site-global-styles-screen-typography__indicator {
553
+ height: 24px;
554
+ width: 24px;
555
+ font-size: 14px;
556
+ display: flex !important;
557
+ align-items: center;
558
+ justify-content: center;
559
+ border-radius: 2px;
560
+ }
561
+
538
562
  .edit-site-global-styles-screen-colors {
539
563
  margin: 16px;
540
564
  }
@@ -542,13 +566,11 @@ body.is-fullscreen-mode .interface-interface-skeleton {
542
566
  margin-right: 0;
543
567
  display: block;
544
568
  border-radius: 50%;
545
- border: 0;
546
569
  height: 24px;
547
570
  width: 24px;
548
571
  padding: 0;
549
- background-image: repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0), repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0);
550
- background-position: 100% 0, 25px 25px;
551
- background-size: calc(2 * 5px) calc(2 * 5px);
572
+ border: 1px solid #ddd;
573
+ background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
552
574
  }
553
575
 
554
576
  .edit-site-global-styles-header__description {
@@ -561,6 +583,23 @@ body.is-fullscreen-mode .interface-interface-skeleton {
561
583
  font-weight: 500;
562
584
  }
563
585
 
586
+ .edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle {
587
+ margin-left: 16px;
588
+ margin-right: 16px;
589
+ width: unset;
590
+ }
591
+ .edit-site-screen-color-palette-toggle.edit-site-screen-color-palette-toggle .components-toggle-group-control {
592
+ min-height: 32px;
593
+ }
594
+
595
+ h2.edit-site-global-styles-gradient-palette-panel__duotone-heading.components-heading {
596
+ text-transform: uppercase;
597
+ line-height: 24px;
598
+ font-weight: 500;
599
+ font-size: 11px;
600
+ margin-bottom: 8px;
601
+ }
602
+
564
603
  .edit-site-header {
565
604
  align-items: center;
566
605
  background-color: #fff;
@@ -1099,12 +1138,14 @@ body.is-fullscreen-mode .edit-site-list-header {
1099
1138
 
1100
1139
  .edit-site-list-table {
1101
1140
  width: 100%;
1102
- border: 1px solid #e0e0e0;
1141
+ border: 1px solid #ddd;
1103
1142
  border-radius: 2px;
1104
1143
  margin: 0;
1105
1144
  overflow: hidden;
1145
+ border-spacing: 0;
1146
+ max-width: 960px;
1106
1147
  }
1107
- .edit-site-list-table li {
1148
+ .edit-site-list-table tr {
1108
1149
  display: flex;
1109
1150
  align-items: center;
1110
1151
  padding: 16px;
@@ -1112,36 +1153,119 @@ body.is-fullscreen-mode .edit-site-list-header {
1112
1153
  border-top: 1px solid #f0f0f0;
1113
1154
  margin: 0;
1114
1155
  }
1156
+ .edit-site-list-table tr:first-child {
1157
+ border-top: 0;
1158
+ }
1115
1159
  @media (min-width: 782px) {
1116
- .edit-site-list-table li {
1160
+ .edit-site-list-table tr {
1117
1161
  padding: 24px 32px;
1118
1162
  }
1119
1163
  }
1120
- .edit-site-list-table li .edit-site-list-table-column:nth-child(1) {
1121
- width: calc(60% - 36px);
1164
+ .edit-site-list-table tr .edit-site-list-table-column:nth-child(1) {
1165
+ width: calc(60% - 18px);
1166
+ padding-left: 24px;
1122
1167
  }
1123
- .edit-site-list-table li .edit-site-list-table-column:nth-child(1) a {
1124
- display: block;
1168
+ .edit-site-list-table tr .edit-site-list-table-column:nth-child(1) a {
1169
+ display: inline-block;
1125
1170
  text-decoration: none;
1126
1171
  font-weight: 500;
1127
1172
  margin-bottom: 4px;
1128
1173
  }
1129
- .edit-site-list-table li .edit-site-list-table-column:nth-child(2) {
1130
- width: calc(40% - 36px);
1174
+ .edit-site-list-table tr .edit-site-list-table-column:nth-child(2) {
1175
+ width: calc(40% - 18px);
1131
1176
  }
1132
- .edit-site-list-table li .edit-site-list-table-column:nth-child(3) {
1177
+ .edit-site-list-table tr .edit-site-list-table-column:nth-child(3) {
1133
1178
  min-width: 36px;
1179
+ flex-shrink: 0;
1134
1180
  }
1135
- .edit-site-list-table li.edit-site-list-table-head {
1136
- border-bottom: 1px solid #e0e0e0;
1181
+ .edit-site-list-table tr.edit-site-list-table-head {
1137
1182
  font-size: 16px;
1138
- font-weight: 500;
1183
+ font-weight: 600;
1139
1184
  text-align: right;
1140
- color: #000;
1185
+ color: #1e1e1e;
1141
1186
  border-top: none;
1187
+ border-bottom: 1px solid #ddd;
1142
1188
  }
1143
- .edit-site-list-table li.edit-site-list-table-head + li {
1144
- border-top: 0;
1189
+ .edit-site-list-table tr.edit-site-list-table-head th {
1190
+ font-weight: inherit;
1191
+ }
1192
+
1193
+ @media (min-width: 782px) {
1194
+ .edit-site-list.is-navigation-open .components-snackbar-list {
1195
+ margin-right: 300px;
1196
+ }
1197
+ }
1198
+
1199
+ @media (min-width: 782px) {
1200
+ .edit-site-list__rename-modal .components-base-control {
1201
+ width: 320px;
1202
+ }
1203
+ }
1204
+ .edit-site-list__rename-modal .components-modal__header {
1205
+ border-bottom: none;
1206
+ }
1207
+ .edit-site-list__rename-modal .components-modal__content::before {
1208
+ margin-bottom: 4px;
1209
+ }
1210
+
1211
+ .edit-site-list__rename-modal-actions {
1212
+ margin-top: 12px;
1213
+ }
1214
+
1215
+ .edit-site-template__actions button:not(:last-child) {
1216
+ margin-left: 8px;
1217
+ }
1218
+
1219
+ .edit-site-list-added-by__icon {
1220
+ display: flex;
1221
+ flex-shrink: 0;
1222
+ position: relative;
1223
+ align-items: center;
1224
+ justify-content: center;
1225
+ width: 32px;
1226
+ height: 32px;
1227
+ background: #2f2f2f;
1228
+ border-radius: 100%;
1229
+ }
1230
+ .edit-site-list-added-by__icon svg {
1231
+ fill: #fff;
1232
+ }
1233
+ .edit-site-list-added-by__icon.is-customized::after {
1234
+ position: absolute;
1235
+ content: "";
1236
+ background: var(--wp-admin-theme-color);
1237
+ height: 8px;
1238
+ width: 8px;
1239
+ outline: 2px solid #fff;
1240
+ border-radius: 100%;
1241
+ top: -1px;
1242
+ left: -1px;
1243
+ }
1244
+
1245
+ .edit-site-list-added-by__avatar {
1246
+ flex-shrink: 0;
1247
+ overflow: hidden;
1248
+ border-radius: 100%;
1249
+ background: #2f2f2f;
1250
+ width: 32px;
1251
+ height: 32px;
1252
+ }
1253
+ .edit-site-list-added-by__avatar img {
1254
+ width: 32px;
1255
+ height: 32px;
1256
+ -o-object-fit: cover;
1257
+ object-fit: cover;
1258
+ opacity: 0;
1259
+ transition: opacity 0.1s linear;
1260
+ }
1261
+ @media (prefers-reduced-motion: reduce) {
1262
+ .edit-site-list-added-by__avatar img {
1263
+ transition-duration: 0s;
1264
+ transition-delay: 0s;
1265
+ }
1266
+ }
1267
+ .edit-site-list-added-by__avatar.is-loaded img {
1268
+ opacity: 1;
1145
1269
  }
1146
1270
 
1147
1271
  .edit-site-new-template-dropdown .components-dropdown-menu__toggle {
@@ -1212,7 +1336,8 @@ body.is-fullscreen-mode .edit-site-list-header {
1212
1336
  padding: 0 16px;
1213
1337
  }
1214
1338
 
1215
- .edit-site-global-styles-color-palette-panel {
1339
+ .edit-site-global-styles-color-palette-panel,
1340
+ .edit-site-global-styles-gradient-palette-panel {
1216
1341
  padding: 16px;
1217
1342
  }
1218
1343