@wordpress/edit-site 5.7.0 → 5.9.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 (259) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template.js +2 -1
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/block-editor/index.js +7 -7
  5. package/build/components/block-editor/index.js.map +1 -1
  6. package/build/components/editor/index.js +6 -4
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/editor-canvas-container/index.js +117 -0
  9. package/build/components/editor-canvas-container/index.js.map +1 -0
  10. package/build/components/global-styles/border-panel.js +81 -1
  11. package/build/components/global-styles/border-panel.js.map +1 -1
  12. package/build/components/global-styles/context-menu.js +6 -8
  13. package/build/components/global-styles/context-menu.js.map +1 -1
  14. package/build/components/global-styles/dimensions-panel.js +11 -1
  15. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  16. package/build/components/global-styles/effects-panel.js +53 -0
  17. package/build/components/global-styles/effects-panel.js.map +1 -0
  18. package/build/components/global-styles/filters-panel.js +50 -0
  19. package/build/components/global-styles/filters-panel.js.map +1 -0
  20. package/build/components/global-styles/global-styles-provider.js +4 -15
  21. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  22. package/build/components/global-styles/preview.js +1 -1
  23. package/build/components/global-styles/preview.js.map +1 -1
  24. package/build/components/global-styles/screen-block-list.js +14 -8
  25. package/build/components/global-styles/screen-block-list.js.map +1 -1
  26. package/build/components/global-styles/screen-css.js +1 -1
  27. package/build/components/global-styles/screen-css.js.map +1 -1
  28. package/build/components/global-styles/screen-effects.js +15 -7
  29. package/build/components/global-styles/screen-effects.js.map +1 -1
  30. package/build/components/global-styles/screen-filters.js +2 -2
  31. package/build/components/global-styles/screen-filters.js.map +1 -1
  32. package/build/components/global-styles/screen-style-variations.js +8 -118
  33. package/build/components/global-styles/screen-style-variations.js.map +1 -1
  34. package/build/components/global-styles/style-variations-container.js +149 -0
  35. package/build/components/global-styles/style-variations-container.js.map +1 -0
  36. package/build/components/global-styles/ui.js +52 -15
  37. package/build/components/global-styles/ui.js.map +1 -1
  38. package/build/components/header-edit-mode/index.js +11 -7
  39. package/build/components/header-edit-mode/index.js.map +1 -1
  40. package/build/components/header-edit-mode/more-menu/index.js +1 -1
  41. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  42. package/build/components/keyboard-shortcuts/index.js +0 -137
  43. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  44. package/build/components/layout/index.js +17 -8
  45. package/build/components/layout/index.js.map +1 -1
  46. package/build/components/list/table.js +3 -3
  47. package/build/components/list/table.js.map +1 -1
  48. package/build/components/preferences-modal/index.js +4 -0
  49. package/build/components/preferences-modal/index.js.map +1 -1
  50. package/build/components/sidebar/index.js +4 -0
  51. package/build/components/sidebar/index.js.map +1 -1
  52. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +28 -13
  53. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  54. package/build/components/sidebar-navigation-screen/index.js +8 -6
  55. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  56. package/build/components/sidebar-navigation-screen-global-styles/index.js +58 -0
  57. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  58. package/build/components/sidebar-navigation-screen-main/index.js +5 -0
  59. package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
  60. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +114 -9
  61. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  62. package/build/components/site-hub/index.js +40 -17
  63. package/build/components/site-hub/index.js.map +1 -1
  64. package/build/components/site-icon/index.js +8 -7
  65. package/build/components/site-icon/index.js.map +1 -1
  66. package/build/components/start-template-options/index.js +9 -8
  67. package/build/components/start-template-options/index.js.map +1 -1
  68. package/build/components/style-book/index.js +9 -41
  69. package/build/components/style-book/index.js.map +1 -1
  70. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
  71. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  72. package/build/components/template-details/index.js +3 -1
  73. package/build/components/template-details/index.js.map +1 -1
  74. package/build/components/welcome-guide/styles.js +1 -1
  75. package/build/components/welcome-guide/styles.js.map +1 -1
  76. package/build/hooks/commands/index.js +19 -0
  77. package/build/hooks/commands/index.js.map +1 -0
  78. package/build/hooks/commands/use-navigation-commands.js +126 -0
  79. package/build/hooks/commands/use-navigation-commands.js.map +1 -0
  80. package/build/hooks/commands/use-wp-admin-commands.js +97 -0
  81. package/build/hooks/commands/use-wp-admin-commands.js.map +1 -0
  82. package/build/hooks/template-part-edit.js +2 -1
  83. package/build/hooks/template-part-edit.js.map +1 -1
  84. package/build/index.js +2 -1
  85. package/build/index.js.map +1 -1
  86. package/build/store/private-actions.js +19 -1
  87. package/build/store/private-actions.js.map +1 -1
  88. package/build/store/private-selectors.js +13 -0
  89. package/build/store/private-selectors.js.map +1 -1
  90. package/build/store/reducer.js +23 -1
  91. package/build/store/reducer.js.map +1 -1
  92. package/build/store/selectors.js +2 -1
  93. package/build/store/selectors.js.map +1 -1
  94. package/build-module/components/add-new-template/new-template.js +3 -2
  95. package/build-module/components/add-new-template/new-template.js.map +1 -1
  96. package/build-module/components/block-editor/index.js +6 -6
  97. package/build-module/components/block-editor/index.js.map +1 -1
  98. package/build-module/components/editor/index.js +6 -4
  99. package/build-module/components/editor/index.js.map +1 -1
  100. package/build-module/components/editor-canvas-container/index.js +100 -0
  101. package/build-module/components/editor-canvas-container/index.js.map +1 -0
  102. package/build-module/components/global-styles/border-panel.js +81 -1
  103. package/build-module/components/global-styles/border-panel.js.map +1 -1
  104. package/build-module/components/global-styles/context-menu.js +6 -6
  105. package/build-module/components/global-styles/context-menu.js.map +1 -1
  106. package/build-module/components/global-styles/dimensions-panel.js +11 -1
  107. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  108. package/build-module/components/global-styles/effects-panel.js +43 -0
  109. package/build-module/components/global-styles/effects-panel.js.map +1 -0
  110. package/build-module/components/global-styles/filters-panel.js +40 -0
  111. package/build-module/components/global-styles/filters-panel.js.map +1 -0
  112. package/build-module/components/global-styles/global-styles-provider.js +5 -16
  113. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  114. package/build-module/components/global-styles/preview.js +1 -1
  115. package/build-module/components/global-styles/preview.js.map +1 -1
  116. package/build-module/components/global-styles/screen-block-list.js +13 -8
  117. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  118. package/build-module/components/global-styles/screen-css.js +1 -1
  119. package/build-module/components/global-styles/screen-css.js.map +1 -1
  120. package/build-module/components/global-styles/screen-effects.js +13 -4
  121. package/build-module/components/global-styles/screen-effects.js.map +1 -1
  122. package/build-module/components/global-styles/screen-filters.js +2 -2
  123. package/build-module/components/global-styles/screen-filters.js.map +1 -1
  124. package/build-module/components/global-styles/screen-style-variations.js +11 -114
  125. package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
  126. package/build-module/components/global-styles/style-variations-container.js +130 -0
  127. package/build-module/components/global-styles/style-variations-container.js.map +1 -0
  128. package/build-module/components/global-styles/ui.js +49 -16
  129. package/build-module/components/global-styles/ui.js.map +1 -1
  130. package/build-module/components/header-edit-mode/index.js +10 -7
  131. package/build-module/components/header-edit-mode/index.js.map +1 -1
  132. package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
  133. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  134. package/build-module/components/keyboard-shortcuts/index.js +1 -135
  135. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  136. package/build-module/components/layout/index.js +14 -8
  137. package/build-module/components/layout/index.js.map +1 -1
  138. package/build-module/components/list/table.js +3 -3
  139. package/build-module/components/list/table.js.map +1 -1
  140. package/build-module/components/preferences-modal/index.js +4 -0
  141. package/build-module/components/preferences-modal/index.js.map +1 -1
  142. package/build-module/components/sidebar/index.js +3 -0
  143. package/build-module/components/sidebar/index.js.map +1 -1
  144. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +28 -15
  145. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  146. package/build-module/components/sidebar-navigation-screen/index.js +9 -7
  147. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  148. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  149. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -0
  150. package/build-module/components/sidebar-navigation-screen-main/index.js +6 -1
  151. package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
  152. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +113 -11
  153. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  154. package/build-module/components/site-hub/index.js +40 -18
  155. package/build-module/components/site-hub/index.js.map +1 -1
  156. package/build-module/components/site-icon/index.js +8 -7
  157. package/build-module/components/site-icon/index.js.map +1 -1
  158. package/build-module/components/start-template-options/index.js +9 -8
  159. package/build-module/components/start-template-options/index.js.map +1 -1
  160. package/build-module/components/style-book/index.js +10 -41
  161. package/build-module/components/style-book/index.js.map +1 -1
  162. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
  163. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  164. package/build-module/components/template-details/index.js +3 -1
  165. package/build-module/components/template-details/index.js.map +1 -1
  166. package/build-module/components/welcome-guide/styles.js +1 -1
  167. package/build-module/components/welcome-guide/styles.js.map +1 -1
  168. package/build-module/hooks/commands/index.js +10 -0
  169. package/build-module/hooks/commands/index.js.map +1 -0
  170. package/build-module/hooks/commands/use-navigation-commands.js +109 -0
  171. package/build-module/hooks/commands/use-navigation-commands.js.map +1 -0
  172. package/build-module/hooks/commands/use-wp-admin-commands.js +81 -0
  173. package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -0
  174. package/build-module/hooks/template-part-edit.js +2 -1
  175. package/build-module/hooks/template-part-edit.js.map +1 -1
  176. package/build-module/index.js +2 -1
  177. package/build-module/index.js.map +1 -1
  178. package/build-module/store/private-actions.js +15 -0
  179. package/build-module/store/private-actions.js.map +1 -1
  180. package/build-module/store/private-selectors.js +11 -0
  181. package/build-module/store/private-selectors.js.map +1 -1
  182. package/build-module/store/reducer.js +23 -1
  183. package/build-module/store/reducer.js.map +1 -1
  184. package/build-module/store/selectors.js +2 -1
  185. package/build-module/store/selectors.js.map +1 -1
  186. package/build-style/style-rtl.css +133 -107
  187. package/build-style/style.css +133 -107
  188. package/package.json +34 -32
  189. package/src/components/add-new-template/new-template.js +3 -0
  190. package/src/components/block-editor/index.js +8 -8
  191. package/src/components/editor/index.js +11 -3
  192. package/src/components/editor-canvas-container/index.js +115 -0
  193. package/src/components/editor-canvas-container/style.scss +19 -0
  194. package/src/components/global-styles/border-panel.js +73 -1
  195. package/src/components/global-styles/context-menu.js +6 -6
  196. package/src/components/global-styles/dimensions-panel.js +11 -0
  197. package/src/components/global-styles/effects-panel.js +40 -0
  198. package/src/components/global-styles/filters-panel.js +39 -0
  199. package/src/components/global-styles/global-styles-provider.js +4 -18
  200. package/src/components/global-styles/preview.js +1 -1
  201. package/src/components/global-styles/screen-block-list.js +9 -5
  202. package/src/components/global-styles/screen-css.js +1 -1
  203. package/src/components/global-styles/screen-effects.js +12 -5
  204. package/src/components/global-styles/screen-filters.js +2 -2
  205. package/src/components/global-styles/screen-style-variations.js +10 -129
  206. package/src/components/global-styles/style-variations-container.js +136 -0
  207. package/src/components/global-styles/style.scss +0 -39
  208. package/src/components/global-styles/ui.js +54 -8
  209. package/src/components/header-edit-mode/index.js +14 -5
  210. package/src/components/header-edit-mode/more-menu/index.js +1 -1
  211. package/src/components/keyboard-shortcuts/index.js +1 -155
  212. package/src/components/layout/index.js +13 -16
  213. package/src/components/layout/style.scss +31 -4
  214. package/src/components/list/table.js +16 -2
  215. package/src/components/preferences-modal/index.js +7 -0
  216. package/src/components/secondary-sidebar/style.scss +23 -5
  217. package/src/components/sidebar/index.js +4 -0
  218. package/src/components/sidebar/style.scss +2 -1
  219. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +36 -17
  220. package/src/components/sidebar-navigation-screen/index.js +10 -5
  221. package/src/components/sidebar-navigation-screen/style.scss +20 -5
  222. package/src/components/sidebar-navigation-screen-global-styles/index.js +41 -0
  223. package/src/components/sidebar-navigation-screen-main/index.js +9 -1
  224. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +134 -9
  225. package/src/components/site-hub/index.js +51 -23
  226. package/src/components/site-icon/index.js +6 -11
  227. package/src/components/site-icon/style.scss +8 -3
  228. package/src/components/start-template-options/index.js +13 -12
  229. package/src/components/start-template-options/style.scss +18 -43
  230. package/src/components/style-book/index.js +7 -51
  231. package/src/components/style-book/style.scss +0 -18
  232. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -3
  233. package/src/components/template-details/index.js +1 -0
  234. package/src/components/welcome-guide/styles.js +1 -1
  235. package/src/hooks/commands/index.js +10 -0
  236. package/src/hooks/commands/use-navigation-commands.js +112 -0
  237. package/src/hooks/commands/use-wp-admin-commands.js +79 -0
  238. package/src/hooks/template-part-edit.js +1 -0
  239. package/src/index.js +1 -0
  240. package/src/store/private-actions.js +14 -0
  241. package/src/store/private-selectors.js +11 -0
  242. package/src/store/reducer.js +18 -0
  243. package/src/store/selectors.js +2 -1
  244. package/src/style.scss +1 -0
  245. package/build/components/global-styles/duotone-panel.js +0 -78
  246. package/build/components/global-styles/duotone-panel.js.map +0 -1
  247. package/build/components/global-styles/filter-utils.js +0 -17
  248. package/build/components/global-styles/filter-utils.js.map +0 -1
  249. package/build/components/global-styles/shadow-panel.js +0 -197
  250. package/build/components/global-styles/shadow-panel.js.map +0 -1
  251. package/build-module/components/global-styles/duotone-panel.js +0 -67
  252. package/build-module/components/global-styles/duotone-panel.js.map +0 -1
  253. package/build-module/components/global-styles/filter-utils.js +0 -9
  254. package/build-module/components/global-styles/filter-utils.js.map +0 -1
  255. package/build-module/components/global-styles/shadow-panel.js +0 -178
  256. package/build-module/components/global-styles/shadow-panel.js.map +0 -1
  257. package/src/components/global-styles/duotone-panel.js +0 -82
  258. package/src/components/global-styles/filter-utils.js +0 -9
  259. package/src/components/global-styles/shadow-panel.js +0 -178
