@wordpress/core-data 4.1.0 → 4.1.2
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 +6 -0
- package/README.md +9 -3
- package/build/actions.js +1 -1
- package/build/actions.js.map +1 -1
- package/build/hooks/constants.js +18 -0
- package/build/hooks/constants.js.map +1 -0
- package/build/hooks/memoize.js +18 -0
- package/build/hooks/memoize.js.map +1 -0
- package/build/hooks/use-entity-record.js +60 -0
- package/build/hooks/use-entity-record.js.map +1 -0
- package/build/hooks/use-entity-records.js +67 -0
- package/build/hooks/use-entity-records.js.map +1 -0
- package/build/hooks/use-query-select.js +130 -0
- package/build/hooks/use-query-select.js.map +1 -0
- package/build/index.js +34 -3
- package/build/index.js.map +1 -1
- package/build/resolvers.js +2 -17
- package/build/resolvers.js.map +1 -1
- package/build/types/attachment.js +6 -0
- package/build/types/attachment.js.map +1 -0
- package/build/types/base-entity-types.js +47 -0
- package/build/types/base-entity-types.js.map +1 -0
- package/build/types/comment.js +6 -0
- package/build/types/comment.js.map +1 -0
- package/build/types/helpers.js +6 -0
- package/build/types/helpers.js.map +1 -0
- package/build/types/index.js +6 -0
- package/build/types/index.js.map +1 -0
- package/build/types/menu-location.js +6 -0
- package/build/types/menu-location.js.map +1 -0
- package/build/types/nav-menu-item.js +6 -0
- package/build/types/nav-menu-item.js.map +1 -0
- package/build/types/nav-menu.js +6 -0
- package/build/types/nav-menu.js.map +1 -0
- package/build/types/navigation-area.js +6 -0
- package/build/types/navigation-area.js.map +1 -0
- package/build/types/page.js +6 -0
- package/build/types/page.js.map +1 -0
- package/build/types/plugin.js +6 -0
- package/build/types/plugin.js.map +1 -0
- package/build/types/post.js +6 -0
- package/build/types/post.js.map +1 -0
- package/build/types/settings.js +6 -0
- package/build/types/settings.js.map +1 -0
- package/build/types/sidebar.js +6 -0
- package/build/types/sidebar.js.map +1 -0
- package/build/types/taxonomy.js +6 -0
- package/build/types/taxonomy.js.map +1 -0
- package/build/types/theme.js +6 -0
- package/build/types/theme.js.map +1 -0
- package/build/types/type.js +6 -0
- package/build/types/type.js.map +1 -0
- package/build/types/user.js +6 -0
- package/build/types/user.js.map +1 -0
- package/build/types/widget-type.js +6 -0
- package/build/types/widget-type.js.map +1 -0
- package/build/types/widget.js +6 -0
- package/build/types/widget.js.map +1 -0
- package/build/types/wp-template-part.js +6 -0
- package/build/types/wp-template-part.js.map +1 -0
- package/build/types/wp-template.js +6 -0
- package/build/types/wp-template.js.map +1 -0
- package/build-module/actions.js +1 -1
- package/build-module/actions.js.map +1 -1
- package/build-module/hooks/constants.js +10 -0
- package/build-module/hooks/constants.js.map +1 -0
- package/build-module/hooks/memoize.js +7 -0
- package/build-module/hooks/memoize.js.map +1 -0
- package/build-module/hooks/use-entity-record.js +49 -0
- package/build-module/hooks/use-entity-record.js.map +1 -0
- package/build-module/hooks/use-entity-records.js +56 -0
- package/build-module/hooks/use-entity-records.js.map +1 -0
- package/build-module/hooks/use-query-select.js +116 -0
- package/build-module/hooks/use-query-select.js.map +1 -0
- package/build-module/index.js +4 -2
- package/build-module/index.js.map +1 -1
- package/build-module/resolvers.js +3 -18
- package/build-module/resolvers.js.map +1 -1
- package/build-module/types/attachment.js +2 -0
- package/build-module/types/attachment.js.map +1 -0
- package/build-module/types/base-entity-types.js +39 -0
- package/build-module/types/base-entity-types.js.map +1 -0
- package/build-module/types/comment.js +2 -0
- package/build-module/types/comment.js.map +1 -0
- package/build-module/types/helpers.js +2 -0
- package/build-module/types/helpers.js.map +1 -0
- package/build-module/types/index.js +2 -0
- package/build-module/types/index.js.map +1 -0
- package/build-module/types/menu-location.js +2 -0
- package/build-module/types/menu-location.js.map +1 -0
- package/build-module/types/nav-menu-item.js +2 -0
- package/build-module/types/nav-menu-item.js.map +1 -0
- package/build-module/types/nav-menu.js +2 -0
- package/build-module/types/nav-menu.js.map +1 -0
- package/build-module/types/navigation-area.js +2 -0
- package/build-module/types/navigation-area.js.map +1 -0
- package/build-module/types/page.js +2 -0
- package/build-module/types/page.js.map +1 -0
- package/build-module/types/plugin.js +2 -0
- package/build-module/types/plugin.js.map +1 -0
- package/build-module/types/post.js +2 -0
- package/build-module/types/post.js.map +1 -0
- package/build-module/types/settings.js +2 -0
- package/build-module/types/settings.js.map +1 -0
- package/build-module/types/sidebar.js +2 -0
- package/build-module/types/sidebar.js.map +1 -0
- package/build-module/types/taxonomy.js +2 -0
- package/build-module/types/taxonomy.js.map +1 -0
- package/build-module/types/theme.js +2 -0
- package/build-module/types/theme.js.map +1 -0
- package/build-module/types/type.js +2 -0
- package/build-module/types/type.js.map +1 -0
- package/build-module/types/user.js +2 -0
- package/build-module/types/user.js.map +1 -0
- package/build-module/types/widget-type.js +2 -0
- package/build-module/types/widget-type.js.map +1 -0
- package/build-module/types/widget.js +2 -0
- package/build-module/types/widget.js.map +1 -0
- package/build-module/types/wp-template-part.js +2 -0
- package/build-module/types/wp-template-part.js.map +1 -0
- package/build-module/types/wp-template.js +2 -0
- package/build-module/types/wp-template.js.map +1 -0
- package/package.json +12 -11
- package/src/actions.js +1 -1
- package/src/hooks/constants.ts +7 -0
- package/src/hooks/memoize.js +7 -0
- package/src/hooks/test/use-entity-record.js +74 -0
- package/src/hooks/test/use-entity-records.js +78 -0
- package/src/hooks/test/use-query-select.js +194 -0
- package/src/hooks/use-entity-record.ts +72 -0
- package/src/hooks/use-entity-records.ts +79 -0
- package/src/hooks/use-query-select.ts +131 -0
- package/src/index.js +3 -1
- package/src/resolvers.js +3 -17
- package/src/test/resolvers.js +4 -10
- package/src/types/README.md +193 -0
- package/src/types/attachment.ts +146 -0
- package/src/types/base-entity-types.ts +36 -0
- package/src/types/comment.ts +96 -0
- package/src/types/helpers.ts +153 -0
- package/src/types/index.ts +72 -0
- package/src/types/menu-location.ts +29 -0
- package/src/types/nav-menu-item.ts +106 -0
- package/src/types/nav-menu.ts +53 -0
- package/src/types/navigation-area.ts +29 -0
- package/src/types/page.ts +144 -0
- package/src/types/plugin.ts +74 -0
- package/src/types/post.ts +153 -0
- package/src/types/settings.ts +93 -0
- package/src/types/sidebar.ts +60 -0
- package/src/types/taxonomy.ts +92 -0
- package/src/types/theme.ts +222 -0
- package/src/types/type.ts +80 -0
- package/src/types/user.ts +109 -0
- package/src/types/widget-type.ts +37 -0
- package/src/types/widget.ts +64 -0
- package/src/types/wp-template-part.ts +94 -0
- package/src/types/wp-template.ts +94 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Widget } from './widget';
|
|
5
|
+
import { Context, OmitNevers } from './helpers';
|
|
6
|
+
|
|
7
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
8
|
+
|
|
9
|
+
declare module './base-entity-types' {
|
|
10
|
+
export namespace BaseEntityTypes {
|
|
11
|
+
export interface Sidebar< C extends Context > {
|
|
12
|
+
/**
|
|
13
|
+
* ID of sidebar.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* Unique name identifying the sidebar.
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* Description of sidebar.
|
|
22
|
+
*/
|
|
23
|
+
description: string;
|
|
24
|
+
/**
|
|
25
|
+
* Extra CSS class to assign to the sidebar in the Widgets interface.
|
|
26
|
+
*/
|
|
27
|
+
class: string;
|
|
28
|
+
/**
|
|
29
|
+
* HTML content to prepend to each widget's HTML output when assigned to this sidebar. Default is an opening list item element.
|
|
30
|
+
*/
|
|
31
|
+
before_widget: string;
|
|
32
|
+
/**
|
|
33
|
+
* HTML content to append to each widget's HTML output when assigned to this sidebar. Default is a closing list item element.
|
|
34
|
+
*/
|
|
35
|
+
after_widget: string;
|
|
36
|
+
/**
|
|
37
|
+
* HTML content to prepend to the sidebar title when displayed. Default is an opening h2 element.
|
|
38
|
+
*/
|
|
39
|
+
before_title: string;
|
|
40
|
+
/**
|
|
41
|
+
* HTML content to append to the sidebar title when displayed. Default is a closing h2 element.
|
|
42
|
+
*/
|
|
43
|
+
after_title: string;
|
|
44
|
+
/**
|
|
45
|
+
* Status of sidebar.
|
|
46
|
+
*/
|
|
47
|
+
status: SidebarStatus;
|
|
48
|
+
/**
|
|
49
|
+
* Nested widgets.
|
|
50
|
+
*/
|
|
51
|
+
widgets: ( Widget< C > | string )[];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type SidebarStatus = 'active' | 'inactive';
|
|
57
|
+
|
|
58
|
+
export type Sidebar< C extends Context > = OmitNevers<
|
|
59
|
+
_BaseEntityTypes.Sidebar< C >
|
|
60
|
+
>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Context, ContextualField, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface Taxonomy< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* All capabilities used by the taxonomy.
|
|
13
|
+
*/
|
|
14
|
+
capabilities: ContextualField<
|
|
15
|
+
Record< string, string >,
|
|
16
|
+
'edit',
|
|
17
|
+
C
|
|
18
|
+
>;
|
|
19
|
+
/**
|
|
20
|
+
* A human-readable description of the taxonomy.
|
|
21
|
+
*/
|
|
22
|
+
description: ContextualField< string, 'view' | 'edit', C >;
|
|
23
|
+
/**
|
|
24
|
+
* Whether or not the taxonomy should have children.
|
|
25
|
+
*/
|
|
26
|
+
hierarchical: ContextualField< boolean, 'view' | 'edit', C >;
|
|
27
|
+
/**
|
|
28
|
+
* Human-readable labels for the taxonomy for various contexts.
|
|
29
|
+
*/
|
|
30
|
+
labels: ContextualField< Record< string, string >, 'edit', C >;
|
|
31
|
+
/**
|
|
32
|
+
* The title for the taxonomy.
|
|
33
|
+
*/
|
|
34
|
+
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* An alphanumeric identifier for the taxonomy.
|
|
37
|
+
*/
|
|
38
|
+
slug: string;
|
|
39
|
+
/**
|
|
40
|
+
* Whether or not the term cloud should be displayed.
|
|
41
|
+
*/
|
|
42
|
+
show_cloud: ContextualField< boolean, 'edit', C >;
|
|
43
|
+
/**
|
|
44
|
+
* Types associated with the taxonomy.
|
|
45
|
+
*/
|
|
46
|
+
types: ContextualField< string[], 'view' | 'edit', C >;
|
|
47
|
+
/**
|
|
48
|
+
* REST base route for the taxonomy.
|
|
49
|
+
*/
|
|
50
|
+
rest_base: string;
|
|
51
|
+
/**
|
|
52
|
+
* REST namespace route for the taxonomy.
|
|
53
|
+
*/
|
|
54
|
+
rest_namespace: string;
|
|
55
|
+
/**
|
|
56
|
+
* The visibility settings for the taxonomy.
|
|
57
|
+
*/
|
|
58
|
+
visibility: TaxonomyVisibility;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface TaxonomyVisibility {
|
|
62
|
+
/**
|
|
63
|
+
* Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.
|
|
64
|
+
*/
|
|
65
|
+
public: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the taxonomy is publicly queryable.
|
|
68
|
+
*/
|
|
69
|
+
publicly_queryable: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to generate a default UI for managing this taxonomy.
|
|
72
|
+
*/
|
|
73
|
+
show_ui: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to allow automatic creation of taxonomy columns on associated post-types table.
|
|
76
|
+
*/
|
|
77
|
+
show_admin_column: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to make the taxonomy available for selection in navigation menus.
|
|
80
|
+
*/
|
|
81
|
+
show_in_nav_menus: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether to show the taxonomy in the quick/bulk edit panel.
|
|
84
|
+
*/
|
|
85
|
+
show_in_quick_edit: boolean;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type Taxonomy< C extends Context > = OmitNevers<
|
|
91
|
+
_BaseEntityTypes.Taxonomy< C >
|
|
92
|
+
>;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Context, PostFormat, RenderedText, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface Theme< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* The theme's stylesheet. This uniquely identifies the theme.
|
|
13
|
+
*/
|
|
14
|
+
stylesheet: string;
|
|
15
|
+
/**
|
|
16
|
+
* The theme's template. If this is a child theme, this refers to the parent theme, otherwise this is the same as the theme's stylesheet.
|
|
17
|
+
*/
|
|
18
|
+
template: string;
|
|
19
|
+
/**
|
|
20
|
+
* The theme author.
|
|
21
|
+
*/
|
|
22
|
+
author: RenderedText< 'edit' >;
|
|
23
|
+
/**
|
|
24
|
+
* The website of the theme author.
|
|
25
|
+
*/
|
|
26
|
+
author_uri: RenderedText< 'edit' >;
|
|
27
|
+
/**
|
|
28
|
+
* A description of the theme.
|
|
29
|
+
*/
|
|
30
|
+
description: RenderedText< 'edit' >;
|
|
31
|
+
/**
|
|
32
|
+
* The name of the theme.
|
|
33
|
+
*/
|
|
34
|
+
name: RenderedText< 'edit' >;
|
|
35
|
+
/**
|
|
36
|
+
* The minimum PHP version required for the theme to work.
|
|
37
|
+
*/
|
|
38
|
+
requires_php: string;
|
|
39
|
+
/**
|
|
40
|
+
* The minimum WordPress version required for the theme to work.
|
|
41
|
+
*/
|
|
42
|
+
requires_wp: string;
|
|
43
|
+
/**
|
|
44
|
+
* The theme's screenshot URL.
|
|
45
|
+
*/
|
|
46
|
+
screenshot: string;
|
|
47
|
+
/**
|
|
48
|
+
* Tags indicating styles and features of the theme.
|
|
49
|
+
*/
|
|
50
|
+
tags: RenderedText< 'edit' >;
|
|
51
|
+
/**
|
|
52
|
+
* The theme's text domain.
|
|
53
|
+
*/
|
|
54
|
+
textdomain: string;
|
|
55
|
+
/**
|
|
56
|
+
* Features supported by this theme.
|
|
57
|
+
*/
|
|
58
|
+
theme_supports: ThemeSupports;
|
|
59
|
+
/**
|
|
60
|
+
* The URI of the theme's webpage.
|
|
61
|
+
*/
|
|
62
|
+
theme_uri: RenderedText< 'edit' >;
|
|
63
|
+
/**
|
|
64
|
+
* The theme's current version.
|
|
65
|
+
*/
|
|
66
|
+
version: string;
|
|
67
|
+
/**
|
|
68
|
+
* A named status for the theme.
|
|
69
|
+
*/
|
|
70
|
+
status: ThemeStatus;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type ThemeStatus = 'active' | 'inactive';
|
|
74
|
+
|
|
75
|
+
export interface ThemeSupports {
|
|
76
|
+
/**
|
|
77
|
+
* Whether theme opts in to wide alignment CSS class.
|
|
78
|
+
*/
|
|
79
|
+
'align-wide': boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether posts and comments RSS feed links are added to head.
|
|
82
|
+
*/
|
|
83
|
+
'automatic-feed-links': boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Custom background if defined by the theme.
|
|
86
|
+
*/
|
|
87
|
+
'custom-background': boolean | CustomBackground;
|
|
88
|
+
/**
|
|
89
|
+
* Custom header if defined by the theme.
|
|
90
|
+
*/
|
|
91
|
+
'custom-header': boolean | CustomHeader;
|
|
92
|
+
/**
|
|
93
|
+
* Custom logo if defined by the theme.
|
|
94
|
+
*/
|
|
95
|
+
'custom-logo': boolean | CustomLogo;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the theme enables Selective Refresh for Widgets being managed with the Customizer.
|
|
98
|
+
*/
|
|
99
|
+
'customize-selective-refresh-widgets': boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Whether theme opts in to the dark editor style UI.
|
|
102
|
+
*/
|
|
103
|
+
'dark-editor-style': boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the theme disables custom colors.
|
|
106
|
+
*/
|
|
107
|
+
'disable-custom-colors': boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the theme disables custom font sizes.
|
|
110
|
+
*/
|
|
111
|
+
'disable-custom-font-sizes': boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the theme disables custom gradients.
|
|
114
|
+
*/
|
|
115
|
+
'disable-custom-gradients': boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Custom color palette if defined by the theme.
|
|
118
|
+
*/
|
|
119
|
+
'editor-color-palette': boolean | Color[];
|
|
120
|
+
/**
|
|
121
|
+
* Custom font sizes if defined by the theme.
|
|
122
|
+
*/
|
|
123
|
+
'editor-font-sizes': boolean | FontSize[];
|
|
124
|
+
/**
|
|
125
|
+
* Custom gradient presets if defined by the theme.
|
|
126
|
+
*/
|
|
127
|
+
'editor-gradient-presets': boolean | GradientPreset[];
|
|
128
|
+
/**
|
|
129
|
+
* Whether theme opts in to the editor styles CSS wrapper.
|
|
130
|
+
*/
|
|
131
|
+
'editor-styles': boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Allows use of HTML5 markup for search forms, comment forms, comment lists, gallery, and caption.
|
|
134
|
+
*/
|
|
135
|
+
html5: boolean | Html5Option[];
|
|
136
|
+
/**
|
|
137
|
+
* Post formats supported.
|
|
138
|
+
*/
|
|
139
|
+
formats: PostFormat[];
|
|
140
|
+
/**
|
|
141
|
+
* The post types that support thumbnails or true if all post types are supported.
|
|
142
|
+
*/
|
|
143
|
+
'post-thumbnails': boolean | string[];
|
|
144
|
+
/**
|
|
145
|
+
* Whether the theme supports responsive embedded content.
|
|
146
|
+
*/
|
|
147
|
+
'responsive-embeds': boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Whether the theme can manage the document title tag.
|
|
150
|
+
*/
|
|
151
|
+
'title-tag': boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether theme opts in to default WordPress block styles for viewing.
|
|
154
|
+
*/
|
|
155
|
+
'wp-block-styles': boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface CustomBackground {
|
|
159
|
+
'default-image': string;
|
|
160
|
+
'default-preset': 'default' | 'fill' | 'fit' | 'repeat' | 'custom';
|
|
161
|
+
'default-position-x': 'left' | 'center' | 'right';
|
|
162
|
+
'default-position-y': 'left' | 'center' | 'right';
|
|
163
|
+
'default-size': 'auto' | 'contain' | 'cover';
|
|
164
|
+
'default-repeat': 'repeat-x' | 'repeat-y' | 'repeat' | 'no-repeat';
|
|
165
|
+
'default-attachment': 'scroll' | 'fixed';
|
|
166
|
+
'default-color': string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface CustomHeader {
|
|
170
|
+
'default-image': string;
|
|
171
|
+
'random-default': boolean;
|
|
172
|
+
width: number;
|
|
173
|
+
height: number;
|
|
174
|
+
'flex-height': boolean;
|
|
175
|
+
'flex-width': boolean;
|
|
176
|
+
'default-text-color': string;
|
|
177
|
+
'header-text': boolean;
|
|
178
|
+
uploads: boolean;
|
|
179
|
+
video: boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface CustomLogo {
|
|
183
|
+
width: number;
|
|
184
|
+
height: number;
|
|
185
|
+
'flex-width': boolean;
|
|
186
|
+
'flex-height': boolean;
|
|
187
|
+
'header-text': string[];
|
|
188
|
+
'unlink-homepage-logo': boolean;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface Color {
|
|
192
|
+
name: string;
|
|
193
|
+
slug: string;
|
|
194
|
+
color: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface FontSize {
|
|
198
|
+
name: string;
|
|
199
|
+
size: number;
|
|
200
|
+
slug: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface GradientPreset {
|
|
204
|
+
name: string;
|
|
205
|
+
gradient: string;
|
|
206
|
+
slug: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export type Html5Option =
|
|
210
|
+
| 'search-form'
|
|
211
|
+
| 'comment-form'
|
|
212
|
+
| 'comment-list'
|
|
213
|
+
| 'gallery'
|
|
214
|
+
| 'caption'
|
|
215
|
+
| 'script'
|
|
216
|
+
| 'style';
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export type Theme< C extends Context > = OmitNevers<
|
|
221
|
+
_BaseEntityTypes.Theme< C >
|
|
222
|
+
>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Context, ContextualField, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface Type< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* All capabilities used by the post type.
|
|
13
|
+
*/
|
|
14
|
+
capabilities: ContextualField<
|
|
15
|
+
Record< string, string >,
|
|
16
|
+
'edit',
|
|
17
|
+
C
|
|
18
|
+
>;
|
|
19
|
+
/**
|
|
20
|
+
* A human-readable description of the post type.
|
|
21
|
+
*/
|
|
22
|
+
description: ContextualField< string, 'view' | 'edit', C >;
|
|
23
|
+
/**
|
|
24
|
+
* Whether or not the post type should have children.
|
|
25
|
+
*/
|
|
26
|
+
hierarchical: ContextualField< boolean, 'view' | 'edit', C >;
|
|
27
|
+
/**
|
|
28
|
+
* Whether or not the post type can be viewed.
|
|
29
|
+
*/
|
|
30
|
+
viewable: ContextualField< boolean, 'edit', C >;
|
|
31
|
+
/**
|
|
32
|
+
* Human-readable labels for the post type for various contexts.
|
|
33
|
+
*/
|
|
34
|
+
labels: ContextualField< Record< string, string >, 'edit', C >;
|
|
35
|
+
/**
|
|
36
|
+
* The title for the post type.
|
|
37
|
+
*/
|
|
38
|
+
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* An alphanumeric identifier for the post type.
|
|
41
|
+
*/
|
|
42
|
+
slug: string;
|
|
43
|
+
/**
|
|
44
|
+
* All features, supported by the post type.
|
|
45
|
+
*/
|
|
46
|
+
supports: ContextualField< Record< string, string >, 'edit', C >;
|
|
47
|
+
/**
|
|
48
|
+
* Taxonomies associated with post type.
|
|
49
|
+
*/
|
|
50
|
+
taxonomies: ContextualField< string[], 'view' | 'edit', C >;
|
|
51
|
+
/**
|
|
52
|
+
* REST base route for the post type.
|
|
53
|
+
*/
|
|
54
|
+
rest_base: string;
|
|
55
|
+
/**
|
|
56
|
+
* REST route's namespace for the post type.
|
|
57
|
+
*/
|
|
58
|
+
rest_namespace: string;
|
|
59
|
+
/**
|
|
60
|
+
* The visibility settings for the post type.
|
|
61
|
+
*/
|
|
62
|
+
visibility: ContextualField< TypeVisibility, 'edit', C >;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface TypeVisibility {
|
|
66
|
+
/**
|
|
67
|
+
* Whether to generate a default UI for managing this post type.
|
|
68
|
+
*/
|
|
69
|
+
show_ui: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to make the post type is available for selection in navigation menus.
|
|
72
|
+
*/
|
|
73
|
+
show_in_nav_menus: boolean;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type Type< C extends Context > = OmitNevers<
|
|
79
|
+
_BaseEntityTypes.Type< C >
|
|
80
|
+
>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { AvatarUrls, Context, ContextualField, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface User< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier for the user.
|
|
13
|
+
*/
|
|
14
|
+
id: number;
|
|
15
|
+
/**
|
|
16
|
+
* Login name for the user.
|
|
17
|
+
*/
|
|
18
|
+
username: ContextualField< string, 'edit', C >;
|
|
19
|
+
/**
|
|
20
|
+
* Display name for the user.
|
|
21
|
+
*/
|
|
22
|
+
name: string;
|
|
23
|
+
/**
|
|
24
|
+
* First name for the user.
|
|
25
|
+
*/
|
|
26
|
+
first_name: ContextualField< string, 'edit', C >;
|
|
27
|
+
/**
|
|
28
|
+
* Last name for the user.
|
|
29
|
+
*/
|
|
30
|
+
last_name: ContextualField< string, 'edit', C >;
|
|
31
|
+
/**
|
|
32
|
+
* The email address for the user.
|
|
33
|
+
*/
|
|
34
|
+
email: ContextualField< string, 'edit', C >;
|
|
35
|
+
/**
|
|
36
|
+
* URL of the user.
|
|
37
|
+
*/
|
|
38
|
+
url: string;
|
|
39
|
+
/**
|
|
40
|
+
* Description of the user.
|
|
41
|
+
*/
|
|
42
|
+
description: string;
|
|
43
|
+
/**
|
|
44
|
+
* Author URL of the user.
|
|
45
|
+
*/
|
|
46
|
+
link: string;
|
|
47
|
+
/**
|
|
48
|
+
* Locale for the user.
|
|
49
|
+
*/
|
|
50
|
+
locale: ContextualField< string, 'edit', C >;
|
|
51
|
+
/**
|
|
52
|
+
* The nickname for the user.
|
|
53
|
+
*/
|
|
54
|
+
nickname: ContextualField< string, 'edit', C >;
|
|
55
|
+
/**
|
|
56
|
+
* An alphanumeric identifier for the user.
|
|
57
|
+
*/
|
|
58
|
+
slug: string;
|
|
59
|
+
/**
|
|
60
|
+
* Registration date for the user.
|
|
61
|
+
*/
|
|
62
|
+
registered_date: ContextualField< string, 'edit', C >;
|
|
63
|
+
/**
|
|
64
|
+
* Roles assigned to the user.
|
|
65
|
+
*/
|
|
66
|
+
roles: ContextualField< string[], 'edit', C >;
|
|
67
|
+
/**
|
|
68
|
+
* Password for the user.
|
|
69
|
+
*
|
|
70
|
+
* This is never sent from the server to the client
|
|
71
|
+
* but exists because we might send an update to the
|
|
72
|
+
* server with a new password to set.
|
|
73
|
+
*/
|
|
74
|
+
password?: string;
|
|
75
|
+
/**
|
|
76
|
+
* All capabilities assigned to the user.
|
|
77
|
+
*/
|
|
78
|
+
capabilities: ContextualField<
|
|
79
|
+
Record< string, string >,
|
|
80
|
+
'edit',
|
|
81
|
+
C
|
|
82
|
+
>;
|
|
83
|
+
/**
|
|
84
|
+
* Any extra capabilities assigned to the user.
|
|
85
|
+
*/
|
|
86
|
+
extra_capabilities: ContextualField<
|
|
87
|
+
Record< string, string >,
|
|
88
|
+
'edit',
|
|
89
|
+
C
|
|
90
|
+
>;
|
|
91
|
+
/**
|
|
92
|
+
* Avatar URLs for the user.
|
|
93
|
+
*/
|
|
94
|
+
avatar_urls: AvatarUrls;
|
|
95
|
+
/**
|
|
96
|
+
* Meta fields.
|
|
97
|
+
*/
|
|
98
|
+
meta: ContextualField<
|
|
99
|
+
Record< string, string >,
|
|
100
|
+
'view' | 'edit',
|
|
101
|
+
C
|
|
102
|
+
>;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type User< C extends Context > = OmitNevers<
|
|
108
|
+
_BaseEntityTypes.User< C >
|
|
109
|
+
>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Context, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface WidgetType< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* Unique slug identifying the widget type.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* Human-readable name identifying the widget type.
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* Description of the widget.
|
|
21
|
+
*/
|
|
22
|
+
description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the widget supports multiple instances
|
|
25
|
+
*/
|
|
26
|
+
is_multi: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Class name
|
|
29
|
+
*/
|
|
30
|
+
classname: string;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type WidgetType< C extends Context > = OmitNevers<
|
|
36
|
+
_BaseEntityTypes.WidgetType< C >
|
|
37
|
+
>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Context, ContextualField, OmitNevers } from './helpers';
|
|
5
|
+
|
|
6
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
7
|
+
|
|
8
|
+
declare module './base-entity-types' {
|
|
9
|
+
export namespace BaseEntityTypes {
|
|
10
|
+
export interface Widget< C extends Context > {
|
|
11
|
+
/**
|
|
12
|
+
* Unique identifier for the widget.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* The type of the widget. Corresponds to ID in widget-types endpoint.
|
|
17
|
+
*/
|
|
18
|
+
id_base: string;
|
|
19
|
+
/**
|
|
20
|
+
* The sidebar the widget belongs to.
|
|
21
|
+
*/
|
|
22
|
+
sidebar: string;
|
|
23
|
+
/**
|
|
24
|
+
* HTML representation of the widget.
|
|
25
|
+
*/
|
|
26
|
+
rendered: string;
|
|
27
|
+
/**
|
|
28
|
+
* HTML representation of the widget admin form.
|
|
29
|
+
*/
|
|
30
|
+
rendered_form: ContextualField< string, 'edit', C >;
|
|
31
|
+
/**
|
|
32
|
+
* Instance settings of the widget, if supported.
|
|
33
|
+
*/
|
|
34
|
+
instance: ContextualField< WidgetInstance, 'edit', C >;
|
|
35
|
+
/**
|
|
36
|
+
* URL-encoded form data from the widget admin form. Used
|
|
37
|
+
* to update a widget that does not support instance.
|
|
38
|
+
*
|
|
39
|
+
* This is never sent from the server to the client but exists
|
|
40
|
+
* because we might send an update.
|
|
41
|
+
*/
|
|
42
|
+
form_data?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface WidgetInstance {
|
|
46
|
+
/**
|
|
47
|
+
* Base64 encoded representation of the instance settings.
|
|
48
|
+
*/
|
|
49
|
+
encoded: string;
|
|
50
|
+
/**
|
|
51
|
+
* Cryptographic hash of the instance settings.
|
|
52
|
+
*/
|
|
53
|
+
hash: string;
|
|
54
|
+
/**
|
|
55
|
+
* Unencoded instance settings, if supported.
|
|
56
|
+
*/
|
|
57
|
+
raw: Record< string, string >;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type Widget< C extends Context > = OmitNevers<
|
|
63
|
+
_BaseEntityTypes.Widget< C >
|
|
64
|
+
>;
|