@wordpress/edit-site 5.0.0 → 5.2.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.
- package/CHANGELOG.md +14 -1
- package/LICENSE.md +1 -1
- package/build/components/add-new-template/new-template-part.js +21 -1
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/utils.js +9 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +0 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +17 -52
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +2 -1
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/editor/index.js +5 -17
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +27 -6
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -5
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -1
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -0
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +16 -11
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +3 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +6 -6
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +4 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -6
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +12 -2
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +3 -4
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +53 -25
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +9 -10
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +12 -2
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +8 -8
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +4 -4
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +71 -0
- package/build/components/global-styles/screen-variations.js.map +1 -0
- package/build/components/global-styles/typography-panel.js +9 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/ui.js +85 -18
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +119 -33
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +60 -3
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +85 -0
- package/build/components/global-styles/variations-panel.js.map +1 -0
- package/build/components/header-edit-mode/document-actions/index.js +10 -41
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/layout/index.js +129 -87
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/index.js +5 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -31
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +54 -0
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build/components/template-details/edit-template-title.js +1 -0
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +1 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +20 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +5 -0
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +0 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +19 -50
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +2 -1
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/editor/index.js +2 -13
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +26 -6
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -5
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +7 -1
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +16 -11
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +6 -6
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +3 -1
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +10 -2
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -4
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +51 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +9 -10
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +10 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +8 -8
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +4 -4
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +9 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +54 -0
- package/build-module/components/global-styles/screen-variations.js.map +1 -0
- package/build-module/components/global-styles/typography-panel.js +9 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/ui.js +84 -19
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +121 -35
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +56 -3
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +68 -0
- package/build-module/components/global-styles/variations-panel.js.map +1 -0
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/layout/index.js +129 -88
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +3 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +127 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +43 -0
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -0
- package/build-module/components/template-details/edit-template-title.js +1 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +1 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +190 -125
- package/build-style/style.css +190 -125
- package/package.json +30 -29
- package/src/components/add-new-template/new-template-part.js +23 -1
- package/src/components/add-new-template/utils.js +14 -0
- package/src/components/block-editor/editor-canvas.js +0 -1
- package/src/components/block-editor/index.js +14 -59
- package/src/components/block-editor/resize-handle.js +6 -2
- package/src/components/block-editor/style.scss +43 -7
- package/src/components/editor/index.js +2 -17
- package/src/components/global-styles/block-preview-panel.js +37 -10
- package/src/components/global-styles/border-panel.js +8 -5
- package/src/components/global-styles/context-menu.js +6 -0
- package/src/components/global-styles/custom-css.js +1 -0
- package/src/components/global-styles/dimensions-panel.js +32 -15
- package/src/components/global-styles/global-styles-provider.js +11 -5
- package/src/components/global-styles/screen-background-color.js +12 -6
- package/src/components/global-styles/screen-block-list.js +6 -1
- package/src/components/global-styles/screen-block.js +1 -4
- package/src/components/global-styles/screen-border.js +8 -3
- package/src/components/global-styles/screen-button-color.js +2 -4
- package/src/components/global-styles/screen-colors.js +84 -20
- package/src/components/global-styles/screen-heading-color.js +8 -10
- package/src/components/global-styles/screen-layout.js +11 -3
- package/src/components/global-styles/screen-link-color.js +19 -8
- package/src/components/global-styles/screen-root.js +34 -27
- package/src/components/global-styles/screen-text-color.js +7 -4
- package/src/components/global-styles/screen-typography.js +13 -3
- package/src/components/global-styles/screen-variations.js +47 -0
- package/src/components/global-styles/style.scss +9 -0
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-panel.js +31 -8
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/ui.js +101 -13
- package/src/components/global-styles/use-global-styles-output.js +137 -14
- package/src/components/global-styles/utils.js +56 -3
- package/src/components/global-styles/variations-panel.js +78 -0
- package/src/components/header-edit-mode/document-actions/index.js +18 -37
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/index.js +217 -172
- package/src/components/layout/style.scss +98 -66
- package/src/components/list/style.scss +1 -8
- package/src/components/sidebar/index.js +4 -1
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-inspector.js +2 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/style.scss +4 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-main/index.js +1 -29
- package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
- package/src/components/site-hub/index.js +161 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +40 -0
- package/src/components/template-details/edit-template-title.js +1 -0
- package/src/components/template-details/template-part-area-selector.js +1 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +2 -0
- package/src/store/reducer.js +1 -1
- package/src/style.scss +2 -0
- package/build/components/site-title/index.js +0 -55
- package/build/components/site-title/index.js.map +0 -1
- package/build-module/components/site-title/index.js +0 -43
- package/build-module/components/site-title/index.js.map +0 -1
- package/src/components/site-title/index.js +0 -39
|
@@ -7,7 +7,8 @@ describe( 'typography utils', () => {
|
|
|
7
7
|
describe( 'getTypographyFontSizeValue', () => {
|
|
8
8
|
[
|
|
9
9
|
{
|
|
10
|
-
message:
|
|
10
|
+
message:
|
|
11
|
+
'should return value when fluid typography is not active',
|
|
11
12
|
preset: {
|
|
12
13
|
size: '28px',
|
|
13
14
|
},
|
|
@@ -16,7 +17,7 @@ describe( 'typography utils', () => {
|
|
|
16
17
|
},
|
|
17
18
|
|
|
18
19
|
{
|
|
19
|
-
message: '
|
|
20
|
+
message: 'should return value where font size is 0',
|
|
20
21
|
preset: {
|
|
21
22
|
size: 0,
|
|
22
23
|
},
|
|
@@ -25,7 +26,7 @@ describe( 'typography utils', () => {
|
|
|
25
26
|
},
|
|
26
27
|
|
|
27
28
|
{
|
|
28
|
-
message: "
|
|
29
|
+
message: "should return value where font size is '0'",
|
|
29
30
|
preset: {
|
|
30
31
|
size: '0',
|
|
31
32
|
},
|
|
@@ -34,7 +35,7 @@ describe( 'typography utils', () => {
|
|
|
34
35
|
},
|
|
35
36
|
|
|
36
37
|
{
|
|
37
|
-
message: '
|
|
38
|
+
message: 'should return value where `size` is `null`.',
|
|
38
39
|
preset: {
|
|
39
40
|
size: null,
|
|
40
41
|
},
|
|
@@ -43,7 +44,7 @@ describe( 'typography utils', () => {
|
|
|
43
44
|
},
|
|
44
45
|
|
|
45
46
|
{
|
|
46
|
-
message: '
|
|
47
|
+
message: 'should return value when fluid is `false`',
|
|
47
48
|
preset: {
|
|
48
49
|
size: '28px',
|
|
49
50
|
fluid: false,
|
|
@@ -55,7 +56,7 @@ describe( 'typography utils', () => {
|
|
|
55
56
|
},
|
|
56
57
|
|
|
57
58
|
{
|
|
58
|
-
message: '
|
|
59
|
+
message: 'should return already clamped value',
|
|
59
60
|
preset: {
|
|
60
61
|
size: 'clamp(21px, 1.313rem + ((1vw - 7.68px) * 2.524), 42px)',
|
|
61
62
|
fluid: false,
|
|
@@ -68,7 +69,7 @@ describe( 'typography utils', () => {
|
|
|
68
69
|
},
|
|
69
70
|
|
|
70
71
|
{
|
|
71
|
-
message: '
|
|
72
|
+
message: 'should return value with unsupported unit',
|
|
72
73
|
preset: {
|
|
73
74
|
size: '1000%',
|
|
74
75
|
fluid: false,
|
|
@@ -80,7 +81,7 @@ describe( 'typography utils', () => {
|
|
|
80
81
|
},
|
|
81
82
|
|
|
82
83
|
{
|
|
83
|
-
message: '
|
|
84
|
+
message: 'should return clamp value with rem min and max units',
|
|
84
85
|
preset: {
|
|
85
86
|
size: '1.75rem',
|
|
86
87
|
},
|
|
@@ -92,7 +93,7 @@ describe( 'typography utils', () => {
|
|
|
92
93
|
},
|
|
93
94
|
|
|
94
95
|
{
|
|
95
|
-
message: '
|
|
96
|
+
message: 'should return clamp value with eem min and max units',
|
|
96
97
|
preset: {
|
|
97
98
|
size: '1.75em',
|
|
98
99
|
},
|
|
@@ -104,7 +105,7 @@ describe( 'typography utils', () => {
|
|
|
104
105
|
},
|
|
105
106
|
|
|
106
107
|
{
|
|
107
|
-
message: '
|
|
108
|
+
message: 'should return clamp value for floats',
|
|
108
109
|
preset: {
|
|
109
110
|
size: '100.175px',
|
|
110
111
|
},
|
|
@@ -116,7 +117,8 @@ describe( 'typography utils', () => {
|
|
|
116
117
|
},
|
|
117
118
|
|
|
118
119
|
{
|
|
119
|
-
message:
|
|
120
|
+
message:
|
|
121
|
+
'should coerce integer to `px` and returns clamp value',
|
|
120
122
|
preset: {
|
|
121
123
|
size: 33,
|
|
122
124
|
fluid: true,
|
|
@@ -129,7 +131,7 @@ describe( 'typography utils', () => {
|
|
|
129
131
|
},
|
|
130
132
|
|
|
131
133
|
{
|
|
132
|
-
message: '
|
|
134
|
+
message: 'should coerce float to `px` and returns clamp value',
|
|
133
135
|
preset: {
|
|
134
136
|
size: 100.23,
|
|
135
137
|
fluid: true,
|
|
@@ -142,7 +144,8 @@ describe( 'typography utils', () => {
|
|
|
142
144
|
},
|
|
143
145
|
|
|
144
146
|
{
|
|
145
|
-
message:
|
|
147
|
+
message:
|
|
148
|
+
'should return clamp value when `fluid` is empty array',
|
|
146
149
|
preset: {
|
|
147
150
|
size: '28px',
|
|
148
151
|
fluid: [],
|
|
@@ -155,7 +158,7 @@ describe( 'typography utils', () => {
|
|
|
155
158
|
},
|
|
156
159
|
|
|
157
160
|
{
|
|
158
|
-
message: '
|
|
161
|
+
message: 'should return clamp value when `fluid` is `null`',
|
|
159
162
|
preset: {
|
|
160
163
|
size: '28px',
|
|
161
164
|
fluid: null,
|
|
@@ -169,7 +172,7 @@ describe( 'typography utils', () => {
|
|
|
169
172
|
|
|
170
173
|
{
|
|
171
174
|
message:
|
|
172
|
-
'
|
|
175
|
+
'should return clamp value if min font size is greater than max',
|
|
173
176
|
preset: {
|
|
174
177
|
size: '3rem',
|
|
175
178
|
fluid: {
|
|
@@ -185,7 +188,7 @@ describe( 'typography utils', () => {
|
|
|
185
188
|
},
|
|
186
189
|
|
|
187
190
|
{
|
|
188
|
-
message: '
|
|
191
|
+
message: 'should return value with invalid min/max fluid units',
|
|
189
192
|
preset: {
|
|
190
193
|
size: '10em',
|
|
191
194
|
fluid: {
|
|
@@ -201,7 +204,7 @@ describe( 'typography utils', () => {
|
|
|
201
204
|
|
|
202
205
|
{
|
|
203
206
|
message:
|
|
204
|
-
'
|
|
207
|
+
'should return value when size is < lower bounds and no fluid min/max set',
|
|
205
208
|
preset: {
|
|
206
209
|
size: '3px',
|
|
207
210
|
},
|
|
@@ -213,7 +216,7 @@ describe( 'typography utils', () => {
|
|
|
213
216
|
|
|
214
217
|
{
|
|
215
218
|
message:
|
|
216
|
-
'
|
|
219
|
+
'should return value when size is equal to lower bounds and no fluid min/max set',
|
|
217
220
|
preset: {
|
|
218
221
|
size: '14px',
|
|
219
222
|
},
|
|
@@ -224,7 +227,8 @@ describe( 'typography utils', () => {
|
|
|
224
227
|
},
|
|
225
228
|
|
|
226
229
|
{
|
|
227
|
-
message:
|
|
230
|
+
message:
|
|
231
|
+
'should return clamp value with different min max units',
|
|
228
232
|
preset: {
|
|
229
233
|
size: '28px',
|
|
230
234
|
fluid: {
|
|
@@ -240,7 +244,8 @@ describe( 'typography utils', () => {
|
|
|
240
244
|
},
|
|
241
245
|
|
|
242
246
|
{
|
|
243
|
-
message:
|
|
247
|
+
message:
|
|
248
|
+
'should return clamp value where no fluid max size is set',
|
|
244
249
|
preset: {
|
|
245
250
|
size: '28px',
|
|
246
251
|
fluid: {
|
|
@@ -255,7 +260,8 @@ describe( 'typography utils', () => {
|
|
|
255
260
|
},
|
|
256
261
|
|
|
257
262
|
{
|
|
258
|
-
message:
|
|
263
|
+
message:
|
|
264
|
+
'should return clamp value where no fluid min size is set',
|
|
259
265
|
preset: {
|
|
260
266
|
size: '28px',
|
|
261
267
|
fluid: {
|
|
@@ -320,7 +326,7 @@ describe( 'typography utils', () => {
|
|
|
320
326
|
|
|
321
327
|
{
|
|
322
328
|
message:
|
|
323
|
-
'
|
|
329
|
+
'should return clamp value when min and max font sizes are equal',
|
|
324
330
|
preset: {
|
|
325
331
|
size: '4rem',
|
|
326
332
|
fluid: {
|
|
@@ -333,8 +339,51 @@ describe( 'typography utils', () => {
|
|
|
333
339
|
},
|
|
334
340
|
expected: 'clamp(30px, 1.875rem + ((1vw - 7.68px) * 1), 30px)',
|
|
335
341
|
},
|
|
342
|
+
|
|
343
|
+
{
|
|
344
|
+
message:
|
|
345
|
+
'should use default min font size value where min font size unit in fluid config is not supported',
|
|
346
|
+
preset: {
|
|
347
|
+
size: '15px',
|
|
348
|
+
},
|
|
349
|
+
typographySettings: {
|
|
350
|
+
fluid: {
|
|
351
|
+
minFontSize: '16%',
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
expected:
|
|
355
|
+
'clamp(14px, 0.875rem + ((1vw - 7.68px) * 0.12), 15px)',
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
// Equivalent custom config PHP unit tests in `test_should_covert_font_sizes_to_fluid_values()`.
|
|
359
|
+
{
|
|
360
|
+
message: 'should return clamp value using custom fluid config',
|
|
361
|
+
preset: {
|
|
362
|
+
size: '17px',
|
|
363
|
+
},
|
|
364
|
+
typographySettings: {
|
|
365
|
+
fluid: {
|
|
366
|
+
minFontSize: '16px',
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
expected: 'clamp(16px, 1rem + ((1vw - 7.68px) * 0.12), 17px)',
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
{
|
|
373
|
+
message:
|
|
374
|
+
'should return value when font size <= custom min font size bound',
|
|
375
|
+
preset: {
|
|
376
|
+
size: '15px',
|
|
377
|
+
},
|
|
378
|
+
typographySettings: {
|
|
379
|
+
fluid: {
|
|
380
|
+
minFontSize: '16px',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
expected: '15px',
|
|
384
|
+
},
|
|
336
385
|
].forEach( ( { message, preset, typographySettings, expected } ) => {
|
|
337
|
-
it(
|
|
386
|
+
it( `${ message }`, () => {
|
|
338
387
|
expect(
|
|
339
388
|
getTypographyFontSizeValue( preset, typographySettings )
|
|
340
389
|
).toBe( expected );
|
|
@@ -681,7 +681,7 @@ describe( 'global styles renderer', () => {
|
|
|
681
681
|
const imageBlock = { name: 'core/image', supports: imageSupports };
|
|
682
682
|
const blockTypes = [ imageBlock ];
|
|
683
683
|
|
|
684
|
-
expect( getBlockSelectors( blockTypes ) ).toEqual( {
|
|
684
|
+
expect( getBlockSelectors( blockTypes, () => {} ) ).toEqual( {
|
|
685
685
|
'core/image': {
|
|
686
686
|
name: imageBlock.name,
|
|
687
687
|
selector: imageSupports.__experimentalSelector,
|
|
@@ -171,7 +171,12 @@ function useFontAppearance( prefix, name ) {
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
export default function TypographyPanel( {
|
|
174
|
+
export default function TypographyPanel( {
|
|
175
|
+
name,
|
|
176
|
+
element,
|
|
177
|
+
headingLevel,
|
|
178
|
+
variationPath = '',
|
|
179
|
+
} ) {
|
|
175
180
|
const supports = getSupportedGlobalStylesPanels( name );
|
|
176
181
|
let prefix = '';
|
|
177
182
|
if ( element === 'heading' ) {
|
|
@@ -210,9 +215,15 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
|
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
const [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =
|
|
213
|
-
useStyleWithReset(
|
|
218
|
+
useStyleWithReset(
|
|
219
|
+
variationPath + prefix + 'typography.fontFamily',
|
|
220
|
+
name
|
|
221
|
+
);
|
|
214
222
|
const { fontSize, setFontSize, hasFontSize, resetFontSize } =
|
|
215
|
-
useFontSizeWithReset(
|
|
223
|
+
useFontSizeWithReset(
|
|
224
|
+
variationPath + prefix + 'typography.fontSize',
|
|
225
|
+
name
|
|
226
|
+
);
|
|
216
227
|
const {
|
|
217
228
|
fontStyle,
|
|
218
229
|
setFontStyle,
|
|
@@ -220,27 +231,39 @@ export default function TypographyPanel( { name, element, headingLevel } ) {
|
|
|
220
231
|
setFontWeight,
|
|
221
232
|
hasFontAppearance,
|
|
222
233
|
resetFontAppearance,
|
|
223
|
-
} = useFontAppearance( prefix, name );
|
|
234
|
+
} = useFontAppearance( variationPath + prefix, name );
|
|
224
235
|
const [ lineHeight, setLineHeight, hasLineHeight, resetLineHeight ] =
|
|
225
|
-
useStyleWithReset(
|
|
236
|
+
useStyleWithReset(
|
|
237
|
+
variationPath + prefix + 'typography.lineHeight',
|
|
238
|
+
name
|
|
239
|
+
);
|
|
226
240
|
const [
|
|
227
241
|
letterSpacing,
|
|
228
242
|
setLetterSpacing,
|
|
229
243
|
hasLetterSpacing,
|
|
230
244
|
resetLetterSpacing,
|
|
231
|
-
] = useStyleWithReset(
|
|
245
|
+
] = useStyleWithReset(
|
|
246
|
+
variationPath + prefix + 'typography.letterSpacing',
|
|
247
|
+
name
|
|
248
|
+
);
|
|
232
249
|
const [
|
|
233
250
|
textTransform,
|
|
234
251
|
setTextTransform,
|
|
235
252
|
hasTextTransform,
|
|
236
253
|
resetTextTransform,
|
|
237
|
-
] = useStyleWithReset(
|
|
254
|
+
] = useStyleWithReset(
|
|
255
|
+
variationPath + prefix + 'typography.textTransform',
|
|
256
|
+
name
|
|
257
|
+
);
|
|
238
258
|
const [
|
|
239
259
|
textDecoration,
|
|
240
260
|
setTextDecoration,
|
|
241
261
|
hasTextDecoration,
|
|
242
262
|
resetTextDecoration,
|
|
243
|
-
] = useStyleWithReset(
|
|
263
|
+
] = useStyleWithReset(
|
|
264
|
+
variationPath + prefix + 'typography.textDecoration',
|
|
265
|
+
name
|
|
266
|
+
);
|
|
244
267
|
|
|
245
268
|
const resetAll = () => {
|
|
246
269
|
resetFontFamily();
|
|
@@ -23,13 +23,23 @@ import { getComputedFluidTypographyValue } from '@wordpress/block-editor';
|
|
|
23
23
|
* @property {boolean|FluidPreset|undefined} fluid A font size slug
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} TypographySettings
|
|
28
|
+
* @property {?string|?number} size A default font size.
|
|
29
|
+
* @property {?string} minViewPortWidth Minimum viewport size from which type will have fluidity. Optional if size is specified.
|
|
30
|
+
* @property {?string} maxViewPortWidth Maximum size up to which type will have fluidity. Optional if size is specified.
|
|
31
|
+
* @property {?number} scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
|
|
32
|
+
* @property {?number} minFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
|
|
33
|
+
* @property {?string} minFontSize The smallest a calculated font size may be. Optional.
|
|
34
|
+
*/
|
|
35
|
+
|
|
26
36
|
/**
|
|
27
37
|
* Returns a font-size value based on a given font-size preset.
|
|
28
38
|
* Takes into account fluid typography parameters and attempts to return a css formula depending on available, valid values.
|
|
29
39
|
*
|
|
30
|
-
* @param {Preset}
|
|
31
|
-
* @param {Object}
|
|
32
|
-
* @param {boolean} typographySettings.fluid Whether fluid typography is enabled.
|
|
40
|
+
* @param {Preset} preset
|
|
41
|
+
* @param {Object} typographySettings
|
|
42
|
+
* @param {boolean|TypographySettings} typographySettings.fluid Whether fluid typography is enabled, and, optionally, fluid font size options.
|
|
33
43
|
*
|
|
34
44
|
* @return {string|*} A font-size value or the value of preset.size.
|
|
35
45
|
*/
|
|
@@ -44,7 +54,11 @@ export function getTypographyFontSizeValue( preset, typographySettings ) {
|
|
|
44
54
|
return defaultSize;
|
|
45
55
|
}
|
|
46
56
|
|
|
47
|
-
if (
|
|
57
|
+
if (
|
|
58
|
+
! typographySettings?.fluid ||
|
|
59
|
+
( typeof typographySettings?.fluid === 'object' &&
|
|
60
|
+
Object.keys( typographySettings.fluid ).length === 0 )
|
|
61
|
+
) {
|
|
48
62
|
return defaultSize;
|
|
49
63
|
}
|
|
50
64
|
|
|
@@ -53,10 +67,16 @@ export function getTypographyFontSizeValue( preset, typographySettings ) {
|
|
|
53
67
|
return defaultSize;
|
|
54
68
|
}
|
|
55
69
|
|
|
70
|
+
const fluidTypographySettings =
|
|
71
|
+
typeof typographySettings?.fluid === 'object'
|
|
72
|
+
? typographySettings?.fluid
|
|
73
|
+
: {};
|
|
74
|
+
|
|
56
75
|
const fluidFontSizeValue = getComputedFluidTypographyValue( {
|
|
57
76
|
minimumFontSize: preset?.fluid?.min,
|
|
58
77
|
maximumFontSize: preset?.fluid?.max,
|
|
59
78
|
fontSize: defaultSize,
|
|
79
|
+
minimumFontSizeLimit: fluidTypographySettings?.minFontSize,
|
|
60
80
|
} );
|
|
61
81
|
|
|
62
82
|
if ( !! fluidFontSizeValue ) {
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
__experimentalNavigatorScreen as NavigatorScreen,
|
|
7
7
|
__experimentalUseNavigator as useNavigator,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
|
-
import { getBlockTypes } from '@wordpress/blocks';
|
|
9
|
+
import { getBlockTypes, store as blocksStore } from '@wordpress/blocks';
|
|
10
|
+
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Internal dependencies
|
|
@@ -25,6 +27,7 @@ import ScreenHeadingColor from './screen-heading-color';
|
|
|
25
27
|
import ScreenButtonColor from './screen-button-color';
|
|
26
28
|
import ScreenLayout from './screen-layout';
|
|
27
29
|
import ScreenStyleVariations from './screen-style-variations';
|
|
30
|
+
import { ScreenVariation } from './screen-variations';
|
|
28
31
|
import ScreenBorder from './screen-border';
|
|
29
32
|
import StyleBook from '../style-book';
|
|
30
33
|
import ScreenCSS from './screen-css';
|
|
@@ -43,14 +46,67 @@ function GlobalStylesNavigationScreen( { className, ...props } ) {
|
|
|
43
46
|
);
|
|
44
47
|
}
|
|
45
48
|
|
|
46
|
-
function
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
+
function BlockStyleVariationsScreens( { name } ) {
|
|
50
|
+
const blockStyleVariations = useSelect(
|
|
51
|
+
( select ) => {
|
|
52
|
+
const { getBlockStyles } = select( blocksStore );
|
|
53
|
+
return getBlockStyles( name );
|
|
54
|
+
},
|
|
55
|
+
[ name ]
|
|
56
|
+
);
|
|
57
|
+
if ( ! blockStyleVariations?.length ) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return blockStyleVariations.map( ( variation ) => (
|
|
62
|
+
<ContextScreens
|
|
63
|
+
key={ variation.name + name }
|
|
64
|
+
name={ name }
|
|
65
|
+
parentMenu={
|
|
66
|
+
'/blocks/' +
|
|
67
|
+
encodeURIComponent( name ) +
|
|
68
|
+
'/variations/' +
|
|
69
|
+
encodeURIComponent( variation.name )
|
|
70
|
+
}
|
|
71
|
+
/>
|
|
72
|
+
) );
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ContextScreens( { name, parentMenu = '' } ) {
|
|
76
|
+
const hasVariationPath = parentMenu.search( 'variations' );
|
|
77
|
+
const variationPath =
|
|
78
|
+
hasVariationPath !== -1
|
|
79
|
+
? parentMenu
|
|
80
|
+
.substring( hasVariationPath )
|
|
81
|
+
.replace( '/', '.' )
|
|
82
|
+
.concat( '', '.' )
|
|
83
|
+
: '';
|
|
84
|
+
const blockStyleVariations = useSelect(
|
|
85
|
+
( select ) => {
|
|
86
|
+
const { getBlockStyles } = select( blocksStore );
|
|
87
|
+
return getBlockStyles( name );
|
|
88
|
+
},
|
|
89
|
+
[ name ]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const BlockStylesNavigationScreens = ( { blockStyles, blockName } ) => {
|
|
93
|
+
return blockStyles.map( ( style, index ) => (
|
|
94
|
+
<GlobalStylesNavigationScreen
|
|
95
|
+
key={ index }
|
|
96
|
+
path={ parentMenu + '/variations/' + style.name }
|
|
97
|
+
>
|
|
98
|
+
<ScreenVariation blockName={ blockName } style={ style } />
|
|
99
|
+
</GlobalStylesNavigationScreen>
|
|
100
|
+
) );
|
|
101
|
+
};
|
|
49
102
|
|
|
50
103
|
return (
|
|
51
104
|
<>
|
|
52
105
|
<GlobalStylesNavigationScreen path={ parentMenu + '/typography' }>
|
|
53
|
-
<ScreenTypography
|
|
106
|
+
<ScreenTypography
|
|
107
|
+
name={ name }
|
|
108
|
+
variationPath={ variationPath }
|
|
109
|
+
/>
|
|
54
110
|
</GlobalStylesNavigationScreen>
|
|
55
111
|
|
|
56
112
|
<GlobalStylesNavigationScreen
|
|
@@ -78,7 +134,7 @@ function ContextScreens( { name } ) {
|
|
|
78
134
|
</GlobalStylesNavigationScreen>
|
|
79
135
|
|
|
80
136
|
<GlobalStylesNavigationScreen path={ parentMenu + '/colors' }>
|
|
81
|
-
<ScreenColors name={ name } />
|
|
137
|
+
<ScreenColors name={ name } variationPath={ variationPath } />
|
|
82
138
|
</GlobalStylesNavigationScreen>
|
|
83
139
|
|
|
84
140
|
<GlobalStylesNavigationScreen
|
|
@@ -90,36 +146,58 @@ function ContextScreens( { name } ) {
|
|
|
90
146
|
<GlobalStylesNavigationScreen
|
|
91
147
|
path={ parentMenu + '/colors/background' }
|
|
92
148
|
>
|
|
93
|
-
<ScreenBackgroundColor
|
|
149
|
+
<ScreenBackgroundColor
|
|
150
|
+
name={ name }
|
|
151
|
+
variationPath={ variationPath }
|
|
152
|
+
/>
|
|
94
153
|
</GlobalStylesNavigationScreen>
|
|
95
154
|
|
|
96
155
|
<GlobalStylesNavigationScreen path={ parentMenu + '/colors/text' }>
|
|
97
|
-
<ScreenTextColor
|
|
156
|
+
<ScreenTextColor
|
|
157
|
+
name={ name }
|
|
158
|
+
variationPath={ variationPath }
|
|
159
|
+
/>
|
|
98
160
|
</GlobalStylesNavigationScreen>
|
|
99
161
|
|
|
100
162
|
<GlobalStylesNavigationScreen path={ parentMenu + '/colors/link' }>
|
|
101
|
-
<ScreenLinkColor
|
|
163
|
+
<ScreenLinkColor
|
|
164
|
+
name={ name }
|
|
165
|
+
variationPath={ variationPath }
|
|
166
|
+
/>
|
|
102
167
|
</GlobalStylesNavigationScreen>
|
|
103
168
|
|
|
104
169
|
<GlobalStylesNavigationScreen
|
|
105
170
|
path={ parentMenu + '/colors/heading' }
|
|
106
171
|
>
|
|
107
|
-
<ScreenHeadingColor
|
|
172
|
+
<ScreenHeadingColor
|
|
173
|
+
name={ name }
|
|
174
|
+
variationPath={ variationPath }
|
|
175
|
+
/>
|
|
108
176
|
</GlobalStylesNavigationScreen>
|
|
109
177
|
|
|
110
178
|
<GlobalStylesNavigationScreen
|
|
111
179
|
path={ parentMenu + '/colors/button' }
|
|
112
180
|
>
|
|
113
|
-
<ScreenButtonColor
|
|
181
|
+
<ScreenButtonColor
|
|
182
|
+
name={ name }
|
|
183
|
+
variationPath={ variationPath }
|
|
184
|
+
/>
|
|
114
185
|
</GlobalStylesNavigationScreen>
|
|
115
186
|
|
|
116
187
|
<GlobalStylesNavigationScreen path={ parentMenu + '/border' }>
|
|
117
|
-
<ScreenBorder name={ name } />
|
|
188
|
+
<ScreenBorder name={ name } variationPath={ variationPath } />
|
|
118
189
|
</GlobalStylesNavigationScreen>
|
|
119
190
|
|
|
120
191
|
<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
|
|
121
|
-
<ScreenLayout name={ name } />
|
|
192
|
+
<ScreenLayout name={ name } variationPath={ variationPath } />
|
|
122
193
|
</GlobalStylesNavigationScreen>
|
|
194
|
+
|
|
195
|
+
{ !! blockStyleVariations?.length && (
|
|
196
|
+
<BlockStylesNavigationScreens
|
|
197
|
+
blockStyles={ blockStyleVariations }
|
|
198
|
+
blockName={ name }
|
|
199
|
+
/>
|
|
200
|
+
) }
|
|
123
201
|
</>
|
|
124
202
|
);
|
|
125
203
|
}
|
|
@@ -154,6 +232,7 @@ function GlobalStylesStyleBook( { onClose } ) {
|
|
|
154
232
|
|
|
155
233
|
function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
|
|
156
234
|
const blocks = getBlockTypes();
|
|
235
|
+
|
|
157
236
|
return (
|
|
158
237
|
<NavigatorProvider
|
|
159
238
|
className="edit-site-global-styles-sidebar__navigator-provider"
|
|
@@ -186,9 +265,18 @@ function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
|
|
|
186
265
|
<ContextScreens
|
|
187
266
|
key={ 'screens-block-' + block.name }
|
|
188
267
|
name={ block.name }
|
|
268
|
+
parentMenu={ '/blocks/' + encodeURIComponent( block.name ) }
|
|
189
269
|
/>
|
|
190
270
|
) ) }
|
|
191
271
|
|
|
272
|
+
{ blocks.map( ( block, index ) => {
|
|
273
|
+
return (
|
|
274
|
+
<BlockStyleVariationsScreens
|
|
275
|
+
key={ 'screens-block-styles-' + block.name + index }
|
|
276
|
+
name={ block.name }
|
|
277
|
+
/>
|
|
278
|
+
);
|
|
279
|
+
} ) }
|
|
192
280
|
{ isStyleBookOpened && (
|
|
193
281
|
<GlobalStylesStyleBook onClose={ onCloseStyleBook } />
|
|
194
282
|
) }
|