@@ -9,29 +9,23 @@ import classnames from 'classnames';
9
9
  * WordPress dependencies
10
10
  */
11
11
 
12
- import { Button, __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState, __unstableCompositeItem as CompositeItem, Disabled, TabPanel, createSlotFill, __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
12
+ import { __unstableComposite as Composite, __unstableUseCompositeState as useCompositeState, __unstableCompositeItem as CompositeItem, Disabled, TabPanel } from '@wordpress/components';
13
13
  import { __, sprintf } from '@wordpress/i18n';
14
14
  import { getCategories, getBlockTypes, getBlockFromExample, createBlock } from '@wordpress/blocks';
15
15
  import { BlockList, privateApis as blockEditorPrivateApis, store as blockEditorStore, __unstableEditorStyles as EditorStyles, __unstableIframe as Iframe } from '@wordpress/block-editor';
16
16
  import { useSelect } from '@wordpress/data';
17
- import { closeSmall } from '@wordpress/icons';
18
- import { useResizeObserver, useFocusOnMount, useFocusReturn, useMergeRefs } from '@wordpress/compose';
17
+ import { useResizeObserver } from '@wordpress/compose';
19
18
  import { useMemo, memo } from '@wordpress/element';
20
- import { ESCAPE } from '@wordpress/keycodes';
21
19
  /**
22
20
  * Internal dependencies
23
21
  */
24
22
 
25
23
  import { unlock } from '../../private-apis';
24
+ import EditorCanvasContainer from '../editor-canvas-container';
26
25
  const {
27
26
  ExperimentalBlockEditorProvider,
28
27
  useGlobalStyle
29
- } = unlock(blockEditorPrivateApis);
30
- const SLOT_FILL_NAME = 'EditSiteStyleBook';
31
- const {
32
- Slot: StyleBookSlot,
33
- Fill: StyleBookFill
34
- } = createSlotFill(SLOT_FILL_NAME); // The content area of the Style Book is rendered within an iframe so that global styles
28
+ } = unlock(blockEditorPrivateApis); // The content area of the Style Book is rendered within an iframe so that global styles
35
29
  // are applied to elements within the entire content area. To support elements that are
