@wordpress/edit-site 3.0.8 → 3.0.12

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 (258) hide show
  1. package/build/components/add-new-template/index.js +49 -0
  2. package/build/components/add-new-template/index.js.map +1 -0
  3. package/build/components/add-new-template/new-template-part.js +95 -0
  4. package/build/components/add-new-template/new-template-part.js.map +1 -0
  5. package/build/components/add-new-template/new-template.js +133 -0
  6. package/build/components/add-new-template/new-template.js.map +1 -0
  7. package/build/components/block-editor/index.js +3 -1
  8. package/build/components/block-editor/index.js.map +1 -1
  9. package/build/components/create-template-part-modal/index.js +115 -0
  10. package/build/components/create-template-part-modal/index.js.map +1 -0
  11. package/build/components/editor/index.js +20 -16
  12. package/build/components/editor/index.js.map +1 -1
  13. package/build/components/global-styles/color-palette-panel.js +29 -6
  14. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  15. package/build/components/global-styles/global-styles-provider.js +9 -47
  16. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  17. package/build/components/global-styles/gradients-palette-panel.js +56 -0
  18. package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
  19. package/build/components/global-styles/hooks.js +29 -27
  20. package/build/components/global-styles/hooks.js.map +1 -1
  21. package/build/components/global-styles/palette.js +11 -5
  22. package/build/components/global-styles/palette.js.map +1 -1
  23. package/build/components/global-styles/screen-background-color.js +2 -1
  24. package/build/components/global-styles/screen-background-color.js.map +1 -1
  25. package/build/components/global-styles/screen-block-list.js +9 -1
  26. package/build/components/global-styles/screen-block-list.js.map +1 -1
  27. package/build/components/global-styles/screen-color-palette.js +23 -3
  28. package/build/components/global-styles/screen-color-palette.js.map +1 -1
  29. package/build/components/global-styles/screen-link-color.js +2 -1
  30. package/build/components/global-styles/screen-link-color.js.map +1 -1
  31. package/build/components/global-styles/screen-text-color.js +2 -1
  32. package/build/components/global-styles/screen-text-color.js.map +1 -1
  33. package/build/components/global-styles/screen-typography-element.js +54 -0
  34. package/build/components/global-styles/screen-typography-element.js.map +1 -0
  35. package/build/components/global-styles/screen-typography.js +74 -6
  36. package/build/components/global-styles/screen-typography.js.map +1 -1
  37. package/build/components/global-styles/typography-panel.js +28 -8
  38. package/build/components/global-styles/typography-panel.js.map +1 -1
  39. package/build/components/global-styles/ui.js +12 -0
  40. package/build/components/global-styles/ui.js.map +1 -1
  41. package/build/components/global-styles/use-global-styles-output.js +2 -2
  42. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  43. package/build/components/global-styles/utils.js +1 -1
  44. package/build/components/global-styles/utils.js.map +1 -1
  45. package/build/components/header/index.js +1 -5
  46. package/build/components/header/index.js.map +1 -1
  47. package/build/components/keyboard-shortcuts/index.js +26 -0
  48. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  49. package/build/components/list/actions/index.js +104 -0
  50. package/build/components/list/actions/index.js.map +1 -0
  51. package/build/components/list/actions/rename-menu-item.js +112 -0
  52. package/build/components/list/actions/rename-menu-item.js.map +1 -0
  53. package/build/components/list/added-by.js +180 -0
  54. package/build/components/list/added-by.js.map +1 -0
  55. package/build/components/list/header.js +50 -0
  56. package/build/components/list/header.js.map +1 -0
  57. package/build/components/list/index.js +102 -0
  58. package/build/components/list/index.js.map +1 -0
  59. package/build/components/list/table.js +114 -0
  60. package/build/components/list/table.js.map +1 -0
  61. package/build/components/list/use-register-shortcuts.js +52 -0
  62. package/build/components/list/use-register-shortcuts.js.map +1 -0
  63. package/build/components/navigation-sidebar/index.js +26 -10
  64. package/build/components/navigation-sidebar/index.js.map +1 -1
  65. package/build/components/navigation-sidebar/navigation-panel/index.js +42 -44
  66. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  67. package/build/components/navigation-sidebar/navigation-toggle/index.js +5 -17
  68. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  69. package/build/components/template-details/index.js +3 -2
  70. package/build/components/template-details/index.js.map +1 -1
  71. package/build/components/template-part-converter/convert-to-template-part.js +20 -84
  72. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  73. package/build/components/welcome-guide/editor.js +58 -0
  74. package/build/components/welcome-guide/editor.js.map +1 -0
  75. package/build/components/welcome-guide/image.js +27 -0
  76. package/build/components/welcome-guide/image.js.map +1 -0
  77. package/build/components/welcome-guide/index.js +49 -0
  78. package/build/components/welcome-guide/index.js.map +1 -0
  79. package/build/components/welcome-guide/styles.js +83 -0
  80. package/build/components/welcome-guide/styles.js.map +1 -0
  81. package/build/index.js +36 -6
  82. package/build/index.js.map +1 -1
  83. package/build/plugins/index.js +4 -2
  84. package/build/plugins/index.js.map +1 -1
  85. package/build/plugins/welcome-guide-menu-item.js +39 -0
  86. package/build/plugins/welcome-guide-menu-item.js.map +1 -0
  87. package/build/store/actions.js +50 -24
  88. package/build/store/actions.js.map +1 -1
  89. package/build/store/defaults.js +4 -1
  90. package/build/store/defaults.js.map +1 -1
  91. package/build/store/selectors.js +25 -5
  92. package/build/store/selectors.js.map +1 -1
  93. package/build/utils/is-template-removable.js +21 -0
  94. package/build/utils/is-template-removable.js.map +1 -0
  95. package/build-module/components/add-new-template/index.js +36 -0
  96. package/build-module/components/add-new-template/index.js.map +1 -0
  97. package/build-module/components/add-new-template/new-template-part.js +79 -0
  98. package/build-module/components/add-new-template/new-template-part.js.map +1 -0
  99. package/build-module/components/add-new-template/new-template.js +114 -0
  100. package/build-module/components/add-new-template/new-template.js.map +1 -0
  101. package/build-module/components/block-editor/index.js +2 -1
  102. package/build-module/components/block-editor/index.js.map +1 -1
  103. package/build-module/components/create-template-part-modal/index.js +102 -0
  104. package/build-module/components/create-template-part-modal/index.js.map +1 -0
  105. package/build-module/components/editor/index.js +19 -17
  106. package/build-module/components/editor/index.js.map +1 -1
  107. package/build-module/components/global-styles/color-palette-panel.js +29 -7
  108. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  109. package/build-module/components/global-styles/global-styles-provider.js +10 -43
  110. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  111. package/build-module/components/global-styles/gradients-palette-panel.js +46 -0
  112. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
  113. package/build-module/components/global-styles/hooks.js +30 -28
  114. package/build-module/components/global-styles/hooks.js.map +1 -1
  115. package/build-module/components/global-styles/palette.js +12 -5
  116. package/build-module/components/global-styles/palette.js.map +1 -1
  117. package/build-module/components/global-styles/screen-background-color.js +2 -1
  118. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  119. package/build-module/components/global-styles/screen-block-list.js +7 -1
  120. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  121. package/build-module/components/global-styles/screen-color-palette.js +22 -3
  122. package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
  123. package/build-module/components/global-styles/screen-link-color.js +2 -1
  124. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  125. package/build-module/components/global-styles/screen-text-color.js +2 -1
  126. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  127. package/build-module/components/global-styles/screen-typography-element.js +41 -0
  128. package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
  129. package/build-module/components/global-styles/screen-typography.js +70 -6
  130. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  131. package/build-module/components/global-styles/typography-panel.js +28 -8
  132. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  133. package/build-module/components/global-styles/ui.js +11 -0
  134. package/build-module/components/global-styles/ui.js.map +1 -1
  135. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  136. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  137. package/build-module/components/global-styles/utils.js +1 -1
  138. package/build-module/components/global-styles/utils.js.map +1 -1
  139. package/build-module/components/header/index.js +1 -3
  140. package/build-module/components/header/index.js.map +1 -1
  141. package/build-module/components/keyboard-shortcuts/index.js +26 -0
  142. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  143. package/build-module/components/list/actions/index.js +85 -0
  144. package/build-module/components/list/actions/index.js.map +1 -0
  145. package/build-module/components/list/actions/rename-menu-item.js +101 -0
  146. package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
  147. package/build-module/components/list/added-by.js +166 -0
  148. package/build-module/components/list/added-by.js.map +1 -0
  149. package/build-module/components/list/header.js +37 -0
  150. package/build-module/components/list/header.js.map +1 -0
  151. package/build-module/components/list/index.js +81 -0
  152. package/build-module/components/list/index.js.map +1 -0
  153. package/build-module/components/list/table.js +98 -0
  154. package/build-module/components/list/table.js.map +1 -0
  155. package/build-module/components/list/use-register-shortcuts.js +41 -0
  156. package/build-module/components/list/use-register-shortcuts.js.map +1 -0
  157. package/build-module/components/navigation-sidebar/index.js +26 -10
  158. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  159. package/build-module/components/navigation-sidebar/navigation-panel/index.js +41 -44
  160. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  161. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +6 -18
  162. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  163. package/build-module/components/template-details/index.js +3 -2
  164. package/build-module/components/template-details/index.js.map +1 -1
  165. package/build-module/components/template-part-converter/convert-to-template-part.js +20 -84
  166. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  167. package/build-module/components/welcome-guide/editor.js +45 -0
  168. package/build-module/components/welcome-guide/editor.js.map +1 -0
  169. package/build-module/components/welcome-guide/image.js +19 -0
  170. package/build-module/components/welcome-guide/image.js.map +1 -0
  171. package/build-module/components/welcome-guide/index.js +35 -0
  172. package/build-module/components/welcome-guide/index.js.map +1 -0
  173. package/build-module/components/welcome-guide/styles.js +69 -0
  174. package/build-module/components/welcome-guide/styles.js.map +1 -0
  175. package/build-module/index.js +28 -3
  176. package/build-module/index.js.map +1 -1
  177. package/build-module/plugins/index.js +3 -2
  178. package/build-module/plugins/index.js.map +1 -1
  179. package/build-module/plugins/welcome-guide-menu-item.js +27 -0
  180. package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
  181. package/build-module/store/actions.js +51 -25
  182. package/build-module/store/actions.js.map +1 -1
  183. package/build-module/store/defaults.js +4 -1
  184. package/build-module/store/defaults.js.map +1 -1
  185. package/build-module/store/selectors.js +21 -3
  186. package/build-module/store/selectors.js.map +1 -1
  187. package/build-module/utils/is-template-removable.js +14 -0
  188. package/build-module/utils/is-template-removable.js.map +1 -0
  189. package/build-style/style-rtl.css +468 -33
  190. package/build-style/style.css +468 -33
  191. package/package.json +10 -8
  192. package/src/components/add-new-template/index.js +30 -0
  193. package/src/components/add-new-template/new-template-part.js +81 -0
  194. package/src/components/add-new-template/new-template.js +136 -0
  195. package/src/components/add-new-template/style.scss +11 -0
  196. package/src/components/block-editor/index.js +2 -0
  197. package/src/components/create-template-part-modal/index.js +132 -0
  198. package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
  199. package/src/components/editor/index.js +22 -15
  200. package/src/components/editor/style.scss +8 -0
  201. package/src/components/global-styles/color-palette-panel.js +64 -7
  202. package/src/components/global-styles/global-styles-provider.js +7 -36
  203. package/src/components/global-styles/gradients-palette-panel.js +79 -0
  204. package/src/components/global-styles/hooks.js +59 -27
  205. package/src/components/global-styles/palette.js +30 -10
  206. package/src/components/global-styles/screen-background-color.js +1 -0
  207. package/src/components/global-styles/screen-block-list.js +11 -1
  208. package/src/components/global-styles/screen-color-palette.js +30 -3
  209. package/src/components/global-styles/screen-link-color.js +1 -0
  210. package/src/components/global-styles/screen-text-color.js +1 -0
  211. package/src/components/global-styles/screen-typography-element.js +39 -0
  212. package/src/components/global-styles/screen-typography.js +84 -3
  213. package/src/components/global-styles/style.scss +33 -0
  214. package/src/components/global-styles/test/use-global-styles-output.js +3 -3
  215. package/src/components/global-styles/test/utils.js +1 -1
  216. package/src/components/global-styles/typography-panel.js +37 -7
  217. package/src/components/global-styles/ui.js +9 -0
  218. package/src/components/global-styles/use-global-styles-output.js +2 -2
  219. package/src/components/global-styles/utils.js +1 -1
  220. package/src/components/header/index.js +0 -6
  221. package/src/components/keyboard-shortcuts/index.js +32 -0
  222. package/src/components/list/actions/index.js +95 -0
  223. package/src/components/list/actions/rename-menu-item.js +134 -0
  224. package/src/components/list/added-by.js +179 -0
  225. package/src/components/list/header.js +34 -0
  226. package/src/components/list/index.js +96 -0
  227. package/src/components/list/style.scss +208 -0
  228. package/src/components/list/table.js +121 -0
  229. package/src/components/list/use-register-shortcuts.js +45 -0
  230. package/src/components/navigation-sidebar/index.js +24 -8
  231. package/src/components/navigation-sidebar/navigation-panel/index.js +57 -51
  232. package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
  233. package/src/components/navigation-sidebar/navigation-toggle/index.js +24 -36
  234. package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
  235. package/src/components/sidebar/style.scss +2 -1
  236. package/src/components/template-details/index.js +3 -2
  237. package/src/components/template-part-converter/convert-to-template-part.js +20 -140
  238. package/src/components/welcome-guide/editor.js +63 -0
  239. package/src/components/welcome-guide/image.js +11 -0
  240. package/src/components/welcome-guide/index.js +33 -0
  241. package/src/components/welcome-guide/style.scss +37 -0
  242. package/src/components/welcome-guide/styles.js +116 -0
  243. package/src/index.js +31 -3
  244. package/src/plugins/index.js +3 -1
  245. package/src/plugins/welcome-guide-menu-item.js +35 -0
  246. package/src/store/actions.js +85 -35
  247. package/src/store/defaults.js +4 -1
  248. package/src/store/selectors.js +22 -4
  249. package/src/store/test/actions.js +0 -30
  250. package/src/store/test/selectors.js +24 -0
  251. package/src/style.scss +9 -6
  252. package/src/utils/is-template-removable.js +13 -0
  253. package/build/components/header/navigation-link/index.js +0 -87
  254. package/build/components/header/navigation-link/index.js.map +0 -1
  255. package/build-module/components/header/navigation-link/index.js +0 -74
  256. package/build-module/components/header/navigation-link/index.js.map +0 -1
  257. package/src/components/header/navigation-link/index.js +0 -71
  258. package/src/components/header/navigation-link/style.scss +0 -69
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = WelcomeGuide;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _interface = require("@wordpress/interface");
15
+
16
+ var _editor = _interopRequireDefault(require("./editor"));
17
+
18
+ var _styles = _interopRequireDefault(require("./styles"));
19
+
20
+ var _store = require("../../store");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ function WelcomeGuide() {
30
+ const {
31
+ isActive,
32
+ isStylesOpen
33
+ } = (0, _data.useSelect)(select => {
34
+ const sidebar = select(_interface.store).getActiveComplementaryArea(_store.store.name);
35
+ const isStylesSidebar = sidebar === 'edit-site/global-styles';
36
+ const feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide';
37
+ return {
38
+ isActive: select(_store.store).isFeatureActive(feature),
39
+ isStylesOpen: isStylesSidebar
40
+ };
41
+ }, []);
42
+
43
+ if (!isActive) {
44
+ return null;
45
+ }
46
+
47
+ return isStylesOpen ? (0, _element.createElement)(_styles.default, null) : (0, _element.createElement)(_editor.default, null);
48
+ }
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/index.js"],"names":["WelcomeGuide","isActive","isStylesOpen","select","sidebar","interfaceStore","getActiveComplementaryArea","editSiteStore","name","isStylesSidebar","feature","isFeatureActive"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKe,SAASA,YAAT,GAAwB;AACtC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6B,qBAAaC,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAEE,gBAAF,CAAN,CAAyBC,0BAAzB,CACfC,aAAcC,IADC,CAAhB;AAGA,UAAMC,eAAe,GAAGL,OAAO,KAAK,yBAApC;AACA,UAAMM,OAAO,GAAGD,eAAe,GAAG,oBAAH,GAA0B,cAAzD;AAEA,WAAO;AACNR,MAAAA,QAAQ,EAAEE,MAAM,CAAEI,YAAF,CAAN,CAAwBI,eAAxB,CAAyCD,OAAzC,CADJ;AAENR,MAAAA,YAAY,EAAEO;AAFR,KAAP;AAIA,GAXkC,EAWhC,EAXgC,CAAnC;;AAaA,MAAK,CAAER,QAAP,EAAkB;AACjB,WAAO,IAAP;AACA;;AAED,SAAOC,YAAY,GAAG,4BAAC,eAAD,OAAH,GAA4B,4BAAC,eAAD,OAA/C;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideEditor from './editor';\nimport WelcomeGuideStyles from './styles';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuide() {\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\t\tconst isStylesSidebar = sidebar === 'edit-site/global-styles';\n\t\tconst feature = isStylesSidebar ? 'welcomeGuideStyles' : 'welcomeGuide';\n\n\t\treturn {\n\t\t\tisActive: select( editSiteStore ).isFeatureActive( feature ),\n\t\t\tisStylesOpen: isStylesSidebar,\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isStylesOpen ? <WelcomeGuideStyles /> : <WelcomeGuideEditor />;\n}\n"]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = WelcomeGuideStyles;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _components = require("@wordpress/components");
15
+
16
+ var _i18n = require("@wordpress/i18n");
17
+
18
+ var _image = _interopRequireDefault(require("./image"));
19
+
20
+ var _store = require("../../store");
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+
26
+ /**
27
+ * Internal dependencies
28
+ */
29
+ function WelcomeGuideStyles() {
30
+ const {
31
+ toggleFeature
32
+ } = (0, _data.useDispatch)(_store.store);
33
+ return (0, _element.createElement)(_components.Guide, {
34
+ className: "edit-site-welcome-guide",
35
+ contentLabel: (0, _i18n.__)('Welcome to styles'),
36
+ finishButtonText: (0, _i18n.__)('Get Started'),
37
+ onFinish: () => toggleFeature('welcomeGuideStyles'),
38
+ pages: [{
39
+ image: (0, _element.createElement)(_image.default, {
40
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.svg?1",
41
+ animatedSrc: "https://s.w.org/images/block-editor/welcome-to-styles.gif?1"
42
+ }),
43
+ content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h1", {
44
+ className: "edit-site-welcome-guide__heading"
45
+ }, (0, _i18n.__)('Welcome to Styles')), (0, _element.createElement)("p", {
46
+ className: "edit-site-welcome-guide__text"
47
+ }, (0, _i18n.__)('Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.')))
48
+ }, {
49
+ image: (0, _element.createElement)(_image.default, {
50
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/set-the-design.svg?1",
51
+ animatedSrc: "https://s.w.org/images/block-editor/set-the-design.gif?1"
52
+ }),
53
+ content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h1", {
54
+ className: "edit-site-welcome-guide__heading"
55
+ }, (0, _i18n.__)('Set the design')), (0, _element.createElement)("p", {
56
+ className: "edit-site-welcome-guide__text"
57
+ }, (0, _i18n.__)('You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! ')))
58
+ }, {
59
+ image: (0, _element.createElement)(_image.default, {
60
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.svg?1",
61
+ animatedSrc: "https://s.w.org/images/block-editor/personalize-blocks.gif?1"
62
+ }),
63
+ content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h1", {
64
+ className: "edit-site-welcome-guide__heading"
65
+ }, (0, _i18n.__)('Personalize blocks')), (0, _element.createElement)("p", {
66
+ className: "edit-site-welcome-guide__text"
67
+ }, (0, _i18n.__)('You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.')))
68
+ }, {
69
+ image: (0, _element.createElement)(_image.default, {
70
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
71
+ animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
72
+ }),
73
+ content: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("h1", {
74
+ className: "edit-site-welcome-guide__heading"
75
+ }, (0, _i18n.__)('Learn more')), (0, _element.createElement)("p", {
76
+ className: "edit-site-welcome-guide__text"
77
+ }, (0, _i18n.__)('New to block themes and styling your site? '), (0, _element.createElement)(_components.ExternalLink, {
78
+ href: (0, _i18n.__)('https://wordpress.org/support/article/wordpress-editor/')
79
+ }, (0, _i18n.__)('Here’s a detailed guide to learn how to make the most of it.'))))
80
+ }]
81
+ });
82
+ }
83
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["WelcomeGuideStyles","toggleFeature","editSiteStore","image","content"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;;AAKA;AACA;AACA;AAIe,SAASA,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AAEA,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,YAAY,EAAG,cAAI,mBAAJ,CAFhB;AAGC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,QAAA,IAAI,EAAG,cACN,yDADM;AADR,SAKG,cACD,8DADC,CALH,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-site-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to styles' ) }\n\t\t\tfinishButtonText={ __( 'Get Started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideStyles' ) }\n\t\t\tpages={ [\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-to-styles.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to Styles' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Tweak your site, or give it a whole new look! Get creative — how about a new color palette for your buttons, or choosing a new font? Take a look at what you can do here.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/set-the-design.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Set the design' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can customize your site as much as you like with different colors, typography, and layouts. Or if you prefer, just leave it up to your theme to handle! '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.svg?1\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/personalize-blocks.gif?1\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Personalize blocks' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'You can adjust your blocks to ensure a cohesive experience across your site — add your unique colors to a branded Button block, or adjust the Heading block to your preferred size.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\timage: (\n\t\t\t\t\t\t<WelcomeGuideImage\n\t\t\t\t\t\t\tnonAnimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-documentation.gif\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t),\n\t\t\t\t\tcontent: (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<h1 className=\"edit-site-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-site-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'New to block themes and styling your site? '\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/wordpress-editor/'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'Here’s a detailed guide to learn how to make the most of it.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</>\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t] }\n\t\t/>\n\t);\n}\n"]}
package/build/index.js CHANGED
@@ -35,7 +35,8 @@ Object.defineProperty(exports, "__experimentalNavigationToggle", {
35
35
  return _navigationToggle.default;
36
36
  }
37
37
  });
