@wordpress/edit-site 4.15.1-next.4d3b314fd5.0 → 4.16.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 (46) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-editor/resizable-editor.js +11 -35
  3. package/build/components/block-editor/resizable-editor.js.map +1 -1
  4. package/build/components/global-styles/preview.js +2 -2
  5. package/build/components/global-styles/preview.js.map +1 -1
  6. package/build/components/global-styles/screen-typography-element.js +49 -2
  7. package/build/components/global-styles/screen-typography-element.js.map +1 -1
  8. package/build/components/global-styles/typography-panel.js +128 -81
  9. package/build/components/global-styles/typography-panel.js.map +1 -1
  10. package/build/components/global-styles/typography-preview.js +54 -0
  11. package/build/components/global-styles/typography-preview.js.map +1 -0
  12. package/build/components/global-styles/use-global-styles-output.js +7 -7
  13. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  14. package/build/components/main-dashboard-button/index.js +2 -2
  15. package/build/components/main-dashboard-button/index.js.map +1 -1
  16. package/build/index.js +20 -1
  17. package/build/index.js.map +1 -1
  18. package/build-module/components/block-editor/resizable-editor.js +10 -34
  19. package/build-module/components/block-editor/resizable-editor.js.map +1 -1
  20. package/build-module/components/global-styles/preview.js +2 -2
  21. package/build-module/components/global-styles/preview.js.map +1 -1
  22. package/build-module/components/global-styles/screen-typography-element.js +48 -2
  23. package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
  24. package/build-module/components/global-styles/typography-panel.js +129 -83
  25. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  26. package/build-module/components/global-styles/typography-preview.js +46 -0
  27. package/build-module/components/global-styles/typography-preview.js.map +1 -0
  28. package/build-module/components/global-styles/use-global-styles-output.js +7 -7
  29. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  30. package/build-module/components/main-dashboard-button/index.js +3 -3
  31. package/build-module/components/main-dashboard-button/index.js.map +1 -1
  32. package/build-module/index.js +19 -1
  33. package/build-module/index.js.map +1 -1
  34. package/build-style/style-rtl.css +3 -3
  35. package/build-style/style.css +3 -3
  36. package/package.json +29 -29
  37. package/src/components/block-editor/resizable-editor.js +8 -37
  38. package/src/components/global-styles/preview.js +2 -2
  39. package/src/components/global-styles/screen-typography-element.js +65 -1
  40. package/src/components/global-styles/style.scss +2 -2
  41. package/src/components/global-styles/typography-panel.js +192 -150
  42. package/src/components/global-styles/typography-preview.js +49 -0
  43. package/src/components/global-styles/use-global-styles-output.js +15 -9
  44. package/src/components/main-dashboard-button/index.js +3 -3
  45. package/src/components/sidebar/style.scss +1 -1
  46. package/src/index.js +21 -0
@@ -707,7 +707,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
707
707
  display: block;
708
708
  }
709
709
 