36
30
  // not part of the block previews, such as headings and layout for the block previews,
37
31
  // additional CSS rules need to be passed into the iframe. These are hard-coded below.
@@ -145,12 +139,9 @@ function getExamples() {
145
139
  function StyleBook(_ref) {
146
140
  let {
147
141
  isSelected,
148
- onSelect,
149
- onClose
142
+ onSelect
150
143
  } = _ref;
151
144
  const [resizeObserver, sizes] = useResizeObserver();
152
- const focusOnMountRef = useFocusOnMount('firstElement');
153
- const sectionFocusReturnRef = useFocusReturn();
154
145
  const [textColor] = useGlobalStyle('color.text');
155
146
  const [backgroundColor] = useGlobalStyle('color.background');
156
147
  const examples = useMemo(getExamples, []);
@@ -163,32 +154,17 @@ function StyleBook(_ref) {
163
154
  const settings = useMemo(() => ({ ...originalSettings,
164
155
  __unstableIsPreviewMode: true
165
156
  }), [originalSettings]);
166
-
167
- function closeOnEscape(event) {
168
- if (event.keyCode === ESCAPE && !event.defaultPrevented) {
169
- event.preventDefault();
170
- onClose();
171
- }
172
- }
173
-
174
- return createElement(StyleBookFill, null, createElement("section", {
157
+ return createElement(EditorCanvasContainer, {
158
+ closeButtonLabel: __('Close Style Book')
159
+ }, createElement("div", {
175
160
  className: classnames('edit-site-style-book', {
176
161
  'is-wide': sizes.width > 600
177
162
  }),
178
163
  style: {
179
164
  color: textColor,
180
165
  background: backgroundColor
181
- },
182
- "aria-label": __('Style Book'),
183
- onKeyDown: closeOnEscape,
184
- ref: useMergeRefs([sectionFocusReturnRef, focusOnMountRef])
185
- }, resizeObserver, createElement(Button, {
186
- className: "edit-site-style-book__close-button",
187
- icon: closeSmall,
188
- label: __('Close Style Book'),
189
- onClick: onClose,
190
- showTooltip: false
191
- }), createElement(TabPanel, {
166
+ }
167
+ }, resizeObserver, createElement(TabPanel, {
192
168
  className: "edit-site-style-book__tab-panel",
193
169
  tabs: tabs
194
170
  }, tab => createElement(Iframe, {
@@ -281,12 +257,5 @@ const Example = _ref3 => {
281
257
  })))));
282
258
  };
283
259
 
284
- function useHasStyleBook() {
285
- const fills = useSlotFills(SLOT_FILL_NAME);
286
- return !!(fills !== null && fills !== void 0 && fills.length);
287
- }
288
-
289
- StyleBook.Slot = StyleBookSlot;
290
260
  export default StyleBook;
291
- export { useHasStyleBook };
292
261
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["classnames","Button","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","Disabled","TabPanel","createSlotFill","__experimentalUseSlotFills","useSlotFills","__","sprintf","getCategories","getBlockTypes","getBlockFromExample","createBlock","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","useSelect","closeSmall","useResizeObserver","useFocusOnMount","useFocusReturn","useMergeRefs","useMemo","memo","ESCAPE","unlock","ExperimentalBlockEditorProvider","useGlobalStyle","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","STYLE_BOOK_IFRAME_STYLES","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","focusOnMountRef","sectionFocusReturnRef","textColor","backgroundColor","examples","tabs","some","slug","icon","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","width","color","background","tab","styles","Examples","className","label","composite","orientation","Example","id","onClick","renderedBlocks","Array","isArray","useHasStyleBook","fills","length"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,mBAAmB,IAAIC,SAFxB,EAGCC,2BAA2B,IAAIC,iBAHhC,EAICC,uBAAuB,IAAIC,aAJ5B,EAKCC,QALD,EAMCC,QAND,EAOCC,cAPD,EAQCC,0BAA0B,IAAIC,YAR/B,QASO,uBATP;AAUA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mBAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SACCC,SADD,EAECC,WAAW,IAAIC,sBAFhB,EAGCC,KAAK,IAAIC,gBAHV,EAICC,sBAAsB,IAAIC,YAJ3B,EAKCC,gBAAgB,IAAIC,MALrB,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SACCC,iBADD,EAECC,eAFD,EAGCC,cAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,+BAAF;AAAmCC,EAAAA;AAAnC,IAAsDF,MAAM,CACjEhB,sBADiE,CAAlE;AAIA,MAAMmB,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IACLlC,cAAc,CAAE8B,cAAF,CADf,C,CAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMK,wBAAwB,GAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA7DA;;AA+DA,SAASC,WAAT,GAAuB;AACtB;AACA;AACA,QAAMC,eAAe,GAAG;AACvBC,IAAAA,IAAI,EAAE,cADiB;AAEvBC,IAAAA,KAAK,EAA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AAAU,IAAA,SAAS,EAAC;AAApB,KACC,cAAC,+BAAD;AACC,IAAA,KAAK,EAAGkD,cADT;AAEC,IAAA,QAAQ,EAAGpB;AAFZ,KAIC,cAAC,SAAD;AAAW,IAAA,cAAc,EAAG;AAA5B,IAJD,CADD,CADD,CAlBD,CADD;AA+BA,CA/CD;;AAiDA,SAASuB,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG3F,YAAY,CAAE4B,cAAF,CAA1B;AACA,SAAO,CAAC,EAAE+D,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAED3C,SAAS,CAACpB,IAAV,GAAiBC,aAAjB;AACA,eAAemB,SAAf;AACA,SAASyC,eAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n\tDisabled,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport {\n\tuseResizeObserver,\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nconst STYLE_BOOK_IFRAME_STYLES = `\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonClose();\n\t\t}\n\t}\n\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tsectionFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Iframe\n\t\t\t\t\t\t\tclassName=\"edit-site-style-book__iframe\"\n\t\t\t\t\t\t\tname=\"style-book-canvas\"\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }` +\n\t\t\t\t\t\t\t\t\t\tSTYLE_BOOK_IFRAME_STYLES\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-style-book__examples',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-wide': sizes.width > 600,\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\texamples={ examples }\n\t\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Examples of blocks in the %s category'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttab.title\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Iframe>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\t{ ...composite }\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t>\n\t\t\t\t{ examples\n\t\t\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t\t\t.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Example = ( { composite, id, title, blocks, isSelected, onClick } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t{ ...composite }\n\t\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tid={ id }\n\t\t\taria-label={ sprintf(\n\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\ttitle\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\trole=\"button\"\n\t\t\tas=\"div\"\n\t\t>\n\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t{ title }\n\t\t\t</span>\n\t\t\t<div className=\"edit-site-style-book__example-preview\" aria-hidden>\n\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</CompositeItem>\n\t);\n};\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["classnames","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","Disabled","TabPanel","__","sprintf","getCategories","getBlockTypes","getBlockFromExample","createBlock","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","useSelect","useResizeObserver","useMemo","memo","unlock","EditorCanvasContainer","ExperimentalBlockEditorProvider","useGlobalStyle","STYLE_BOOK_IFRAME_STYLES","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","resizeObserver","sizes","textColor","backgroundColor","examples","tabs","some","slug","icon","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","width","color","background","tab","styles","Examples","className","label","composite","orientation","Example","id","onClick","renderedBlocks","Array","isArray"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mBAAmB,IAAIC,SADxB,EAECC,2BAA2B,IAAIC,iBAFhC,EAGCC,uBAAuB,IAAIC,aAH5B,EAICC,QAJD,EAKCC,QALD,QAMO,uBANP;AAOA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mBAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SACCC,SADD,EAECC,WAAW,IAAIC,sBAFhB,EAGCC,KAAK,IAAIC,gBAHV,EAICC,sBAAsB,IAAIC,YAJ3B,EAKCC,gBAAgB,IAAIC,MALrB,QAMO,yBANP;AAOA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,MAAM;AAAEC,EAAAA,+BAAF;AAAmCC,EAAAA;AAAnC,IAAsDH,MAAM,CACjEX,sBADiE,CAAlE,C,CAIA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMe,wBAAwB,GAAI;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n\tDisabled,\n\tTabPanel,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst { ExperimentalBlockEditorProvider, useGlobalStyle } = unlock(\n\tblockEditorPrivateApis\n);\n\n// The content area of the Style Book is rendered within an iframe so that global styles\n// are applied to elements within the entire content area. To support elements that are\n// not part of the block previews, such as headings and layout for the block previews,\n// additional CSS rules need to be passed into the iframe. These are hard-coded below.\n// Note that button styles are unset, and then focus rules from the `Button` component are\n// applied to the `button` element, targeted via `.edit-site-style-book__example`.\n// This is to ensure that browser default styles for buttons are not applied to the previews.\nconst STYLE_BOOK_IFRAME_STYLES = `\n\t.edit-site-style-book__examples {\n\t\tmax-width: 900px;\n\t\tmargin: 0 auto;\n\t}\n\n\t.edit-site-style-book__example {\n\t\tborder-radius: 2px;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 40px;\n\t\tmargin-bottom: 40px;\n\t\tpadding: 16px;\n\t\twidth: 100%;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.edit-site-style-book__example.is-selected {\n\t\tbox-shadow: 0 0 0 1px var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t}\n\n\t.edit-site-style-book__example:focus:not(:disabled) {\n\t\tbox-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));\n\t\toutline: 3px solid transparent;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example {\n\t\tflex-direction: row;\n\t}\n\n\t.edit-site-style-book__example-title {\n\t\tfont-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen-Sans, Ubuntu, Cantarell, \"Helvetica Neue\", sans-serif;\n\t\tfont-size: 11px;\n\t\tfont-weight: 500;\n\t\tline-height: normal;\n\t\tmargin: 0;\n\t\ttext-align: left;\n\t\ttext-transform: uppercase;\n\t}\n\n\t.edit-site-style-book__examples.is-wide .edit-site-style-book__example-title {\n\t\ttext-align: right;\n\t\twidth: 120px;\n\t}\n\n\t.edit-site-style-book__example-preview {\n\t\twidth: 100%;\n\t}\n\n\t.edit-site-style-book__example-preview .block-editor-block-list__insertion-point,\n\t.edit-site-style-book__example-preview .block-list-appender {\n\t\tdisplay: none;\n\t}\n\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:first-child {\n\t\tmargin-top: 0;\n\t}\n\t.edit-site-style-book__example-preview .is-root-container > .wp-block:last-child {\n\t\tmargin-bottom: 0;\n\t}\n`;\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\treturn (\n\t\t<EditorCanvasContainer closeButtonLabel={ __( 'Close Style Book' ) }>\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Iframe\n\t\t\t\t\t\t\tclassName=\"edit-site-style-book__iframe\"\n\t\t\t\t\t\t\tname=\"style-book-canvas\"\n\t\t\t\t\t\t\ttabIndex={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\t\t\t\t\tbody { position: relative; padding: 32px !important; }` +\n\t\t\t\t\t\t\t\t\t\tSTYLE_BOOK_IFRAME_STYLES\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'edit-site-style-book__examples',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-wide': sizes.width > 600,\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\texamples={ examples }\n\t\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Category of blocks, e.g. Text.\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Examples of blocks in the %s category'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttab.title\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Iframe>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</div>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nconst Examples = memo(\n\t( { className, examples, category, label, isSelected, onSelect } ) => {\n\t\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\t\treturn (\n\t\t\t<Composite\n\t\t\t\t{ ...composite }\n\t\t\t\tclassName={ className }\n\t\t\t\taria-label={ label }\n\t\t\t>\n\t\t\t\t{ examples\n\t\t\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t\t\t.map( ( example ) => (\n\t\t\t\t\t\t<Example\n\t\t\t\t\t\t\tkey={ example.name }\n\t\t\t\t\t\t\tid={ `example-${ example.name }` }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t</Composite>\n\t\t);\n\t}\n);\n\nconst Example = ( { composite, id, title, blocks, isSelected, onClick } ) => {\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\t// Cache the list of blocks to avoid additional processing when the component is re-rendered.\n\tconst renderedBlocks = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\treturn (\n\t\t<CompositeItem\n\t\t\t{ ...composite }\n\t\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tid={ id }\n\t\t\taria-label={ sprintf(\n\t\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\t\ttitle\n\t\t\t) }\n\t\t\tonClick={ onClick }\n\t\t\trole=\"button\"\n\t\t\tas=\"div\"\n\t\t>\n\t\t\t<span className=\"edit-site-style-book__example-title\">\n\t\t\t\t{ title }\n\t\t\t</span>\n\t\t\t<div className=\"edit-site-style-book__example-preview\" aria-hidden>\n\t\t\t\t<Disabled className=\"edit-site-style-book__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocks }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</div>\n\t\t</CompositeItem>\n\t);\n};\n\nexport default StyleBook;\n"]}
@@ -23,13 +23,15 @@ export default function useInitEditedEntityFromURL() {
23
23
  url
24
24
  } = useSelect(select => {
25
25
  const {
26
- getSite
26
+ getSite,
27
+ getUnstableBase
27
28
  } = select(coreDataStore);
28
29
  const siteData = getSite();
30
+ const base = getUnstableBase();
29
31
  return {
30
- isRequestingSite: !siteData,
32
+ isRequestingSite: !base,
31
33
  homepageId: (siteData === null || siteData === void 0 ? void 0 : siteData.show_on_front) === 'page' ? siteData.page_on_front : null,
32
- url: siteData === null || siteData === void 0 ? void 0 : siteData.url
34
+ url: base === null || base === void 0 ? void 0 : base.home
33
35
  };
34
36
  }, []);
35
37
  const {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","isRequestingSite","homepageId","url","select","getSite","siteData","show_on_front","page_on_front","setTemplate","setTemplatePart","setPage","context","path"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,0BAAT,GAAsC;AACpD,QAAM;AAAEC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAuB;AAAjC,MAAwCL,WAAW,EAAzD;AACA,QAAM;AAAEM,IAAAA,gBAAF;AAAoBC,IAAAA,UAApB;AAAgCC,IAAAA;AAAhC,MAAwCZ,SAAS,CAAIa,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAEV,aAAF,CAA1B;AACA,UAAMY,QAAQ,GAAGD,OAAO,EAAxB;AAEA,WAAO;AACNJ,MAAAA,gBAAgB,EAAE,CAAEK,QADd;AAENJ,MAAAA,UAAU,EACT,CAAAI,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEC,aAAV,MAA4B,MAA5B,GACGD,QAAQ,CAACE,aADZ,GAEG,IALE;AAMNL,MAAAA,GAAG,EAAEG,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEH;AANT,KAAP;AAQA,GAZsD,EAYpD,EAZoD,CAAvD;AAcA,QAAM;AAAEM,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MACLnB,WAAW,CAAEI,aAAF,CADZ;AAGAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKU,QAAQ,IAAID,MAAjB,EAA0B;AACzB,cAASC,QAAT;AACC,aAAK,aAAL;AACCS,UAAAA,WAAW,CAAEV,MAAF,CAAX;AACA;;AACD,aAAK,kBAAL;AACCW,UAAAA,eAAe,CAAEX,MAAF,CAAf;AACA;;AACD;AACCY,UAAAA,OAAO,CAAE;AACRC,YAAAA,OAAO,EAAE;AAAEZ,cAAAA,QAAF;AAAYD,cAAAA;AAAZ;AADD,WAAF,CAAP;AARF;;AAaA;AACA,KAhBe,CAkBhB;;;AACA,QAAKG,UAAL,EAAkB;AACjBS,MAAAA,OAAO,CAAE;AACRC,QAAAA,OAAO,EAAE;AAAEZ,UAAAA,QAAQ,EAAE,MAAZ;AAAoBD,UAAAA,MAAM,EAAEG;AAA5B;AADD,OAAF,CAAP;AAGA,KAJD,MAIO,IAAK,CAAED,gBAAP,EAA0B;AAChCU,MAAAA,OAAO,CAAE;AACRE,QAAAA,IAAI,EAAEV;AADE,OAAF,CAAP;AAGA;AACD,GA5BQ,EA4BN,CACFA,GADE,EAEFJ,MAFE,EAGFC,QAHE,EAIFE,UAJE,EAKFD,gBALE,EAMFU,OANE,EAOFF,WAPE,EAQFC,eARE,CA5BM,CAAT;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params: { postId, postType } = {} } = useLocation();\n\tconst { isRequestingSite, homepageId, url } = useSelect( ( select ) => {\n\t\tconst { getSite } = select( coreDataStore );\n\t\tconst siteData = getSite();\n\n\t\treturn {\n\t\t\tisRequestingSite: ! siteData,\n\t\t\thomepageId:\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? siteData.page_on_front\n\t\t\t\t\t: null,\n\t\t\turl: siteData?.url,\n\t\t};\n\t}, [] );\n\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( postType && postId ) {\n\t\t\tswitch ( postType ) {\n\t\t\t\tcase 'wp_template':\n\t\t\t\t\tsetTemplate( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'wp_template_part':\n\t\t\t\t\tsetTemplatePart( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\tcontext: { postType, postId },\n\t\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// In all other cases, we need to set the home page in the site editor view.\n\t\tif ( homepageId ) {\n\t\t\tsetPage( {\n\t\t\t\tcontext: { postType: 'page', postId: homepageId },\n\t\t\t} );\n\t\t} else if ( ! isRequestingSite ) {\n\t\t\tsetPage( {\n\t\t\t\tpath: url,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\turl,\n\t\tpostId,\n\t\tpostType,\n\t\thomepageId,\n\t\tisRequestingSite,\n\t\tsetPage,\n\t\tsetTemplate,\n\t\tsetTemplatePart,\n\t] );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","isRequestingSite","homepageId","url","select","getSite","getUnstableBase","siteData","base","show_on_front","page_on_front","home","setTemplate","setTemplatePart","setPage","context","path"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,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aA;AACA,KAhBe,CAkBhB;;;AACA,QAAKG,UAAL,EAAkB;AACjBY,MAAAA,OAAO,CAAE;AACRC,QAAAA,OAAO,EAAE;AAAEf,UAAAA,QAAQ,EAAE,MAAZ;AAAoBD,UAAAA,MAAM,EAAEG;AAA5B;AADD,OAAF,CAAP;AAGA,KAJD,MAIO,IAAK,CAAED,gBAAP,EAA0B;AAChCa,MAAAA,OAAO,CAAE;AACRE,QAAAA,IAAI,EAAEb;AADE,OAAF,CAAP;AAGA;AACD,GA5BQ,EA4BN,CACFA,GADE,EAEFJ,MAFE,EAGFC,QAHE,EAIFE,UAJE,EAKFD,gBALE,EAMFa,OANE,EAOFF,WAPE,EAQFC,eARE,CA5BM,CAAT;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params: { postId, postType } = {} } = useLocation();\n\tconst { isRequestingSite, homepageId, url } = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase } = select( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\n\t\treturn {\n\t\t\tisRequestingSite: ! base,\n\t\t\thomepageId:\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? siteData.page_on_front\n\t\t\t\t\t: null,\n\t\t\turl: base?.home,\n\t\t};\n\t}, [] );\n\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( postType && postId ) {\n\t\t\tswitch ( postType ) {\n\t\t\t\tcase 'wp_template':\n\t\t\t\t\tsetTemplate( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'wp_template_part':\n\t\t\t\t\tsetTemplatePart( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\tcontext: { postType, postId },\n\t\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// In all other cases, we need to set the home page in the site editor view.\n\t\tif ( homepageId ) {\n\t\t\tsetPage( {\n\t\t\t\tcontext: { postType: 'page', postId: homepageId },\n\t\t\t} );\n\t\t} else if ( ! isRequestingSite ) {\n\t\t\tsetPage( {\n\t\t\t\tpath: url,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\turl,\n\t\tpostId,\n\t\tpostType,\n\t\thomepageId,\n\t\tisRequestingSite,\n\t\tsetPage,\n\t\tsetTemplate,\n\t\tsetTemplatePart,\n\t] );\n}\n"]}
@@ -76,6 +76,8 @@ export default function TemplateDetails(_ref) {
76
76
  onClick: revert
77
77
  }, __('Clear customizations'))), createElement(Button, _extends({
78
78
  className: "edit-site-template-details__show-all-button"
79
- }, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('Manage all templates') : __('Manage all template parts')));
79
+ }, browseAllLinkProps, {
80
+ onClick: () => onClose()
81
+ }), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('Manage all templates') : __('Manage all template parts')));
80
82
  }
81
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","EditTemplateTitle","useLink","TemplatePartAreaSelector","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps","path","type","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,oBAA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__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","EditTemplateTitle","useLink","TemplatePartAreaSelector","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps","path","type","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;A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ourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t\tonClick={ () => onClose() }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
@@ -78,7 +78,7 @@ export default function WelcomeGuideStyles() {
78
78
  }, __('Learn more')), createElement("p", {
79
79
  className: "edit-site-welcome-guide__text"
80
80
  }, __('New to block themes and styling your site? '), createElement(ExternalLink, {
81
- href: __('https://wordpress.org/support/article/styles-overview/')
81
+ href: __('https://wordpress.org/documentation/article/styles-overview/')
82
82
  }, __('Here’s a detailed guide to learn how to make the most of it.'))))
