@wordpress/edit-site 6.4.0 → 6.5.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 +2 -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/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 +21 -6
- 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-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 +50 -59
- package/build/components/global-styles/shadows-edit-panel.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 +8 -226
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +26 -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 +18 -6
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +19 -15
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +125 -67
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build/components/sidebar-dataviews/add-new-view.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 +2 -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-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/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 +21 -6
- 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-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 +51 -60
- package/build-module/components/global-styles/shadows-edit-panel.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 +11 -229
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +26 -1
- 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 +20 -8
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +19 -15
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +127 -69
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +2 -2
- package/build-module/components/sidebar-dataviews/add-new-view.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 +2 -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-style/posts-rtl.css +190 -11
- package/build-style/posts.css +190 -11
- package/build-style/style-rtl.css +296 -55
- package/build-style/style.css +296 -55
- 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/utils.js +10 -6
- package/src/components/editor/index.js +80 -22
- package/src/components/editor/style.scss +59 -1
- 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 +23 -5
- package/src/components/global-styles/font-library-modal/style.scss +1 -1
- package/src/components/global-styles/font-library-modal/upload-fonts.js +2 -2
- 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 +66 -73
- 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 +15 -244
- package/src/components/page-patterns/style.scss +82 -85
- package/src/components/page-patterns/use-patterns.js +31 -1
- 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 +27 -8
- package/src/components/post-fields/index.js +29 -17
- package/src/components/post-list/index.js +134 -74
- package/src/components/sidebar-dataviews/add-new-view.js +2 -4
- 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 +2 -3
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -3
- package/src/index.js +0 -2
- 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
|
@@ -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,
|
|
@@ -395,13 +394,14 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) {
|
|
|
395
394
|
);
|
|
396
395
|
} }
|
|
397
396
|
renderContent={ () => (
|
|
398
|
-
<DropdownContentWrapper
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
397
|
+
<DropdownContentWrapper
|
|
398
|
+
paddingSize="medium"
|
|
399
|
+
className="edit-site-global-styles__shadow-editor__dropdown-content"
|
|
400
|
+
>
|
|
401
|
+
<ShadowPopover
|
|
402
|
+
shadowObj={ shadowObj }
|
|
403
|
+
onChange={ onShadowChange }
|
|
404
|
+
/>
|
|
405
405
|
</DropdownContentWrapper>
|
|
406
406
|
) }
|
|
407
407
|
/>
|
|
@@ -421,71 +421,64 @@ function ShadowPopover( { shadowObj, onChange } ) {
|
|
|
421
421
|
};
|
|
422
422
|
|
|
423
423
|
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>
|
|
424
|
+
<VStack
|
|
425
|
+
spacing={ 4 }
|
|
426
|
+
className="edit-site-global-styles__shadow-editor-panel"
|
|
427
|
+
>
|
|
428
|
+
<ColorPalette
|
|
429
|
+
clearable={ false }
|
|
430
|
+
enableAlpha={ enableAlpha }
|
|
431
|
+
__experimentalIsRenderedInSidebar={
|
|
432
|
+
__experimentalIsRenderedInSidebar
|
|
433
|
+
}
|
|
434
|
+
value={ shadowObj.color }
|
|
435
|
+
onChange={ ( value ) => onShadowChange( 'color', value ) }
|
|
436
|
+
/>
|
|
437
|
+
<ToggleGroupControl
|
|
438
|
+
__nextHasNoMarginBottom
|
|
439
|
+
value={ shadowObj.inset ? 'inset' : 'outset' }
|
|
440
|
+
isBlock
|
|
441
|
+
onChange={ ( value ) =>
|
|
442
|
+
onShadowChange( 'inset', value === 'inset' )
|
|
443
|
+
}
|
|
444
|
+
hideLabelFromVision
|
|
445
|
+
__next40pxDefaultSize
|
|
446
|
+
>
|
|
447
|
+
<ToggleGroupControlOption
|
|
448
|
+
value="outset"
|
|
449
|
+
label={ __( 'Outset' ) }
|
|
450
|
+
/>
|
|
451
|
+
<ToggleGroupControlOption
|
|
452
|
+
value="inset"
|
|
453
|
+
label={ __( 'Inset' ) }
|
|
454
|
+
/>
|
|
455
|
+
</ToggleGroupControl>
|
|
456
|
+
<Grid columns={ 2 } gap={ 4 }>
|
|
457
|
+
<ShadowInputControl
|
|
458
|
+
label={ __( 'X Position' ) }
|
|
459
|
+
value={ shadowObj.x }
|
|
460
|
+
hasNegativeRange
|
|
461
|
+
onChange={ ( value ) => onShadowChange( 'x', value ) }
|
|
462
|
+
/>
|
|
463
|
+
<ShadowInputControl
|
|
464
|
+
label={ __( 'Y Position' ) }
|
|
465
|
+
value={ shadowObj.y }
|
|
466
|
+
hasNegativeRange
|
|
467
|
+
onChange={ ( value ) => onShadowChange( 'y', value ) }
|
|
468
|
+
/>
|
|
469
|
+
<ShadowInputControl
|
|
470
|
+
label={ __( 'Blur' ) }
|
|
471
|
+
value={ shadowObj.blur }
|
|
472
|
+
onChange={ ( value ) => onShadowChange( 'blur', value ) }
|
|
473
|
+
/>
|
|
474
|
+
<ShadowInputControl
|
|
475
|
+
label={ __( 'Spread' ) }
|
|
476
|
+
value={ shadowObj.spread }
|
|
477
|
+
hasNegativeRange
|
|
478
|
+
onChange={ ( value ) => onShadowChange( 'spread', value ) }
|
|
479
|
+
/>
|
|
480
|
+
</Grid>
|
|
481
|
+
</VStack>
|
|
489
482
|
);
|
|
490
483
|
}
|
|
491
484
|
|
|
@@ -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
|
+
);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalItemGroup as ItemGroup,
|
|
7
|
+
__experimentalVStack as VStack,
|
|
8
|
+
__experimentalHStack as HStack,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
11
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
12
|
+
import { useContext } from '@wordpress/element';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import FontLibraryProvider, {
|
|
18
|
+
FontLibraryContext,
|
|
19
|
+
} from './font-library-modal/context';
|
|
20
|
+
import FontLibraryModal from './font-library-modal';
|
|
21
|
+
import FontFamilyItem from './font-family-item';
|
|
22
|
+
import Subtitle from './subtitle';
|
|
23
|
+
import { getFontFamilies } from './utils';
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
25
|
+
|
|
26
|
+
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
27
|
+
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
28
|
+
|
|
29
|
+
function Typesets() {
|
|
30
|
+
const { modalTabOpen, setModalTabOpen } = useContext( FontLibraryContext );
|
|
31
|
+
const { base } = useContext( GlobalStylesContext );
|
|
32
|
+
const { user: userConfig } = useContext( GlobalStylesContext );
|
|
33
|
+
const config = mergeBaseAndUserConfigs( base, userConfig );
|
|
34
|
+
const allFontFamilies = getFontFamilies( config );
|
|
35
|
+
const hasFonts =
|
|
36
|
+
allFontFamilies.filter( ( font ) => font !== null ).length > 0;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
hasFonts && (
|
|
40
|
+
<>
|
|
41
|
+
{ !! modalTabOpen && (
|
|
42
|
+
<FontLibraryModal
|
|
43
|
+
onRequestClose={ () => setModalTabOpen( null ) }
|
|
44
|
+
defaultTabId={ modalTabOpen }
|
|
45
|
+
/>
|
|
46
|
+
) }
|
|
47
|
+
|
|
48
|
+
<VStack spacing={ 2 }>
|
|
49
|
+
<HStack justify="space-between">
|
|
50
|
+
<Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
|
|
51
|
+
</HStack>
|
|
52
|
+
<ItemGroup isBordered isSeparated>
|
|
53
|
+
{ allFontFamilies.map(
|
|
54
|
+
( font ) =>
|
|
55
|
+
font && (
|
|
56
|
+
<FontFamilyItem
|
|
57
|
+
key={ font.slug }
|
|
58
|
+
font={ font }
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
) }
|
|
62
|
+
</ItemGroup>
|
|
63
|
+
</VStack>
|
|
64
|
+
</>
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default ( { ...props } ) => (
|
|
70
|
+
<FontLibraryProvider>
|
|
71
|
+
<Typesets { ...props } />
|
|
72
|
+
</FontLibraryProvider>
|
|
73
|
+
);
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from './screen-block-list';
|
|
33
33
|
import ScreenBlock from './screen-block';
|
|
34
34
|
import ScreenTypography from './screen-typography';
|
|
35
|
+
import ScreenTypeset from './screen-typeset';
|
|
35
36
|
import ScreenTypographyElement from './screen-typography-element';
|
|
36
37
|
import FontSize from './font-sizes/font-size';
|
|
37
38
|
import FontSizes from './font-sizes/font-sizes';
|
|
@@ -323,6 +324,10 @@ function GlobalStylesUI() {
|
|
|
323
324
|
<FontSize />
|
|
324
325
|
</GlobalStylesNavigationScreen>
|
|
325
326
|
|
|
327
|
+
<GlobalStylesNavigationScreen path="/typography/typeset">
|
|
328
|
+
<ScreenTypeset />
|
|
329
|
+
</GlobalStylesNavigationScreen>
|
|
330
|
+
|
|
326
331
|
<GlobalStylesNavigationScreen path="/typography/text">
|
|
327
332
|
<ScreenTypographyElement element="text" />
|
|
328
333
|
</GlobalStylesNavigationScreen>
|
|
@@ -52,7 +52,19 @@ function getFontFamilyFromSetting( fontFamilies, setting ) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export function getFontFamilies( themeJson ) {
|
|
55
|
-
const
|
|
55
|
+
const themeFontFamilies =
|
|
56
|
+
themeJson?.settings?.typography?.fontFamilies?.theme;
|
|
57
|
+
const customFontFamilies =
|
|
58
|
+
themeJson?.settings?.typography?.fontFamilies?.custom;
|
|
59
|
+
|
|
60
|
+
let fontFamilies = [];
|
|
61
|
+
if ( themeFontFamilies && customFontFamilies ) {
|
|
62
|
+
fontFamilies = [ ...themeFontFamilies, ...customFontFamilies ];
|
|
63
|
+
} else if ( themeFontFamilies ) {
|
|
64
|
+
fontFamilies = themeFontFamilies;
|
|
65
|
+
} else if ( customFontFamilies ) {
|
|
66
|
+
fontFamilies = customFontFamilies;
|
|
67
|
+
}
|
|
56
68
|
const bodyFontFamilySetting = themeJson?.styles?.typography?.fontFamily;
|
|
57
69
|
const bodyFontFamily = getFontFamilyFromSetting(
|
|
58
70
|
fontFamilies,
|
|
@@ -148,6 +148,14 @@
|
|
|
148
148
|
html.canvas-mode-edit-transition::view-transition-group(toggle) {
|
|
149
149
|
animation-delay: 255ms;
|
|
150
150
|
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion) {
|
|
153
|
+
::view-transition-group(*),
|
|
154
|
+
::view-transition-old(*),
|
|
155
|
+
::view-transition-new(*) {
|
|
156
|
+
animation: none !important;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
151
159
|
/* stylelint-enable */
|
|
152
160
|
|
|
153
161
|
.edit-site-layout.is-full-canvas .edit-site-layout__sidebar-region .edit-site-layout__view-mode-toggle {
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
__experimentalHStack as HStack,
|
|
11
|
+
Button,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Flex,
|
|
14
|
+
} from '@wordpress/components';
|
|
15
|
+
import { __, _x } from '@wordpress/i18n';
|
|
16
|
+
import { useState, useMemo, useId } from '@wordpress/element';
|
|
17
|
+
import {
|
|
18
|
+
BlockPreview,
|
|
19
|
+
privateApis as blockEditorPrivateApis,
|
|
20
|
+
} from '@wordpress/block-editor';
|
|
21
|
+
import { Icon, lockSmall } from '@wordpress/icons';
|
|
22
|
+
import { parse } from '@wordpress/blocks';
|
|
23
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { Async } from '../async';
|
|
29
|
+
import {
|
|
30
|
+
PATTERN_TYPES,
|
|
31
|
+
TEMPLATE_PART_POST_TYPE,
|
|
32
|
+
PATTERN_SYNC_TYPES,
|
|
33
|
+
OPERATOR_IS,
|
|
34
|
+
} from '../../utils/constants';
|
|
35
|
+
import { unlock } from '../../lock-unlock';
|
|
36
|
+
import { useLink } from '../routes/link';
|
|
37
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
38
|
+
import { defaultGetTitle } from './search-items';
|
|
39
|
+
|
|
40
|
+
const { useGlobalStyle } = unlock( blockEditorPrivateApis );
|
|
41
|
+
|
|
42
|
+
function PreviewWrapper( { item, onClick, ariaDescribedBy, children } ) {
|
|
43
|
+
return (
|
|
44
|
+
<button
|
|
45
|
+
className="page-patterns-preview-field__button"
|
|
46
|
+
type="button"
|
|
47
|
+
onClick={ item.type !== PATTERN_TYPES.theme ? onClick : undefined }
|
|
48
|
+
aria-label={ item.title }
|
|
49
|
+
aria-describedby={ ariaDescribedBy }
|
|
50
|
+
aria-disabled={ item.type === PATTERN_TYPES.theme }
|
|
51
|
+
>
|
|
52
|
+
{ children }
|
|
53
|
+
</button>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function PreviewField( { item } ) {
|
|
58
|
+
const descriptionId = useId();
|
|
59
|
+
const description = item.description || item?.excerpt?.raw;
|
|
60
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
61
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
62
|
+
const [ backgroundColor ] = useGlobalStyle( 'color.background' );
|
|
63
|
+
const { onClick } = useLink( {
|
|
64
|
+
postType: item.type,
|
|
65
|
+
postId: isUserPattern || isTemplatePart ? item.id : item.name,
|
|
66
|
+
canvas: 'edit',
|
|
67
|
+
} );
|
|
68
|
+
const blocks = useMemo( () => {
|
|
69
|
+
return (
|
|
70
|
+
item.blocks ??
|
|
71
|
+
parse( item.content.raw, {
|
|
72
|
+
__unstableSkipMigrationLogs: true,
|
|
73
|
+
} )
|
|
74
|
+
);
|
|
75
|
+
}, [ item?.content?.raw, item.blocks ] );
|
|
76
|
+
const isEmpty = ! blocks?.length;
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
className="page-patterns-preview-field"
|
|
81
|
+
style={ { backgroundColor } }
|
|
82
|
+
>
|
|
83
|
+
<PreviewWrapper
|
|
84
|
+
item={ item }
|
|
85
|
+
onClick={ onClick }
|
|
86
|
+
ariaDescribedBy={ !! description ? descriptionId : undefined }
|
|
87
|
+
>
|
|
88
|
+
{ isEmpty && isTemplatePart && __( 'Empty template part' ) }
|
|
89
|
+
{ isEmpty && ! isTemplatePart && __( 'Empty pattern' ) }
|
|
90
|
+
{ ! isEmpty && (
|
|
91
|
+
<Async>
|
|
92
|
+
<BlockPreview
|
|
93
|
+
blocks={ blocks }
|
|
94
|
+
viewportWidth={ item.viewportWidth }
|
|
95
|
+
/>
|
|
96
|
+
</Async>
|
|
97
|
+
) }
|
|
98
|
+
</PreviewWrapper>
|
|
99
|
+
{ !! description && (
|
|
100
|
+
<div hidden id={ descriptionId }>
|
|
101
|
+
{ description }
|
|
102
|
+
</div>
|
|
103
|
+
) }
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const previewField = {
|
|
109
|
+
label: __( 'Preview' ),
|
|
110
|
+
id: 'preview',
|
|
111
|
+
render: PreviewField,
|
|
112
|
+
enableSorting: false,
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function TitleField( { item } ) {
|
|
116
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
117
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
118
|
+
const { onClick } = useLink( {
|
|
119
|
+
postType: item.type,
|
|
120
|
+
postId: isUserPattern || isTemplatePart ? item.id : item.name,
|
|
121
|
+
canvas: 'edit',
|
|
122
|
+
} );
|
|
123
|
+
const title = decodeEntities( defaultGetTitle( item ) );
|
|
124
|
+
return (
|
|
125
|
+
<HStack alignment="center" justify="flex-start" spacing={ 2 }>
|
|
126
|
+
<Flex
|
|
127
|
+
as="div"
|
|
128
|
+
gap={ 0 }
|
|
129
|
+
justify="left"
|
|
130
|
+
className="edit-site-patterns__pattern-title"
|
|
131
|
+
>
|
|
132
|
+
{ item.type === PATTERN_TYPES.theme ? (
|
|
133
|
+
title
|
|
134
|
+
) : (
|
|
135
|
+
<Button
|
|
136
|
+
variant="link"
|
|
137
|
+
onClick={ onClick }
|
|
138
|
+
// Required for the grid's roving tab index system.
|
|
139
|
+
// See https://github.com/WordPress/gutenberg/pull/51898#discussion_r1243399243.
|
|
140
|
+
tabIndex="-1"
|
|
141
|
+
>
|
|
142
|
+
{ title }
|
|
143
|
+
</Button>
|
|
144
|
+
) }
|
|
145
|
+
</Flex>
|
|
146
|
+
{ item.type === PATTERN_TYPES.theme && (
|
|
147
|
+
<Tooltip
|
|
148
|
+
placement="top"
|
|
149
|
+
text={ __( 'This pattern cannot be edited.' ) }
|
|
150
|
+
>
|
|
151
|
+
<Icon
|
|
152
|
+
className="edit-site-patterns__pattern-lock-icon"
|
|
153
|
+
icon={ lockSmall }
|
|
154
|
+
size={ 24 }
|
|
155
|
+
/>
|
|
156
|
+
</Tooltip>
|
|
157
|
+
) }
|
|
158
|
+
</HStack>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export const titleField = {
|
|
163
|
+
label: __( 'Title' ),
|
|
164
|
+
id: 'title',
|
|
165
|
+
getValue: ( { item } ) => item.title?.raw || item.title,
|
|
166
|
+
render: TitleField,
|
|
167
|
+
enableHiding: false,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const SYNC_FILTERS = [
|
|
171
|
+
{
|
|
172
|
+
value: PATTERN_SYNC_TYPES.full,
|
|
173
|
+
label: _x( 'Synced', 'pattern (singular)' ),
|
|
174
|
+
description: __( 'Patterns that are kept in sync across the site.' ),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
value: PATTERN_SYNC_TYPES.unsynced,
|
|
178
|
+
label: _x( 'Not synced', 'pattern (singular)' ),
|
|
179
|
+
description: __(
|
|
180
|
+
'Patterns that can be changed freely without affecting the site.'
|
|
181
|
+
),
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
export const patternStatusField = {
|
|
186
|
+
label: __( 'Sync status' ),
|
|
187
|
+
id: 'sync-status',
|
|
188
|
+
render: ( { item } ) => {
|
|
189
|
+
const syncStatus =
|
|
190
|
+
'wp_pattern_sync_status' in item
|
|
191
|
+
? item.wp_pattern_sync_status || PATTERN_SYNC_TYPES.full
|
|
192
|
+
: PATTERN_SYNC_TYPES.unsynced;
|
|
193
|
+
// User patterns can have their sync statuses checked directly.
|
|
194
|
+
// Non-user patterns are all unsynced for the time being.
|
|
195
|
+
return (
|
|
196
|
+
<span
|
|
197
|
+
className={ `edit-site-patterns__field-sync-status-${ syncStatus }` }
|
|
198
|
+
>
|
|
199
|
+
{
|
|
200
|
+
SYNC_FILTERS.find( ( { value } ) => value === syncStatus )
|
|
201
|
+
.label
|
|
202
|
+
}
|
|
203
|
+
</span>
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
elements: SYNC_FILTERS,
|
|
207
|
+
filterBy: {
|
|
208
|
+
operators: [ OPERATOR_IS ],
|
|
209
|
+
isPrimary: true,
|
|
210
|
+
},
|
|
211
|
+
enableSorting: false,
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
function AuthorField( { item } ) {
|
|
215
|
+
const [ isImageLoaded, setIsImageLoaded ] = useState( false );
|
|
216
|
+
const { text, icon, imageUrl } = useAddedBy( item.type, item.id );
|
|
217
|
+
|
|
218
|
+
return (
|
|
219
|
+
<HStack alignment="left" spacing={ 0 }>
|
|
220
|
+
{ imageUrl && (
|
|
221
|
+
<div
|
|
222
|
+
className={ clsx( 'page-templates-author-field__avatar', {
|
|
223
|
+
'is-loaded': isImageLoaded,
|
|
224
|
+
} ) }
|
|
225
|
+
>
|
|
226
|
+
<img
|
|
227
|
+
onLoad={ () => setIsImageLoaded( true ) }
|
|
228
|
+
alt=""
|
|
229
|
+
src={ imageUrl }
|
|
230
|
+
/>
|
|
231
|
+
</div>
|
|
232
|
+
) }
|
|
233
|
+
{ ! imageUrl && (
|
|
234
|
+
<div className="page-templates-author-field__icon">
|
|
235
|
+
<Icon icon={ icon } />
|
|
236
|
+
</div>
|
|
237
|
+
) }
|
|
238
|
+
<span className="page-templates-author-field__name">{ text }</span>
|
|
239
|
+
</HStack>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export const templatePartAuthorField = {
|
|
244
|
+
label: __( 'Author' ),
|
|
245
|
+
id: 'author',
|
|
246
|
+
getValue: ( { item } ) => item.author_text,
|
|
247
|
+
render: AuthorField,
|
|
248
|
+
filterBy: {
|
|
249
|
+
isPrimary: true,
|
|
250
|
+
},
|
|
251
|
+
};
|