@wordpress/edit-site 6.0.1 → 6.1.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 (133) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-page/index.js +2 -1
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/app/index.js +17 -1
  5. package/build/components/app/index.js.map +1 -1
  6. package/build/components/editor/index.js +3 -10
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  9. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  10. package/build/components/global-styles/screen-revisions/index.js +4 -23
  11. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  12. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  13. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  14. package/build/components/global-styles/variations/variation.js +11 -16
  15. package/build/components/global-styles/variations/variation.js.map +1 -1
  16. package/build/components/global-styles/variations/variations-color.js +1 -0
  17. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  18. package/build/components/global-styles/variations/variations-typography.js +1 -0
  19. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  20. package/build/components/layout/index.js +8 -37
  21. package/build/components/layout/index.js.map +1 -1
  22. package/build/components/page/header.js +1 -0
  23. package/build/components/page/header.js.map +1 -1
  24. package/build/components/page-patterns/header.js +2 -1
  25. package/build/components/page-patterns/header.js.map +1 -1
  26. package/build/components/posts-app/index.js +50 -0
  27. package/build/components/posts-app/index.js.map +1 -0
  28. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  29. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  30. package/build/hooks/commands/use-set-command-context.js +53 -0
  31. package/build/hooks/commands/use-set-command-context.js.map +1 -0
  32. package/build/hooks/push-changes-to-global-styles/index.js +2 -2
  33. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  34. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
  35. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  36. package/build/index.js +15 -2
  37. package/build/index.js.map +1 -1
  38. package/build/posts.js +34 -0
  39. package/build/posts.js.map +1 -0
  40. package/build-module/components/add-new-page/index.js +2 -1
  41. package/build-module/components/add-new-page/index.js.map +1 -1
  42. package/build-module/components/app/index.js +17 -1
  43. package/build-module/components/app/index.js.map +1 -1
  44. package/build-module/components/editor/index.js +3 -10
  45. package/build-module/components/editor/index.js.map +1 -1
  46. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  47. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  48. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  49. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  50. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  51. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  52. package/build-module/components/global-styles/variations/variation.js +11 -16
  53. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  54. package/build-module/components/global-styles/variations/variations-color.js +1 -0
  55. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  56. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  57. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  58. package/build-module/components/layout/index.js +10 -39
  59. package/build-module/components/layout/index.js.map +1 -1
  60. package/build-module/components/page/header.js +1 -0
  61. package/build-module/components/page/header.js.map +1 -1
  62. package/build-module/components/page-patterns/header.js +2 -1
  63. package/build-module/components/page-patterns/header.js.map +1 -1
  64. package/build-module/components/posts-app/index.js +43 -0
  65. package/build-module/components/posts-app/index.js.map +1 -0
  66. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  67. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  68. package/build-module/hooks/commands/use-set-command-context.js +46 -0
  69. package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
  70. package/build-module/hooks/push-changes-to-global-styles/index.js +2 -2
  71. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  72. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
  73. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  74. package/build-module/index.js +8 -2
  75. package/build-module/index.js.map +1 -1
  76. package/build-module/posts.js +27 -0
  77. package/build-module/posts.js.map +1 -0
  78. package/build-style/posts-rtl.css +1707 -0
  79. package/build-style/posts.css +1707 -0
  80. package/build-style/style-rtl.css +16 -19
  81. package/build-style/style.css +16 -19
  82. package/package.json +41 -41
  83. package/src/components/add-new-page/index.js +2 -1
  84. package/src/components/app/index.js +17 -1
  85. package/src/components/editor/index.js +2 -8
  86. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  87. package/src/components/global-styles/screen-revisions/index.js +4 -24
  88. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  89. package/src/components/global-styles/style.scss +1 -7
  90. package/src/components/global-styles/variations/variation.js +14 -19
  91. package/src/components/global-styles/variations/variations-color.js +6 -1
  92. package/src/components/global-styles/variations/variations-typography.js +5 -1
  93. package/src/components/global-styles-sidebar/style.scss +0 -1
  94. package/src/components/layout/index.js +24 -70
  95. package/src/components/page/header.js +1 -0
  96. package/src/components/page/style.scss +6 -0
  97. package/src/components/page-patterns/header.js +8 -2
  98. package/src/components/page-patterns/style.scss +6 -0
  99. package/src/components/posts-app/index.js +39 -0
  100. package/src/components/sidebar/style.scss +4 -4
  101. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  102. package/src/hooks/commands/use-set-command-context.js +37 -0
  103. package/src/hooks/push-changes-to-global-styles/index.js +2 -2
  104. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
  105. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
  106. package/src/index.js +10 -2
  107. package/src/posts.js +29 -0
  108. package/src/posts.scss +46 -0
  109. package/build/components/block-editor/block-inspector-button.js +0 -57
  110. package/build/components/block-editor/block-inspector-button.js.map +0 -1
  111. package/build/components/block-editor/inserter-media-categories.js +0 -183
  112. package/build/components/block-editor/inserter-media-categories.js.map +0 -1
  113. package/build/components/template-part-converter/convert-to-regular.js +0 -38
  114. package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
  115. package/build/components/template-part-converter/convert-to-template-part.js +0 -84
  116. package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
  117. package/build/components/template-part-converter/index.js +0 -67
  118. package/build/components/template-part-converter/index.js.map +0 -1
  119. package/build-module/components/block-editor/block-inspector-button.js +0 -50
  120. package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
  121. package/build-module/components/block-editor/inserter-media-categories.js +0 -177
  122. package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
  123. package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
  124. package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
  125. package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
  126. package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
  127. package/build-module/components/template-part-converter/index.js +0 -59
  128. package/build-module/components/template-part-converter/index.js.map +0 -1
  129. package/src/components/block-editor/block-inspector-button.js +0 -60
  130. package/src/components/block-editor/inserter-media-categories.js +0 -225
  131. package/src/components/template-part-converter/convert-to-regular.js +0 -32
  132. package/src/components/template-part-converter/convert-to-template-part.js +0 -78
  133. package/src/components/template-part-converter/index.js +0 -59
