-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.d.ts
186 lines (136 loc) · 4.03 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import {asAttr} from 'on-to-me/types.js';
import {PD} from './p-d.js';
export interface PDToFrom extends HTMLElement{
/**
* css pattern to match for from downstream siblings.
* @attr
*/
to?: string;
/**
* Find the closest ancestor matching this css pattern.
* Use that as the base element to pass down the value from.
* @attr
*/
from?: string;
/**
* @private
*/
lastVal?: any;
/**
* CSS Selector to use to select single child within the destination element.
* @attr care-of
*
*/
careOf?: string;
/**
* Name of property to set on matching (downstream) siblings.
* @attr
*/
prop?: string;
/**
* Pass value to an attribute
* @attr as-attr
*/
as?: asAttr;
mutateEvents?: string[];
/**
* Add runtime breakpoints at critical points
* @attr
*/
debug?: boolean;
/**
* Add console.logs at critical points
* @attr
*/
log?: boolean;
/**
* Maximum number of elements to search for
* @attr
*/
m?: number;
disabled?: boolean;
enabled?: boolean;
}
export interface PassDownProps extends PDToFrom{
async?: boolean;
cloneVal?: boolean;
/**
* Artificially fire event on target element whose name is specified by this attribute.
* @attr fire-event
*/
fireEvent?: string;
/**
* In some cases, the initVal can only be obtained after initEvent fires
*/
initEvent?: string;
initVal?: string;
initDelay?: number;
isC?: boolean;
lastEvent?: Event;
mutateEvents?: string[];
parseValAs?: 'int' | 'float' | 'bool' | 'date' | 'truthy' | 'falsy' | '' | 'string' | 'object';
previousOn?: string;
/**
* Dynamically determined name of property to set on matching (downstream) siblings from target.
* @attr prop-from-target
*/
propFromTarget?: string;
/**
* Specifies path to JS object from event, that should be passed to downstream siblings. Value of '.' passes entire entire object.
* @attr
*/
val?: string;
//valFromEvent?: string;
valFromTarget?: string;
vft?: string;
_wr: WeakRef<Element> | undefined; //TODO: make private?
trueVal: string;
falseVal: string;
cnt:number;
}
// export interface PassDownActions {
// doInit(self: this): void;
// doEvent(self: this): void;
// setValFromTarget(self: this): void;
// setAliases(self: this): void;
// attachEventHandler(self: this): void;
// }
export interface PassDown extends PassDownProps{
}
export interface PassDownExtProps extends PassDownProps{
/**
* @prop {string} [valFilter] - JSONPath expression
* @attr {string} [val-filter] - JSONPath expression
*/
valFilter?: string;
/**
* Id within the ShadowDOM Realm of p-d-x of a script tag.
* The script tag is expected to have a property path where a custom filter function is specified.
* This custom filter function is applied to the value.
*/
valFilterScriptId?: string;
/**
* @prop {string} [valFilterScriptPropPath=] - Property path from the script tag, where custom filter function can be obtained.
*/
valFilterScriptPropPath?: string;
closestWeakMapKey?: string;
addMutObs?: boolean;
}
export interface PDMixinActions {
handleValChange(self: IPDMixin): void;
attachMutationEventHandler(self: IPDMixin): void;
}
export interface IPDMixin extends PassDownProps, PDMixinActions{}
export interface PassDownCompositeActions extends PDMixinActions, PassDownActions{}
type pd = PassDownActions;
export interface PassDownActions{
doEvent(self: this): void;
parseInitVal(elementToObserve: Element): any;
setAliases(self: this): void;
doInit(self: this): void;
setValFromTarget(self: this): void;
valFromEvent(e: Event): void;
parseValFromEvent(e: Event): any;
onFromProp(initVal: string): string;
}
// export interface IPassDownWithIPDMixin extends Pass, IPDMixin{}