@wordpress/edit-site 6.4.0 → 6.6.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 +4 -0
- package/build/components/add-new-pattern/index.js +6 -1
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-post/index.js +2 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +2 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/editor/index.js +71 -20
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +1 -4
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +3 -4
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +0 -5
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +25 -5
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +1 -8
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +23 -7
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +2 -3
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/screen-block.js +5 -7
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-typeset.js +40 -0
- package/build/components/global-styles/screen-typeset.js.map +1 -0
- package/build/components/global-styles/screen-typography-element.js +14 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +51 -59
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/size-control/index.js +10 -5
- package/build/components/global-styles/size-control/index.js.map +1 -1
- package/build/components/global-styles/typeset-button.js +97 -0
- package/build/components/global-styles/typeset-button.js.map +1 -0
- package/build/components/global-styles/typeset.js +80 -0
- package/build/components/global-styles/typeset.js.map +1 -0
- package/build/components/global-styles/ui.js +4 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/utils.js +10 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/page-patterns/fields.js +230 -0
- package/build/components/page-patterns/fields.js.map +1 -0
- package/build/components/page-patterns/index.js +13 -228
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +29 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/fields.js +169 -0
- package/build/components/page-templates/fields.js.map +1 -0
- package/build/components/page-templates/index.js +10 -177
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/post-edit/index.js +46 -34
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +50 -28
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +126 -68
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +3 -2
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +1 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -3
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +81 -81
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +3 -42
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/site-hub/index.js +6 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +22 -25
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/utils/is-template-removable.js +2 -2
- package/build/utils/is-template-removable.js.map +1 -1
- package/build/utils/is-template-revertable.js +1 -1
- package/build/utils/is-template-revertable.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +6 -1
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-post/index.js +2 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +2 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/editor/index.js +73 -22
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +1 -4
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +3 -4
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +0 -5
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +26 -6
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +1 -8
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +23 -7
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +2 -3
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +5 -7
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-typeset.js +34 -0
- package/build-module/components/global-styles/screen-typeset.js.map +1 -0
- package/build-module/components/global-styles/screen-typography-element.js +14 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +52 -60
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/size-control/index.js +10 -5
- package/build-module/components/global-styles/size-control/index.js.map +1 -1
- package/build-module/components/global-styles/typeset-button.js +89 -0
- package/build-module/components/global-styles/typeset-button.js.map +1 -0
- package/build-module/components/global-styles/typeset.js +71 -0
- package/build-module/components/global-styles/typeset.js.map +1 -0
- package/build-module/components/global-styles/ui.js +4 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/utils.js +10 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +223 -0
- package/build-module/components/page-patterns/fields.js.map +1 -0
- package/build-module/components/page-patterns/index.js +14 -231
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +26 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/fields.js +160 -0
- package/build-module/components/page-templates/fields.js.map +1 -0
- package/build-module/components/page-templates/index.js +12 -178
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +49 -37
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +50 -28
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +128 -70
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +3 -2
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +1 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -3
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +81 -81
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +3 -42
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +7 -4
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +23 -26
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +0 -2
- package/build-module/index.js.map +1 -1
- package/build-module/utils/is-template-removable.js +2 -2
- package/build-module/utils/is-template-removable.js.map +1 -1
- package/build-module/utils/is-template-revertable.js +1 -1
- package/build-module/utils/is-template-revertable.js.map +1 -1
- package/build-style/posts-rtl.css +201 -25
- package/build-style/posts.css +201 -25
- package/build-style/style-rtl.css +307 -69
- package/build-style/style.css +307 -69
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +8 -3
- package/src/components/add-new-post/index.js +2 -1
- package/src/components/add-new-template/style.scss +1 -1
- package/src/components/add-new-template/utils.js +10 -6
- package/src/components/editor/index.js +80 -22
- package/src/components/editor/style.scss +60 -2
- package/src/components/global-styles/background-panel.js +0 -3
- package/src/components/global-styles/font-families.js +3 -5
- package/src/components/global-styles/font-library-modal/context.js +0 -5
- package/src/components/global-styles/font-library-modal/font-collection.js +34 -10
- package/src/components/global-styles/font-library-modal/index.js +2 -7
- package/src/components/global-styles/font-library-modal/installed-fonts.js +26 -6
- package/src/components/global-styles/font-library-modal/style.scss +2 -2
- package/src/components/global-styles/font-library-modal/upload-fonts.js +2 -2
- package/src/components/global-styles/screen-block.js +2 -4
- package/src/components/global-styles/screen-css.js +3 -1
- package/src/components/global-styles/screen-typeset.js +42 -0
- package/src/components/global-styles/screen-typography-element.js +14 -0
- package/src/components/global-styles/screen-typography.js +4 -4
- package/src/components/global-styles/shadows-edit-panel.js +67 -73
- package/src/components/global-styles/size-control/index.js +9 -6
- package/src/components/global-styles/style.scss +4 -7
- package/src/components/global-styles/typeset-button.js +93 -0
- package/src/components/global-styles/typeset.js +73 -0
- package/src/components/global-styles/ui.js +5 -0
- package/src/components/global-styles/utils.js +13 -1
- package/src/components/layout/style.scss +8 -0
- package/src/components/page-patterns/fields.js +251 -0
- package/src/components/page-patterns/index.js +19 -246
- package/src/components/page-patterns/style.scss +82 -85
- package/src/components/page-patterns/use-patterns.js +33 -0
- package/src/components/page-templates/fields.js +157 -0
- package/src/components/page-templates/index.js +19 -170
- package/src/components/page-templates/style.scss +14 -5
- package/src/components/post-edit/index.js +58 -35
- package/src/components/post-fields/index.js +88 -25
- package/src/components/post-list/index.js +135 -79
- package/src/components/sidebar-dataviews/add-new-view.js +3 -4
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +1 -0
- package/src/components/sidebar-dataviews/dataview-item.js +2 -2
- package/src/components/sidebar-dataviews/default-views.js +95 -95
- package/src/components/sidebar-dataviews/index.js +3 -37
- package/src/components/site-hub/index.js +11 -2
- package/src/components/site-icon/style.scss +4 -1
- package/src/components/style-book/index.js +27 -32
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -0
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
- package/src/index.js +0 -2
- package/src/utils/is-template-removable.js +4 -2
- package/src/utils/is-template-revertable.js +2 -1
- package/build/utils/clone-deep.js +0 -15
- package/build/utils/clone-deep.js.map +0 -1
- package/build-module/utils/clone-deep.js +0 -9
- package/build-module/utils/clone-deep.js.map +0 -1
- package/src/utils/clone-deep.js +0 -8
|
@@ -53,14 +53,13 @@ function InstalledFonts() {
|
|
|
53
53
|
isInstalling,
|
|
54
54
|
saveFontFamilies,
|
|
55
55
|
getFontFacesActivated,
|
|
56
|
-
notice,
|
|
57
|
-
setNotice,
|
|
58
56
|
} = useContext( FontLibraryContext );
|
|
59
57
|
|
|
60
58
|
const [ fontFamilies, setFontFamilies ] = useGlobalSetting(
|
|
61
59
|
'typography.fontFamilies'
|
|
62
60
|
);
|
|
63
61
|
const [ isConfirmDeleteOpen, setIsConfirmDeleteOpen ] = useState( false );
|
|
62
|
+
const [ notice, setNotice ] = useState( false );
|
|
64
63
|
const [ baseFontFamilies ] = useGlobalSetting(
|
|
65
64
|
'typography.fontFamilies',
|
|
66
65
|
undefined,
|
|
@@ -120,6 +119,26 @@ function InstalledFonts() {
|
|
|
120
119
|
setIsConfirmDeleteOpen( true );
|
|
121
120
|
};
|
|
122
121
|
|
|
122
|
+
const handleUpdate = async () => {
|
|
123
|
+
setNotice( null );
|
|
124
|
+
try {
|
|
125
|
+
await saveFontFamilies( fontFamilies );
|
|
126
|
+
setNotice( {
|
|
127
|
+
type: 'success',
|
|
128
|
+
message: __( 'Font family updated successfully.' ),
|
|
129
|
+
} );
|
|
130
|
+
} catch ( error ) {
|
|
131
|
+
setNotice( {
|
|
132
|
+
type: 'error',
|
|
133
|
+
message: sprintf(
|
|
134
|
+
/* translators: %s: error message */
|
|
135
|
+
__( 'There was an error updating the font family. %s' ),
|
|
136
|
+
error.message
|
|
137
|
+
),
|
|
138
|
+
} );
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
123
142
|
const getFontFacesToDisplay = ( font ) => {
|
|
124
143
|
if ( ! font ) {
|
|
125
144
|
return [];
|
|
@@ -265,6 +284,7 @@ function InstalledFonts() {
|
|
|
265
284
|
font
|
|
266
285
|
) }
|
|
267
286
|
onClick={ () => {
|
|
287
|
+
setNotice( null );
|
|
268
288
|
handleSetLibraryFontSelected(
|
|
269
289
|
font
|
|
270
290
|
);
|
|
@@ -305,6 +325,7 @@ function InstalledFonts() {
|
|
|
305
325
|
font
|
|
306
326
|
) }
|
|
307
327
|
onClick={ () => {
|
|
328
|
+
setNotice( null );
|
|
308
329
|
handleSetLibraryFontSelected(
|
|
309
330
|
font
|
|
310
331
|
);
|
|
@@ -337,6 +358,7 @@ function InstalledFonts() {
|
|
|
337
358
|
size="small"
|
|
338
359
|
onClick={ () => {
|
|
339
360
|
handleSetLibraryFontSelected( null );
|
|
361
|
+
setNotice( null );
|
|
340
362
|
} }
|
|
341
363
|
label={ __( 'Back' ) }
|
|
342
364
|
/>
|
|
@@ -406,9 +428,7 @@ function InstalledFonts() {
|
|
|
406
428
|
) }
|
|
407
429
|
<Button
|
|
408
430
|
variant="primary"
|
|
409
|
-
onClick={
|
|
410
|
-
saveFontFamilies( fontFamilies );
|
|
411
|
-
} }
|
|
431
|
+
onClick={ handleUpdate }
|
|
412
432
|
disabled={ ! fontFamiliesHasChanges }
|
|
413
433
|
accessibleWhenDisabled
|
|
414
434
|
>
|
|
@@ -446,7 +466,7 @@ function ConfirmDeleteDialog( {
|
|
|
446
466
|
setNotice( {
|
|
447
467
|
type: 'error',
|
|
448
468
|
message:
|
|
449
|
-
__( 'There was an error uninstalling the font family.
|
|
469
|
+
__( 'There was an error uninstalling the font family.' ) +
|
|
450
470
|
error.message,
|
|
451
471
|
} );
|
|
452
472
|
}
|
|
@@ -69,6 +69,7 @@ $footer-height: 70px;
|
|
|
69
69
|
color: $gray-900;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// TODO: See if this can be removed after https://github.com/WordPress/gutenberg/issues/38730
|
|
72
73
|
.font-library-modal__tabpanel-layout .components-base-control__field {
|
|
73
74
|
margin-bottom: 0;
|
|
74
75
|
}
|
|
@@ -91,7 +92,7 @@ $footer-height: 70px;
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
.font-library-modal__font-card {
|
|
94
|
-
border:
|
|
95
|
+
border: $border-width solid $gray-200;
|
|
95
96
|
width: 100%;
|
|
96
97
|
height: auto;
|
|
97
98
|
padding: $grid-unit-20;
|
|
@@ -194,4 +195,3 @@ button.font-library-modal__upload-area {
|
|
|
194
195
|
padding-left: $grid-unit-20;
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
|
-
|
|
@@ -25,9 +25,9 @@ import makeFamiliesFromFaces from './utils/make-families-from-faces';
|
|
|
25
25
|
import { loadFontFaceInBrowser } from './utils';
|
|
26
26
|
|
|
27
27
|
function UploadFonts() {
|
|
28
|
-
const { installFonts
|
|
29
|
-
useContext( FontLibraryContext );
|
|
28
|
+
const { installFonts } = useContext( FontLibraryContext );
|
|
30
29
|
const [ isUploading, setIsUploading ] = useState( false );
|
|
30
|
+
const [ notice, setNotice ] = useState( false );
|
|
31
31
|
|
|
32
32
|
const handleDropZone = ( files ) => {
|
|
33
33
|
handleFilesUpload( files );
|
|
@@ -25,9 +25,10 @@ import {
|
|
|
25
25
|
VariationsPanel,
|
|
26
26
|
} from './variations/variations-panel';
|
|
27
27
|
|
|
28
|
-
// Initial control values
|
|
28
|
+
// Initial control values.
|
|
29
29
|
const BACKGROUND_BLOCK_DEFAULT_VALUES = {
|
|
30
30
|
backgroundSize: 'cover',
|
|
31
|
+
backgroundPosition: '50% 50%', // used only when backgroundSize is 'contain'.
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
function applyFallbackStyle( border ) {
|
|
@@ -84,7 +85,6 @@ const {
|
|
|
84
85
|
FiltersPanel: StylesFiltersPanel,
|
|
85
86
|
ImageSettingsPanel,
|
|
86
87
|
AdvancedPanel: StylesAdvancedPanel,
|
|
87
|
-
useGlobalStyleLinks,
|
|
88
88
|
} = unlock( blockEditorPrivateApis );
|
|
89
89
|
|
|
90
90
|
function ScreenBlock( { name, variation } ) {
|
|
@@ -104,7 +104,6 @@ function ScreenBlock( { name, variation } ) {
|
|
|
104
104
|
const [ rawSettings, setSettings ] = useGlobalSetting( '', name );
|
|
105
105
|
const settings = useSettingsForBlockElement( rawSettings, name );
|
|
106
106
|
const blockType = getBlockType( name );
|
|
107
|
-
const _links = useGlobalStyleLinks();
|
|
108
107
|
|
|
109
108
|
// Only allow `blockGap` support if serialization has not been skipped, to be sure global spacing can be applied.
|
|
110
109
|
if (
|
|
@@ -271,7 +270,6 @@ function ScreenBlock( { name, variation } ) {
|
|
|
271
270
|
onChange={ setStyle }
|
|
272
271
|
settings={ settings }
|
|
273
272
|
defaultValues={ BACKGROUND_BLOCK_DEFAULT_VALUES }
|
|
274
|
-
themeFileURIs={ _links?.[ 'wp:theme-file' ] }
|
|
275
273
|
/>
|
|
276
274
|
) }
|
|
277
275
|
{ hasTypographyPanel && (
|
|
@@ -34,7 +34,9 @@ function ScreenCSS() {
|
|
|
34
34
|
<>
|
|
35
35
|
{ description }
|
|
36
36
|
<ExternalLink
|
|
37
|
-
href=
|
|
37
|
+
href={ __(
|
|
38
|
+
'https://developer.wordpress.org/advanced-administration/wordpress/css/'
|
|
39
|
+
) }
|
|
38
40
|
className="edit-site-global-styles-screen-css-help-link"
|
|
39
41
|
>
|
|
40
42
|
{ __( 'Learn more about CSS' ) }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import TypographyVariations from './variations/variations-typography';
|
|
13
|
+
import ScreenHeader from './header';
|
|
14
|
+
import FontFamilies from './font-families';
|
|
15
|
+
|
|
16
|
+
function ScreenTypeset() {
|
|
17
|
+
const fontLibraryEnabled = useSelect(
|
|
18
|
+
( select ) =>
|
|
19
|
+
select( editorStore ).getEditorSettings().fontLibraryEnabled,
|
|
20
|
+
[]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<ScreenHeader
|
|
26
|
+
title={ __( 'Typesets' ) }
|
|
27
|
+
description={ __(
|
|
28
|
+
'Fonts and typographic styling applied across the site.'
|
|
29
|
+
) }
|
|
30
|
+
/>
|
|
31
|
+
<div className="edit-site-global-styles-screen">
|
|
32
|
+
<VStack spacing={ 7 }>
|
|
33
|
+
<TypographyVariations />
|
|
34
|
+
|
|
35
|
+
{ fontLibraryEnabled && <FontFamilies /> }
|
|
36
|
+
</VStack>
|
|
37
|
+
</div>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default ScreenTypeset;
|
|
@@ -67,30 +67,44 @@ function ScreenTypographyElement( { element } ) {
|
|
|
67
67
|
>
|
|
68
68
|
<ToggleGroupControlOption
|
|
69
69
|
value="heading"
|
|
70
|
+
showTooltip
|
|
71
|
+
aria-label={ __( 'All headings' ) }
|
|
70
72
|
label={ _x( 'All', 'heading levels' ) }
|
|
71
73
|
/>
|
|
72
74
|
<ToggleGroupControlOption
|
|
73
75
|
value="h1"
|
|
76
|
+
showTooltip
|
|
77
|
+
aria-label={ __( 'Heading 1' ) }
|
|
74
78
|
label={ __( 'H1' ) }
|
|
75
79
|
/>
|
|
76
80
|
<ToggleGroupControlOption
|
|
77
81
|
value="h2"
|
|
82
|
+
showTooltip
|
|
83
|
+
aria-label={ __( 'Heading 2' ) }
|
|
78
84
|
label={ __( 'H2' ) }
|
|
79
85
|
/>
|
|
80
86
|
<ToggleGroupControlOption
|
|
81
87
|
value="h3"
|
|
88
|
+
showTooltip
|
|
89
|
+
aria-label={ __( 'Heading 3' ) }
|
|
82
90
|
label={ __( 'H3' ) }
|
|
83
91
|
/>
|
|
84
92
|
<ToggleGroupControlOption
|
|
85
93
|
value="h4"
|
|
94
|
+
showTooltip
|
|
95
|
+
aria-label={ __( 'Heading 4' ) }
|
|
86
96
|
label={ __( 'H4' ) }
|
|
87
97
|
/>
|
|
88
98
|
<ToggleGroupControlOption
|
|
89
99
|
value="h5"
|
|
100
|
+
showTooltip
|
|
101
|
+
aria-label={ __( 'Heading 5' ) }
|
|
90
102
|
label={ __( 'H5' ) }
|
|
91
103
|
/>
|
|
92
104
|
<ToggleGroupControlOption
|
|
93
105
|
value="h6"
|
|
106
|
+
showTooltip
|
|
107
|
+
aria-label={ __( 'Heading 6' ) }
|
|
94
108
|
label={ __( 'H6' ) }
|
|
95
109
|
/>
|
|
96
110
|
</ToggleGroupControl>
|
|
@@ -3,17 +3,17 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import TypographyElements from './typography-elements';
|
|
13
|
-
import TypographyVariations from './variations/variations-typography';
|
|
14
|
-
import FontFamilies from './font-families';
|
|
15
13
|
import ScreenHeader from './header';
|
|
16
14
|
import FontSizesCount from './font-sizes/font-sizes-count';
|
|
15
|
+
import TypesetButton from './typeset-button';
|
|
16
|
+
import FontFamilies from './font-families';
|
|
17
17
|
|
|
18
18
|
function ScreenTypography() {
|
|
19
19
|
const fontLibraryEnabled = useSelect(
|
|
@@ -32,9 +32,9 @@ function ScreenTypography() {
|
|
|
32
32
|
/>
|
|
33
33
|
<div className="edit-site-global-styles-screen">
|
|
34
34
|
<VStack spacing={ 7 }>
|
|
35
|
+
<TypesetButton />
|
|
35
36
|
{ fontLibraryEnabled && <FontFamilies /> }
|
|
36
37
|
<TypographyElements />
|
|
37
|
-
<TypographyVariations title={ __( 'Presets' ) } />
|
|
38
38
|
<FontSizesCount />
|
|
39
39
|
</VStack>
|
|
40
40
|
</div>
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
__experimentalVStack as VStack,
|
|
12
12
|
__experimentalSpacer as Spacer,
|
|
13
13
|
__experimentalItemGroup as ItemGroup,
|
|
14
|
-
__experimentalHeading as Heading,
|
|
15
14
|
__experimentalInputControl as InputControl,
|
|
16
15
|
__experimentalUnitControl as UnitControl,
|
|
17
16
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
@@ -224,6 +223,7 @@ export default function ShadowsEditPanel() {
|
|
|
224
223
|
} }
|
|
225
224
|
>
|
|
226
225
|
<InputControl
|
|
226
|
+
__next40pxDefaultSize
|
|
227
227
|
autoComplete="off"
|
|
228
228
|
label={ __( 'Name' ) }
|
|
229
229
|
placeholder={ __( 'Shadow name' ) }
|
|
@@ -395,13 +395,14 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
|
|
|
395
395
|
);
|
|
396
396
|
} }
|
|
397
397
|
renderContent={ () => (
|
|
398
|
-
<DropdownContentWrapper
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
398
|
+
<DropdownContentWrapper
|
|
399
|
+
paddingSize="medium"
|
|
400
|
+
className="edit-site-global-styles__shadow-editor__dropdown-content"
|
|
401
|
+
>
|
|
402
|
+
<ShadowPopover
|
|
403
|
+
shadowObj={ shadowObj }
|
|
404
|
+
onChange={ onShadowChange }
|
|
405
|
+
/>
|
|
405
406
|
</DropdownContentWrapper>
|
|
406
407
|
) }
|
|
407
408
|
/>
|
|
@@ -421,71 +422,64 @@ function ShadowPopover( { shadowObj, onChange } ) {
|
|
|
421
422
|
};
|
|
422
423
|
|
|
423
424
|
return (
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
onChange={ ( value ) =>
|
|
483
|
-
onShadowChange( 'spread', value )
|
|
484
|
-
}
|
|
485
|
-
/>
|
|
486
|
-
</Grid>
|
|
487
|
-
</VStack>
|
|
488
|
-
</div>
|
|
425
|
+
<VStack
|
|
426
|
+
spacing={ 4 }
|
|
427
|
+
className="edit-site-global-styles__shadow-editor-panel"
|
|
428
|
+
>
|
|
429
|
+
<ColorPalette
|
|
430
|
+
clearable={ false }
|
|
431
|
+
enableAlpha={ enableAlpha }
|
|
432
|
+
__experimentalIsRenderedInSidebar={
|
|
433
|
+
__experimentalIsRenderedInSidebar
|
|
434
|
+
}
|
|
435
|
+
value={ shadowObj.color }
|
|
436
|
+
onChange={ ( value ) => onShadowChange( 'color', value ) }
|
|
437
|
+
/>
|
|
438
|
+
<ToggleGroupControl
|
|
439
|
+
__nextHasNoMarginBottom
|
|
440
|
+
value={ shadowObj.inset ? 'inset' : 'outset' }
|
|
441
|
+
isBlock
|
|
442
|
+
onChange={ ( value ) =>
|
|
443
|
+
onShadowChange( 'inset', value === 'inset' )
|
|
444
|
+
}
|
|
445
|
+
hideLabelFromVision
|
|
446
|
+
__next40pxDefaultSize
|
|
447
|
+
>
|
|
448
|
+
<ToggleGroupControlOption
|
|
449
|
+
value="outset"
|
|
450
|
+
label={ __( 'Outset' ) }
|
|
451
|
+
/>
|
|
452
|
+
<ToggleGroupControlOption
|
|
453
|
+
value="inset"
|
|
454
|
+
label={ __( 'Inset' ) }
|
|
455
|
+
/>
|
|
456
|
+
</ToggleGroupControl>
|
|
457
|
+
<Grid columns={ 2 } gap={ 4 }>
|
|
458
|
+
<ShadowInputControl
|
|
459
|
+
label={ __( 'X Position' ) }
|
|
460
|
+
value={ shadowObj.x }
|
|
461
|
+
hasNegativeRange
|
|
462
|
+
onChange={ ( value ) => onShadowChange( 'x', value ) }
|
|
463
|
+
/>
|
|
464
|
+
<ShadowInputControl
|
|
465
|
+
label={ __( 'Y Position' ) }
|
|
466
|
+
value={ shadowObj.y }
|
|
467
|
+
hasNegativeRange
|
|
468
|
+
onChange={ ( value ) => onShadowChange( 'y', value ) }
|
|
469
|
+
/>
|
|
470
|
+
<ShadowInputControl
|
|
471
|
+
label={ __( 'Blur' ) }
|
|
472
|
+
value={ shadowObj.blur }
|
|
473
|
+
onChange={ ( value ) => onShadowChange( 'blur', value ) }
|
|
474
|
+
/>
|
|
475
|
+
<ShadowInputControl
|
|
476
|
+
label={ __( 'Spread' ) }
|
|
477
|
+
value={ shadowObj.spread }
|
|
478
|
+
hasNegativeRange
|
|
479
|
+
onChange={ ( value ) => onShadowChange( 'spread', value ) }
|
|
480
|
+
/>
|
|
481
|
+
</Grid>
|
|
482
|
+
</VStack>
|
|
489
483
|
);
|
|
490
484
|
}
|
|
491
485
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Internal dependencies
|
|
@@ -20,9 +19,13 @@ import {
|
|
|
20
19
|
|
|
21
20
|
const DEFAULT_UNITS = [ 'px', 'em', 'rem', 'vw', 'vh' ];
|
|
22
21
|
|
|
23
|
-
function SizeControl(
|
|
22
|
+
function SizeControl( {
|
|
23
|
+
// Do not allow manipulation of margin bottom
|
|
24
|
+
__nextHasNoMarginBottom,
|
|
25
|
+
...props
|
|
26
|
+
} ) {
|
|
24
27
|
const { baseControlProps } = useBaseControlProps( props );
|
|
25
|
-
const { value, onChange, fallbackValue, disabled } = props;
|
|
28
|
+
const { value, onChange, fallbackValue, disabled, label } = props;
|
|
26
29
|
|
|
27
30
|
const units = useCustomUnits( {
|
|
28
31
|
availableUnits: DEFAULT_UNITS,
|
|
@@ -45,13 +48,13 @@ function SizeControl( props ) {
|
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
return (
|
|
48
|
-
<BaseControl { ...baseControlProps }>
|
|
51
|
+
<BaseControl { ...baseControlProps } __nextHasNoMarginBottom>
|
|
49
52
|
<Flex>
|
|
50
53
|
<FlexItem isBlock>
|
|
51
54
|
<UnitControl
|
|
52
55
|
__next40pxDefaultSize
|
|
53
56
|
__nextHasNoMarginBottom
|
|
54
|
-
label={
|
|
57
|
+
label={ label }
|
|
55
58
|
hideLabelFromVision
|
|
56
59
|
value={ value }
|
|
57
60
|
onChange={ handleUnitControlChange }
|
|
@@ -65,7 +68,7 @@ function SizeControl( props ) {
|
|
|
65
68
|
<RangeControl
|
|
66
69
|
__next40pxDefaultSize
|
|
67
70
|
__nextHasNoMarginBottom
|
|
68
|
-
label={
|
|
71
|
+
label={ label }
|
|
69
72
|
hideLabelFromVision
|
|
70
73
|
value={ valueQuantity }
|
|
71
74
|
initialPosition={ fallbackValue }
|
|
@@ -135,16 +135,13 @@
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.edit-site-global-styles__shadow-
|
|
138
|
+
.edit-site-global-styles__shadow-editor__dropdown-content {
|
|
139
139
|
width: 280px;
|
|
140
|
-
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.edit-site-global-styles__shadow-editor-panel {
|
|
141
143
|
// because tooltip of the range control is too close to the edge and creates overflow
|
|
142
144
|
margin-bottom: $grid-unit-05;
|
|
143
|
-
|
|
144
|
-
& .edit-site-global-styles__shadow-editor-color-palette {
|
|
145
|
-
// color palette adds empty .components-circular-option-picker
|
|
146
|
-
margin-bottom: -1 * $grid-unit-05;
|
|
147
|
-
}
|
|
148
145
|
}
|
|
149
146
|
|
|
150
147
|
.edit-site-global-styles__shadow-editor__dropdown {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalItemGroup as ItemGroup,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
__experimentalHStack as HStack,
|
|
9
|
+
FlexItem,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
13
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
14
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
15
|
+
import { useMemo, useContext } from '@wordpress/element';
|
|
16
|
+
import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import FontLibraryProvider from './font-library-modal/context';
|
|
22
|
+
import { getFontFamilies } from './utils';
|
|
23
|
+
import { NavigationButtonAsItem } from './navigation-button';
|
|
24
|
+
import Subtitle from './subtitle';
|
|
25
|
+
import { unlock } from '../../lock-unlock';
|
|
26
|
+
import { filterObjectByProperties } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
27
|
+
|
|
28
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
29
|
+
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
30
|
+
|
|
31
|
+
function TypesetButton() {
|
|
32
|
+
const { base } = useContext( GlobalStylesContext );
|
|
33
|
+
const { user: userConfig } = useContext( GlobalStylesContext );
|
|
34
|
+
const config = mergeBaseAndUserConfigs( base, userConfig );
|
|
35
|
+
const allFontFamilies = getFontFamilies( config );
|
|
36
|
+
const hasFonts =
|
|
37
|
+
allFontFamilies.filter( ( font ) => font !== null ).length > 0;
|
|
38
|
+
const variations = useSelect( ( select ) => {
|
|
39
|
+
return select(
|
|
40
|
+
coreStore
|
|
41
|
+
).__experimentalGetCurrentThemeGlobalStylesVariations();
|
|
42
|
+
}, [] );
|
|
43
|
+
const userTypographyConfig = filterObjectByProperties(
|
|
44
|
+
userConfig,
|
|
45
|
+
'typography'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const title = useMemo( () => {
|
|
49
|
+
if ( Object.keys( userTypographyConfig ).length === 0 ) {
|
|
50
|
+
return __( 'Default' );
|
|
51
|
+
}
|
|
52
|
+
const activeVariation = variations?.find( ( variation ) => {
|
|
53
|
+
return (
|
|
54
|
+
JSON.stringify(
|
|
55
|
+
filterObjectByProperties( variation, 'typography' )
|
|
56
|
+
) === JSON.stringify( userTypographyConfig )
|
|
57
|
+
);
|
|
58
|
+
} );
|
|
59
|
+
if ( activeVariation ) {
|
|
60
|
+
return activeVariation.title;
|
|
61
|
+
}
|
|
62
|
+
return allFontFamilies.map( ( font ) => font?.name ).join( ', ' );
|
|
63
|
+
}, [ allFontFamilies, userTypographyConfig, variations ] );
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
hasFonts && (
|
|
67
|
+
<VStack spacing={ 2 }>
|
|
68
|
+
<HStack justify="space-between">
|
|
69
|
+
<Subtitle level={ 3 }>{ __( 'Typeset' ) }</Subtitle>
|
|
70
|
+
</HStack>
|
|
71
|
+
<ItemGroup isBordered isSeparated>
|
|
72
|
+
<NavigationButtonAsItem
|
|
73
|
+
path="/typography/typeset"
|
|
74
|
+
aria-label={ __( 'Typeset' ) }
|
|
75
|
+
>
|
|
76
|
+
<HStack direction="row">
|
|
77
|
+
<FlexItem>{ title }</FlexItem>
|
|
78
|
+
<Icon
|
|
79
|
+
icon={ isRTL() ? chevronLeft : chevronRight }
|
|
80
|
+
/>
|
|
81
|
+
</HStack>
|
|
82
|
+
</NavigationButtonAsItem>
|
|
83
|
+
</ItemGroup>
|
|
84
|
+
</VStack>
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default ( { ...props } ) => (
|
|
90
|
+
<FontLibraryProvider>
|
|
91
|
+
<TypesetButton { ...props } />
|
|
92
|
+
</FontLibraryProvider>
|
|
93
|
+
);
|