710
- .edit-site-typography-panel__preview {
710
+ .edit-site-typography-preview {
711
711
  display: flex;
712
712
  align-items: center;
713
713
  justify-content: center;
@@ -787,7 +787,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
787
787
  border: var(--wp-admin-theme-color) 1px solid;
788
788
  }
789
789
  .edit-site-global-styles-variations_item:focus .edit-site-global-styles-variations_item-preview {
790
- border: var(--wp-admin-theme-color) 1px solid;
790
+ border: var(--wp-admin-theme-color) var(--wp-admin-border-width-focus) solid;
791
791
  }
792
792
 
793
793
  .edit-site-global-styles-icon-with-current-color {
@@ -1690,7 +1690,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1690
1690
  border: 0;
1691
1691
  }
1692
1692
 
1693
- .edit-site-global-styles-sidebar .components-tools-panel-item.single-column {
1693
+ .edit-site-global-styles-sidebar .single-column {
1694
1694
  grid-column: span 1;
1695
1695
  }
1696
1696
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "4.15.1-next.4d3b314fd5.0",
3
+ "version": "4.16.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,33 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.18.1-next.4d3b314fd5.0",
31
- "@wordpress/api-fetch": "^6.15.1-next.4d3b314fd5.0",
32
- "@wordpress/block-editor": "^10.1.1-next.4d3b314fd5.0",
33
- "@wordpress/block-library": "^7.15.1-next.4d3b314fd5.0",
34
- "@wordpress/blocks": "^11.18.1-next.4d3b314fd5.0",
35
- "@wordpress/components": "^21.1.2-next.4d3b314fd5.0",
36
- "@wordpress/compose": "^5.16.1-next.4d3b314fd5.0",
37
- "@wordpress/core-data": "^5.1.1-next.4d3b314fd5.0",
38
- "@wordpress/data": "^7.2.1-next.4d3b314fd5.0",
39
- "@wordpress/deprecated": "^3.18.1-next.4d3b314fd5.0",
40
- "@wordpress/editor": "^12.17.1-next.4d3b314fd5.0",
41
- "@wordpress/element": "^4.16.1-next.4d3b314fd5.0",
42
- "@wordpress/hooks": "^3.18.1-next.4d3b314fd5.0",
43
- "@wordpress/html-entities": "^3.18.1-next.4d3b314fd5.0",
44
- "@wordpress/i18n": "^4.18.1-next.4d3b314fd5.0",
45
- "@wordpress/icons": "^9.9.1-next.4d3b314fd5.0",
46
- "@wordpress/interface": "^4.17.1-next.4d3b314fd5.0",
47
- "@wordpress/keyboard-shortcuts": "^3.16.1-next.4d3b314fd5.0",
48
- "@wordpress/keycodes": "^3.18.1-next.4d3b314fd5.0",
49
- "@wordpress/media-utils": "^4.9.1-next.4d3b314fd5.0",
50
- "@wordpress/notices": "^3.18.1-next.4d3b314fd5.0",
51
- "@wordpress/plugins": "^4.16.1-next.4d3b314fd5.0",
52
- "@wordpress/preferences": "^2.10.1-next.4d3b314fd5.0",
53
- "@wordpress/reusable-blocks": "^3.16.1-next.4d3b314fd5.0",
54
- "@wordpress/style-engine": "^1.1.1-next.4d3b314fd5.0",
55
- "@wordpress/url": "^3.19.1-next.4d3b314fd5.0",
56
- "@wordpress/viewport": "^4.16.1-next.4d3b314fd5.0",
30
+ "@wordpress/a11y": "^3.19.0",
31
+ "@wordpress/api-fetch": "^6.16.0",
32
+ "@wordpress/block-editor": "^10.2.0",
33
+ "@wordpress/block-library": "^7.16.0",
34
+ "@wordpress/blocks": "^11.18.0",
35
+ "@wordpress/components": "^21.2.0",
36
+ "@wordpress/compose": "^5.17.0",
37
+ "@wordpress/core-data": "^5.2.0",
38
+ "@wordpress/data": "^7.3.0",
39
+ "@wordpress/deprecated": "^3.19.0",
40
+ "@wordpress/editor": "^12.18.0",
41
+ "@wordpress/element": "^4.17.0",
42
+ "@wordpress/hooks": "^3.19.0",
43
+ "@wordpress/html-entities": "^3.19.0",
44
+ "@wordpress/i18n": "^4.19.0",
45
+ "@wordpress/icons": "^9.10.0",
46
+ "@wordpress/interface": "^4.18.0",
47
+ "@wordpress/keyboard-shortcuts": "^3.17.0",
48
+ "@wordpress/keycodes": "^3.19.0",
49
+ "@wordpress/media-utils": "^4.10.0",
50
+ "@wordpress/notices": "^3.19.0",
51
+ "@wordpress/plugins": "^4.17.0",
52
+ "@wordpress/preferences": "^2.11.0",
53
+ "@wordpress/reusable-blocks": "^3.17.0",
54
+ "@wordpress/style-engine": "^1.2.0",
55
+ "@wordpress/url": "^3.20.0",
56
+ "@wordpress/viewport": "^4.17.0",
57
57
  "classnames": "^2.3.1",
58
58
  "downloadjs": "^1.4.7",
59
59
  "history": "^5.1.0",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "25054766423cb49d959eb656c2533530073ff5c2"
71
+ "gitHead": "8d42d2febb7d0ba8372a33e560a62f5a5f6a9112"
72
72
  }
@@ -57,38 +57,14 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
57
57
 
58
58
  useEffect(
59
59
  function autoResizeIframeHeight() {
60
- const iframe = iframeRef.current;
61
-
62
- if ( ! iframe || ! enableResizing ) {
60
+ if ( ! iframeRef.current || ! enableResizing ) {
63
61
  return;
64
62
  }
65
63
 
66
- let timeoutId = null;
67
-
68
- function resizeHeight() {
69
- if ( ! timeoutId ) {
70
- // Throttle the updates on timeout. This code previously
71
- // used `requestAnimationFrame`, but that seems to not
72
- // always work before an iframe is ready.
73
- timeoutId = iframe.contentWindow.setTimeout( () => {
74
- const { readyState } = iframe.contentDocument;
75
-
76
- // Continue deferring the timeout until the document is ready.
77
- // Only then will it have a height.
78
- if (
79
- readyState !== 'interactive' &&
80
- readyState !== 'complete'
81
- ) {
82
- resizeHeight();
83
- return;
84
- }
85
-
86
- setHeight( iframe.contentDocument.body.scrollHeight );
87
- timeoutId = null;
88
-
89
- // 30 frames per second.
90
- }, 1000 / 30 );
91
- }
64
+ const iframe = iframeRef.current;
65
+
66
+ function setFrameHeight() {
67
+ setHeight( iframe.contentDocument.body.scrollHeight );
92
68
  }
93
69
 
94
70
  let resizeObserver;
@@ -97,28 +73,23 @@ function ResizableEditor( { enableResizing, settings, children, ...props } ) {
97
73
  resizeObserver?.disconnect();
98
74
 
99
75
  resizeObserver = new iframe.contentWindow.ResizeObserver(
100
- resizeHeight
76
+ setFrameHeight
101
77
  );
102
78
 
103
79
  // Observe the body, since the `html` element seems to always
104
80
  // have a height of `100%`.
105
81
  resizeObserver.observe( iframe.contentDocument.body );
106
-
107
- resizeHeight();
82
+ setFrameHeight();
108
83
  }
109
84
 
110
- // This is only required in Firefox for some unknown reasons.
111
85
  iframe.addEventListener( 'load', registerObserver );
112
- // This is required in Chrome and Safari.
113
- registerObserver();
114
86
 
115
87
  return () => {
116
- iframe.contentWindow?.clearTimeout( timeoutId );
117
88
  resizeObserver?.disconnect();
118
89
  iframe.removeEventListener( 'load', registerObserver );
119
90
  };
120
91
  },
121
- [ enableResizing ]
92
+ [ enableResizing, iframeRef.current ]
122
93
  );
123
94
 
124
95
  const resizeWidthBy = useCallback( ( deltaPixels ) => {
@@ -79,13 +79,13 @@ const StylesPreview = ( { label, isFocused } ) => {
79
79
  )
80
80
  .slice( 0, 2 );
81
81
 
82
- // Reset leaked styles from WP common.css and remove main content layout padding.
82
+ // Reset leaked styles from WP common.css and remove main content layout padding and border.
83
83
  const editorStyles = useMemo( () => {
84
84
  if ( styles ) {
85
85
  return [
86
86
  ...styles,
87
87
  {
88
- css: 'body{min-width: 0;padding: 0;}',
88
+ css: 'body{min-width: 0;padding: 0;border: none;}',
89
89
  isGlobalStyles: true,
90
90
  },
91
91
  ];
@@ -2,12 +2,19 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
+ import {
6
+ __experimentalToggleGroupControl as ToggleGroupControl,
7
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
8
+ __experimentalSpacer as Spacer,
9
+ } from '@wordpress/components';
10
+ import { useState } from '@wordpress/element';
5
11
 
6
12
  /**
7
13
  * Internal dependencies
8
14
  */
9
15
  import TypographyPanel from './typography-panel';
10
16
  import ScreenHeader from './header';
17
+ import TypographyPreview from './typography-preview';
11
18
 
12
19
  const elements = {
13
20
  text: {
@@ -29,13 +36,70 @@ const elements = {
29
36
  };
30
37
 
31
38
  function ScreenTypographyElement( { name, element } ) {
39
+ const [ headingLevel, setHeadingLevel ] = useState( 'heading' );
40
+
32
41
  return (
33
42
  <>
34
43
  <ScreenHeader
35
44
  title={ elements[ element ].title }
36
45
  description={ elements[ element ].description }
37
46
  />
38
- <TypographyPanel name={ name } element={ element } />
47
+ <Spacer marginX={ 4 }>
48
+ <TypographyPreview
49
+ name={ name }
50
+ element={ element }
51
+ headingLevel={ headingLevel }
52
+ />
53
+ </Spacer>
54
+ { element === 'heading' && (
55
+ <Spacer marginX={ 4 } marginBottom="1em">
56
+ <ToggleGroupControl
57
+ label={ __( 'Select heading level' ) }
58
+ hideLabelFromVision
59
+ value={ headingLevel }
60
+ onChange={ setHeadingLevel }
61
+ isBlock
62
+ size="__unstable-large"
63
+ __nextHasNoMarginBottom
64
+ >
65
+ <ToggleGroupControlOption
66
+ value="heading"
67
+ /* translators: 'All' refers to selecting all heading levels
68
+ and applying the same style to h1-h6. */
69
+ label={ __( 'All' ) }
70
+ />
71
+ <ToggleGroupControlOption
72
+ value="h1"
73
+ label={ __( 'H1' ) }
74
+ />
75
+ <ToggleGroupControlOption
76
+ value="h2"
77
+ label={ __( 'H2' ) }
78
+ />
79
+ <ToggleGroupControlOption
80
+ value="h3"
81
+ label={ __( 'H3' ) }
82
+ />
83
+ <ToggleGroupControlOption
84
+ value="h4"
85
+ label={ __( 'H4' ) }
86
+ />
87
+ <ToggleGroupControlOption
88
+ value="h5"
89
+ label={ __( 'H5' ) }
90
+ />
91
+ <ToggleGroupControlOption
92
+ value="h6"
93
+ label={ __( 'H6' ) }
94
+ />
95
+ </ToggleGroupControl>
96
+ </Spacer>
97
+ ) }
98
+ <TypographyPanel
99
+ name={ name }
100
+ element={ element }
101
+ headingLevel={ headingLevel }
102
+ />
39
103
  </>
40
104
  );
41
105
  }
@@ -11,7 +11,7 @@
11
11
  display: block;
12
12
  }
13
13
 
14
- .edit-site-typography-panel__preview {
14
+ .edit-site-typography-preview {
15
15
  display: flex;
16
16
  align-items: center;
17
17
  justify-content: center;
@@ -97,7 +97,7 @@
97
97
  }
98
98
 
99
99
  &:focus .edit-site-global-styles-variations_item-preview {
100
- border: var(--wp-admin-theme-color) $border-width solid;
100
+ border: var(--wp-admin-theme-color) var(--wp-admin-border-width-focus) solid;
101
101
  }
102
102
  }
103
103