1
- import type { OrderedSet , Set } from 'immutable' ;
2
1
import React from 'react' ;
2
+ import type { Set } from '../sources/client/src/vo/set' ;
3
3
4
4
import { BaseEntityRecords , Context } from '@wordpress/core-data' ;
5
5
@@ -19,7 +19,7 @@ declare namespace EntitiesSearch {
19
19
fields : EntitiesSearch . SearchQueryFields ;
20
20
[ p : string ] : unknown ;
21
21
} >
22
- > { }
22
+ > { }
23
23
24
24
interface SearchEntityFields
25
25
extends Readonly < {
@@ -28,7 +28,7 @@ declare namespace EntitiesSearch {
28
28
url : string ;
29
29
type : string ;
30
30
subtype : string ;
31
- } > { }
31
+ } > { }
32
32
33
33
type ControlOption < V extends any > = Readonly < {
34
34
value : V ;
@@ -37,39 +37,39 @@ declare namespace EntitiesSearch {
37
37
38
38
type SingularControl < V > = {
39
39
[ K in keyof BaseControl < V > ] : K extends 'value'
40
- ? V
41
- : K extends 'onChange'
42
- ? ( value : V ) => void
43
- : BaseControl < V > [ K ] ;
40
+ ? V
41
+ : K extends 'onChange'
42
+ ? ( value : V ) => void
43
+ : BaseControl < V > [ K ] ;
44
44
} ;
45
45
46
46
interface BaseControl < V >
47
47
extends Readonly < {
48
- value : OrderedSet < V > ;
49
- options : OrderedSet < ControlOption < V > > ;
48
+ value : Set < V > ;
49
+ options : Set < ControlOption < V > > ;
50
50
onChange ( values : BaseControl < V > [ 'value' ] ) : void ;
51
- } > { }
51
+ } > { }
52
52
53
53
/*
54
54
* Hooks
55
55
*/
56
56
type ViewablePostType = Readonly < {
57
57
[ K in keyof PostType < 'edit' > ] : K extends 'viewable'
58
- ? true
59
- : PostType < 'edit' > [ K ] ;
58
+ ? true
59
+ : PostType < 'edit' > [ K ] ;
60
60
} > ;
61
61
62
62
// TODO Need Type Test.
63
63
type ViewableTaxonomy = Readonly < {
64
64
[ K in keyof Taxonomy < 'edit' > ] : K extends 'visibility'
65
- ? BaseEntityRecords . TaxonomyVisibility & {
66
- publicly_queryable : true ;
67
- }
68
- : Taxonomy < 'edit' > [ K ] ;
65
+ ? BaseEntityRecords . TaxonomyVisibility & {
66
+ publicly_queryable : true ;
67
+ }
68
+ : Taxonomy < 'edit' > [ K ] ;
69
69
} > ;
70
70
71
71
type EntitiesRecords < Entity > = Readonly < {
72
- records ( ) : OrderedSet < Entity > ;
72
+ records ( ) : Set < Entity > ;
73
73
isResolving ( ) : boolean ;
74
74
errored ( ) : boolean ;
75
75
succeed ( ) : boolean ;
@@ -88,45 +88,45 @@ declare namespace EntitiesSearch {
88
88
interface EntitiesState <
89
89
E ,
90
90
K ,
91
- OptionSet = OrderedSet < EntitiesSearch . ControlOption < E > >
91
+ OptionSet = Set < EntitiesSearch . ControlOption < E > >
92
92
> extends Readonly < {
93
- entities : BaseControl < E > [ 'value' ] ;
94
- kind : BaseControl < K > [ 'value' ] ;
95
- contextualEntitiesOptions : OptionSet ;
96
- currentEntitiesOptions : OptionSet ;
97
- selectedEntitiesOptions : OptionSet ;
98
- } > { }
93
+ entities : BaseControl < E > [ 'value' ] ;
94
+ kind : BaseControl < K > [ 'value' ] ;
95
+ contextualEntitiesOptions : OptionSet ;
96
+ currentEntitiesOptions : OptionSet ;
97
+ selectedEntitiesOptions : OptionSet ;
98
+ } > { }
99
99
100
100
type StoreAction < E , K > =
101
101
| {
102
- type : 'UPDATE_ENTITIES' ;
103
- entities : EntitiesState < E , K > [ 'entities' ] ;
104
- }
102
+ type : 'UPDATE_ENTITIES' ;
103
+ entities : EntitiesState < E , K > [ 'entities' ] ;
104
+ }
105
105
| {
106
- type : 'UPDATE_KIND' ;
107
- kind : EntitiesState < E , K > [ 'kind' ] ;
108
- }
106
+ type : 'UPDATE_KIND' ;
107
+ kind : EntitiesState < E , K > [ 'kind' ] ;
108
+ }
109
109
| {
110
- type : 'UPDATE_CURRENT_ENTITIES_OPTIONS' ;
111
- currentEntitiesOptions : EntitiesState <
112
- E ,
113
- K
114
- > [ 'currentEntitiesOptions' ] ;
115
- }
110
+ type : 'UPDATE_CURRENT_ENTITIES_OPTIONS' ;
111
+ currentEntitiesOptions : EntitiesState <
112
+ E ,
113
+ K
114
+ > [ 'currentEntitiesOptions' ] ;
115
+ }
116
116
| {
117
- type : 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS' ;
118
- contextualEntitiesOptions : EntitiesState <
119
- E ,
120
- K
121
- > [ 'contextualEntitiesOptions' ] ;
122
- }
117
+ type : 'UPDATE_CONTEXTUAL_ENTITIES_OPTIONS' ;
118
+ contextualEntitiesOptions : EntitiesState <
119
+ E ,
120
+ K
121
+ > [ 'contextualEntitiesOptions' ] ;
122
+ }
123
123
| {
124
- type : 'UPDATE_SELECTED_ENTITIES_OPTIONS' ;
125
- selectedEntitiesOptions : EntitiesState <
126
- E ,
127
- K
128
- > [ 'selectedEntitiesOptions' ] ;
129
- } ;
124
+ type : 'UPDATE_SELECTED_ENTITIES_OPTIONS' ;
125
+ selectedEntitiesOptions : EntitiesState <
126
+ E ,
127
+ K
128
+ > [ 'selectedEntitiesOptions' ] ;
129
+ } ;
130
130
131
131
/*
132
132
* Components
@@ -135,7 +135,7 @@ declare namespace EntitiesSearch {
135
135
extends Readonly < {
136
136
id ?: string ;
137
137
onChange ( phrase : string | React . ChangeEvent < HTMLInputElement > ) ;
138
- } > { }
138
+ } > { }
139
139
140
140
interface CompositeEntitiesKinds < E , K >
141
141
extends Readonly < {
@@ -155,5 +155,5 @@ declare namespace EntitiesSearch {
155
155
phrase : Parameters < SearchControl < E , K > [ 'search' ] > [ 0 ]
156
156
) => ReturnType < SearchControl < E , K > [ 'search' ] >
157
157
) : React . ReactNode ;
158
- } > { }
158
+ } > { }
159
159
}
0 commit comments