@@ -21,91 +21,60 @@ import {
21
21
  import { __ } from '@wordpress/i18n';
22
22
  import { useState, useRef, useEffect } from '@wordpress/element';
23
23
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
24
- import {
25
- CommandMenu,
26
- privateApis as commandsPrivateApis,
27
- } from '@wordpress/commands';
28
- import { store as preferencesStore } from '@wordpress/preferences';
29
- import {
30
- privateApis as blockEditorPrivateApis,
31
- store as blockEditorStore,
32
- } from '@wordpress/block-editor';
33
- import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
24
+ import { CommandMenu } from '@wordpress/commands';
25
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
34
26
  import {
35
27
  EditorSnackbars,
36
28
  privateApis as editorPrivateApis,
37
29
  } from '@wordpress/editor';
30
+ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
38
31
 
39
32
  /**
40
33
  * Internal dependencies
41
34
  */
42
35
  import ErrorBoundary from '../error-boundary';
43
36
  import { store as editSiteStore } from '../../store';
44
- import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
45
37
  import SiteHub from '../site-hub';
46
38
  import ResizableFrame from '../resizable-frame';
47
- import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
48
39
  import { unlock } from '../../lock-unlock';
49
40
  import SavePanel from '../save-panel';
50
41
  import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
51
42
  import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
52
- import { useCommonCommands } from '../../hooks/commands/use-common-commands';
53
- import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
54
43
  import { useIsSiteEditorLoading } from './hooks';
55
- import useLayoutAreas from './router';
56
44
  import useMovingAnimation from './animation';
57
45
  import SidebarContent from '../sidebar';
58
46
  import SaveHub from '../save-hub';
47
+ import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
59
48
 
60
49
  const { useCommands } = unlock( coreCommandsPrivateApis );
61
- const { useCommandContext } = unlock( commandsPrivateApis );
62
50
  const { useGlobalStyle } = unlock( blockEditorPrivateApis );
63
51
  const { NavigableRegion } = unlock( editorPrivateApis );
64
52
 
65
53
  const ANIMATION_DURATION = 0.3;
66
54
 
67
- export default function Layout() {
68
- // This ensures the edited entity id and type are initialized properly.
69
- useInitEditedEntityFromURL();
55
+ export default function Layout( { route } ) {
70
56
  useSyncCanvasModeWithURL();
71
57
  useCommands();
72
- useEditModeCommands();
73
- useCommonCommands();
74
-
75
58
  const isMobileViewport = useViewportMatch( 'medium', '<' );
76
59
  const toggleRef = useRef();
77
- const {
78
- isDistractionFree,
79
- hasFixedToolbar,
80
- hasBlockSelected,
81
- canvasMode,
82
- previousShortcut,
83
- nextShortcut,
84
- } = useSelect( ( select ) => {
85
- const { getAllShortcutKeyCombinations } = select(
86
- keyboardShortcutsStore
87
- );
88
- const { getCanvasMode } = unlock( select( editSiteStore ) );
89
- return {
90
- canvasMode: getCanvasMode(),
91
- previousShortcut: getAllShortcutKeyCombinations(
92
- 'core/editor/previous-region'
93
- ),
94
- nextShortcut: getAllShortcutKeyCombinations(
95
- 'core/editor/next-region'
96
- ),
97
- hasFixedToolbar: select( preferencesStore ).get(
98
- 'core',
99
- 'fixedToolbar'
100
- ),
101
- isDistractionFree: select( preferencesStore ).get(
102
- 'core',
103
- 'distractionFree'
104
- ),
105
- hasBlockSelected:
106
- select( blockEditorStore ).getBlockSelectionStart(),
107
- };
108
- }, [] );
60
+ const { canvasMode, previousShortcut, nextShortcut } = useSelect(
61
+ ( select ) => {
62
+ const { getAllShortcutKeyCombinations } = select(
63
+ keyboardShortcutsStore
64
+ );
65
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
66
+ return {
67
+ canvasMode: getCanvasMode(),
68
+ previousShortcut: getAllShortcutKeyCombinations(
69
+ 'core/editor/previous-region'
70
+ ),
71
+ nextShortcut: getAllShortcutKeyCombinations(
72
+ 'core/editor/next-region'
73
+ ),
74
+ };
75
+ },
76
+ []
77
+ );
109
78
  const navigateRegionsProps = useNavigateRegions( {
110
79
  previous: previousShortcut,
111
80
  next: nextShortcut,
@@ -116,22 +85,11 @@ export default function Layout() {
116
85
  const isEditorLoading = useIsSiteEditorLoading();
117
86
  const [ isResizableFrameOversized, setIsResizableFrameOversized ] =
118
87
  useState( false );
119
- const { key: routeKey, areas, widths } = useLayoutAreas();
88
+ const { key: routeKey, areas, widths } = route;
120
89
  const animationRef = useMovingAnimation( {
121
90
  triggerAnimationOnChange: canvasMode + '__' + routeKey,
122
91
  } );
123
92
 
124
- // Sets the right context for the command palette
125
- let commandContext = 'site-editor';
126
-
127
- if ( canvasMode === 'edit' ) {
128
- commandContext = 'entity-edit';
129
- }
130
- if ( hasBlockSelected ) {
131
- commandContext = 'block-selection-edit';
132
- }
133
- useCommandContext( commandContext );
134
-
135
93
  const [ backgroundColor ] = useGlobalStyle( 'color.background' );
136
94
  const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
137
95
  const previousCanvaMode = usePrevious( canvasMode );
@@ -163,11 +121,7 @@ export default function Layout() {
163
121
  'edit-site-layout',
164
122
  navigateRegionsProps.className,
165
123
  {
166
- 'is-distraction-free':
167
- isDistractionFree && canvasMode === 'edit',
168
124
  'is-full-canvas': canvasMode === 'edit',
169
- 'has-fixed-toolbar': hasFixedToolbar,
170
- 'is-block-toolbar-visible': hasBlockSelected,
171
125
  }
172
126
  ) }
173
127
  >
@@ -22,6 +22,7 @@ export default function Header( { title, subTitle, actions } ) {
22
22
  level={ 3 }
23
23
  weight={ 500 }
24
24
  className="edit-site-page-header__title"
25
+ truncate
25
26
  >
26
27
  { title }
27
28
  </Heading>
@@ -24,6 +24,12 @@
24
24
 
25
25
  .edit-site-page-header__page-title {
26
26
  min-height: $grid-unit-50;
27
+
28
+ .components-heading {
29
+ flex-grow: 1;
30
+ flex-basis: 0;
31
+ white-space: nowrap;
32
+ }
27
33
  }
28
34
 
29
35
  .edit-site-page-header__sub-title {
@@ -58,12 +58,18 @@ export default function PatternsHeader( {
58
58
  }
59
59
 
60
60
  return (
61
- <VStack className="edit-site-patterns__section-header" spacing={ 0 }>
61
+ <VStack className="edit-site-patterns__section-header" spacing={ 1 }>
62
62
  <HStack
63
63
  justify="space-between"
64
64
  className="edit-site-patterns__title"
65
65
  >
66
- <Heading as="h2" level={ 3 } id={ titleId } weight={ 500 }>
66
+ <Heading
67
+ as="h2"
68
+ level={ 3 }
69
+ id={ titleId }
70
+ weight={ 500 }
71
+ truncate
72
+ >
67
73
  { title }
68
74
  </Heading>
69
75
  <HStack expanded={ false }>
@@ -98,6 +98,12 @@
98
98
 
99
99
  .edit-site-patterns__title {
100
100
  min-height: $grid-unit-50;
101
+
102
+ .components-heading {
103
+ flex-grow: 1;
104
+ flex-basis: 0;
105
+ white-space: nowrap;
106
+ }
101
107
  }
102
108
 
103
109
  .edit-site-patterns__sub-title {
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ UnsavedChangesWarning,
6
+ privateApis as editorPrivateApis,
7
+ } from '@wordpress/editor';
8
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import Layout from '../layout';
14
+ import Page from '../page';
15
+ import { unlock } from '../../lock-unlock';
16
+
17
+ const { RouterProvider } = unlock( routerPrivateApis );
18
+ const { GlobalStylesProvider } = unlock( editorPrivateApis );
19
+
20
+ const defaultRoute = {
21
+ key: 'index',
22
+ areas: {
23
+ sidebar: 'Empty Sidebar',
24
+ content: <Page>Welcome to Posts</Page>,
25
+ preview: undefined,
26
+ mobile: <Page>Welcome to Posts</Page>,
27
+ },
28
+ };
29
+
30
+ export default function PostsApp() {
31
+ return (
32
+ <GlobalStylesProvider>
33
+ <UnsavedChangesWarning />
34
+ <RouterProvider>
35
+ <Layout route={ defaultRoute } />
36
+ </RouterProvider>
37
+ </GlobalStylesProvider>
38
+ );
39
+ }
@@ -3,7 +3,7 @@
3
3
  overflow-y: auto;
4
4
  }
5
5
 
6
- @keyframes slide-from-right {
6
+ @keyframes local--slide-from-right {
7
7
  from {
8
8
  transform: translateX(50px);
9
9
  opacity: 0;
@@ -14,7 +14,7 @@
14
14
  }
15
15
  }
16
16
 
17
- @keyframes slide-from-left {
17
+ @keyframes local--slide-from-left {
18
18
  from {
19
19
  transform: translateX(-50px);
20
20
  opacity: 0;
@@ -47,11 +47,11 @@
47
47
  }
48
48
 
49
49
  &.slide-from-left {
50
- animation-name: slide-from-left;
50
+ animation-name: local--slide-from-left;
51
51
  }
52
52
 
53
53
  &.slide-from-right {
54
- animation-name: slide-from-right;
54
+ animation-name: local--slide-from-right;
55
55
  }
56
56
 
57
57
  }
@@ -16,6 +16,7 @@ export default function DeleteConfirmDialog( { onClose, onConfirm } ) {
16
16
  } }
17
17
  onCancel={ onClose }
18
18
  confirmButtonText={ __( 'Delete' ) }
19
+ size="medium"
19
20
  >
20
21
  { __( 'Are you sure you want to delete this Navigation Menu?' ) }
21
22
  </ConfirmDialog>
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { privateApis as commandsPrivateApis } from '@wordpress/commands';
6
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editSiteStore } from '../../store';
12
+ import { unlock } from '../../lock-unlock';
13
+
14
+ const { useCommandContext } = unlock( commandsPrivateApis );
15
+
16
+ /**
17
+ * React hook used to set the correct command context based on the current state.
18
+ */
19
+ export default function useSetCommandContext() {
20
+ const { hasBlockSelected, canvasMode } = useSelect( ( select ) => {
21
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
22
+ const { getBlockSelectionStart } = select( blockEditorStore );
23
+ return {
24
+ canvasMode: getCanvasMode(),
25
+ hasBlockSelected: getBlockSelectionStart(),
26
+ };
27
+ }, [] );
28
+ // Sets the right context for the command palette
29
+ let commandContext = 'site-editor';
30
+ if ( canvasMode === 'edit' ) {
31
+ commandContext = 'entity-edit';
32
+ }
33
+ if ( hasBlockSelected ) {
34
+ commandContext = 'block-selection-edit';
35
+ }
36
+ useCommandContext( commandContext );
37
+ }
@@ -287,7 +287,7 @@ function PushChangesToGlobalStylesControl( {
287
287
  // notification.
288
288
  __unstableMarkNextChangeAsNotPersistent();
289
289
  setAttributes( newBlockAttributes );
290
- setUserConfig( () => newUserConfig, { undoIgnore: true } );
290
+ setUserConfig( newUserConfig, { undoIgnore: true } );
291
291
  createSuccessNotice(
292
292
  sprintf(
293
293
  // translators: %s: Title of the block e.g. 'Heading'.
@@ -302,7 +302,7 @@ function PushChangesToGlobalStylesControl( {
302
302
  onClick() {
303
303
  __unstableMarkNextChangeAsNotPersistent();
304
304
  setAttributes( attributes );
305
- setUserConfig( () => userConfig, {
305
+ setUserConfig( userConfig, {
306
306
  undoIgnore: true,
307
307
  } );
308
308
  },