@wordpress/edit-post 8.32.0 → 8.32.1-next.ff1cebbba.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/build/commands/use-commands.js +54 -47
  2. package/build/commands/use-commands.js.map +7 -1
  3. package/build/components/back-button/fullscreen-mode-close.js +127 -118
  4. package/build/components/back-button/fullscreen-mode-close.js.map +7 -1
  5. package/build/components/back-button/index.js +56 -54
  6. package/build/components/back-button/index.js.map +7 -1
  7. package/build/components/browser-url/index.js +45 -44
  8. package/build/components/browser-url/index.js.map +7 -1
  9. package/build/components/editor-initialization/index.js +24 -18
  10. package/build/components/editor-initialization/index.js.map +7 -1
  11. package/build/components/editor-initialization/listener-hooks.js +42 -43
  12. package/build/components/editor-initialization/listener-hooks.js.map +7 -1
  13. package/build/components/init-pattern-modal/index.js +100 -79
  14. package/build/components/init-pattern-modal/index.js.map +7 -1
  15. package/build/components/keyboard-shortcuts/index.js +37 -33
  16. package/build/components/keyboard-shortcuts/index.js.map +7 -1
  17. package/build/components/layout/index.js +447 -467
  18. package/build/components/layout/index.js.map +7 -1
  19. package/build/components/layout/use-padding-appender.js +66 -59
  20. package/build/components/layout/use-padding-appender.js.map +7 -1
  21. package/build/components/layout/use-should-iframe.js +36 -30
  22. package/build/components/layout/use-should-iframe.js.map +7 -1
  23. package/build/components/meta-boxes/index.js +46 -33
  24. package/build/components/meta-boxes/index.js.map +7 -1
  25. package/build/components/meta-boxes/meta-box-visibility.js +37 -22
  26. package/build/components/meta-boxes/meta-box-visibility.js.map +7 -1
  27. package/build/components/meta-boxes/meta-boxes-area/index.js +62 -53
  28. package/build/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  29. package/build/components/meta-boxes/use-meta-box-initialization.js +37 -32
  30. package/build/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  31. package/build/components/more-menu/index.js +64 -44
  32. package/build/components/more-menu/index.js.map +7 -1
  33. package/build/components/more-menu/manage-patterns-menu-item.js +39 -37
  34. package/build/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  35. package/build/components/more-menu/welcome-guide-menu-item.js +39 -21
  36. package/build/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  37. package/build/components/preferences-modal/enable-custom-fields.js +76 -66
  38. package/build/components/preferences-modal/enable-custom-fields.js.map +7 -1
  39. package/build/components/preferences-modal/enable-panel.js +47 -43
  40. package/build/components/preferences-modal/enable-panel.js.map +7 -1
  41. package/build/components/preferences-modal/index.js +51 -39
  42. package/build/components/preferences-modal/index.js.map +7 -1
  43. package/build/components/preferences-modal/meta-boxes-section.js +65 -52
  44. package/build/components/preferences-modal/meta-boxes-section.js.map +7 -1
  45. package/build/components/welcome-guide/default.js +134 -97
  46. package/build/components/welcome-guide/default.js.map +7 -1
  47. package/build/components/welcome-guide/image.js +34 -23
  48. package/build/components/welcome-guide/image.js.map +7 -1
  49. package/build/components/welcome-guide/index.js +51 -38
  50. package/build/components/welcome-guide/index.js.map +7 -1
  51. package/build/components/welcome-guide/template.js +65 -45
  52. package/build/components/welcome-guide/template.js.map +7 -1
  53. package/build/deprecated.js +84 -110
  54. package/build/deprecated.js.map +7 -1
  55. package/build/hooks/use-navigate-to-entity-record.js +60 -78
  56. package/build/hooks/use-navigate-to-entity-record.js.map +7 -1
  57. package/build/index.js +101 -136
  58. package/build/index.js.map +7 -1
  59. package/build/lock-unlock.js +31 -15
  60. package/build/lock-unlock.js.map +7 -1
  61. package/build/store/actions.js +239 -431
  62. package/build/store/actions.js.map +7 -1
  63. package/build/store/constants.js +33 -26
  64. package/build/store/constants.js.map +7 -1
  65. package/build/store/index.js +44 -32
  66. package/build/store/index.js.map +7 -1
  67. package/build/store/reducer.js +50 -57
  68. package/build/store/reducer.js.map +7 -1
  69. package/build/store/selectors.js +288 -459
  70. package/build/store/selectors.js.map +7 -1
  71. package/build/utils/meta-boxes.js +31 -19
  72. package/build/utils/meta-boxes.js.map +7 -1
  73. package/build-module/commands/use-commands.js +35 -40
  74. package/build-module/commands/use-commands.js.map +7 -1
  75. package/build-module/components/back-button/fullscreen-mode-close.js +102 -110
  76. package/build-module/components/back-button/fullscreen-mode-close.js.map +7 -1
  77. package/build-module/components/back-button/index.js +28 -47
  78. package/build-module/components/back-button/index.js.map +7 -1
  79. package/build-module/components/browser-url/index.js +23 -38
  80. package/build-module/components/browser-url/index.js.map +7 -1
  81. package/build-module/components/editor-initialization/index.js +6 -13
  82. package/build-module/components/editor-initialization/index.js.map +7 -1
  83. package/build-module/components/editor-initialization/listener-hooks.js +20 -34
  84. package/build-module/components/editor-initialization/listener-hooks.js.map +7 -1
  85. package/build-module/components/init-pattern-modal/index.js +90 -74
  86. package/build-module/components/init-pattern-modal/index.js.map +7 -1
  87. package/build-module/components/keyboard-shortcuts/index.js +21 -26
  88. package/build-module/components/keyboard-shortcuts/index.js.map +7 -1
  89. package/build-module/components/layout/index.js +439 -448
  90. package/build-module/components/layout/index.js.map +7 -1
  91. package/build-module/components/layout/use-padding-appender.js +44 -54
  92. package/build-module/components/layout/use-padding-appender.js.map +7 -1
  93. package/build-module/components/layout/use-should-iframe.js +15 -25
  94. package/build-module/components/layout/use-should-iframe.js.map +7 -1
  95. package/build-module/components/meta-boxes/index.js +18 -26
  96. package/build-module/components/meta-boxes/index.js.map +7 -1
  97. package/build-module/components/meta-boxes/meta-box-visibility.js +18 -15
  98. package/build-module/components/meta-boxes/meta-box-visibility.js.map +7 -1
  99. package/build-module/components/meta-boxes/meta-boxes-area/index.js +30 -44
  100. package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +7 -1
  101. package/build-module/components/meta-boxes/use-meta-box-initialization.js +14 -25
  102. package/build-module/components/meta-boxes/use-meta-box-initialization.js.map +7 -1
  103. package/build-module/components/more-menu/index.js +36 -37
  104. package/build-module/components/more-menu/index.js.map +7 -1
  105. package/build-module/components/more-menu/manage-patterns-menu-item.js +21 -31
  106. package/build-module/components/more-menu/manage-patterns-menu-item.js.map +7 -1
  107. package/build-module/components/more-menu/welcome-guide-menu-item.js +22 -16
  108. package/build-module/components/more-menu/welcome-guide-menu-item.js.map +7 -1
  109. package/build-module/components/preferences-modal/enable-custom-fields.js +51 -56
  110. package/build-module/components/preferences-modal/enable-custom-fields.js.map +7 -1
  111. package/build-module/components/preferences-modal/enable-panel.js +30 -38
  112. package/build-module/components/preferences-modal/enable-panel.js.map +7 -1
  113. package/build-module/components/preferences-modal/index.js +24 -34
  114. package/build-module/components/preferences-modal/index.js.map +7 -1
  115. package/build-module/components/preferences-modal/meta-boxes-section.js +34 -45
  116. package/build-module/components/preferences-modal/meta-boxes-section.js.map +7 -1
  117. package/build-module/components/welcome-guide/default.js +107 -91
  118. package/build-module/components/welcome-guide/default.js.map +7 -1
  119. package/build-module/components/welcome-guide/image.js +16 -18
  120. package/build-module/components/welcome-guide/image.js.map +7 -1
  121. package/build-module/components/welcome-guide/index.js +23 -31
  122. package/build-module/components/welcome-guide/index.js.map +7 -1
  123. package/build-module/components/welcome-guide/template.js +38 -39
  124. package/build-module/components/welcome-guide/template.js.map +7 -1
  125. package/build-module/deprecated.js +62 -103
  126. package/build-module/deprecated.js.map +7 -1
  127. package/build-module/hooks/use-navigate-to-entity-record.js +42 -73
  128. package/build-module/hooks/use-navigate-to-entity-record.js.map +7 -1
  129. package/build-module/index.js +70 -95
  130. package/build-module/index.js.map +7 -1
  131. package/build-module/lock-unlock.js +8 -7
  132. package/build-module/lock-unlock.js.map +7 -1
  133. package/build-module/store/actions.js +158 -368
  134. package/build-module/store/actions.js.map +7 -1
  135. package/build-module/store/constants.js +9 -21
  136. package/build-module/store/constants.js.map +7 -1
  137. package/build-module/store/index.js +10 -22
  138. package/build-module/store/index.js.map +7 -1
  139. package/build-module/store/reducer.js +28 -51
  140. package/build-module/store/reducer.js.map +7 -1
  141. package/build-module/store/selectors.js +232 -442
  142. package/build-module/store/selectors.js.map +7 -1
  143. package/build-module/utils/meta-boxes.js +9 -13
  144. package/build-module/utils/meta-boxes.js.map +7 -1
  145. package/build-style/classic-rtl.css +0 -154
  146. package/build-style/classic.css +0 -154
  147. package/build-style/style-rtl.css +135 -110
  148. package/build-style/style.css +135 -110
  149. package/package.json +39 -31
  150. package/src/classic.scss +3 -0
  151. package/src/components/back-button/style.scss +3 -0
  152. package/src/components/layout/index.js +3 -2
  153. package/src/components/layout/style.scss +4 -0
  154. package/src/components/meta-boxes/meta-boxes-area/style.scss +3 -0
  155. package/src/components/welcome-guide/style.scss +3 -0
  156. package/src/style.scss +8 -4
  157. package/build/components/header/header-toolbar/index.native.js +0 -204
  158. package/build/components/header/header-toolbar/index.native.js.map +0 -1
  159. package/build/components/header/index.native.js +0 -59
  160. package/build/components/header/index.native.js.map +0 -1
  161. package/build/components/layout/index.native.js +0 -166
  162. package/build/components/layout/index.native.js.map +0 -1
  163. package/build/components/visual-editor/header.native.js +0 -63
  164. package/build/components/visual-editor/header.native.js.map +0 -1
  165. package/build/components/visual-editor/index.native.js +0 -44
  166. package/build/components/visual-editor/index.native.js.map +0 -1
  167. package/build/editor.native.js +0 -157
  168. package/build/editor.native.js.map +0 -1
  169. package/build/index.native.js +0 -58
  170. package/build/index.native.js.map +0 -1
  171. package/build-module/components/header/header-toolbar/index.native.js +0 -196
  172. package/build-module/components/header/header-toolbar/index.native.js.map +0 -1
  173. package/build-module/components/header/index.native.js +0 -50
  174. package/build-module/components/header/index.native.js.map +0 -1
  175. package/build-module/components/layout/index.native.js +0 -158
  176. package/build-module/components/layout/index.native.js.map +0 -1
  177. package/build-module/components/visual-editor/header.native.js +0 -56
  178. package/build-module/components/visual-editor/header.native.js.map +0 -1
  179. package/build-module/components/visual-editor/index.native.js +0 -35
  180. package/build-module/components/visual-editor/index.native.js.map +0 -1
  181. package/build-module/editor.native.js +0 -149
  182. package/build-module/editor.native.js.map +0 -1
  183. package/build-module/index.native.js +0 -45
  184. package/build-module/index.native.js.map +0 -1