83
83
  }]
84
84
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","useSelect","ExternalLink","Guide","__","store","interfaceStore","preferencesStore","WelcomeGuideImage","editSiteStore","WelcomeGuideStyles","toggle","isActive","isStylesOpen","select","sidebar","getActiveComplementaryArea","name","get","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAaX,WAAW,CAAEO,gBAAF,CAA9B;AAEA,QAAM;AAAEK,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6BZ,SAAS,CAAIa,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAER,cAAF,CAAN,CAAyBU,0BAAzB,CACfP,aAAa,CAACQ,IADC,CAAhB;AAIA,WAAO;AACNL,MAAAA,QAAQ,EAAE,CAAC,CAAEE,MAAM,CAAEP,gBAAF,CAAN,CAA2BW,GAA3B,CACZ,gBADY,EAEZ,oBAFY,CADP;AAKNL,MAAAA,YAAY,EAAEE,OAAO,KAAK;AALpB,KAAP;AAOA,GAZ2C,EAYzC,EAZyC,CAA5C;;AAcA,MAAK,CAAEH,QAAF,IAAc,CAAEC,YAArB,EAAoC;AACnC,WAAO,IAAP;AACA;;AAED,SACC,cAAC,KAAD;AACC,IAAA,SAAS,EAAC,yBADX;AAEC,IAAA,Y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ACGhB,EAAE,CAAE,YAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,6CADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,wDADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn {\n\t\t\tisActive: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'welcomeGuideStyles'\n\t\t\t),\n\t\t\tisStylesOpen: sidebar === 'edit-site/global-styles',\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive || ! isStylesOpen ) {\n\t\treturn null;\n\t}\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={ () => toggle( 'core/edit-site', '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/styles-overview/'\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"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/welcome-guide/styles.js"],"names":["useDispatch","useSelect","ExternalLink","Guide","__","store","interfaceStore","preferencesStore","WelcomeGuideImage","editSiteStore","WelcomeGuideStyles","toggle","isActive","isStylesOpen","select","sidebar","getActiveComplementaryArea","name","get","image","content"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,YAAT,EAAuBC,KAAvB,QAAoC,uBAApC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,SAA9B;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,kBAAT,GAA8B;AAC5C,QAAM;AAAEC,IAAAA;AAAF,MAAaX,WAAW,CAAEO,gBAAF,CAA9B;AAEA,QAAM;AAAEK,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA6BZ,SAAS,CAAIa,MAAF,IAAc;AAC3D,UAAMC,OAAO,GAAGD,MAAM,CAAER,cAAF,CAAN,CAAyBU,0BAAzB,CACfP,aAAa,CAACQ,IADC,CAAhB;AAIA,WAAO;AACNL,MAAAA,QAAQ,EAAE,CAAC,CAAEE,MAAM,CAAEP,gBAAF,CAAN,CAA2BW,GAA3B,CACZ,gBADY,EAEZ,oBAFY,CADP;AAKNL,MAAAA,YAAY,EAAEE,OAAO,KAAK;AALpB,KAAP;AAOA,GAZ2C,EAYzC,EAZyC,CAA5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,cAAC,iBAAD;AACC,QAAA,cAAc,EAAC,+DADhB;AAEC,QAAA,WAAW,EAAC;AAFb,QAFF;AAOCC,MAAAA,OAAO,EACN,8BACC;AAAI,QAAA,SAAS,EAAC;AAAd,SACGhB,EAAE,CAAE,YAAF,CADL,CADD,EAIC;AAAG,QAAA,SAAS,EAAC;AAAb,SACGA,EAAE,CACH,6CADG,CADL,EAIC,cAAC,YAAD;AACC,QAAA,IAAI,EAAGA,EAAE,CACR,8DADQ;AADV,SAKGA,EAAE,CACH,8DADG,CALL,CAJD,CAJD;AARF,KA7DO;AALT,IADD;AAmGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { ExternalLink, Guide } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport WelcomeGuideImage from './image';\nimport { store as editSiteStore } from '../../store';\n\nexport default function WelcomeGuideStyles() {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst { isActive, isStylesOpen } = useSelect( ( select ) => {\n\t\tconst sidebar = select( interfaceStore ).getActiveComplementaryArea(\n\t\t\teditSiteStore.name\n\t\t);\n\n\t\treturn {\n\t\t\tisActive: !! select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'welcomeGuideStyles'\n\t\t\t),\n\t\t\tisStylesOpen: sidebar === 'edit-site/global-styles',\n\t\t};\n\t}, [] );\n\n\tif ( ! isActive || ! isStylesOpen ) {\n\t\treturn null;\n\t}\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={ () => toggle( 'core/edit-site', '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/documentation/article/styles-overview/'\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"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { useNavigationCommands } from './use-navigation-commands';
5
+ import { useWPAdminCommands } from './use-wp-admin-commands';
6
+ export function useCommands() {
7
+ useWPAdminCommands();
8
+ useNavigationCommands();
9
+ }
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/index.js"],"names":["useNavigationCommands","useWPAdminCommands","useCommands"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,qBAAT,QAAsC,2BAAtC;AACA,SAASC,kBAAT,QAAmC,yBAAnC;AAEA,OAAO,SAASC,WAAT,GAAuB;AAC7BD,EAAAA,kBAAkB;AAClBD,EAAAA,qBAAqB;AACrB","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useNavigationCommands } from './use-navigation-commands';\nimport { useWPAdminCommands } from './use-wp-admin-commands';\n\nexport function useCommands() {\n\tuseWPAdminCommands();\n\tuseNavigationCommands();\n}\n"]}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis } from '@wordpress/commands';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { useMemo } from '@wordpress/element';
7
+ import { useSelect } from '@wordpress/data';
8
+ import { store as coreStore } from '@wordpress/core-data';
9
+ import { post, page, layout, symbolFilled } from '@wordpress/icons';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { store as editSiteStore } from '../../store';
15
+ import { unlock } from '../../private-apis';
16
+ import { useHistory } from '../../components/routes';
17
+ const {
18
+ useCommandLoader
19
+ } = unlock(privateApis);
20
+ const icons = {
21
+ post,
22
+ page,
23
+ wp_template: layout,
24
+ wp_template_part: symbolFilled
25
+ };
26
+
27
+ const getNavigationCommandLoaderPerPostType = postType => function useNavigationCommandLoader(_ref) {
28
+ let {
29
+ search
30
+ } = _ref;
31
+ const supportsSearch = !['wp_template', 'wp_template_part'].includes(postType);
32
+ const deps = supportsSearch ? [search] : [];
33
+ const history = useHistory();
34
+ const {
35
+ canvasMode,
36
+ records,
37
+ isLoading
38
+ } = useSelect(select => {
39
+ const {
40
+ getEntityRecords
41
+ } = select(coreStore);
42
+ const query = supportsSearch ? {
43
+ search: !!search ? search : undefined,
44
+ per_page: 10,
45
+ orderby: search ? 'relevance' : 'date'
46
+ } : {
47
+ per_page: -1
48
+ };
49
+ return {
50
+ records: getEntityRecords('postType', postType, query),
51
+ isLoading: !select(coreStore).hasFinishedResolution('getEntityRecords', ['postType', postType, query]),
52
+ canvasMode: unlock(select(editSiteStore)).getCanvasMode()
53
+ };
54
+ }, deps);
55
+ const commands = useMemo(() => {
56
+ return (records !== null && records !== void 0 ? records : []).slice(0, 10).map(record => {
57
+ var _record$title, _record$title2, _record$title3;
58
+
59
+ return {
60
+ name: ((_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) + ' ' + record.id,
61
+ label: (_record$title2 = record.title) !== null && _record$title2 !== void 0 && _record$title2.rendered ? (_record$title3 = record.title) === null || _record$title3 === void 0 ? void 0 : _record$title3.rendered : __('(no title)'),
62
+ icon: icons[postType],
63
+ callback: _ref2 => {
64
+ let {
65
+ close
66
+ } = _ref2;
67
+ history.push({
68
+ postType,
69
+ postId: record.id,
70
+ canvas: canvasMode === 'edit' ? canvasMode : undefined
71
+ });
72
+ close();
73
+ }
74
+ };
75
+ });
76
+ }, [records, history, canvasMode]);
77
+ return {
78
+ commands,
79
+ isLoading
80
+ };
81
+ };
82
+
83
+ const usePageNavigationCommandLoader = getNavigationCommandLoaderPerPostType('page');
84
+ const usePostNavigationCommandLoader = getNavigationCommandLoaderPerPostType('post');
85
+ const useTemplateNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template');
86
+ const useTemplatePartNavigationCommandLoader = getNavigationCommandLoaderPerPostType('wp_template_part');
87
+ export function useNavigationCommands() {
88
+ useCommandLoader({
89
+ name: 'core/edit-site/navigate-pages',
90
+ group: __('Pages'),
91
+ hook: usePageNavigationCommandLoader
92
+ });
93
+ useCommandLoader({
94
+ name: 'core/edit-site/navigate-posts',
95
+ group: __('Posts'),
96
+ hook: usePostNavigationCommandLoader
97
+ });
98
+ useCommandLoader({
99
+ name: 'core/edit-site/navigate-templates',
100
+ group: __('Templates'),
101
+ hook: useTemplateNavigationCommandLoader
102
+ });
103
+ useCommandLoader({
104
+ name: 'core/edit-site/navigate-template-parts',
105
+ group: __('Template Parts'),
106
+ hook: useTemplatePartNavigationCommandLoader
107
+ });
108
+ }
109
+ //# sourceMappingURL=use-navigation-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-navigation-commands.js"],"names":["privateApis","__","useMemo","useSelect","store","coreStore","post","page","layout","symbolFilled","editSiteStore","unlock","useHistory","useCommandLoader","icons","wp_template","wp_template_part","getNavigationCommandLoaderPerPostType","postType","useNavigationCommandLoader","search","supportsSearch","includes","deps","history","canvasMode","records","isLoading","select","getEntityRecords","query","undefined","per_page","orderby","hasFinishedResolution","getCanvasMode","commands","slice","map","record","name","title","rendered","id","label","icon","callback","close","push","postId","canvas","usePageNavigationCommandLoader","usePostNavigationCommandLoader","useTemplateNavigationCommandLoader","useTemplatePartNavigationCommandLoader","useNavigationCommands","group","hook"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,qBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAA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P;AAgBA,KAjBM,CAAP;AAkBA,GAnBuB,EAmBrB,CAAErB,OAAF,EAAWF,OAAX,EAAoBC,UAApB,CAnBqB,CAAxB;AAqBA,SAAO;AACNW,IAAAA,QADM;AAENT,IAAAA;AAFM,GAAP;AAIA,CArDF;;AAuDA,MAAMwB,8BAA8B,GACnClC,qCAAqC,CAAE,MAAF,CADtC;AAEA,MAAMmC,8BAA8B,GACnCnC,qCAAqC,CAAE,MAAF,CADtC;AAEA,MAAMoC,kCAAkC,GACvCpC,qCAAqC,CAAE,aAAF,CADtC;AAEA,MAAMqC,sCAAsC,GAC3CrC,qCAAqC,CAAE,kBAAF,CADtC;AAGA,OAAO,SAASsC,qBAAT,GAAiC;AACvC1C,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,+BADW;AAEjBgB,IAAAA,KAAK,EAAEvD,EAAE,CAAE,OAAF,CAFQ;AAGjBwD,IAAAA,IAAI,EAAEN;AAHW,GAAF,CAAhB;AAKAtC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,+BADW;AAEjBgB,IAAAA,KAAK,EAAEvD,EAAE,CAAE,OAAF,CAFQ;AAGjBwD,IAAAA,IAAI,EAAEL;AAHW,GAAF,CAAhB;AAKAvC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,mCADW;AAEjBgB,IAAAA,KAAK,EAAEvD,EAAE,CAAE,WAAF,CAFQ;AAGjBwD,IAAAA,IAAI,EAAEJ;AAHW,GAAF,CAAhB;AAKAxC,EAAAA,gBAAgB,CAAE;AACjB2B,IAAAA,IAAI,EAAE,wCADW;AAEjBgB,IAAAA,KAAK,EAAEvD,EAAE,CAAE,gBAAF,CAFQ;AAGjBwD,IAAAA,IAAI,EAAEH;AAHW,GAAF,CAAhB;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { post, page, layout, symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport { useHistory } from '../../components/routes';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst icons = {\n\tpost,\n\tpage,\n\twp_template: layout,\n\twp_template_part: symbolFilled,\n};\n\nconst getNavigationCommandLoaderPerPostType = ( postType ) =>\n\tfunction useNavigationCommandLoader( { search } ) {\n\t\tconst supportsSearch = ! [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tpostType\n\t\t);\n\t\tconst deps = supportsSearch ? [ search ] : [];\n\t\tconst history = useHistory();\n\t\tconst { canvasMode, records, isLoading } = useSelect( ( select ) => {\n\t\t\tconst { getEntityRecords } = select( coreStore );\n\t\t\tconst query = supportsSearch\n\t\t\t\t? {\n\t\t\t\t\t\tsearch: !! search ? search : undefined,\n\t\t\t\t\t\tper_page: 10,\n\t\t\t\t\t\torderby: search ? 'relevance' : 'date',\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t };\n\t\t\treturn {\n\t\t\t\trecords: getEntityRecords( 'postType', postType, query ),\n\t\t\t\tisLoading: ! select( coreStore ).hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\t[ 'postType', postType, query ]\n\t\t\t\t),\n\t\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\t};\n\t\t}, deps );\n\n\t\tconst commands = useMemo( () => {\n\t\t\treturn ( records ?? [] ).slice( 0, 10 ).map( ( record ) => {\n\t\t\t\treturn {\n\t\t\t\t\tname: record.title?.rendered + ' ' + record.id,\n\t\t\t\t\tlabel: record.title?.rendered\n\t\t\t\t\t\t? record.title?.rendered\n\t\t\t\t\t\t: __( '(no title)' ),\n\t\t\t\t\ticon: icons[ postType ],\n\t\t\t\t\tcallback: ( { close } ) => {\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\tpostId: record.id,\n\t\t\t\t\t\t\tcanvas:\n\t\t\t\t\t\t\t\tcanvasMode === 'edit' ? canvasMode : undefined,\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tclose();\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} );\n\t\t}, [ records, history, canvasMode ] );\n\n\t\treturn {\n\t\t\tcommands,\n\t\t\tisLoading,\n\t\t};\n\t};\n\nconst usePageNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'page' );\nconst usePostNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'post' );\nconst useTemplateNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template' );\nconst useTemplatePartNavigationCommandLoader =\n\tgetNavigationCommandLoaderPerPostType( 'wp_template_part' );\n\nexport function useNavigationCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-pages',\n\t\tgroup: __( 'Pages' ),\n\t\thook: usePageNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-posts',\n\t\tgroup: __( 'Posts' ),\n\t\thook: usePostNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-templates',\n\t\tgroup: __( 'Templates' ),\n\t\thook: useTemplateNavigationCommandLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/navigate-template-parts',\n\t\tgroup: __( 'Template Parts' ),\n\t\thook: useTemplatePartNavigationCommandLoader,\n\t} );\n}\n"]}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis } from '@wordpress/commands';
5
+ import { __, sprintf } from '@wordpress/i18n';
6
+ import { useSelect } from '@wordpress/data';
7
+ import { addQueryArgs } from '@wordpress/url';
8
+ import { useMemo } from '@wordpress/element';
9
+ import { plus } from '@wordpress/icons';
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+
14
+ import { store as editSiteStore } from '../../store';
15
+ import { unlock } from '../../private-apis';
16
+ const {
17
+ useCommandLoader
18
+ } = unlock(privateApis);
19
+
20
+ const getWPAdminAddCommandLoader = postType => function useAddCommandLoader(_ref) {
21
+ let {
22
+ search
23
+ } = _ref;
24
+ let label;
25
+
26
+ if (postType === 'post') {
27
+ label = __('Add a new post');
28
+ } else if (postType === 'page') {
29
+ label = __('Add a new page');
30
+ } else {
31
+ throw 'unsupported post type ' + postType;
32
+ }
33
+
34
+ const hasRecordTitle = !!search && !label.toLowerCase().includes(search.toLowerCase());
35
+
36
+ if (postType === 'post' && hasRecordTitle) {
37
+ /* translators: %s: Post title placeholder */
38
+ label = sprintf(__('Add a new post "%s"'), search);
39
+ } else if (postType === 'page' && hasRecordTitle) {
40
+ /* translators: %s: Page title placeholder */
41
+ label = sprintf(__('Add a new page "%s"'), search);
42
+ }
43
+
44
+ const newPostLink = useSelect(select => {
45
+ var _getSettings$newPostL;
46
+
47
+ const {
48
+ getSettings
49
+ } = unlock(select(editSiteStore));
50
+ return (_getSettings$newPostL = getSettings().newPostLink) !== null && _getSettings$newPostL !== void 0 ? _getSettings$newPostL : 'post-new.php';
51
+ }, []);
52
+ const commands = useMemo(() => [{
53
+ name: 'core/wp-admin/add-' + postType + '-' + search,
54
+ label,
55
+ icon: plus,
56
+ callback: () => {
57
+ document.location.href = addQueryArgs(newPostLink, {
58
+ post_type: postType,
59
+ post_title: hasRecordTitle ? search : undefined
60
+ });
61
+ }
62
+ }], [newPostLink, hasRecordTitle, search, label]);
63
+ return {
64
+ isLoading: false,
65
+ commands
66
+ };
67
+ };
68
+
69
+ const useAddPostLoader = getWPAdminAddCommandLoader('post');
70
+ const useAddPageLoader = getWPAdminAddCommandLoader('page');
71
+ export function useWPAdminCommands() {
72
+ useCommandLoader({
73
+ name: 'core/wp-admin/add-post-loader',
74
+ hook: useAddPostLoader
75
+ });
76
+ useCommandLoader({
77
+ name: 'core/wp-admin/add-page-loader',
78
+ hook: useAddPageLoader
79
+ });
80
+ }
81
+ //# sourceMappingURL=use-wp-admin-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/commands/use-wp-admin-commands.js"],"names":["privateApis","__","sprintf","useSelect","addQueryArgs","useMemo","plus","store","editSiteStore","unlock","useCommandLoader","getWPAdminAddCommandLoader","postType","useAddCommandLoader","search","label","hasRecordTitle","toLowerCase","includes","newPostLink","select","getSettings","commands","name","icon","callback","document","location","href","post_type","post_title","undefined","isLoading","useAddPostLoader","useAddPageLoader","useWPAdminCommands","hook"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,qBAA5B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAuBD,MAAM,CAAET,WAAF,CAAnC;;AAEA,MAAMW,0BAA0B,GAAKC,QAAF,IAClC,SAASC,mBAAT,OAA2C;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC1C,MAAIC,KAAJ;;AACA,MAAKH,QAAQ,KAAK,MAAlB,EAA2B;AAC1BG,IAAAA,KAAK,GAAGd,EAAE,CAAE,gBAAF,CAAV;AACA,GAFD,MAEO,IAAKW,QAAQ,KAAK,MAAlB,EAA2B;AACjCG,IAAAA,KAAK,GAAGd,EAAE,CAAE,gBAAF,CAAV;AACA,GAFM,MAEA;AACN,UAAM,2BAA2BW,QAAjC;AACA;;AACD,QAAMI,cAAc,GACnB,CAAC,CAAEF,MAAH,IAAa,CAA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BAAgB,GAAGtB,0BAA0B,CAAE,MAAF,CAAnD;AACA,MAAMuB,gBAAgB,GAAGvB,0BAA0B,CAAE,MAAF,CAAnD;AAEA,OAAO,SAASwB,kBAAT,GAA8B;AACpCzB,EAAAA,gBAAgB,CAAE;AACjBa,IAAAA,IAAI,EAAE,+BADW;AAEjBa,IAAAA,IAAI,EAAEH;AAFW,GAAF,CAAhB;AAIAvB,EAAAA,gBAAgB,CAAE;AACjBa,IAAAA,IAAI,EAAE,+BADW;AAEjBa,IAAAA,IAAI,EAAEF;AAFW,GAAF,CAAhB;AAIA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/commands';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useMemo } from '@wordpress/element';\nimport { plus } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst { useCommandLoader } = unlock( privateApis );\n\nconst getWPAdminAddCommandLoader = ( postType ) =>\n\tfunction useAddCommandLoader( { search } ) {\n\t\tlet label;\n\t\tif ( postType === 'post' ) {\n\t\t\tlabel = __( 'Add a new post' );\n\t\t} else if ( postType === 'page' ) {\n\t\t\tlabel = __( 'Add a new page' );\n\t\t} else {\n\t\t\tthrow 'unsupported post type ' + postType;\n\t\t}\n\t\tconst hasRecordTitle =\n\t\t\t!! search && ! label.toLowerCase().includes( search.toLowerCase() );\n\t\tif ( postType === 'post' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Post title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new post \"%s\"' ), search );\n\t\t} else if ( postType === 'page' && hasRecordTitle ) {\n\t\t\t/* translators: %s: Page title placeholder */\n\t\t\tlabel = sprintf( __( 'Add a new page \"%s\"' ), search );\n\t\t}\n\n\t\tconst newPostLink = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\treturn getSettings().newPostLink ?? 'post-new.php';\n\t\t}, [] );\n\n\t\tconst commands = useMemo(\n\t\t\t() => [\n\t\t\t\t{\n\t\t\t\t\tname: 'core/wp-admin/add-' + postType + '-' + search,\n\t\t\t\t\tlabel,\n\t\t\t\t\ticon: plus,\n\t\t\t\t\tcallback: () => {\n\t\t\t\t\t\tdocument.location.href = addQueryArgs( newPostLink, {\n\t\t\t\t\t\t\tpost_type: postType,\n\t\t\t\t\t\t\tpost_title: hasRecordTitle ? search : undefined,\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\t[ newPostLink, hasRecordTitle, search, label ]\n\t\t);\n\n\t\treturn {\n\t\t\tisLoading: false,\n\t\t\tcommands,\n\t\t};\n\t};\n\nconst useAddPostLoader = getWPAdminAddCommandLoader( 'post' );\nconst useAddPageLoader = getWPAdminAddCommandLoader( 'page' );\n\nexport function useWPAdminCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-post-loader',\n\t\thook: useAddPostLoader,\n\t} );\n\tuseCommandLoader( {\n\t\tname: 'core/wp-admin/add-page-loader',\n\t\thook: useAddPageLoader,\n\t} );\n}\n"]}
@@ -35,7 +35,8 @@ function EditTemplatePartMenuItem(_ref) {
35
35
  }, [theme, slug]);
36
36
  const linkProps = useLink({
37
37
  postId: templatePart === null || templatePart === void 0 ? void 0 : templatePart.id,
38
- postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type
38
+ postType: templatePart === null || templatePart === void 0 ? void 0 : templatePart.type,
39
+ canvas: 'edit'
39
40
  }, {
40
41
  fromTemplateId: params.postId
41
42
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["__","useSelect","BlockControls","store","coreStore","ToolbarButton","addFilter","createHigherOrderComponent","useLocation","useLink","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","getEntityRecord","linkProps","postId","id","postType","type","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,OAAT,QAAwB,2BAAxB;;AAEA,SAASC,wBAAT,OAAoD;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACnD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBF,UAAxB;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAaN,WAAW,EAA9B;AACA,QAAMO,YAAY,GAAGd,SAAS,CAC3Be,MAAF,IAAc;AACb,WAAOA,MAAM,CAAEZ,SAAF,CAAN,CAAoBa,eAApB,CACN,UADM,EAEN,kBAFM,EAGN;AACC,OAAGL,KAAO,KAAKC,IAAM,EAJhB,CAAP;AAMA,GAR4B,EAS7B,CAAED,KAAF,EAASC,IAAT,CAT6B,CAA9B;AAYA,QAAMK,SAAS,GAAGT,OAAO,CACxB;AACCU,IAAAA,MAAM,EAAEJ,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEK,EADvB;AAECC,IAAAA,QAAQ,EAAEN,YAAF,aAAEA,YAAF,uBAAEA,YAAY,CAAEO;AAFzB,GADwB,EAKxB;AACCC,IAAAA,cAAc,EAAET,MAAM,CAACK;AADxB,GALwB,CAAzB;;AAUA,MAAK,CAAEJ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,cAAC,aAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,cAAC,aAAD,eACMG,SADN;AAEC,IAAA,OAAO,EAAKM,KAAF,IAAa;AACtBN,MAAAA,SAAS,CAACO,OAAV,CAAmBD,KAAnB;AACA;AAJF,MAMGxB,EAAE,CAAE,MAAF,CANL,CADD,CADD;AAYA;;AAED,OAAO,MAAM0B,qBAAqB,GAAGnB,0BAA0B,CAC5DoB,SAAF,IAAmBC,KAAF,IAAa;AAC7B,QAAM;AAAEjB,IAAAA,UAAF;AAAckB,IAAAA;AAAd,MAAuBD,KAA7B;AACA,QAAME,WAAW,GAAGD,IAAI,KAAK,oBAAT,IAAiClB,UAAU,CAACE,IAAhE;AAEA,SACC,8BACC,cAAC,SAAD,EAAgBe,KAAhB,CADD,EAEGE,WAAW,IACZ,cAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGnB;AAAvC,IAHF,CADD;AAQA,CAb6D,EAc9D,uBAd8D,CAAxD;AAiBPL,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRoB,qBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../components/routes';\nimport { useLink } from '../components/routes/link';\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/hooks/template-part-edit.js"],"names":["__","useSelect","BlockControls","store","coreStore","ToolbarButton","addFilter","createHigherOrderComponent","useLocation","useLink","EditTemplatePartMenuItem","attributes","theme","slug","params","templatePart","select","getEntityRecord","linkProps","postId","id","postType","type","canvas","fromTemplateId","event","onClick","withEditBlockControls","BlockEdit","props","name","isDisplayed"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,aAAT,QAA8B,uBAA9B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,SAASC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IAAI,KAAK,oBAAT,IAAiCnB,UAAU,CAACE,IAAhE;AAEA,SACC,8BACC,cAAC,SAAD,EAAgBgB,KAAhB,CADD,EAEGE,WAAW,IACZ,cAAC,wBAAD;AAA0B,IAAA,UAAU,EAAGpB;AAAvC,IAHF,CADD;AAQA,CAb6D,EAc9D,uBAd8D,CAAxD;AAiBPL,SAAS,CACR,kBADQ,EAER,0CAFQ,EAGRqB,qBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { BlockControls } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ToolbarButton } from '@wordpress/components';\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../components/routes';\nimport { useLink } from '../components/routes/link';\n\nfunction EditTemplatePartMenuItem( { attributes } ) {\n\tconst { theme, slug } = attributes;\n\tconst { params } = useLocation();\n\tconst templatePart = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t// Ideally this should be an official public API.\n\t\t\t\t`${ theme }//${ slug }`\n\t\t\t);\n\t\t},\n\t\t[ theme, slug ]\n\t);\n\n\tconst linkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart?.id,\n\t\t\tpostType: templatePart?.type,\n\t\t\tcanvas: 'edit',\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tif ( ! templatePart ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockControls group=\"other\">\n\t\t\t<ToolbarButton\n\t\t\t\t{ ...linkProps }\n\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\tlinkProps.onClick( event );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Edit' ) }\n\t\t\t</ToolbarButton>\n\t\t</BlockControls>\n\t);\n}\n\nexport const withEditBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { attributes, name } = props;\n\t\tconst isDisplayed = name === 'core/template-part' && attributes.slug;\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ isDisplayed && (\n\t\t\t\t\t<EditTemplatePartMenuItem attributes={ attributes } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withEditBlockControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/template-part-edit-button',\n\twithEditBlockControls\n);\n"]}