@wordpress/edit-site 6.15.0 → 6.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-template/utils.js +1 -1
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/global-styles/screen-root.js +1 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/maybe-editor/index.js +1 -0
- package/build/components/maybe-editor/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +1 -1
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/style-book/categories.js +13 -6
- package/build/components/style-book/categories.js.map +1 -1
- package/build/components/style-book/color-examples.js.map +1 -1
- package/build/components/style-book/duotone-examples.js.map +1 -1
- package/build/components/style-book/examples.js +7 -6
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/types.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -1
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +1 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/maybe-editor/index.js +1 -0
- package/build-module/components/maybe-editor/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +1 -1
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/style-book/categories.js +13 -6
- package/build-module/components/style-book/categories.js.map +1 -1
- package/build-module/components/style-book/color-examples.js +4 -1
- package/build-module/components/style-book/color-examples.js.map +1 -1
- package/build-module/components/style-book/duotone-examples.js.map +1 -1
- package/build-module/components/style-book/examples.js +11 -7
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/types.js.map +1 -1
- package/build-style/posts-rtl.css +29 -26
- package/build-style/posts.css +29 -26
- package/build-style/style-rtl.css +29 -26
- package/build-style/style.css +29 -26
- package/build-types/components/style-book/categories.d.ts +18 -0
- package/build-types/components/style-book/categories.d.ts.map +1 -0
- package/build-types/components/style-book/color-examples.d.ts +7 -0
- package/build-types/components/style-book/color-examples.d.ts.map +1 -0
- package/build-types/components/style-book/constants.d.ts +11 -0
- package/build-types/components/style-book/constants.d.ts.map +1 -0
- package/build-types/components/style-book/duotone-examples.d.ts +9 -0
- package/build-types/components/style-book/duotone-examples.d.ts.map +1 -0
- package/build-types/components/style-book/examples.d.ts +12 -0
- package/build-types/components/style-book/examples.d.ts.map +1 -0
- package/build-types/components/style-book/types.d.ts +72 -0
- package/build-types/components/style-book/types.d.ts.map +1 -0
- package/package.json +42 -42
- package/src/components/add-new-template/utils.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +1 -1
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/maybe-editor/index.js +3 -0
- package/src/components/resizable-frame/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/src/components/style-book/categories.ts +12 -6
- package/src/components/style-book/color-examples.tsx +4 -9
- package/src/components/style-book/duotone-examples.tsx +5 -1
- package/src/components/style-book/examples.tsx +23 -14
- package/src/components/style-book/types.ts +21 -1
- package/tsconfig.json +53 -0
- package/tsconfig.tsbuildinfo +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.16.0",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,46 +30,46 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "7.25.7",
|
|
32
32
|
"@react-spring/web": "^9.4.5",
|
|
33
|
-
"@wordpress/a11y": "^4.
|
|
34
|
-
"@wordpress/api-fetch": "^7.
|
|
35
|
-
"@wordpress/blob": "^4.
|
|
36
|
-
"@wordpress/block-editor": "^14.
|
|
37
|
-
"@wordpress/block-library": "^9.
|
|
38
|
-
"@wordpress/blocks": "^14.
|
|
39
|
-
"@wordpress/commands": "^1.
|
|
40
|
-
"@wordpress/components": "^29.
|
|
41
|
-
"@wordpress/compose": "^7.
|
|
42
|
-
"@wordpress/core-commands": "^1.
|
|
43
|
-
"@wordpress/core-data": "^7.
|
|
44
|
-
"@wordpress/data": "^10.
|
|
45
|
-
"@wordpress/dataviews": "^4.
|
|
46
|
-
"@wordpress/date": "^5.
|
|
47
|
-
"@wordpress/deprecated": "^4.
|
|
48
|
-
"@wordpress/dom": "^4.
|
|
49
|
-
"@wordpress/editor": "^14.
|
|
50
|
-
"@wordpress/element": "^6.
|
|
51
|
-
"@wordpress/escape-html": "^3.
|
|
52
|
-
"@wordpress/fields": "^0.
|
|
53
|
-
"@wordpress/hooks": "^4.
|
|
54
|
-
"@wordpress/html-entities": "^4.
|
|
55
|
-
"@wordpress/i18n": "^5.
|
|
56
|
-
"@wordpress/icons": "^10.
|
|
57
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
58
|
-
"@wordpress/keycodes": "^4.
|
|
59
|
-
"@wordpress/media-utils": "^5.
|
|
60
|
-
"@wordpress/notices": "^5.
|
|
61
|
-
"@wordpress/patterns": "^2.
|
|
62
|
-
"@wordpress/plugins": "^7.
|
|
63
|
-
"@wordpress/preferences": "^4.
|
|
64
|
-
"@wordpress/primitives": "^4.
|
|
65
|
-
"@wordpress/private-apis": "^1.
|
|
66
|
-
"@wordpress/reusable-blocks": "^5.
|
|
67
|
-
"@wordpress/router": "^1.
|
|
68
|
-
"@wordpress/style-engine": "^2.
|
|
69
|
-
"@wordpress/url": "^4.
|
|
70
|
-
"@wordpress/viewport": "^6.
|
|
71
|
-
"@wordpress/widgets": "^4.
|
|
72
|
-
"@wordpress/wordcount": "^4.
|
|
33
|
+
"@wordpress/a11y": "^4.16.0",
|
|
34
|
+
"@wordpress/api-fetch": "^7.16.0",
|
|
35
|
+
"@wordpress/blob": "^4.16.0",
|
|
36
|
+
"@wordpress/block-editor": "^14.11.0",
|
|
37
|
+
"@wordpress/block-library": "^9.16.0",
|
|
38
|
+
"@wordpress/blocks": "^14.5.0",
|
|
39
|
+
"@wordpress/commands": "^1.16.0",
|
|
40
|
+
"@wordpress/components": "^29.2.0",
|
|
41
|
+
"@wordpress/compose": "^7.16.0",
|
|
42
|
+
"@wordpress/core-commands": "^1.16.0",
|
|
43
|
+
"@wordpress/core-data": "^7.16.0",
|
|
44
|
+
"@wordpress/data": "^10.16.0",
|
|
45
|
+
"@wordpress/dataviews": "^4.12.0",
|
|
46
|
+
"@wordpress/date": "^5.16.0",
|
|
47
|
+
"@wordpress/deprecated": "^4.16.0",
|
|
48
|
+
"@wordpress/dom": "^4.16.0",
|
|
49
|
+
"@wordpress/editor": "^14.16.0",
|
|
50
|
+
"@wordpress/element": "^6.16.0",
|
|
51
|
+
"@wordpress/escape-html": "^3.16.0",
|
|
52
|
+
"@wordpress/fields": "^0.8.0",
|
|
53
|
+
"@wordpress/hooks": "^4.16.0",
|
|
54
|
+
"@wordpress/html-entities": "^4.16.0",
|
|
55
|
+
"@wordpress/i18n": "^5.16.0",
|
|
56
|
+
"@wordpress/icons": "^10.16.0",
|
|
57
|
+
"@wordpress/keyboard-shortcuts": "^5.16.0",
|
|
58
|
+
"@wordpress/keycodes": "^4.16.0",
|
|
59
|
+
"@wordpress/media-utils": "^5.16.0",
|
|
60
|
+
"@wordpress/notices": "^5.16.0",
|
|
61
|
+
"@wordpress/patterns": "^2.16.0",
|
|
62
|
+
"@wordpress/plugins": "^7.16.0",
|
|
63
|
+
"@wordpress/preferences": "^4.16.0",
|
|
64
|
+
"@wordpress/primitives": "^4.16.0",
|
|
65
|
+
"@wordpress/private-apis": "^1.16.0",
|
|
66
|
+
"@wordpress/reusable-blocks": "^5.16.0",
|
|
67
|
+
"@wordpress/router": "^1.16.0",
|
|
68
|
+
"@wordpress/style-engine": "^2.16.0",
|
|
69
|
+
"@wordpress/url": "^4.16.0",
|
|
70
|
+
"@wordpress/viewport": "^6.16.0",
|
|
71
|
+
"@wordpress/widgets": "^4.16.0",
|
|
72
|
+
"@wordpress/wordcount": "^4.16.0",
|
|
73
73
|
"change-case": "^4.1.2",
|
|
74
74
|
"clsx": "^2.1.1",
|
|
75
75
|
"colord": "^2.9.2",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "f48b9f56629e400891abb5ae491504de475237ff"
|
|
88
88
|
}
|
|
@@ -36,7 +36,7 @@ const getValueFromObjectPath = ( object, path ) => {
|
|
|
36
36
|
*
|
|
37
37
|
* @param {Object[]} entities The array of entities.
|
|
38
38
|
* @param {string} path The path to map a `name` property from the entity.
|
|
39
|
-
* @return {IHasNameAndId[]} An array of
|
|
39
|
+
* @return {IHasNameAndId[]} An array of entities that now implement the `IHasNameAndId` interface.
|
|
40
40
|
*/
|
|
41
41
|
export const mapToIHasNameAndId = ( entities, path ) => {
|
|
42
42
|
return ( entities || [] ).map( ( entity ) => ( {
|
|
@@ -201,7 +201,7 @@ describe( 'formatFontFaceName', () => {
|
|
|
201
201
|
);
|
|
202
202
|
} );
|
|
203
203
|
|
|
204
|
-
it( 'should
|
|
204
|
+
it( 'should output the font face name with quotes on Firefox', () => {
|
|
205
205
|
const mockUserAgent =
|
|
206
206
|
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0';
|
|
207
207
|
|
|
@@ -93,7 +93,7 @@ function ScreenRoot() {
|
|
|
93
93
|
paddingTop={ 2 }
|
|
94
94
|
/*
|
|
95
95
|
* 13px matches the text inset of the NavigationButton (12px padding, plus the width of the button's border).
|
|
96
|
-
* This is an ad hoc override for this instance and the
|
|
96
|
+
* This is an ad hoc override for this instance and the Additional CSS option below. Other options for matching the
|
|
97
97
|
* the nav button inset should be looked at before reusing further.
|
|
98
98
|
*/
|
|
99
99
|
paddingX="13px"
|
|
@@ -43,6 +43,9 @@ export function MaybeEditor( { showEditor = true } ) {
|
|
|
43
43
|
document
|
|
44
44
|
.getElementsByTagName( 'html' )[ 0 ]
|
|
45
45
|
.setAttribute( 'style', 'margin-top: 0 !important;' );
|
|
46
|
+
document
|
|
47
|
+
.getElementsByTagName( 'body' )[ 0 ]
|
|
48
|
+
.classList.remove( 'admin-bar' );
|
|
46
49
|
// Make interactive elements unclickable.
|
|
47
50
|
const interactiveElements = document.querySelectorAll(
|
|
48
51
|
'a, button, input, details, audio'
|
|
@@ -86,7 +86,7 @@ function ResizableFrame( {
|
|
|
86
86
|
setIsOversized,
|
|
87
87
|
isReady,
|
|
88
88
|
children,
|
|
89
|
-
/** The default (unresized) width/height of the frame, based on the space
|
|
89
|
+
/** The default (unresized) width/height of the frame, based on the space available in the viewport. */
|
|
90
90
|
defaultSize,
|
|
91
91
|
innerContentStyle,
|
|
92
92
|
} ) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
// @wordpress/blocks imports are not typed.
|
|
5
|
+
// @ts-expect-error
|
|
4
6
|
import { getCategories } from '@wordpress/blocks';
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -29,15 +31,19 @@ export function getExamplesByCategory(
|
|
|
29
31
|
if ( ! categoryDefinition?.slug || ! examples?.length ) {
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const categories: CategoryExamples[] =
|
|
35
|
+
categoryDefinition?.subcategories ?? [];
|
|
36
|
+
if ( categories.length ) {
|
|
37
|
+
return categories.reduce(
|
|
35
38
|
( acc, subcategoryDefinition ) => {
|
|
36
39
|
const subcategoryExamples = getExamplesByCategory(
|
|
37
40
|
subcategoryDefinition,
|
|
38
41
|
examples
|
|
39
42
|
);
|
|
40
43
|
if ( subcategoryExamples ) {
|
|
44
|
+
if ( ! acc.subcategories ) {
|
|
45
|
+
acc.subcategories = [];
|
|
46
|
+
}
|
|
41
47
|
acc.subcategories = [
|
|
42
48
|
...acc.subcategories,
|
|
43
49
|
subcategoryExamples,
|
|
@@ -48,7 +54,6 @@ export function getExamplesByCategory(
|
|
|
48
54
|
{
|
|
49
55
|
title: categoryDefinition.title,
|
|
50
56
|
slug: categoryDefinition.slug,
|
|
51
|
-
subcategories: [],
|
|
52
57
|
}
|
|
53
58
|
);
|
|
54
59
|
}
|
|
@@ -84,8 +89,9 @@ export function getTopLevelStyleBookCategories(): StyleBookCategory[] {
|
|
|
84
89
|
...STYLE_BOOK_THEME_SUBCATEGORIES,
|
|
85
90
|
...STYLE_BOOK_CATEGORIES,
|
|
86
91
|
].map( ( { slug } ) => slug );
|
|
87
|
-
const extraCategories = getCategories()
|
|
92
|
+
const extraCategories: StyleBookCategory[] = getCategories();
|
|
93
|
+
const extraCategoriesFiltered = extraCategories.filter(
|
|
88
94
|
( { slug } ) => ! reservedCategories.includes( slug )
|
|
89
95
|
);
|
|
90
|
-
return [ ...STYLE_BOOK_CATEGORIES, ...
|
|
96
|
+
return [ ...STYLE_BOOK_CATEGORIES, ...extraCategoriesFiltered ];
|
|
91
97
|
}
|
|
@@ -11,26 +11,21 @@ import { View } from '@wordpress/primitives';
|
|
|
11
11
|
import {
|
|
12
12
|
getColorClassName,
|
|
13
13
|
__experimentalGetGradientClass,
|
|
14
|
+
// @wordpress/block-editor imports are not typed.
|
|
15
|
+
// @ts-expect-error
|
|
14
16
|
} from '@wordpress/block-editor';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
18
20
|
*/
|
|
19
|
-
import type { Color, Gradient } from './types';
|
|
20
|
-
|
|
21
|
-
type Props = {
|
|
22
|
-
colors: Color[] | Gradient[];
|
|
23
|
-
type: 'colors' | 'gradients';
|
|
24
|
-
templateColumns?: string | number;
|
|
25
|
-
itemHeight?: string;
|
|
26
|
-
};
|
|
21
|
+
import type { Color, Gradient, ColorExampleProps } from './types';
|
|
27
22
|
|
|
28
23
|
const ColorExamples = ( {
|
|
29
24
|
colors,
|
|
30
25
|
type,
|
|
31
26
|
templateColumns = '1fr 1fr',
|
|
32
27
|
itemHeight = '52px',
|
|
33
|
-
}:
|
|
28
|
+
}: ColorExampleProps ): JSX.Element | null => {
|
|
34
29
|
if ( ! colors ) {
|
|
35
30
|
return null;
|
|
36
31
|
}
|
|
@@ -9,7 +9,11 @@ import { View } from '@wordpress/primitives';
|
|
|
9
9
|
*/
|
|
10
10
|
import type { Duotone } from './types';
|
|
11
11
|
|
|
12
|
-
const DuotoneExamples = ( {
|
|
12
|
+
const DuotoneExamples = ( {
|
|
13
|
+
duotones,
|
|
14
|
+
}: {
|
|
15
|
+
duotones: Duotone[];
|
|
16
|
+
} ): JSX.Element | null => {
|
|
13
17
|
if ( ! duotones ) {
|
|
14
18
|
return null;
|
|
15
19
|
}
|
|
@@ -7,16 +7,18 @@ import {
|
|
|
7
7
|
getBlockTypes,
|
|
8
8
|
getBlockFromExample,
|
|
9
9
|
createBlock,
|
|
10
|
+
// @wordpress/blocks imports are not typed.
|
|
11
|
+
// @ts-expect-error
|
|
10
12
|
} from '@wordpress/blocks';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
14
16
|
*/
|
|
15
17
|
import type {
|
|
16
|
-
Block,
|
|
17
18
|
BlockExample,
|
|
18
19
|
ColorOrigin,
|
|
19
20
|
MultiOriginPalettes,
|
|
21
|
+
BlockType,
|
|
20
22
|
} from './types';
|
|
21
23
|
import ColorExamples from './color-examples';
|
|
22
24
|
import DuotoneExamples from './duotone-examples';
|
|
@@ -37,11 +39,14 @@ function getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
37
39
|
const examples: BlockExample[] = [];
|
|
38
40
|
|
|
39
41
|
STYLE_BOOK_COLOR_GROUPS.forEach( ( group ) => {
|
|
40
|
-
const palette = colors[ group.type ]
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const palette = colors[ group.type as keyof MultiOriginPalettes ];
|
|
43
|
+
const paletteFiltered = Array.isArray( palette )
|
|
44
|
+
? palette.find(
|
|
45
|
+
( origin: ColorOrigin ) => origin.slug === group.origin
|
|
46
|
+
)
|
|
47
|
+
: undefined;
|
|
43
48
|
|
|
44
|
-
if (
|
|
49
|
+
if ( paletteFiltered?.[ group.type ] ) {
|
|
45
50
|
const example: BlockExample = {
|
|
46
51
|
name: group.slug,
|
|
47
52
|
title: group.title,
|
|
@@ -49,13 +54,15 @@ function getColorExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
49
54
|
};
|
|
50
55
|
if ( group.type === 'duotones' ) {
|
|
51
56
|
example.content = (
|
|
52
|
-
<DuotoneExamples
|
|
57
|
+
<DuotoneExamples
|
|
58
|
+
duotones={ paletteFiltered[ group.type ] }
|
|
59
|
+
/>
|
|
53
60
|
);
|
|
54
61
|
examples.push( example );
|
|
55
62
|
} else {
|
|
56
63
|
example.content = (
|
|
57
64
|
<ColorExamples
|
|
58
|
-
colors={
|
|
65
|
+
colors={ paletteFiltered[ group.type ] }
|
|
59
66
|
type={ group.type }
|
|
60
67
|
/>
|
|
61
68
|
);
|
|
@@ -79,9 +86,11 @@ function getOverviewBlockExamples(
|
|
|
79
86
|
const examples: BlockExample[] = [];
|
|
80
87
|
|
|
81
88
|
// Get theme palette from colors if they exist.
|
|
82
|
-
const themePalette = colors?.colors
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
const themePalette = Array.isArray( colors?.colors )
|
|
90
|
+
? colors.colors.find(
|
|
91
|
+
( origin: ColorOrigin ) => origin.slug === 'theme'
|
|
92
|
+
)
|
|
93
|
+
: undefined;
|
|
85
94
|
|
|
86
95
|
if ( themePalette ) {
|
|
87
96
|
const themeColorexample: BlockExample = {
|
|
@@ -91,7 +100,7 @@ function getOverviewBlockExamples(
|
|
|
91
100
|
content: (
|
|
92
101
|
<ColorExamples
|
|
93
102
|
colors={ themePalette.colors }
|
|
94
|
-
type=
|
|
103
|
+
type="colors"
|
|
95
104
|
templateColumns="repeat(auto-fill, minmax( 200px, 1fr ))"
|
|
96
105
|
itemHeight="32px"
|
|
97
106
|
/>
|
|
@@ -102,7 +111,7 @@ function getOverviewBlockExamples(
|
|
|
102
111
|
}
|
|
103
112
|
|
|
104
113
|
// Get examples for typography blocks.
|
|
105
|
-
const typographyBlockExamples:
|
|
114
|
+
const typographyBlockExamples: BlockType[] = [];
|
|
106
115
|
|
|
107
116
|
if ( getBlockType( 'core/heading' ) ) {
|
|
108
117
|
const headingBlock = createBlock( 'core/heading', {
|
|
@@ -202,7 +211,7 @@ function getOverviewBlockExamples(
|
|
|
202
211
|
*/
|
|
203
212
|
export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
204
213
|
const nonHeadingBlockExamples = getBlockTypes()
|
|
205
|
-
.filter( ( blockType ) => {
|
|
214
|
+
.filter( ( blockType: BlockType ) => {
|
|
206
215
|
const { name, example, supports } = blockType;
|
|
207
216
|
return (
|
|
208
217
|
name !== 'core/heading' &&
|
|
@@ -210,7 +219,7 @@ export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
210
219
|
supports?.inserter !== false
|
|
211
220
|
);
|
|
212
221
|
} )
|
|
213
|
-
.map( ( blockType ) => ( {
|
|
222
|
+
.map( ( blockType: BlockType ) => ( {
|
|
214
223
|
name: blockType.name,
|
|
215
224
|
title: blockType.title,
|
|
216
225
|
category: blockType.category,
|
|
@@ -32,7 +32,7 @@ export type StyleBookColorGroup = {
|
|
|
32
32
|
origin: string;
|
|
33
33
|
slug: string;
|
|
34
34
|
title: string;
|
|
35
|
-
type:
|
|
35
|
+
type: 'colors' | 'gradients' | 'duotones';
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export type Color = { slug: string };
|
|
@@ -42,6 +42,13 @@ export type Duotone = {
|
|
|
42
42
|
slug: string;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
export type ColorExampleProps = {
|
|
46
|
+
colors: Color[] | Gradient[];
|
|
47
|
+
type: StyleBookColorGroup[ 'type' ];
|
|
48
|
+
templateColumns?: string | number;
|
|
49
|
+
itemHeight?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
45
52
|
export type ColorOrigin = {
|
|
46
53
|
name: string;
|
|
47
54
|
slug: string;
|
|
@@ -58,3 +65,16 @@ export type MultiOriginPalettes = {
|
|
|
58
65
|
duotones: Omit< ColorOrigin, 'colors' | 'gradients' >;
|
|
59
66
|
gradients: Omit< ColorOrigin, 'colors' | 'duotones' >;
|
|
60
67
|
};
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* Typing the items from getBlockTypes from '@wordpress/blocks'
|
|
71
|
+
* to appease the TS linter.
|
|
72
|
+
*/
|
|
73
|
+
export type BlockType = {
|
|
74
|
+
name: string;
|
|
75
|
+
title: string;
|
|
76
|
+
category: string;
|
|
77
|
+
example: BlockType;
|
|
78
|
+
attributes: Record< string, unknown >;
|
|
79
|
+
supports: Record< string, unknown >;
|
|
80
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig.json",
|
|
3
|
+
"extends": "../../tsconfig.base.json",
|
|
4
|
+
"references": [
|
|
5
|
+
{ "path": "../a11y" },
|
|
6
|
+
{ "path": "../api-fetch" },
|
|
7
|
+
{ "path": "../autop" },
|
|
8
|
+
{ "path": "../blob" },
|
|
9
|
+
{ "path": "../block-library" },
|
|
10
|
+
{ "path": "../block-editor" },
|
|
11
|
+
{ "path": "../components" },
|
|
12
|
+
{ "path": "../compose" },
|
|
13
|
+
{ "path": "../core-data" },
|
|
14
|
+
{ "path": "../data" },
|
|
15
|
+
{ "path": "../dataviews" },
|
|
16
|
+
{ "path": "../date" },
|
|
17
|
+
{ "path": "../deprecated" },
|
|
18
|
+
{ "path": "../dom" },
|
|
19
|
+
{ "path": "../editor" },
|
|
20
|
+
{ "path": "../element" },
|
|
21
|
+
{ "path": "../escape-html" },
|
|
22
|
+
{ "path": "../fields" },
|
|
23
|
+
{ "path": "../hooks" },
|
|
24
|
+
{ "path": "../html-entities" },
|
|
25
|
+
{ "path": "../i18n" },
|
|
26
|
+
{ "path": "../icons" },
|
|
27
|
+
{ "path": "../interactivity" },
|
|
28
|
+
{ "path": "../interactivity-router" },
|
|
29
|
+
{ "path": "../media-utils" },
|
|
30
|
+
{ "path": "../notices" },
|
|
31
|
+
{ "path": "../keycodes" },
|
|
32
|
+
{ "path": "../plugins" },
|
|
33
|
+
{ "path": "../primitives" },
|
|
34
|
+
{ "path": "../private-apis" },
|
|
35
|
+
{ "path": "../rich-text" },
|
|
36
|
+
{ "path": "../router" },
|
|
37
|
+
{ "path": "../style-engine" },
|
|
38
|
+
{ "path": "../url" },
|
|
39
|
+
{ "path": "../wordcount" }
|
|
40
|
+
],
|
|
41
|
+
// NOTE: This package is being progressively typed. You are encouraged to
|
|
42
|
+
// expand this array with files which can be type-checked. At some point in
|
|
43
|
+
// the future, this can be simplified to an `includes` of `src/**/*`.
|
|
44
|
+
"files": [
|
|
45
|
+
"src/components/style-book/categories.ts",
|
|
46
|
+
"src/components/style-book/constants.ts",
|
|
47
|
+
"src/components/style-book/types.ts",
|
|
48
|
+
"src/components/style-book/color-examples.tsx",
|
|
49
|
+
"src/components/style-book/duotone-examples.tsx",
|
|
50
|
+
"src/components/style-book/examples.tsx"
|
|
51
|
+
],
|
|
52
|
+
"include": []
|
|
53
|
+
}
|