@@ -1,35 +1,27 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import WelcomeGuideDefault from './default';
10
- import WelcomeGuideTemplate from './template';
11
- import { store as editPostStore } from '../../store';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- export default function WelcomeGuide({
14
- postType
15
- }) {
16
- const {
17
- isActive,
18
- isEditingTemplate
19
- } = useSelect(select => {
20
- const {
21
- isFeatureActive
22
- } = select(editPostStore);
23
- const _isEditingTemplate = postType === 'wp_template';
24
- const feature = _isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide';
25
- return {
26
- isActive: isFeatureActive(feature),
27
- isEditingTemplate: _isEditingTemplate
28
- };
29
- }, [postType]);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useSelect } from "@wordpress/data";
3
+ import WelcomeGuideDefault from "./default";
4
+ import WelcomeGuideTemplate from "./template";
5
+ import { store as editPostStore } from "../../store";
6
+ function WelcomeGuide({ postType }) {
7
+ const { isActive, isEditingTemplate } = useSelect(
8
+ (select) => {
9
+ const { isFeatureActive } = select(editPostStore);
10
+ const _isEditingTemplate = postType === "wp_template";
11
+ const feature = _isEditingTemplate ? "welcomeGuideTemplate" : "welcomeGuide";
12
+ return {
13
+ isActive: isFeatureActive(feature),
14
+ isEditingTemplate: _isEditingTemplate
15
+ };
16
+ },
17
+ [postType]
18
+ );
30
19
  if (!isActive) {
31
20
  return null;
32
21
  }
33
- return isEditingTemplate ? /*#__PURE__*/_jsx(WelcomeGuideTemplate, {}) : /*#__PURE__*/_jsx(WelcomeGuideDefault, {});
22
+ return isEditingTemplate ? /* @__PURE__ */ jsx(WelcomeGuideTemplate, {}) : /* @__PURE__ */ jsx(WelcomeGuideDefault, {});
34
23
  }