38
- exports.initialize = initialize;
38
+ exports.initializeEditor = initializeEditor;
39
+ exports.initializeList = initializeList;
39
40
  exports.reinitializeEditor = reinitializeEditor;
40
41
 
41
42
  var _element = require("@wordpress/element");
@@ -48,13 +49,19 @@ var _data = require("@wordpress/data");
48
49
 
49
50
  var _coreData = require("@wordpress/core-data");
50
51
 
52
+ var _editor = require("@wordpress/editor");
53
+
54
+ var _viewport = require("@wordpress/viewport");
55
+
51
56
  require("./plugins");
52
57
 
53
58
  require("./hooks");
54
59
 
55
- require("./store");
60
+ var _store = require("./store");
61
+
62
+ var _editor2 = _interopRequireDefault(require("./components/editor"));
56
63
 
57
- var _editor = _interopRequireDefault(require("./components/editor"));
64
+ var _list = _interopRequireDefault(require("./components/list"));
58
65
 
59
66
  var _mainDashboardButton = _interopRequireDefault(require("./components/main-dashboard-button"));
60
67
 
@@ -85,7 +92,7 @@ var _pluginMoreMenuItem = _interopRequireDefault(require("./components/header/pl
85
92
  function reinitializeEditor(target, settings) {
86
93
  (0, _element.unmountComponentAtNode)(target);
87
94
  const reboot = reinitializeEditor.bind(null, target, settings);
88
- (0, _element.render)((0, _element.createElement)(_editor.default, {
95
+ (0, _element.render)((0, _element.createElement)(_editor2.default, {
89
96
  initialSettings: settings,
90
97
  onError: reboot
91
98
  }), target);
@@ -98,7 +105,7 @@ function reinitializeEditor(target, settings) {
98
105
  */
99
106
 
100
107
 
101
- function initialize(id, settings) {
108
+ function initializeEditor(id, settings) {
102
109
  settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings);
103
110
 
104
111
  settings.__experimentalFetchRichUrlData = _coreData.__experimentalFetchUrlData;
@@ -116,9 +123,32 @@ function initialize(id, settings) {
116
123
  });
117
124
  }
118
125
 
119
- (0, _element.render)((0, _element.createElement)(_editor.default, {
126
+ (0, _element.render)((0, _element.createElement)(_editor2.default, {
120
127
  initialSettings: settings,
121
128
  onError: reboot
122
129
  }), target);
123
130
  }
131
+ /**
132
+ * Initializes the site editor templates list screen.
133
+ *
134
+ * @param {string} id ID of the root element to render the screen in.
135
+ * @param {string} templateType The type of the list. "wp_template" or "wp_template_part".
136
+ * @param {Object} settings Editor settings.
137
+ */
138
+
139
+
140
+ function initializeList(id, templateType, settings) {
141
+ const target = document.getElementById(id);
142
+ (0, _data.dispatch)(_editor.store).updateEditorSettings({
143
+ defaultTemplateTypes: settings.defaultTemplateTypes,
144
+ defaultTemplatePartAreas: settings.defaultTemplatePartAreas
145
+ }); // Default the navigation panel to be opened when we're in a bigger screen.
146
+ // We update the store synchronously before rendering so that we won't
147
+ // trigger an unnecessary re-render with useEffect.
148
+
149
+ (0, _data.dispatch)(_store.store).setIsNavigationPanelOpened((0, _data.select)(_viewport.store).isViewportMatch('medium'));
150
+ (0, _element.render)((0, _element.createElement)(_list.default, {
151
+ templateType: templateType
152
+ }), target);
153
+ }
124
154
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","reboot","bind","initialize","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;AANA;;AACA;;AAIA;;AAEA;;AAQA;;AACA;;AACA;;AACA;;AAgDA;;AACA;;AACA;;AACA;;AACA;;AAzEA;AACA;AACA;;AAaA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD,uCAAwBD,MAAxB;AACA,QAAME,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;AACA,uBACC,4BAAC,eAAD;AAAQ,IAAA,eAAe,EAAGA,QAA1B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADD,EAECF,MAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,UAAT,CAAqBC,EAArB,EAAyBJ,QAAzB,EAAoC;AAC1CA,EAAAA,QAAQ,CAACK,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6CP,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACQ,8BAAT,GAA0CC,oCAA1C;AACAT,EAAAA,QAAQ,CAACU,mCAAT,GAA+C,CAAE,oBAAF,CAA/C;AAEA,QAAMX,MAAM,GAAGY,QAAQ,CAACC,cAAT,CAAyBR,EAAzB,CAAf;AACA,QAAMH,MAAM,GAAGH,kBAAkB,CAACI,IAAnB,CAAyB,IAAzB,EAA+BH,MAA/B,EAAuCC,QAAvC,CAAf;;AAEA,sBAAUa,aAAV,EAAwBC,qCAAxB;;AACA;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,eAAZ,KAAgC,CAArC,EAAyC;AACxC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAED,uBACC,4BAAC,eAAD;AAAQ,IAAA,eAAe,EAAGlB,QAA1B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADD,EAECF,MAFD;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport './store';\nimport Editor from './components/editor';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initialize( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","reboot","bind","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","GUTENBERG_PHASE","enableFSEBlocks","initializeList","templateType","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","editSiteStore","setIsNavigationPanelOpened","viewportStore","isViewportMatch"],"mappings":";;;;;;;;;;;;;;;;;;;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B;AAAqC,IAAA,OAAO,EAAGC;AAA/C,IADD,EAECF,MAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASoB,cAAT,CAAyBf,EAAzB,EAA6BgB,YAA7B,EAA2CpB,QAA3C,EAAsD;AAC5D,QAAMD,MAAM,GAAGY,QAAQ,CAACC,cAAT,CAAyBR,EAAzB,CAAf;AAEA,sBAAUiB,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAEvB,QAAQ,CAACuB,oBADc;AAE7CC,IAAAA,wBAAwB,EAAExB,QAAQ,CAACwB;AAFU,GAA9C,EAH4D,CAQ5D;AACA;AACA;;AACA,sBAAUC,YAAV,EAA0BC,0BAA1B,CACC,kBAAQC,eAAR,EAAwBC,eAAxB,CAAyC,QAAzC,CADD;AAIA,uBAAQ,4BAAC,aAAD;AAAM,IAAA,YAAY,EAAGR;AAArB,IAAR,EAAgDrB,MAAhD;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as viewportStore } from '@wordpress/viewport';\n\n/**\n * Internal dependencies\n */\nimport './plugins';\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport Editor from './components/editor';\nimport List from './components/list';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.GUTENBERG_PHASE === 2 ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\trender(\n\t\t<Editor initialSettings={ settings } onError={ reboot } />,\n\t\ttarget\n\t);\n}\n\n/**\n * Initializes the site editor templates list screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {string} templateType The type of the list. \"wp_template\" or \"wp_template_part\".\n * @param {Object} settings Editor settings.\n */\nexport function initializeList( id, templateType, settings ) {\n\tconst target = document.getElementById( id );\n\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Default the navigation panel to be opened when we're in a bigger screen.\n\t// We update the store synchronously before rendering so that we won't\n\t// trigger an unnecessary re-render with useEffect.\n\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t);\n\n\trender( <List templateType={ templateType } />, target );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
@@ -18,6 +18,8 @@ var _icons = require("@wordpress/icons");
18
18
 
19
19
  var _toolsMoreMenuGroup = _interopRequireDefault(require("../components/header/tools-more-menu-group"));
20
20
 
21
+ var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
22
+
21
23
  /**
22
24
  * External dependencies
23
25
  */
@@ -35,11 +37,11 @@ var _toolsMoreMenuGroup = _interopRequireDefault(require("../components/header/t
35
37
  role: "menuitem",
36
38
  icon: _icons.download,
37
39
  onClick: () => (0, _apiFetch.default)({
38
- path: '/__experimental/edit-site/v1/export',
40
+ path: '/wp-block-editor/v1/export',
39
41
  parse: false
40
42
  }).then(res => res.blob()).then(blob => (0, _downloadjs.default)(blob, 'edit-site-export.zip', 'application/zip')),
41
43
  info: (0, _i18n.__)('Download your templates and template parts.')
42
- }, (0, _i18n.__)('Export'))));
44
+ }, (0, _i18n.__)('Export')), (0, _element.createElement)(_welcomeGuideMenuItem.default, null)));
43
45
  }
44
46
 
45
47
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/plugins/index.js"],"names":["render","download","path","parse","then","res","blob"],"mappings":";;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGA,6BAAgB,WAAhB,EAA6B;AAC5BA,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGC,eAFR;AAGC,MAAA,OAAO,EAAG,MACT,uBAAU;AACTC,QAAAA,IAAI,EAAE,qCADG;AAETC,QAAAA,KAAK,EAAE;AAFE,OAAV,EAIEC,IAJF,CAIUC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAJnB,EAKEF,IALF,CAKUE,IAAF,IACN,yBACCA,IADD,EAEC,sBAFD,EAGC,iBAHD,CANF,CAJF;AAiBC,MAAA,IAAI,EAAG,cACN,6CADM;AAjBR,OAqBG,cAAI,QAAJ,CArBH,CADD,CADD,CADD;AA6BA;;AA/B2B,CAA7B","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\n\nregisterPlugin( 'edit-site', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\ticon={ download }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\t\tpath: '/__experimental/edit-site/v1/export',\n\t\t\t\t\t\t\t\tparse: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.then( ( res ) => res.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tdownloadjs(\n\t\t\t\t\t\t\t\t\t\tblob,\n\t\t\t\t\t\t\t\t\t\t'edit-site-export.zip',\n\t\t\t\t\t\t\t\t\t\t'application/zip'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Download your templates and template parts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Export' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/plugins/index.js"],"names":["render","download","path","parse","then","res","blob"],"mappings":";;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,6BAAgB,WAAhB,EAA6B;AAC5BA,EAAAA,MAAM,GAAG;AACR,WACC,qDACC,4BAAC,2BAAD,QACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAC,UADN;AAEC,MAAA,IAAI,EAAGC,eAFR;AAGC,MAAA,OAAO,EAAG,MACT,uBAAU;AACTC,QAAAA,IAAI,EAAE,4BADG;AAETC,QAAAA,KAAK,EAAE;AAFE,OAAV,EAIEC,IAJF,CAIUC,GAAF,IAAWA,GAAG,CAACC,IAAJ,EAJnB,EAKEF,IALF,CAKUE,IAAF,IACN,yBACCA,IADD,EAEC,sBAFD,EAGC,iBAHD,CANF,CAJF;AAiBC,MAAA,IAAI,EAAG,cACN,6CADM;AAjBR,OAqBG,cAAI,QAAJ,CArBH,CADD,EAwBC,4BAAC,6BAAD,OAxBD,CADD,CADD;AA8BA;;AAhC2B,CAA7B","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nregisterPlugin( 'edit-site', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\ticon={ download }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tapiFetch( {\n\t\t\t\t\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\t\t\t\t\tparse: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t.then( ( res ) => res.blob() )\n\t\t\t\t\t\t\t\t.then( ( blob ) =>\n\t\t\t\t\t\t\t\t\tdownloadjs(\n\t\t\t\t\t\t\t\t\t\tblob,\n\t\t\t\t\t\t\t\t\t\t'edit-site-export.zip',\n\t\t\t\t\t\t\t\t\t\t'application/zip'\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Download your templates and template parts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Export' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = WelcomeGuideMenuItem;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _i18n = require("@wordpress/i18n");
11
+
12
+ var _data = require("@wordpress/data");
13
+
14
+ var _components = require("@wordpress/components");
15
+
16
+ var _interface = require("@wordpress/interface");
17
+
18
+ var _store = require("../store");
19
+
20
+ /**
21
+ * WordPress dependencies
22
+ */
23
+
24
+ /**
25
+ * Internal dependencies
26
+ */
27
+ function WelcomeGuideMenuItem() {
28
+ const {
29
+ toggleFeature
30
+ } = (0, _data.useDispatch)(_store.store);
31
+ const isStylesOpen = (0, _data.useSelect)(select => {
32
+ const sidebar = select(_interface.store).getActiveComplementaryArea(_store.store.name);
33
+ return sidebar === 'edit-site/global-styles';
34
+ }, []);
35
+ return (0, _element.createElement)(_components.MenuItem, {
36
+ onClick: () => toggleFeature(isStylesOpen ? 'welcomeGuideStyles' : 'welcomeGuide')
37
+ }, (0, _i18n.__)('Welcome Guide'));
38
+ }
39
+ //# sourceMappingURL=welcome-guide-menu-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/plugins/welcome-guide-menu-item.js"],"names":["WelcomeGuideMenuItem","toggleFeature","editSiteStore","isStylesOpen","select","sidebar","interfaceStore","getActiveComplementaryArea","name"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGe,SAASA,oBAAT,GAAgC;AAC9C,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,YAAb,CAA1B;AACA,QAAMC,YAAY,GAAG,qBAAaC,MAAF,IAAc;AAC7C,UAAMC,OAAO,GAAGD,MAAM,CAAEE,gBAAF,CAAN,CAAyBC,0BAAzB,CACfL,aAAcM,IADC,CAAhB;AAIA,WAAOH,OAAO,KAAK,yBAAnB;AACA,GANoB,EAMlB,EANkB,CAArB;AAQA,SACC,4BAAC,oBAAD;AACC,IAAA,OAAO,EAAG,MACTJ,aAAa,CACZE,YAAY,GAAG,oBAAH,GAA0B,cAD1B;AAFf,KAOG,cAAI,eAAJ,CAPH,CADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../store';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst { toggleFeature } = useDispatch( editSiteStore );\n\tconst isStylesOpen = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn sidebar === 'edit-site/global-styles';\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () =>\n\t\t\t\ttoggleFeature(\n\t\t\t\t\tisStylesOpen ? 'welcomeGuideStyles' : 'welcomeGuide'\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t{ __( 'Welcome Guide' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -140,19 +140,34 @@ function* addTemplate(template) {
140
140
  };
141
141
  }
142
142
  /**
143
- * Removes a template, and updates the current page and template.
143
+ * Removes a template.
144
144
  *
145
- * @param {number} templateId The template ID.
145
+ * @param {Object} template The template object.
146
146
  */
147
147
 
148
148
 
149
- function* removeTemplate(templateId) {
150
- yield (0, _dataControls.apiFetch)({
151
- path: `/wp/v2/templates/${templateId}`,
152
- method: 'DELETE'
153
- });
154
- const page = yield _data.controls.select(_constants.STORE_NAME, 'getPage');
155
- yield _data.controls.dispatch(_constants.STORE_NAME, 'setPage', page);
149
+ function* removeTemplate(template) {
150
+ try {
151
+ yield _data.controls.dispatch(_coreData.store, 'deleteEntityRecord', 'postType', template.type, template.id, {
152
+ force: true
153
+ });
154
+ const lastError = yield _data.controls.select(_coreData.store, 'getLastEntityDeleteError', 'postType', template.type, template.id);
155
+
156
+ if (lastError) {
157
+ throw lastError;
158
+ }
159
+
160
+ yield _data.controls.dispatch(_notices.store, 'createSuccessNotice', (0, _i18n.sprintf)(
161
+ /* translators: The template/part's name. */
162
+ (0, _i18n.__)('"%s" removed.'), template.title.rendered), {
163
+ type: 'snackbar'
164
+ });
165
+ } catch (error) {
166
+ const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while deleting the template.');
167
+ yield _data.controls.dispatch(_notices.store, 'createErrorNotice', errorMessage, {
168
+ type: 'snackbar'
169
+ });
170
+ }
156
171
  }
157
172
  /**
158
173
  * Returns an action object used to set a template part.
@@ -362,11 +377,18 @@ function setIsListViewOpened(isOpen) {
362
377
  /**
363
378
  * Reverts a template to its original theme-provided file.
364
379
  *
365
- * @param {Object} template The template to revert.
380
+ * @param {Object} template The template to revert.
381
+ * @param {Object} [options]
382
+ * @param {boolean} [options.allowUndo] Whether to allow the user to undo
383
+ * reverting the template. Default true.
366
384
  */
367
385
 
368
386
 
369
387
  function* revertTemplate(template) {
388
+ let {
389
+ allowUndo = true
390
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
391
+
370
392
  if (!(0, _isTemplateRevertable.default)(template)) {
371
393
  yield _data.controls.dispatch(_notices.store, 'createErrorNotice', (0, _i18n.__)('This template is not revertable.'), {
372
394
  type: 'snackbar'
@@ -429,21 +451,25 @@ function* revertTemplate(template) {
429
451
  source: 'theme'
430
452
  });
431
453
 
432
- const undoRevert = async () => {
433
- await (0, _data.dispatch)(_coreData.store).editEntityRecord('postType', template.type, edited.id, {
434
- content: serializeBlocks,
435
- blocks: edited.blocks,
436
- source: 'custom'
454
+ if (allowUndo) {
455
+ const undoRevert = async () => {
456
+ await (0, _data.dispatch)(_coreData.store).editEntityRecord('postType', template.type, edited.id, {
457
+ content: serializeBlocks,
458
+ blocks: edited.blocks,
459
+ source: 'custom'
460
+ });
461
+ };
462
+
463
+ yield _data.controls.dispatch(_notices.store, 'createSuccessNotice', (0, _i18n.__)('Template reverted.'), {
464
+ type: 'snackbar',
465
+ actions: [{
466
+ label: (0, _i18n.__)('Undo'),
467
+ onClick: undoRevert
468
+ }]
437
469
  });
438
- };
439
-
440
- yield _data.controls.dispatch(_notices.store, 'createSuccessNotice', (0, _i18n.__)('Template reverted.'), {
441
- type: 'snackbar',
442
- actions: [{
443
- label: (0, _i18n.__)('Undo'),
444
- onClick: undoRevert
445
- }]
446
- });
470
+ } else {
471
+ yield _data.controls.dispatch(_notices.store, 'createSuccessNotice', (0, _i18n.__)('Template reverted.'));
472
+ }
447
473
  } catch (error) {
448
474
  const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('Template revert failed. Please reload.');
449
475
  yield _data.controls.dispatch(_notices.store, 'createErrorNotice', errorMessage, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","controls","resolveSelect","coreStore","slug","page","context","addTemplate","newTemplate","dispatch","content","id","blocks","undoIgnore","removeTemplate","path","method","select","editSiteStoreName","setTemplatePart","templatePartId","pushTemplatePart","setHomeTemplateId","homeTemplateId","setPage","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","noticesStore","templateEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","raw","undoRevert","editEntityRecord","actions","label","onClick","error","errorMessage","message","code","openGeneralSidebar","name","interfaceStore","closeGeneralSidebar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,OAAxB,EAAkC;AACxC,SAAO;AACNC,IAAAA,IAAI,EAAE,gBADA;AAEND,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,kCAAT,CAA6CC,UAA7C,EAA0D;AAChE,SAAO;AACNF,IAAAA,IAAI,EAAE,yBADA;AAENE,IAAAA;AAFM,GAAP;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,UAAUC,WAAV,CAAuBC,UAAvB,EAAmCC,YAAnC,EAAkD;AACxD,QAAMC,WAAW,GAAG;AAAED,IAAAA;AAAF,GAApB;;A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gBADK,EAEL,yBAFK,EAGLnD,qBAHK,EAILkD,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;;AACO,UAAUE,mBAAV,GAAgC;AACtC,QAAMrE,eAASQ,QAAT,CACL4D,gBADK,EAEL,0BAFK,EAGLnD,qBAHK,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, and updates the current page and template.\n *\n * @param {number} templateId The template ID.\n */\nexport function* removeTemplate( templateId ) {\n\tyield apiFetch( {\n\t\tpath: `/wp/v2/templates/${ templateId }`,\n\t\tmethod: 'DELETE',\n\t} );\n\tconst page = yield controls.select( editSiteStoreName, 'getPage' );\n\tyield controls.dispatch( editSiteStoreName, 'setPage', page );\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":["toggleFeature","feature","type","__experimentalSetPreviewDeviceType","deviceType","setTemplate","templateId","templateSlug","pageContext","template","controls","resolveSelect","coreStore","slug","page","context","addTemplate","newTemplate","dispatch","content","id","blocks","undoIgnore","removeTemplate","force","lastError","select","noticesStore","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","editSiteStoreName","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","interfaceStore","closeGeneralSidebar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAhBA;AACA;AACA;;AAUA;AACA;AACA;;A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AAT,CACLgE,gBADK,EAEL,yBAFK,EAGL9B,qBAHK,EAIL6B,IAJK,CAAN;AAMA;AAED;AACA;AACA;AACA;AACA;;;AACO,UAAUE,mBAAV,GAAgC;AACtC,QAAMzE,eAASQ,QAAT,CACLgE,gBADK,EAEL,0BAFK,EAGL9B,qBAHK,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"]}
@@ -5,7 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.PREFERENCES_DEFAULTS = void 0;
7
7
  const PREFERENCES_DEFAULTS = {
8
- features: {}
8
+ features: {
9
+ welcomeGuide: true,
10
+ welcomeGuideStyles: true
11
+ }
9
12
  };
10
13
  exports.PREFERENCES_DEFAULTS = PREFERENCES_DEFAULTS;
11
14
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AADyB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {},\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","features","welcomeGuide","welcomeGuideStyles"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,QAAQ,EAAE;AACTC,IAAAA,YAAY,EAAE,IADL;AAETC,IAAAA,kBAAkB,EAAE;AAFX;AADyB,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tfeatures: {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t},\n};\n"]}