35
- //# sourceMappingURL=index.js.map
24
+ export {
25
+ WelcomeGuide as default
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useSelect","WelcomeGuideDefault","WelcomeGuideTemplate","store","editPostStore","jsx","_jsx","WelcomeGuide","postType","isActive","isEditingTemplate","select","isFeatureActive","_isEditingTemplate","feature"],"sources":["@wordpress/edit-post/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideDefault from './default';\nimport WelcomeGuideTemplate from './template';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuide( { postType } ) {\n\tconst { isActive, isEditingTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst _isEditingTemplate = postType === 'wp_template';\n\t\t\tconst feature = _isEditingTemplate\n\t\t\t\t? 'welcomeGuideTemplate'\n\t\t\t\t: 'welcomeGuide';\n\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( feature ),\n\t\t\t\tisEditingTemplate: _isEditingTemplate,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isEditingTemplate ? (\n\t\t<WelcomeGuideTemplate />\n\t) : (\n\t\t<WelcomeGuideDefault />\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,WAAW;AAC3C,OAAOC,oBAAoB,MAAM,YAAY;AAC7C,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAErD,eAAe,SAASC,YAAYA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACpD,MAAM;IAAEC,QAAQ;IAAEC;EAAkB,CAAC,GAAGV,SAAS,CAC9CW,MAAM,IAAM;IACb,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEP,aAAc,CAAC;IACnD,MAAMS,kBAAkB,GAAGL,QAAQ,KAAK,aAAa;IACrD,MAAMM,OAAO,GAAGD,kBAAkB,GAC/B,sBAAsB,GACtB,cAAc;IAEjB,OAAO;MACNJ,QAAQ,EAAEG,eAAe,CAAEE,OAAQ,CAAC;MACpCJ,iBAAiB,EAAEG;IACpB,CAAC;EACF,CAAC,EACD,CAAEL,QAAQ,CACX,CAAC;EAED,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OAAOC,iBAAiB,gBACvBJ,IAAA,CAACJ,oBAAoB,IAAE,CAAC,gBAExBI,IAAA,CAACL,mBAAmB,IAAE,CACtB;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/welcome-guide/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideDefault from './default';\nimport WelcomeGuideTemplate from './template';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuide( { postType } ) {\n\tconst { isActive, isEditingTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isFeatureActive } = select( editPostStore );\n\t\t\tconst _isEditingTemplate = postType === 'wp_template';\n\t\t\tconst feature = _isEditingTemplate\n\t\t\t\t? 'welcomeGuideTemplate'\n\t\t\t\t: 'welcomeGuide';\n\n\t\t\treturn {\n\t\t\t\tisActive: isFeatureActive( feature ),\n\t\t\t\tisEditingTemplate: _isEditingTemplate,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn isEditingTemplate ? (\n\t\t<WelcomeGuideTemplate />\n\t) : (\n\t\t<WelcomeGuideDefault />\n\t);\n}\n"],
5
+ "mappings": "AAkCE;AA/BF,SAAS,iBAAiB;AAK1B,OAAO,yBAAyB;AAChC,OAAO,0BAA0B;AACjC,SAAS,SAAS,qBAAqB;AAExB,SAAR,aAA+B,EAAE,SAAS,GAAI;AACpD,QAAM,EAAE,UAAU,kBAAkB,IAAI;AAAA,IACvC,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,IAAI,OAAQ,aAAc;AAClD,YAAM,qBAAqB,aAAa;AACxC,YAAM,UAAU,qBACb,yBACA;AAEH,aAAO;AAAA,QACN,UAAU,gBAAiB,OAAQ;AAAA,QACnC,mBAAmB;AAAA,MACpB;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AAAA,EACZ;AAEA,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SAAO,oBACN,oBAAC,wBAAqB,IAEtB,oBAAC,uBAAoB;AAEvB;",
6
+ "names": []
7
+ }
@@ -1,40 +1,39 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useDispatch } from '@wordpress/data';
5
- import { Guide } from '@wordpress/components';
6
- import { __ } from '@wordpress/i18n';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import WelcomeGuideImage from './image';
12
- import { store as editPostStore } from '../../store';
13
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
- export default function WelcomeGuideTemplate() {
15
- const {
16
- toggleFeature
17
- } = useDispatch(editPostStore);
18
- return /*#__PURE__*/_jsx(Guide, {
19
- className: "edit-template-welcome-guide",
20
- contentLabel: __('Welcome to the template editor'),
21
- finishButtonText: __('Get started'),
22
- onFinish: () => toggleFeature('welcomeGuideTemplate'),
23
- pages: [{
24
- image: /*#__PURE__*/_jsx(WelcomeGuideImage, {
25
- nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
26
- animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
27
- }),
28
- content: /*#__PURE__*/_jsxs(_Fragment, {
29
- children: [/*#__PURE__*/_jsx("h1", {
30
- className: "edit-post-welcome-guide__heading",
31
- children: __('Welcome to the template editor')
32
- }), /*#__PURE__*/_jsx("p", {
33
- className: "edit-post-welcome-guide__text",
34
- children: __('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.')
35
- })]
36
- })
37
- }]
38
- });
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useDispatch } from "@wordpress/data";
3
+ import { Guide } from "@wordpress/components";
4
+ import { __ } from "@wordpress/i18n";
5
+ import WelcomeGuideImage from "./image";
6
+ import { store as editPostStore } from "../../store";
7
+ function WelcomeGuideTemplate() {
8
+ const { toggleFeature } = useDispatch(editPostStore);
9
+ return /* @__PURE__ */ jsx(
10
+ Guide,
11
+ {
12
+ className: "edit-template-welcome-guide",
13
+ contentLabel: __("Welcome to the template editor"),
14
+ finishButtonText: __("Get started"),
15
+ onFinish: () => toggleFeature("welcomeGuideTemplate"),
16
+ pages: [
17
+ {
18
+ image: /* @__PURE__ */ jsx(
19
+ WelcomeGuideImage,
20
+ {
21
+ nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
22
+ animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
23
+ }
24
+ ),
25
+ content: /* @__PURE__ */ jsxs(Fragment, { children: [
26
+ /* @__PURE__ */ jsx("h1", { className: "edit-post-welcome-guide__heading", children: __("Welcome to the template editor") }),
27
+ /* @__PURE__ */ jsx("p", { className: "edit-post-welcome-guide__text", children: __(
28
+ "Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor."
29
+ ) })
30
+ ] })
31
+ }
32
+ ]
33
+ }
34
+ );
39
35
  }
40
- //# sourceMappingURL=template.js.map
36
+ export {
37
+ WelcomeGuideTemplate as default
38
+ };
39
+ //# sourceMappingURL=template.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useDispatch","Guide","__","WelcomeGuideImage","store","editPostStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","WelcomeGuideTemplate","toggleFeature","className","contentLabel","finishButtonText","onFinish","pages","image","nonAnimatedSrc","animatedSrc","content","children"],"sources":["@wordpress/edit-post/src/components/welcome-guide/template.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggleFeature } = useDispatch( editPostStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-template-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the template editor' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideTemplate' ) }\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-template-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-template-editor.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-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to the template editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.'\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] }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,iBAAiB,MAAM,SAAS;AACvC,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAErD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC;EAAc,CAAC,GAAGb,WAAW,CAAEK,aAAc,CAAC;EAEtD,oBACCE,IAAA,CAACN,KAAK;IACLa,SAAS,EAAC,6BAA6B;IACvCC,YAAY,EAAGb,EAAE,CAAE,gCAAiC,CAAG;IACvDc,gBAAgB,EAAGd,EAAE,CAAE,aAAc,CAAG;IACxCe,QAAQ,EAAGA,CAAA,KAAMJ,aAAa,CAAE,sBAAuB,CAAG;IAC1DK,KAAK,EAAG,CACP;MACCC,KAAK,eACJZ,IAAA,CAACJ,iBAAiB;QACjBiB,cAAc,EAAC,iEAAiE;QAChFC,WAAW,EAAC;MAAiE,CAC7E,CACD;MACDC,OAAO,eACNX,KAAA,CAAAF,SAAA;QAAAc,QAAA,gBACChB,IAAA;UAAIO,SAAS,EAAC,kCAAkC;UAAAS,QAAA,EAC7CrB,EAAE,CAAE,gCAAiC;QAAC,CACrC,CAAC,eACLK,IAAA;UAAGO,SAAS,EAAC,+BAA+B;UAAAS,QAAA,EACzCrB,EAAE,CACH,+IACD;QAAC,CACC,CAAC;MAAA,CACH;IAEJ,CAAC;EACC,CACH,CAAC;AAEJ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/welcome-guide/template.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editPostStore } from '../../store';\n\nexport default function WelcomeGuideTemplate() {\n\tconst { toggleFeature } = useDispatch( editPostStore );\n\n\treturn (\n\t\t<Guide\n\t\t\tclassName=\"edit-template-welcome-guide\"\n\t\t\tcontentLabel={ __( 'Welcome to the template editor' ) }\n\t\t\tfinishButtonText={ __( 'Get started' ) }\n\t\t\tonFinish={ () => toggleFeature( 'welcomeGuideTemplate' ) }\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-template-editor.svg\"\n\t\t\t\t\t\t\tanimatedSrc=\"https://s.w.org/images/block-editor/welcome-template-editor.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-post-welcome-guide__heading\">\n\t\t\t\t\t\t\t\t{ __( 'Welcome to the template editor' ) }\n\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t<p className=\"edit-post-welcome-guide__text\">\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.'\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] }\n\t\t/>\n\t);\n}\n"],
5
+ "mappings": "AAyBM,SAMA,UANA,KAMA,YANA;AAtBN,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AACtB,SAAS,UAAU;AAKnB,OAAO,uBAAuB;AAC9B,SAAS,SAAS,qBAAqB;AAExB,SAAR,uBAAwC;AAC9C,QAAM,EAAE,cAAc,IAAI,YAAa,aAAc;AAErD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,cAAe,GAAI,gCAAiC;AAAA,MACpD,kBAAmB,GAAI,aAAc;AAAA,MACrC,UAAW,MAAM,cAAe,sBAAuB;AAAA,MACvD,OAAQ;AAAA,QACP;AAAA,UACC,OACC;AAAA,YAAC;AAAA;AAAA,cACA,gBAAe;AAAA,cACf,aAAY;AAAA;AAAA,UACb;AAAA,UAED,SACC,iCACC;AAAA,gCAAC,QAAG,WAAU,oCACX,aAAI,gCAAiC,GACxC;AAAA,YACA,oBAAC,OAAE,WAAU,iCACV;AAAA,cACD;AAAA,YACD,GACD;AAAA,aACD;AAAA,QAEF;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
6
+ "names": []
7
+ }
@@ -1,145 +1,104 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { privateApis as editorPrivateApis, PluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem, PluginDocumentSettingPanel as EditorPluginDocumentSettingPanel, PluginMoreMenuItem as EditorPluginMoreMenuItem, PluginPrePublishPanel as EditorPluginPrePublishPanel, PluginPostPublishPanel as EditorPluginPostPublishPanel, PluginPostStatusInfo as EditorPluginPostStatusInfo, PluginSidebar as EditorPluginSidebar, PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem } from '@wordpress/editor';
5
- import { getPath } from '@wordpress/url';
6
- import deprecated from '@wordpress/deprecated';
7
-
8
- /**
9
- * Internal dependencies
10
- */
11
- import { unlock } from './lock-unlock';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- const {
14
- PluginPostExcerpt
15
- } = unlock(editorPrivateApis);
16
- const isSiteEditor = getPath(window.location.href)?.includes('site-editor.php');
17
- const deprecateSlot = name => {
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {
3
+ privateApis as editorPrivateApis,
4
+ PluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem,
5
+ PluginDocumentSettingPanel as EditorPluginDocumentSettingPanel,
6
+ PluginMoreMenuItem as EditorPluginMoreMenuItem,
7
+ PluginPrePublishPanel as EditorPluginPrePublishPanel,
8
+ PluginPostPublishPanel as EditorPluginPostPublishPanel,
9
+ PluginPostStatusInfo as EditorPluginPostStatusInfo,
10
+ PluginSidebar as EditorPluginSidebar,
11
+ PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem
12
+ } from "@wordpress/editor";
13
+ import { getPath } from "@wordpress/url";
14
+ import deprecated from "@wordpress/deprecated";
15
+ import { unlock } from "./lock-unlock";
16
+ const { PluginPostExcerpt } = unlock(editorPrivateApis);
17
+ const isSiteEditor = getPath(window.location.href)?.includes(
18
+ "site-editor.php"
19
+ );
20
+ const deprecateSlot = (name) => {
18
21
  deprecated(`wp.editPost.${name}`, {
19
- since: '6.6',
22
+ since: "6.6",
20
23
  alternative: `wp.editor.${name}`
21
24
  });
22
25
  };
23
-
24
- /* eslint-disable jsdoc/require-param */
25
- /**
26
- * @see PluginBlockSettingsMenuItem in @wordpress/editor package.
27
- */
28
- export function PluginBlockSettingsMenuItem(props) {
26
+ function PluginBlockSettingsMenuItem(props) {
29
27
  if (isSiteEditor) {
30
28
  return null;
31
29
  }
32
- deprecateSlot('PluginBlockSettingsMenuItem');
33
- return /*#__PURE__*/_jsx(EditorPluginBlockSettingsMenuItem, {
34
- ...props
35
- });
30
+ deprecateSlot("PluginBlockSettingsMenuItem");
31
+ return /* @__PURE__ */ jsx(EditorPluginBlockSettingsMenuItem, { ...props });
36
32
  }
37
-
38
- /**
39
- * @see PluginDocumentSettingPanel in @wordpress/editor package.
40
- */
41
- export function PluginDocumentSettingPanel(props) {
33
+ function PluginDocumentSettingPanel(props) {
42
34
  if (isSiteEditor) {
43
35
  return null;
44
36
  }
45
- deprecateSlot('PluginDocumentSettingPanel');
46
- return /*#__PURE__*/_jsx(EditorPluginDocumentSettingPanel, {
47
- ...props
48
- });
37
+ deprecateSlot("PluginDocumentSettingPanel");
38
+ return /* @__PURE__ */ jsx(EditorPluginDocumentSettingPanel, { ...props });
49
39
  }
50
-
51
- /**
52
- * @see PluginMoreMenuItem in @wordpress/editor package.
53
- */
54
- export function PluginMoreMenuItem(props) {
40
+ function PluginMoreMenuItem(props) {
55
41
  if (isSiteEditor) {
56
42
  return null;
57
43
  }
58
- deprecateSlot('PluginMoreMenuItem');
59
- return /*#__PURE__*/_jsx(EditorPluginMoreMenuItem, {
60
- ...props
61
- });
44
+ deprecateSlot("PluginMoreMenuItem");
45
+ return /* @__PURE__ */ jsx(EditorPluginMoreMenuItem, { ...props });
62
46
  }
63
-
64
- /**
65
- * @see PluginPrePublishPanel in @wordpress/editor package.
66
- */
67
- export function PluginPrePublishPanel(props) {
47
+ function PluginPrePublishPanel(props) {
68
48
  if (isSiteEditor) {
69
49
  return null;
70
50
  }
71
- deprecateSlot('PluginPrePublishPanel');
72
- return /*#__PURE__*/_jsx(EditorPluginPrePublishPanel, {
73
- ...props
74
- });
51
+ deprecateSlot("PluginPrePublishPanel");
52
+ return /* @__PURE__ */ jsx(EditorPluginPrePublishPanel, { ...props });
75
53
  }
76
-
77
- /**
78
- * @see PluginPostPublishPanel in @wordpress/editor package.
79
- */
80
- export function PluginPostPublishPanel(props) {
54
+ function PluginPostPublishPanel(props) {
81
55
  if (isSiteEditor) {
82
56
  return null;
83
57
  }
84
- deprecateSlot('PluginPostPublishPanel');
85
- return /*#__PURE__*/_jsx(EditorPluginPostPublishPanel, {
86
- ...props
87
- });
58
+ deprecateSlot("PluginPostPublishPanel");
59
+ return /* @__PURE__ */ jsx(EditorPluginPostPublishPanel, { ...props });
88
60
  }
89
-
90
- /**
91
- * @see PluginPostStatusInfo in @wordpress/editor package.
92
- */
93
- export function PluginPostStatusInfo(props) {
61
+ function PluginPostStatusInfo(props) {
94
62
  if (isSiteEditor) {
95
63
  return null;
96
64
  }
97
- deprecateSlot('PluginPostStatusInfo');
98
- return /*#__PURE__*/_jsx(EditorPluginPostStatusInfo, {
99
- ...props
100
- });
65
+ deprecateSlot("PluginPostStatusInfo");
66
+ return /* @__PURE__ */ jsx(EditorPluginPostStatusInfo, { ...props });
101
67
  }
102
-
103
- /**
104
- * @see PluginSidebar in @wordpress/editor package.
105
- */
106
- export function PluginSidebar(props) {
68
+ function PluginSidebar(props) {
107
69
  if (isSiteEditor) {
108
70
  return null;
109
71
  }
110
- deprecateSlot('PluginSidebar');
111
- return /*#__PURE__*/_jsx(EditorPluginSidebar, {
112
- ...props
113
- });
72
+ deprecateSlot("PluginSidebar");
73
+ return /* @__PURE__ */ jsx(EditorPluginSidebar, { ...props });
114
74
  }
115
-
116
- /**
117
- * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
118
- */
119
- export function PluginSidebarMoreMenuItem(props) {
75
+ function PluginSidebarMoreMenuItem(props) {
120
76
  if (isSiteEditor) {
121
77
  return null;
122
78
  }
123
- deprecateSlot('PluginSidebarMoreMenuItem');
124
- return /*#__PURE__*/_jsx(EditorPluginSidebarMoreMenuItem, {
125
- ...props
126
- });
79
+ deprecateSlot("PluginSidebarMoreMenuItem");
80
+ return /* @__PURE__ */ jsx(EditorPluginSidebarMoreMenuItem, { ...props });
127
81
  }
128
-
129
- /**
130
- * @see PluginPostExcerpt in @wordpress/editor package.
131
- */
132
- export function __experimentalPluginPostExcerpt() {
82
+ function __experimentalPluginPostExcerpt() {
133
83
  if (isSiteEditor) {
134
84
  return null;
135
85
  }
136
- deprecated('wp.editPost.__experimentalPluginPostExcerpt', {
137
- since: '6.6',
138
- hint: 'Core and custom panels can be access programmatically using their panel name.',
139
- link: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically'
86
+ deprecated("wp.editPost.__experimentalPluginPostExcerpt", {
87
+ since: "6.6",
88
+ hint: "Core and custom panels can be access programmatically using their panel name.",
89
+ link: "https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically"
140
90
  });
141
91
  return PluginPostExcerpt;
142
92
  }
143
-
144
- /* eslint-enable jsdoc/require-param */
145
- //# sourceMappingURL=deprecated.js.map
93
+ export {
94
+ PluginBlockSettingsMenuItem,
95
+ PluginDocumentSettingPanel,
96
+ PluginMoreMenuItem,
97
+ PluginPostPublishPanel,
98
+ PluginPostStatusInfo,
99
+ PluginPrePublishPanel,
100
+ PluginSidebar,
101
+ PluginSidebarMoreMenuItem,
102
+ __experimentalPluginPostExcerpt
103
+ };
104
+ //# sourceMappingURL=deprecated.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["privateApis","editorPrivateApis","PluginBlockSettingsMenuItem","EditorPluginBlockSettingsMenuItem","PluginDocumentSettingPanel","EditorPluginDocumentSettingPanel","PluginMoreMenuItem","EditorPluginMoreMenuItem","PluginPrePublishPanel","EditorPluginPrePublishPanel","PluginPostPublishPanel","EditorPluginPostPublishPanel","PluginPostStatusInfo","EditorPluginPostStatusInfo","PluginSidebar","EditorPluginSidebar","PluginSidebarMoreMenuItem","EditorPluginSidebarMoreMenuItem","getPath","deprecated","unlock","jsx","_jsx","PluginPostExcerpt","isSiteEditor","window","location","href","includes","deprecateSlot","name","since","alternative","props","__experimentalPluginPostExcerpt","hint","link"],"sources":["@wordpress/edit-post/src/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as editorPrivateApis,\n\tPluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem,\n\tPluginDocumentSettingPanel as EditorPluginDocumentSettingPanel,\n\tPluginMoreMenuItem as EditorPluginMoreMenuItem,\n\tPluginPrePublishPanel as EditorPluginPrePublishPanel,\n\tPluginPostPublishPanel as EditorPluginPostPublishPanel,\n\tPluginPostStatusInfo as EditorPluginPostStatusInfo,\n\tPluginSidebar as EditorPluginSidebar,\n\tPluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,\n} from '@wordpress/editor';\nimport { getPath } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nconst { PluginPostExcerpt } = unlock( editorPrivateApis );\n\nconst isSiteEditor = getPath( window.location.href )?.includes(\n\t'site-editor.php'\n);\n\nconst deprecateSlot = ( name ) => {\n\tdeprecated( `wp.editPost.${ name }`, {\n\t\tsince: '6.6',\n\t\talternative: `wp.editor.${ name }`,\n\t} );\n};\n\n/* eslint-disable jsdoc/require-param */\n/**\n * @see PluginBlockSettingsMenuItem in @wordpress/editor package.\n */\nexport function PluginBlockSettingsMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginBlockSettingsMenuItem' );\n\treturn <EditorPluginBlockSettingsMenuItem { ...props } />;\n}\n\n/**\n * @see PluginDocumentSettingPanel in @wordpress/editor package.\n */\nexport function PluginDocumentSettingPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginDocumentSettingPanel' );\n\treturn <EditorPluginDocumentSettingPanel { ...props } />;\n}\n\n/**\n * @see PluginMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginMoreMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginMoreMenuItem' );\n\treturn <EditorPluginMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginPrePublishPanel in @wordpress/editor package.\n */\nexport function PluginPrePublishPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPrePublishPanel' );\n\treturn <EditorPluginPrePublishPanel { ...props } />;\n}\n\n/**\n * @see PluginPostPublishPanel in @wordpress/editor package.\n */\nexport function PluginPostPublishPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPostPublishPanel' );\n\treturn <EditorPluginPostPublishPanel { ...props } />;\n}\n\n/**\n * @see PluginPostStatusInfo in @wordpress/editor package.\n */\nexport function PluginPostStatusInfo( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPostStatusInfo' );\n\treturn <EditorPluginPostStatusInfo { ...props } />;\n}\n\n/**\n * @see PluginSidebar in @wordpress/editor package.\n */\nexport function PluginSidebar( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebar' );\n\treturn <EditorPluginSidebar { ...props } />;\n}\n\n/**\n * @see PluginSidebarMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginSidebarMoreMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebarMoreMenuItem' );\n\treturn <EditorPluginSidebarMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginPostExcerpt in @wordpress/editor package.\n */\nexport function __experimentalPluginPostExcerpt() {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecated( 'wp.editPost.__experimentalPluginPostExcerpt', {\n\t\tsince: '6.6',\n\t\thint: 'Core and custom panels can be access programmatically using their panel name.',\n\t\tlink: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically',\n\t} );\n\treturn PluginPostExcerpt;\n}\n\n/* eslint-enable jsdoc/require-param */\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,iBAAiB,EAChCC,2BAA2B,IAAIC,iCAAiC,EAChEC,0BAA0B,IAAIC,gCAAgC,EAC9DC,kBAAkB,IAAIC,wBAAwB,EAC9CC,qBAAqB,IAAIC,2BAA2B,EACpDC,sBAAsB,IAAIC,4BAA4B,EACtDC,oBAAoB,IAAIC,0BAA0B,EAClDC,aAAa,IAAIC,mBAAmB,EACpCC,yBAAyB,IAAIC,+BAA+B,QACtD,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,gBAAgB;AACxC,OAAOC,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AACvC,MAAM;EAAEC;AAAkB,CAAC,GAAGH,MAAM,CAAEnB,iBAAkB,CAAC;AAEzD,MAAMuB,YAAY,GAAGN,OAAO,CAAEO,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC,EAAEC,QAAQ,CAC7D,iBACD,CAAC;AAED,MAAMC,aAAa,GAAKC,IAAI,IAAM;EACjCX,U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AC;AACrD;;AAEA;AACA;AACA;AACA,OAAO,SAASrB,oBAAoBA,CAAEqB,KAAK,EAAG;EAC7C,IAAKT,YAAY,EAAG;IACnB,OAAO,IAAI;EACZ;EACAK,aAAa,CAAE,sBAAuB,CAAC;EACvC,oBAAOP,IAAA,CAACT,0BAA0B;IAAA,GAAMoB;EAAK,CAAI,CAAC;AACnD;;AAEA;AACA;AACA;AACA,OAAO,SAASnB,aAAaA,CAAEmB,KAAK,EAAG;EACtC,IAAKT,YAAY,EAAG;IACnB,OAAO,IAAI;EACZ;EACAK,aAAa,CAAE,eAAgB,CAAC;EAChC,oBAAOP,IAAA,CAACP,mBAAmB;IAAA,GAAMkB;EAAK,CAAI,CAAC;AAC5C;;AAEA;AACA;AACA;AACA,OAAO,SAASjB,yBAAyBA,CAAEiB,KAAK,EAAG;EAClD,IAAKT,YAAY,EAAG;IACnB,OAAO,IAAI;EACZ;EACAK,aAAa,CAAE,2BAA4B,CAAC;EAC5C,oBAAOP,IAAA,CAACL,+BAA+B;IAAA,GAAMgB;EAAK,CAAI,CAAC;AACxD;;AAEA;AACA;AACA;AACA,OAAO,SAASC,+BAA+BA,CAAA,EAAG;EACjD,IAAKV,YAAY,EAAG;IACnB,OAAO,IAAI;EACZ;EACAL,UAAU,CAAE,6CAA6C,EAAE;IAC1DY,KAAK,EAAE,KAAK;IACZI,IAAI,EAAE,+EAA+E;IACrFC,IAAI,EAAE;EACP,CAAE,CAAC;EACH,OAAOb,iBAAiB;AACzB;;AAEA","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/deprecated.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as editorPrivateApis,\n\tPluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem,\n\tPluginDocumentSettingPanel as EditorPluginDocumentSettingPanel,\n\tPluginMoreMenuItem as EditorPluginMoreMenuItem,\n\tPluginPrePublishPanel as EditorPluginPrePublishPanel,\n\tPluginPostPublishPanel as EditorPluginPostPublishPanel,\n\tPluginPostStatusInfo as EditorPluginPostStatusInfo,\n\tPluginSidebar as EditorPluginSidebar,\n\tPluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,\n} from '@wordpress/editor';\nimport { getPath } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from './lock-unlock';\nconst { PluginPostExcerpt } = unlock( editorPrivateApis );\n\nconst isSiteEditor = getPath( window.location.href )?.includes(\n\t'site-editor.php'\n);\n\nconst deprecateSlot = ( name ) => {\n\tdeprecated( `wp.editPost.${ name }`, {\n\t\tsince: '6.6',\n\t\talternative: `wp.editor.${ name }`,\n\t} );\n};\n\n/* eslint-disable jsdoc/require-param */\n/**\n * @see PluginBlockSettingsMenuItem in @wordpress/editor package.\n */\nexport function PluginBlockSettingsMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginBlockSettingsMenuItem' );\n\treturn <EditorPluginBlockSettingsMenuItem { ...props } />;\n}\n\n/**\n * @see PluginDocumentSettingPanel in @wordpress/editor package.\n */\nexport function PluginDocumentSettingPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginDocumentSettingPanel' );\n\treturn <EditorPluginDocumentSettingPanel { ...props } />;\n}\n\n/**\n * @see PluginMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginMoreMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginMoreMenuItem' );\n\treturn <EditorPluginMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginPrePublishPanel in @wordpress/editor package.\n */\nexport function PluginPrePublishPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPrePublishPanel' );\n\treturn <EditorPluginPrePublishPanel { ...props } />;\n}\n\n/**\n * @see PluginPostPublishPanel in @wordpress/editor package.\n */\nexport function PluginPostPublishPanel( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPostPublishPanel' );\n\treturn <EditorPluginPostPublishPanel { ...props } />;\n}\n\n/**\n * @see PluginPostStatusInfo in @wordpress/editor package.\n */\nexport function PluginPostStatusInfo( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginPostStatusInfo' );\n\treturn <EditorPluginPostStatusInfo { ...props } />;\n}\n\n/**\n * @see PluginSidebar in @wordpress/editor package.\n */\nexport function PluginSidebar( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebar' );\n\treturn <EditorPluginSidebar { ...props } />;\n}\n\n/**\n * @see PluginSidebarMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginSidebarMoreMenuItem( props ) {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebarMoreMenuItem' );\n\treturn <EditorPluginSidebarMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginPostExcerpt in @wordpress/editor package.\n */\nexport function __experimentalPluginPostExcerpt() {\n\tif ( isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecated( 'wp.editPost.__experimentalPluginPostExcerpt', {\n\t\tsince: '6.6',\n\t\thint: 'Core and custom panels can be access programmatically using their panel name.',\n\t\tlink: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically',\n\t} );\n\treturn PluginPostExcerpt;\n}\n\n/* eslint-enable jsdoc/require-param */\n"],
5
+ "mappings": "AA2CQ;AAxCR;AAAA,EACC,eAAe;AAAA,EACf,+BAA+B;AAAA,EAC/B,8BAA8B;AAAA,EAC9B,sBAAsB;AAAA,EACtB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,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eAAgB;AAC/B,SAAO,oBAAC,uBAAsB,GAAG,OAAQ;AAC1C;AAKO,SAAS,0BAA2B,OAAQ;AAClD,MAAK,cAAe;AACnB,WAAO;AAAA,EACR;AACA,gBAAe,2BAA4B;AAC3C,SAAO,oBAAC,mCAAkC,GAAG,OAAQ;AACtD;AAKO,SAAS,kCAAkC;AACjD,MAAK,cAAe;AACnB,WAAO;AAAA,EACR;AACA,aAAY,+CAA+C;AAAA,IAC1D,OAAO;AAAA,IACP,MAAM;AAAA,IACN,MAAM;AAAA,EACP,CAAE;AACF,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,76 +1,42 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useCallback, useReducer } from '@wordpress/element';
5
- import { useSelect, useDispatch } from '@wordpress/data';
6
- import { store as editorStore } from '@wordpress/editor';
7
-
8
- /**
9
- * A hook that records the 'entity' history in the post editor as a user
10
- * navigates between editing a post and editing the post template or patterns.
11
- *
12
- * Implemented as a stack, so a little similar to the browser history API.
13
- *
14
- * Used to control displaying UI elements like the back button.
15
- *
16
- * @param {number} initialPostId The post id of the post when the editor loaded.
17
- * @param {string} initialPostType The post type of the post when the editor loaded.
18
- * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.
19
- *
20
- * @return {Object} An object containing the `currentPost` variable and
21
- * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.
22
- */
23
- export default function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) {
24
- const [postHistory, dispatch] = useReducer((historyState, {
25
- type,
26
- post,
27
- previousRenderingMode
28
- }) => {
29
- if (type === 'push') {
30
- return [...historyState, {
31
- post,
32
- previousRenderingMode
33
- }];
34
- }
35
- if (type === 'pop') {
36
- // Try to leave one item in the history.
37
- if (historyState.length > 1) {
38
- return historyState.slice(0, -1);
1
+ import { useCallback, useReducer } from "@wordpress/element";
2
+ import { useSelect, useDispatch } from "@wordpress/data";
3
+ import { store as editorStore } from "@wordpress/editor";
4
+ function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) {
5
+ const [postHistory, dispatch] = useReducer(
6
+ (historyState, { type, post: post2, previousRenderingMode: previousRenderingMode2 }) => {
7
+ if (type === "push") {
8
+ return [...historyState, { post: post2, previousRenderingMode: previousRenderingMode2 }];
39
9
  }
40
- }
41
- return historyState;
42
- }, [{
43
- post: {
44
- postId: initialPostId,
45
- postType: initialPostType
46
- }
47
- }]);
48
- const {
49
- post,
50
- previousRenderingMode
51
- } = postHistory[postHistory.length - 1];
52
- const {
53
- getRenderingMode
54
- } = useSelect(editorStore);
55
- const {
56
- setRenderingMode
57
- } = useDispatch(editorStore);
58
- const onNavigateToEntityRecord = useCallback(params => {
59
- dispatch({
60
- type: 'push',
61
- post: {
62
- postId: params.postId,
63
- postType: params.postType
64
- },
65
- // Save the current rendering mode so we can restore it when navigating back.
66
- previousRenderingMode: getRenderingMode()
67
- });
68
- setRenderingMode(defaultRenderingMode);
69
- }, [getRenderingMode, setRenderingMode, defaultRenderingMode]);
10
+ if (type === "pop") {
11
+ if (historyState.length > 1) {
12
+ return historyState.slice(0, -1);
13
+ }
14
+ }
15
+ return historyState;
16
+ },
17
+ [
18
+ {
19
+ post: { postId: initialPostId, postType: initialPostType }
20
+ }
21
+ ]
22
+ );
23
+ const { post, previousRenderingMode } = postHistory[postHistory.length - 1];
24
+ const { getRenderingMode } = useSelect(editorStore);
25
+ const { setRenderingMode } = useDispatch(editorStore);
26
+ const onNavigateToEntityRecord = useCallback(
27
+ (params) => {
28
+ dispatch({
29
+ type: "push",
30
+ post: { postId: params.postId, postType: params.postType },
31
+ // Save the current rendering mode so we can restore it when navigating back.
32
+ previousRenderingMode: getRenderingMode()
33
+ });
34
+ setRenderingMode(defaultRenderingMode);
35
+ },
36
+ [getRenderingMode, setRenderingMode, defaultRenderingMode]
37
+ );
70
38
  const onNavigateToPreviousEntityRecord = useCallback(() => {
71
- dispatch({
72
- type: 'pop'
73
- });
39
+ dispatch({ type: "pop" });
74
40
  if (previousRenderingMode) {
75
41
  setRenderingMode(previousRenderingMode);
76
42
  }
@@ -78,7 +44,10 @@ export default function useNavigateToEntityRecord(initialPostId, initialPostType
78
44
  return {
79
45
  currentPost: post,
80
46
  onNavigateToEntityRecord,
81
- onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined
47
+ onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : void 0
82
48
  };
83
49
  }
84
- //# sourceMappingURL=use-navigate-to-entity-record.js.map
50
+ export {
51
+ useNavigateToEntityRecord as default
52
+ };
53
+ //# sourceMappingURL=use-navigate-to-entity-record.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["useCallback","useReducer","useSelect","useDispatch","store","editorStore","useNavigateToEntityRecord","initialPostId","initialPostType","defaultRenderingMode","postHistory","dispatch","historyState","type","post","previousRenderingMode","length","slice","postId","postType","getRenderingMode","setRenderingMode","onNavigateToEntityRecord","params","onNavigateToPreviousEntityRecord","currentPost","undefined"],"sources":["@wordpress/edit-post/src/hooks/use-navigate-to-entity-record.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.\n */\nexport default function useNavigateToEntityRecord(\n\tinitialPostId,\n\tinitialPostType,\n\tdefaultRenderingMode\n) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post, previousRenderingMode } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, { post, previousRenderingMode } ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[\n\t\t\t{\n\t\t\t\tpost: { postId: initialPostId, postType: initialPostType },\n\t\t\t},\n\t\t]\n\t);\n\n\tconst { post, previousRenderingMode } =\n\t\tpostHistory[ postHistory.length - 1 ];\n\n\tconst { getRenderingMode } = useSelect( editorStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'push',\n\t\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t\t\t// Save the current rendering mode so we can restore it when navigating back.\n\t\t\t\tpreviousRenderingMode: getRenderingMode(),\n\t\t\t} );\n\t\t\tsetRenderingMode( defaultRenderingMode );\n\t\t},\n\t\t[ getRenderingMode, setRenderingMode, defaultRenderingMode ]\n\t);\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t\tif ( previousRenderingMode ) {\n\t\t\tsetRenderingMode( previousRenderingMode );\n\t\t}\n\t}, [ setRenderingMode, previousRenderingMode ] );\n\n\treturn {\n\t\tcurrentPost: post,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord:\n\t\t\tpostHistory.length > 1\n\t\t\t\t? onNavigateToPreviousEntityRecord\n\t\t\t\t: undefined,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,oBAAoB;AAC5D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,WA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E,CAAC;IACHC,gBAAgB,CAAEZ,oBAAqB,CAAC;EACzC,CAAC,EACD,CAAEW,gBAAgB,EAAEC,gBAAgB,EAAEZ,oBAAoB,CAC3D,CAAC;EAED,MAAMe,gCAAgC,GAAGxB,WAAW,CAAE,MAAM;IAC3DW,QAAQ,CAAE;MAAEE,IAAI,EAAE;IAAM,CAAE,CAAC;IAC3B,IAAKE,qBAAqB,EAAG;MAC5BM,gBAAgB,CAAEN,qBAAsB,CAAC;IAC1C;EACD,CAAC,EAAE,CAAEM,gBAAgB,EAAEN,qBAAqB,CAAG,CAAC;EAEhD,OAAO;IACNU,WAAW,EAAEX,IAAI;IACjBQ,wBAAwB;IACxBE,gCAAgC,EAC/Bd,WAAW,CAACM,MAAM,GAAG,CAAC,GACnBQ,gCAAgC,GAChCE;EACL,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/hooks/use-navigate-to-entity-record.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.\n */\nexport default function useNavigateToEntityRecord(\n\tinitialPostId,\n\tinitialPostType,\n\tdefaultRenderingMode\n) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post, previousRenderingMode } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, { post, previousRenderingMode } ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[\n\t\t\t{\n\t\t\t\tpost: { postId: initialPostId, postType: initialPostType },\n\t\t\t},\n\t\t]\n\t);\n\n\tconst { post, previousRenderingMode } =\n\t\tpostHistory[ postHistory.length - 1 ];\n\n\tconst { getRenderingMode } = useSelect( editorStore );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tconst onNavigateToEntityRecord = useCallback(\n\t\t( params ) => {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'push',\n\t\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t\t\t// Save the current rendering mode so we can restore it when navigating back.\n\t\t\t\tpreviousRenderingMode: getRenderingMode(),\n\t\t\t} );\n\t\t\tsetRenderingMode( defaultRenderingMode );\n\t\t},\n\t\t[ getRenderingMode, setRenderingMode, defaultRenderingMode ]\n\t);\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t\tif ( previousRenderingMode ) {\n\t\t\tsetRenderingMode( previousRenderingMode );\n\t\t}\n\t}, [ setRenderingMode, previousRenderingMode ] );\n\n\treturn {\n\t\tcurrentPost: post,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord:\n\t\t\tpostHistory.length > 1\n\t\t\t\t? onNavigateToPreviousEntityRecord\n\t\t\t\t: undefined,\n\t};\n}\n"],
5
+ "mappings": "AAGA,SAAS,aAAa,kBAAkB;AACxC,SAAS,WAAW,mBAAmB;AACvC,SAAS,SAAS,mBAAmB;AAiBtB,SAAR,0BACN,eACA,iBACA,sBACC;AACD,QAAM,CAAE,aAAa,QAAS,IAAI;AAAA,IACjC,CAAE,cAAc,EAAE,MAAM,MAAAA,OAAM,uBAAAC,uBAAsB,MAAO;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