native-document 1.0.26 → 1.0.28
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/dist/native-document.dev.js +20 -5
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/observables.md +50 -0
- package/index.d.ts +17 -0
- package/package.json +3 -2
- package/readme.md +3 -2
- package/src/utils/events.js +16 -1
- package/src/wrappers/AttributesWrapper.js +1 -1
- package/src/wrappers/NDElement.js +3 -3
- package/types/control-flow.d.ts +51 -0
- package/types/elements.d.ts +460 -0
- package/types/forms.d.ts +34 -0
- package/types/images.d.ts +12 -0
- package/types/observable.d.ts +129 -0
- package/types/polyfill.d.ts +8 -0
- package/types/router.d.ts +80 -0
- package/types/store.d.ts +12 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
// DOM elements and components type definitions - Version complète
|
|
2
|
+
import { ObservableItem } from './observable';
|
|
3
|
+
|
|
4
|
+
export interface NDElement {
|
|
5
|
+
readonly __$isNDElement: true;
|
|
6
|
+
readonly $element: HTMLElement;
|
|
7
|
+
readonly $observer: any;
|
|
8
|
+
|
|
9
|
+
ref(target: any, name: string): this;
|
|
10
|
+
unmountChildren(): this;
|
|
11
|
+
remove(): this;
|
|
12
|
+
|
|
13
|
+
lifecycle(states: { mounted?: (node: HTMLElement) => void; unmounted?: (node: HTMLElement) => boolean | void }): this;
|
|
14
|
+
mounted(callback: (node: HTMLElement) => void): this;
|
|
15
|
+
unmounted(callback: (node: HTMLElement) => boolean | void): this;
|
|
16
|
+
|
|
17
|
+
htmlElement(): HTMLElement;
|
|
18
|
+
node(): HTMLElement;
|
|
19
|
+
|
|
20
|
+
// Mouse Events
|
|
21
|
+
onClick(callback: (event: MouseEvent) => void): this;
|
|
22
|
+
onDblClick(callback: (event: MouseEvent) => void): this;
|
|
23
|
+
onMouseDown(callback: (event: MouseEvent) => void): this;
|
|
24
|
+
onMouseEnter(callback: (event: MouseEvent) => void): this;
|
|
25
|
+
onMouseLeave(callback: (event: MouseEvent) => void): this;
|
|
26
|
+
onMouseMove(callback: (event: MouseEvent) => void): this;
|
|
27
|
+
onMouseOut(callback: (event: MouseEvent) => void): this;
|
|
28
|
+
onMouseOver(callback: (event: MouseEvent) => void): this;
|
|
29
|
+
onMouseUp(callback: (event: MouseEvent) => void): this;
|
|
30
|
+
onWheel(callback: (event: WheelEvent) => void): this;
|
|
31
|
+
onContextMenu(callback: (event: MouseEvent) => void): this; // Extra event
|
|
32
|
+
|
|
33
|
+
// Keyboard Events
|
|
34
|
+
onKeyDown(callback: (event: KeyboardEvent) => void): this;
|
|
35
|
+
onKeyPress(callback: (event: KeyboardEvent) => void): this;
|
|
36
|
+
onKeyUp(callback: (event: KeyboardEvent) => void): this;
|
|
37
|
+
|
|
38
|
+
// Form Events
|
|
39
|
+
onBlur(callback: (event: FocusEvent) => void): this;
|
|
40
|
+
onChange(callback: (event: Event) => void): this;
|
|
41
|
+
onFocus(callback: (event: FocusEvent) => void): this;
|
|
42
|
+
onFocusIn(callback: (event: FocusEvent) => void): this; // Extra event
|
|
43
|
+
onFocusOut(callback: (event: FocusEvent) => void): this; // Extra event
|
|
44
|
+
onInput(callback: (event: Event) => void): this;
|
|
45
|
+
onInvalid(callback: (event: Event) => void): this;
|
|
46
|
+
onReset(callback: (event: Event) => void): this;
|
|
47
|
+
onSearch(callback: (event: Event) => void): this;
|
|
48
|
+
onSelect(callback: (event: Event) => void): this;
|
|
49
|
+
onSubmit(callback: (event: Event) => void): this;
|
|
50
|
+
|
|
51
|
+
// Drag Events
|
|
52
|
+
onDrag(callback: (event: DragEvent) => void): this;
|
|
53
|
+
onDragEnd(callback: (event: DragEvent) => void): this;
|
|
54
|
+
onDragEnter(callback: (event: DragEvent) => void): this;
|
|
55
|
+
onDragLeave(callback: (event: DragEvent) => void): this;
|
|
56
|
+
onDragOver(callback: (event: DragEvent) => void): this;
|
|
57
|
+
onDragStart(callback: (event: DragEvent) => void): this;
|
|
58
|
+
onDrop(callback: (event: DragEvent) => void): this;
|
|
59
|
+
|
|
60
|
+
// Window/Page Events
|
|
61
|
+
onAfterPrint(callback: (event: Event) => void): this;
|
|
62
|
+
onBeforePrint(callback: (event: Event) => void): this;
|
|
63
|
+
onBeforeUnload(callback: (event: BeforeUnloadEvent) => void): this;
|
|
64
|
+
onError(callback: (event: Event) => void): this;
|
|
65
|
+
onHashChange(callback: (event: HashChangeEvent) => void): this;
|
|
66
|
+
onLoad(callback: (event: Event) => void): this;
|
|
67
|
+
onOffline(callback: (event: Event) => void): this;
|
|
68
|
+
onOnline(callback: (event: Event) => void): this;
|
|
69
|
+
onPageHide(callback: (event: PageTransitionEvent) => void): this;
|
|
70
|
+
onPageShow(callback: (event: PageTransitionEvent) => void): this;
|
|
71
|
+
onResize(callback: (event: UIEvent) => void): this;
|
|
72
|
+
onScroll(callback: (event: Event) => void): this;
|
|
73
|
+
onUnload(callback: (event: Event) => void): this;
|
|
74
|
+
|
|
75
|
+
// Media Events
|
|
76
|
+
onAbort(callback: (event: Event) => void): this;
|
|
77
|
+
onCanPlay(callback: (event: Event) => void): this;
|
|
78
|
+
onCanPlayThrough(callback: (event: Event) => void): this;
|
|
79
|
+
onDurationChange(callback: (event: Event) => void): this;
|
|
80
|
+
onEmptied(callback: (event: Event) => void): this;
|
|
81
|
+
onEnded(callback: (event: Event) => void): this;
|
|
82
|
+
onLoadedData(callback: (event: Event) => void): this;
|
|
83
|
+
onLoadedMetadata(callback: (event: Event) => void): this;
|
|
84
|
+
onLoadStart(callback: (event: Event) => void): this;
|
|
85
|
+
onPause(callback: (event: Event) => void): this;
|
|
86
|
+
onPlay(callback: (event: Event) => void): this;
|
|
87
|
+
onPlaying(callback: (event: Event) => void): this;
|
|
88
|
+
onProgress(callback: (event: ProgressEvent) => void): this;
|
|
89
|
+
onRateChange(callback: (event: Event) => void): this;
|
|
90
|
+
onSeeked(callback: (event: Event) => void): this;
|
|
91
|
+
onSeeking(callback: (event: Event) => void): this;
|
|
92
|
+
onStalled(callback: (event: Event) => void): this;
|
|
93
|
+
onSuspend(callback: (event: Event) => void): this;
|
|
94
|
+
onTimeUpdate(callback: (event: Event) => void): this;
|
|
95
|
+
onVolumeChange(callback: (event: Event) => void): this;
|
|
96
|
+
onWaiting(callback: (event: Event) => void): this;
|
|
97
|
+
|
|
98
|
+
// Touch Events (Extra events)
|
|
99
|
+
onTouchCancel(callback: (event: TouchEvent) => void): this;
|
|
100
|
+
onTouchEnd(callback: (event: TouchEvent) => void): this;
|
|
101
|
+
onTouchMove(callback: (event: TouchEvent) => void): this;
|
|
102
|
+
onTouchStart(callback: (event: TouchEvent) => void): this;
|
|
103
|
+
|
|
104
|
+
// Animation Events (Extra events)
|
|
105
|
+
onAnimationEnd(callback: (event: AnimationEvent) => void): this;
|
|
106
|
+
onAnimationIteration(callback: (event: AnimationEvent) => void): this;
|
|
107
|
+
onAnimationStart(callback: (event: AnimationEvent) => void): this;
|
|
108
|
+
|
|
109
|
+
// Transition Events (Extra events)
|
|
110
|
+
onTransitionEnd(callback: (event: TransitionEvent) => void): this;
|
|
111
|
+
|
|
112
|
+
// Clipboard Events (Extra events)
|
|
113
|
+
onCopy(callback: (event: ClipboardEvent) => void): this;
|
|
114
|
+
onCut(callback: (event: ClipboardEvent) => void): this;
|
|
115
|
+
onPaste(callback: (event: ClipboardEvent) => void): this;
|
|
116
|
+
|
|
117
|
+
// PREVENT DEFAULT VERSIONS
|
|
118
|
+
|
|
119
|
+
// Prevent default versions for Mouse Events
|
|
120
|
+
onPreventClick(callback: (event: MouseEvent) => void): this;
|
|
121
|
+
onPreventDblClick(callback: (event: MouseEvent) => void): this;
|
|
122
|
+
onPreventMouseDown(callback: (event: MouseEvent) => void): this;
|
|
123
|
+
onPreventMouseEnter(callback: (event: MouseEvent) => void): this;
|
|
124
|
+
onPreventMouseLeave(callback: (event: MouseEvent) => void): this;
|
|
125
|
+
onPreventMouseMove(callback: (event: MouseEvent) => void): this;
|
|
126
|
+
onPreventMouseOut(callback: (event: MouseEvent) => void): this;
|
|
127
|
+
onPreventMouseOver(callback: (event: MouseEvent) => void): this;
|
|
128
|
+
onPreventMouseUp(callback: (event: MouseEvent) => void): this;
|
|
129
|
+
onPreventWheel(callback: (event: WheelEvent) => void): this;
|
|
130
|
+
onPreventContextMenu(callback: (event: MouseEvent) => void): this;
|
|
131
|
+
|
|
132
|
+
// Prevent default versions for Keyboard Events
|
|
133
|
+
onPreventKeyDown(callback: (event: KeyboardEvent) => void): this;
|
|
134
|
+
onPreventKeyPress(callback: (event: KeyboardEvent) => void): this;
|
|
135
|
+
onPreventKeyUp(callback: (event: KeyboardEvent) => void): this;
|
|
136
|
+
|
|
137
|
+
// Prevent default versions for Form Events
|
|
138
|
+
onPreventBlur(callback: (event: FocusEvent) => void): this;
|
|
139
|
+
onPreventChange(callback: (event: Event) => void): this;
|
|
140
|
+
onPreventFocus(callback: (event: FocusEvent) => void): this;
|
|
141
|
+
onPreventFocusIn(callback: (event: FocusEvent) => void): this;
|
|
142
|
+
onPreventFocusOut(callback: (event: FocusEvent) => void): this;
|
|
143
|
+
onPreventInput(callback: (event: Event) => void): this;
|
|
144
|
+
onPreventInvalid(callback: (event: Event) => void): this;
|
|
145
|
+
onPreventReset(callback: (event: Event) => void): this;
|
|
146
|
+
onPreventSearch(callback: (event: Event) => void): this;
|
|
147
|
+
onPreventSelect(callback: (event: Event) => void): this;
|
|
148
|
+
onPreventSubmit(callback: (event: Event) => void): this;
|
|
149
|
+
|
|
150
|
+
// Prevent default versions for Drag Events
|
|
151
|
+
onPreventDrag(callback: (event: DragEvent) => void): this;
|
|
152
|
+
onPreventDragEnd(callback: (event: DragEvent) => void): this;
|
|
153
|
+
onPreventDragEnter(callback: (event: DragEvent) => void): this;
|
|
154
|
+
onPreventDragLeave(callback: (event: DragEvent) => void): this;
|
|
155
|
+
onPreventDragOver(callback: (event: DragEvent) => void): this;
|
|
156
|
+
onPreventDragStart(callback: (event: DragEvent) => void): this;
|
|
157
|
+
onPreventDrop(callback: (event: DragEvent) => void): this;
|
|
158
|
+
|
|
159
|
+
// Prevent default versions for Window/Page Events
|
|
160
|
+
onPreventAfterPrint(callback: (event: Event) => void): this;
|
|
161
|
+
onPreventBeforePrint(callback: (event: Event) => void): this;
|
|
162
|
+
onPreventBeforeUnload(callback: (event: BeforeUnloadEvent) => void): this;
|
|
163
|
+
onPreventError(callback: (event: Event) => void): this;
|
|
164
|
+
onPreventHashChange(callback: (event: HashChangeEvent) => void): this;
|
|
165
|
+
onPreventLoad(callback: (event: Event) => void): this;
|
|
166
|
+
onPreventOffline(callback: (event: Event) => void): this;
|
|
167
|
+
onPreventOnline(callback: (event: Event) => void): this;
|
|
168
|
+
onPreventPageHide(callback: (event: PageTransitionEvent) => void): this;
|
|
169
|
+
onPreventPageShow(callback: (event: PageTransitionEvent) => void): this;
|
|
170
|
+
onPreventResize(callback: (event: UIEvent) => void): this;
|
|
171
|
+
onPreventScroll(callback: (event: Event) => void): this;
|
|
172
|
+
onPreventUnload(callback: (event: Event) => void): this;
|
|
173
|
+
|
|
174
|
+
// Prevent default versions for Media Events
|
|
175
|
+
onPreventAbort(callback: (event: Event) => void): this;
|
|
176
|
+
onPreventCanPlay(callback: (event: Event) => void): this;
|
|
177
|
+
onPreventCanPlayThrough(callback: (event: Event) => void): this;
|
|
178
|
+
onPreventDurationChange(callback: (event: Event) => void): this;
|
|
179
|
+
onPreventEmptied(callback: (event: Event) => void): this;
|
|
180
|
+
onPreventEnded(callback: (event: Event) => void): this;
|
|
181
|
+
onPreventLoadedData(callback: (event: Event) => void): this;
|
|
182
|
+
onPreventLoadedMetadata(callback: (event: Event) => void): this;
|
|
183
|
+
onPreventLoadStart(callback: (event: Event) => void): this;
|
|
184
|
+
onPreventPause(callback: (event: Event) => void): this;
|
|
185
|
+
onPreventPlay(callback: (event: Event) => void): this;
|
|
186
|
+
onPreventPlaying(callback: (event: Event) => void): this;
|
|
187
|
+
onPreventProgress(callback: (event: ProgressEvent) => void): this;
|
|
188
|
+
onPreventRateChange(callback: (event: Event) => void): this;
|
|
189
|
+
onPreventSeeked(callback: (event: Event) => void): this;
|
|
190
|
+
onPreventSeeking(callback: (event: Event) => void): this;
|
|
191
|
+
onPreventStalled(callback: (event: Event) => void): this;
|
|
192
|
+
onPreventSuspend(callback: (event: Event) => void): this;
|
|
193
|
+
onPreventTimeUpdate(callback: (event: Event) => void): this;
|
|
194
|
+
onPreventVolumeChange(callback: (event: Event) => void): this;
|
|
195
|
+
onPreventWaiting(callback: (event: Event) => void): this;
|
|
196
|
+
|
|
197
|
+
// Prevent default versions for Touch Events
|
|
198
|
+
onPreventTouchCancel(callback: (event: TouchEvent) => void): this;
|
|
199
|
+
onPreventTouchEnd(callback: (event: TouchEvent) => void): this;
|
|
200
|
+
onPreventTouchMove(callback: (event: TouchEvent) => void): this;
|
|
201
|
+
onPreventTouchStart(callback: (event: TouchEvent) => void): this;
|
|
202
|
+
|
|
203
|
+
// Prevent default versions for Animation Events
|
|
204
|
+
onPreventAnimationEnd(callback: (event: AnimationEvent) => void): this;
|
|
205
|
+
onPreventAnimationIteration(callback: (event: AnimationEvent) => void): this;
|
|
206
|
+
onPreventAnimationStart(callback: (event: AnimationEvent) => void): this;
|
|
207
|
+
|
|
208
|
+
// Prevent default versions for Transition Events
|
|
209
|
+
onPreventTransitionEnd(callback: (event: TransitionEvent) => void): this;
|
|
210
|
+
|
|
211
|
+
// Prevent default versions for Clipboard Events
|
|
212
|
+
onPreventCopy(callback: (event: ClipboardEvent) => void): this;
|
|
213
|
+
onPreventCut(callback: (event: ClipboardEvent) => void): this;
|
|
214
|
+
onPreventPaste(callback: (event: ClipboardEvent) => void): this;
|
|
215
|
+
|
|
216
|
+
// STOP PROPAGATION VERSIONS
|
|
217
|
+
|
|
218
|
+
// Stop propagation versions for Mouse Events
|
|
219
|
+
onStopClick(callback: (event: MouseEvent) => void): this;
|
|
220
|
+
onStopDblClick(callback: (event: MouseEvent) => void): this;
|
|
221
|
+
onStopMouseDown(callback: (event: MouseEvent) => void): this;
|
|
222
|
+
onStopMouseEnter(callback: (event: MouseEvent) => void): this;
|
|
223
|
+
onStopMouseLeave(callback: (event: MouseEvent) => void): this;
|
|
224
|
+
onStopMouseMove(callback: (event: MouseEvent) => void): this;
|
|
225
|
+
onStopMouseOut(callback: (event: MouseEvent) => void): this;
|
|
226
|
+
onStopMouseOver(callback: (event: MouseEvent) => void): this;
|
|
227
|
+
onStopMouseUp(callback: (event: MouseEvent) => void): this;
|
|
228
|
+
onStopWheel(callback: (event: WheelEvent) => void): this;
|
|
229
|
+
onStopContextMenu(callback: (event: MouseEvent) => void): this;
|
|
230
|
+
|
|
231
|
+
// Stop propagation versions for Keyboard Events
|
|
232
|
+
onStopKeyDown(callback: (event: KeyboardEvent) => void): this;
|
|
233
|
+
onStopKeyPress(callback: (event: KeyboardEvent) => void): this;
|
|
234
|
+
onStopKeyUp(callback: (event: KeyboardEvent) => void): this;
|
|
235
|
+
|
|
236
|
+
// Stop propagation versions for Form Events
|
|
237
|
+
onStopBlur(callback: (event: FocusEvent) => void): this;
|
|
238
|
+
onStopChange(callback: (event: Event) => void): this;
|
|
239
|
+
onStopFocus(callback: (event: FocusEvent) => void): this;
|
|
240
|
+
onStopFocusIn(callback: (event: FocusEvent) => void): this;
|
|
241
|
+
onStopFocusOut(callback: (event: FocusEvent) => void): this;
|
|
242
|
+
onStopInput(callback: (event: Event) => void): this;
|
|
243
|
+
onStopInvalid(callback: (event: Event) => void): this;
|
|
244
|
+
onStopReset(callback: (event: Event) => void): this;
|
|
245
|
+
onStopSearch(callback: (event: Event) => void): this;
|
|
246
|
+
onStopSelect(callback: (event: Event) => void): this;
|
|
247
|
+
onStopSubmit(callback: (event: Event) => void): this;
|
|
248
|
+
|
|
249
|
+
// Stop propagation versions for Drag Events
|
|
250
|
+
onStopDrag(callback: (event: DragEvent) => void): this;
|
|
251
|
+
onStopDragEnd(callback: (event: DragEvent) => void): this;
|
|
252
|
+
onStopDragEnter(callback: (event: DragEvent) => void): this;
|
|
253
|
+
onStopDragLeave(callback: (event: DragEvent) => void): this;
|
|
254
|
+
onStopDragOver(callback: (event: DragEvent) => void): this;
|
|
255
|
+
onStopDragStart(callback: (event: DragEvent) => void): this;
|
|
256
|
+
onStopDrop(callback: (event: DragEvent) => void): this;
|
|
257
|
+
|
|
258
|
+
// Stop propagation versions for Window/Page Events
|
|
259
|
+
onStopAfterPrint(callback: (event: Event) => void): this;
|
|
260
|
+
onStopBeforePrint(callback: (event: Event) => void): this;
|
|
261
|
+
onStopBeforeUnload(callback: (event: BeforeUnloadEvent) => void): this;
|
|
262
|
+
onStopError(callback: (event: Event) => void): this;
|
|
263
|
+
onStopHashChange(callback: (event: HashChangeEvent) => void): this;
|
|
264
|
+
onStopLoad(callback: (event: Event) => void): this;
|
|
265
|
+
onStopOffline(callback: (event: Event) => void): this;
|
|
266
|
+
onStopOnline(callback: (event: Event) => void): this;
|
|
267
|
+
onStopPageHide(callback: (event: PageTransitionEvent) => void): this;
|
|
268
|
+
onStopPageShow(callback: (event: PageTransitionEvent) => void): this;
|
|
269
|
+
onStopResize(callback: (event: UIEvent) => void): this;
|
|
270
|
+
onStopScroll(callback: (event: Event) => void): this;
|
|
271
|
+
onStopUnload(callback: (event: Event) => void): this;
|
|
272
|
+
|
|
273
|
+
// Stop propagation versions for Media Events
|
|
274
|
+
onStopAbort(callback: (event: Event) => void): this;
|
|
275
|
+
onStopCanPlay(callback: (event: Event) => void): this;
|
|
276
|
+
onStopCanPlayThrough(callback: (event: Event) => void): this;
|
|
277
|
+
onStopDurationChange(callback: (event: Event) => void): this;
|
|
278
|
+
onStopEmptied(callback: (event: Event) => void): this;
|
|
279
|
+
onStopEnded(callback: (event: Event) => void): this;
|
|
280
|
+
onStopLoadedData(callback: (event: Event) => void): this;
|
|
281
|
+
onStopLoadedMetadata(callback: (event: Event) => void): this;
|
|
282
|
+
onStopLoadStart(callback: (event: Event) => void): this;
|
|
283
|
+
onStopPause(callback: (event: Event) => void): this;
|
|
284
|
+
onStopPlay(callback: (event: Event) => void): this;
|
|
285
|
+
onStopPlaying(callback: (event: Event) => void): this;
|
|
286
|
+
onStopProgress(callback: (event: ProgressEvent) => void): this;
|
|
287
|
+
onStopRateChange(callback: (event: Event) => void): this;
|
|
288
|
+
onStopSeeked(callback: (event: Event) => void): this;
|
|
289
|
+
onStopSeeking(callback: (event: Event) => void): this;
|
|
290
|
+
onStopStalled(callback: (event: Event) => void): this;
|
|
291
|
+
onStopSuspend(callback: (event: Event) => void): this;
|
|
292
|
+
onStopTimeUpdate(callback: (event: Event) => void): this;
|
|
293
|
+
onStopVolumeChange(callback: (event: Event) => void): this;
|
|
294
|
+
onStopWaiting(callback: (event: Event) => void): this;
|
|
295
|
+
|
|
296
|
+
// Stop propagation versions for Touch Events
|
|
297
|
+
onStopTouchCancel(callback: (event: TouchEvent) => void): this;
|
|
298
|
+
onStopTouchEnd(callback: (event: TouchEvent) => void): this;
|
|
299
|
+
onStopTouchMove(callback: (event: TouchEvent) => void): this;
|
|
300
|
+
onStopTouchStart(callback: (event: TouchEvent) => void): this;
|
|
301
|
+
|
|
302
|
+
// Stop propagation versions for Animation Events
|
|
303
|
+
onStopAnimationEnd(callback: (event: AnimationEvent) => void): this;
|
|
304
|
+
onStopAnimationIteration(callback: (event: AnimationEvent) => void): this;
|
|
305
|
+
onStopAnimationStart(callback: (event: AnimationEvent) => void): this;
|
|
306
|
+
|
|
307
|
+
// Stop propagation versions for Transition Events
|
|
308
|
+
onStopTransitionEnd(callback: (event: TransitionEvent) => void): this;
|
|
309
|
+
|
|
310
|
+
// Stop propagation versions for Clipboard Events
|
|
311
|
+
onStopCopy(callback: (event: ClipboardEvent) => void): this;
|
|
312
|
+
onStopCut(callback: (event: ClipboardEvent) => void): this;
|
|
313
|
+
onStopPaste(callback: (event: ClipboardEvent) => void): this;
|
|
314
|
+
|
|
315
|
+
// PREVENT + STOP VERSIONS
|
|
316
|
+
|
|
317
|
+
// Prevent + Stop versions for Mouse Events
|
|
318
|
+
onPreventStopClick(callback: (event: MouseEvent) => void): this;
|
|
319
|
+
onPreventStopDblClick(callback: (event: MouseEvent) => void): this;
|
|
320
|
+
onPreventStopMouseDown(callback: (event: MouseEvent) => void): this;
|
|
321
|
+
onPreventStopMouseEnter(callback: (event: MouseEvent) => void): this;
|
|
322
|
+
onPreventStopMouseLeave(callback: (event: MouseEvent) => void): this;
|
|
323
|
+
onPreventStopMouseMove(callback: (event: MouseEvent) => void): this;
|
|
324
|
+
onPreventStopMouseOut(callback: (event: MouseEvent) => void): this;
|
|
325
|
+
onPreventStopMouseOver(callback: (event: MouseEvent) => void): this;
|
|
326
|
+
onPreventStopMouseUp(callback: (event: MouseEvent) => void): this;
|
|
327
|
+
onPreventStopWheel(callback: (event: WheelEvent) => void): this;
|
|
328
|
+
onPreventStopContextMenu(callback: (event: MouseEvent) => void): this;
|
|
329
|
+
|
|
330
|
+
// Prevent + Stop versions for Keyboard Events
|
|
331
|
+
onPreventStopKeyDown(callback: (event: KeyboardEvent) => void): this;
|
|
332
|
+
onPreventStopKeyPress(callback: (event: KeyboardEvent) => void): this;
|
|
333
|
+
onPreventStopKeyUp(callback: (event: KeyboardEvent) => void): this;
|
|
334
|
+
|
|
335
|
+
// Prevent + Stop versions for Form Events
|
|
336
|
+
onPreventStopBlur(callback: (event: FocusEvent) => void): this;
|
|
337
|
+
onPreventStopChange(callback: (event: Event) => void): this;
|
|
338
|
+
onPreventStopFocus(callback: (event: FocusEvent) => void): this;
|
|
339
|
+
onPreventStopFocusIn(callback: (event: FocusEvent) => void): this;
|
|
340
|
+
onPreventStopFocusOut(callback: (event: FocusEvent) => void): this;
|
|
341
|
+
onPreventStopInput(callback: (event: Event) => void): this;
|
|
342
|
+
onPreventStopInvalid(callback: (event: Event) => void): this;
|
|
343
|
+
onPreventStopReset(callback: (event: Event) => void): this;
|
|
344
|
+
onPreventStopSearch(callback: (event: Event) => void): this;
|
|
345
|
+
onPreventStopSelect(callback: (event: Event) => void): this;
|
|
346
|
+
onPreventStopSubmit(callback: (event: Event) => void): this;
|
|
347
|
+
|
|
348
|
+
// Prevent + Stop versions for Drag Events
|
|
349
|
+
onPreventStopDrag(callback: (event: DragEvent) => void): this;
|
|
350
|
+
onPreventStopDragEnd(callback: (event: DragEvent) => void): this;
|
|
351
|
+
onPreventStopDragEnter(callback: (event: DragEvent) => void): this;
|
|
352
|
+
onPreventStopDragLeave(callback: (event: DragEvent) => void): this;
|
|
353
|
+
onPreventStopDragOver(callback: (event: DragEvent) => void): this;
|
|
354
|
+
onPreventStopDragStart(callback: (event: DragEvent) => void): this;
|
|
355
|
+
onPreventStopDrop(callback: (event: DragEvent) => void): this;
|
|
356
|
+
|
|
357
|
+
// Prevent + Stop versions for Window/Page Events
|
|
358
|
+
onPreventStopAfterPrint(callback: (event: Event) => void): this;
|
|
359
|
+
onPreventStopBeforePrint(callback: (event: Event) => void): this;
|
|
360
|
+
onPreventStopBeforeUnload(callback: (event: BeforeUnloadEvent) => void): this;
|
|
361
|
+
onPreventStopError(callback: (event: Event) => void): this;
|
|
362
|
+
onPreventStopHashChange(callback: (event: HashChangeEvent) => void): this;
|
|
363
|
+
onPreventStopLoad(callback: (event: Event) => void): this;
|
|
364
|
+
onPreventStopOffline(callback: (event: Event) => void): this;
|
|
365
|
+
onPreventStopOnline(callback: (event: Event) => void): this;
|
|
366
|
+
onPreventStopPageHide(callback: (event: PageTransitionEvent) => void): this;
|
|
367
|
+
onPreventStopPageShow(callback: (event: PageTransitionEvent) => void): this;
|
|
368
|
+
onPreventStopResize(callback: (event: UIEvent) => void): this;
|
|
369
|
+
onPreventStopScroll(callback: (event: Event) => void): this;
|
|
370
|
+
onPreventStopUnload(callback: (event: Event) => void): this;
|
|
371
|
+
|
|
372
|
+
// Prevent + Stop versions for Media Events
|
|
373
|
+
onPreventStopAbort(callback: (event: Event) => void): this;
|
|
374
|
+
onPreventStopCanPlay(callback: (event: Event) => void): this;
|
|
375
|
+
onPreventStopCanPlayThrough(callback: (event: Event) => void): this;
|
|
376
|
+
onPreventStopDurationChange(callback: (event: Event) => void): this;
|
|
377
|
+
onPreventStopEmptied(callback: (event: Event) => void): this;
|
|
378
|
+
onPreventStopEnded(callback: (event: Event) => void): this;
|
|
379
|
+
onPreventStopLoadedData(callback: (event: Event) => void): this;
|
|
380
|
+
onPreventStopLoadedMetadata(callback: (event: Event) => void): this;
|
|
381
|
+
onPreventStopLoadStart(callback: (event: Event) => void): this;
|
|
382
|
+
onPreventStopPause(callback: (event: Event) => void): this;
|
|
383
|
+
onPreventStopPlay(callback: (event: Event) => void): this;
|
|
384
|
+
onPreventStopPlaying(callback: (event: Event) => void): this;
|
|
385
|
+
onPreventStopProgress(callback: (event: ProgressEvent) => void): this;
|
|
386
|
+
onPreventStopRateChange(callback: (event: Event) => void): this;
|
|
387
|
+
onPreventStopSeeked(callback: (event: Event) => void): this;
|
|
388
|
+
onPreventStopSeeking(callback: (event: Event) => void): this;
|
|
389
|
+
onPreventStopStalled(callback: (event: Event) => void): this;
|
|
390
|
+
onPreventStopSuspend(callback: (event: Event) => void): this;
|
|
391
|
+
onPreventStopTimeUpdate(callback: (event: Event) => void): this;
|
|
392
|
+
onPreventStopVolumeChange(callback: (event: Event) => void): this;
|
|
393
|
+
onPreventStopWaiting(callback: (event: Event) => void): this;
|
|
394
|
+
|
|
395
|
+
// Prevent + Stop versions for Touch Events
|
|
396
|
+
onPreventStopTouchCancel(callback: (event: TouchEvent) => void): this;
|
|
397
|
+
onPreventStopTouchEnd(callback: (event: TouchEvent) => void): this;
|
|
398
|
+
onPreventStopTouchMove(callback: (event: TouchEvent) => void): this;
|
|
399
|
+
onPreventStopTouchStart(callback: (event: TouchEvent) => void): this;
|
|
400
|
+
|
|
401
|
+
// Prevent + Stop versions for Animation Events
|
|
402
|
+
onPreventStopAnimationEnd(callback: (event: AnimationEvent) => void): this;
|
|
403
|
+
onPreventStopAnimationIteration(callback: (event: AnimationEvent) => void): this;
|
|
404
|
+
onPreventStopAnimationStart(callback: (event: AnimationEvent) => void): this;
|
|
405
|
+
|
|
406
|
+
// Prevent + Stop versions for Transition Events
|
|
407
|
+
onPreventStopTransitionEnd(callback: (event: TransitionEvent) => void): this;
|
|
408
|
+
|
|
409
|
+
// Prevent + Stop versions for Clipboard Events
|
|
410
|
+
onPreventStopCopy(callback: (event: ClipboardEvent) => void): this;
|
|
411
|
+
onPreventStopCut(callback: (event: ClipboardEvent) => void): this;
|
|
412
|
+
onPreventStopPaste(callback: (event: ClipboardEvent) => void): this;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export type ValidChild =
|
|
416
|
+
| string
|
|
417
|
+
| number
|
|
418
|
+
| boolean
|
|
419
|
+
| null
|
|
420
|
+
| HTMLElement
|
|
421
|
+
| DocumentFragment
|
|
422
|
+
| Text
|
|
423
|
+
| ObservableItem
|
|
424
|
+
| NDElement
|
|
425
|
+
| ValidChild[];
|
|
426
|
+
|
|
427
|
+
export type Attributes = Record<string, any> & {
|
|
428
|
+
class?: string | Record<string, boolean | ObservableItem<boolean>>;
|
|
429
|
+
style?: string | Record<string, string | ObservableItem<string>>;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
export type ElementFunction = (attributes?: Attributes, children?: ValidChild) => HTMLElement & { nd: NDElement };
|
|
433
|
+
export type ElementFunctionWithoutAttrs = (children?: ValidChild) => HTMLElement & { nd: NDElement };
|
|
434
|
+
|
|
435
|
+
// HTML Elements
|
|
436
|
+
export declare const Div: ElementFunction;
|
|
437
|
+
export declare const Span: ElementFunction;
|
|
438
|
+
export declare const P: ElementFunction;
|
|
439
|
+
export declare const Paragraph: ElementFunction;
|
|
440
|
+
export declare const Strong: ElementFunction;
|
|
441
|
+
export declare const H1: ElementFunction;
|
|
442
|
+
export declare const H2: ElementFunction;
|
|
443
|
+
export declare const H3: ElementFunction;
|
|
444
|
+
export declare const H4: ElementFunction;
|
|
445
|
+
export declare const H5: ElementFunction;
|
|
446
|
+
export declare const H6: ElementFunction;
|
|
447
|
+
export declare const Label: ElementFunction;
|
|
448
|
+
export declare const Br: ElementFunctionWithoutAttrs;
|
|
449
|
+
export declare const Hr: ElementFunctionWithoutAttrs;
|
|
450
|
+
|
|
451
|
+
export declare const Pre: ElementFunction;
|
|
452
|
+
export declare const Code: ElementFunction;
|
|
453
|
+
export declare const Blockquote: ElementFunction;
|
|
454
|
+
export declare const Em: ElementFunction;
|
|
455
|
+
export declare const Small: ElementFunction;
|
|
456
|
+
export declare const Mark: ElementFunction;
|
|
457
|
+
export declare const Del: ElementFunction;
|
|
458
|
+
export declare const Ins: ElementFunction;
|
|
459
|
+
export declare const Sub: ElementFunction;
|
|
460
|
+
export declare const Sup: ElementFunction;
|
package/types/forms.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Form elements type definitions
|
|
2
|
+
import { Attributes, ValidChild, NDElement } from './elements';
|
|
3
|
+
import {ElementFunction} from "./elements";
|
|
4
|
+
|
|
5
|
+
// Form Elements
|
|
6
|
+
export declare const Form: ElementFunction & {
|
|
7
|
+
submit(action: string | ((event: Event) => void)): HTMLFormElement & { nd: NDElement };
|
|
8
|
+
multipartFormData(): HTMLFormElement & { nd: NDElement };
|
|
9
|
+
post(action: string): HTMLFormElement & { nd: NDElement };
|
|
10
|
+
get(action: string): HTMLFormElement & { nd: NDElement };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare const Input: ElementFunction;
|
|
14
|
+
export declare const TextArea: ElementFunction;
|
|
15
|
+
export declare const Select: ElementFunction;
|
|
16
|
+
export declare const Option: ElementFunction;
|
|
17
|
+
export declare const Button: ElementFunction;
|
|
18
|
+
|
|
19
|
+
// Specialized Input Types
|
|
20
|
+
export declare const HiddenInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
21
|
+
export declare const FileInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
22
|
+
export declare const PasswordInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
23
|
+
export declare const Checkbox: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
24
|
+
export declare const Radio: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
25
|
+
export declare const NumberInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
26
|
+
export declare const EmailInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
27
|
+
export declare const DateInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
28
|
+
export declare const TimeInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
29
|
+
export declare const RangeInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
30
|
+
export declare const ColorInput: (attributes?: Attributes) => HTMLInputElement & { nd: NDElement };
|
|
31
|
+
|
|
32
|
+
// Specialized Button Types
|
|
33
|
+
export declare const SimpleButton: (child: ValidChild, attributes?: Attributes) => HTMLButtonElement & { nd: NDElement };
|
|
34
|
+
export declare const SubmitButton: (child: ValidChild, attributes?: Attributes) => HTMLButtonElement & { nd: NDElement };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Image components type definitions
|
|
2
|
+
import { Attributes, NDElement } from './elements';
|
|
3
|
+
|
|
4
|
+
// Image Elements
|
|
5
|
+
export declare const Img: (src: string, attributes?: Attributes) => HTMLImageElement & { nd: NDElement };
|
|
6
|
+
export declare const AsyncImg: (
|
|
7
|
+
src: string,
|
|
8
|
+
defaultImage?: string,
|
|
9
|
+
attributes?: Attributes,
|
|
10
|
+
callback?: (error: Error | null, img?: HTMLImageElement) => void
|
|
11
|
+
) => HTMLImageElement & { nd: NDElement };
|
|
12
|
+
export declare const LazyImg: (src: string, attributes?: Attributes) => HTMLImageElement & { nd: NDElement };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Observable system type definitions
|
|
2
|
+
export interface ObservableItem<T = any> {
|
|
3
|
+
readonly $currentValue: T;
|
|
4
|
+
readonly $previousValue: T;
|
|
5
|
+
readonly $isCleanedUp: boolean;
|
|
6
|
+
|
|
7
|
+
val(): T;
|
|
8
|
+
set(value: T | ((prev: T) => T)): void;
|
|
9
|
+
trigger(operations?: ObservableOperation): void;
|
|
10
|
+
cleanup(): void;
|
|
11
|
+
|
|
12
|
+
subscribe(callback: (current: T, previous: T, operations?: ObservableOperation) => void): () => void;
|
|
13
|
+
unsubscribe(callback: Function): void;
|
|
14
|
+
on(value: T, callback: ObservableItem<boolean> | ((isActive: boolean) => void)): () => void;
|
|
15
|
+
|
|
16
|
+
check<U>(callback: (value: T) => U): ObservableChecker<U>;
|
|
17
|
+
get<U>(callback: (value: T) => U): ObservableChecker<U>;
|
|
18
|
+
when(value: T): { $target: T; $observer: ObservableItem<T> };
|
|
19
|
+
|
|
20
|
+
toString(): string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ObservableOperation {
|
|
24
|
+
action?: string;
|
|
25
|
+
args?: any[];
|
|
26
|
+
result?: any;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface ObservableChecker<T = any> {
|
|
30
|
+
readonly __$isObservableChecker: true;
|
|
31
|
+
|
|
32
|
+
subscribe(callback: (value: T) => void): () => void;
|
|
33
|
+
check<U>(callback: (value: T) => U): ObservableChecker<U>;
|
|
34
|
+
val(): T;
|
|
35
|
+
|
|
36
|
+
set(value: any): void;
|
|
37
|
+
trigger(): void;
|
|
38
|
+
cleanup(): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface ObservableArray<T> extends ObservableItem<T[]> {
|
|
42
|
+
push(...items: T[]): number;
|
|
43
|
+
pop(): T | undefined;
|
|
44
|
+
shift(): T | undefined;
|
|
45
|
+
unshift(...items: T[]): number;
|
|
46
|
+
reverse(): T[];
|
|
47
|
+
sort(compareFn?: (a: T, b: T) => number): T[];
|
|
48
|
+
splice(start: number, deleteCount?: number, ...items: T[]): T[];
|
|
49
|
+
|
|
50
|
+
clear(): boolean;
|
|
51
|
+
merge(values: T[]): void;
|
|
52
|
+
remove(index: number): T[];
|
|
53
|
+
swap(indexA: number, indexB: number): boolean;
|
|
54
|
+
length(): number;
|
|
55
|
+
populateAndRender(iteration: number, callback: (index: number) => T): void;
|
|
56
|
+
|
|
57
|
+
map<U>(callback: (value: T, index: number, array: T[]) => U): U[];
|
|
58
|
+
filter(callback: (value: T, index: number, array: T[]) => boolean): T[];
|
|
59
|
+
reduce<U>(callback: (acc: U, value: T, index: number, array: T[]) => U, initial: U): U;
|
|
60
|
+
some(callback: (value: T, index: number, array: T[]) => boolean): boolean;
|
|
61
|
+
every(callback: (value: T, index: number, array: T[]) => boolean): boolean;
|
|
62
|
+
find(callback: (value: T, index: number, array: T[]) => boolean): T | undefined;
|
|
63
|
+
findIndex(callback: (value: T, index: number, array: T[]) => boolean): number;
|
|
64
|
+
concat(...items: (T | T[])[]): T[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type ObservableProxy<T extends Record<string, any>> = {
|
|
68
|
+
readonly __isProxy__: true;
|
|
69
|
+
readonly $value: T;
|
|
70
|
+
$clone(): ObservableProxy<T>;
|
|
71
|
+
} & {
|
|
72
|
+
[K in keyof T]: T[K] extends (infer U)[]
|
|
73
|
+
? ObservableArray<U>
|
|
74
|
+
: T[K] extends Record<string, any>
|
|
75
|
+
? ObservableProxy<T[K]>
|
|
76
|
+
: ObservableItem<T[K]>;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export interface BatchFunction<TArgs extends any[] = any[], TReturn = any> {
|
|
80
|
+
(...args: TArgs): TReturn;
|
|
81
|
+
readonly $observer: ObservableItem<number>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface ObservableStatic {
|
|
85
|
+
<T>(value: T): ObservableItem<T>;
|
|
86
|
+
array<T>(target: T[]): ObservableArray<T>;
|
|
87
|
+
init<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
88
|
+
object<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
89
|
+
json<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
90
|
+
|
|
91
|
+
computed<T>(callback: () => T, dependencies?: ObservableItem[]): ObservableItem<T>;
|
|
92
|
+
computed<T>(callback: () => T, batchFunction?: BatchFunction): ObservableItem<T>;
|
|
93
|
+
|
|
94
|
+
batch(callback: Function): BatchFunction;
|
|
95
|
+
value(data: any): any;
|
|
96
|
+
update(target: any, data: any): void;
|
|
97
|
+
|
|
98
|
+
getById(id: number): ObservableItem | null;
|
|
99
|
+
cleanup(observable: ObservableItem): void;
|
|
100
|
+
autoCleanup(enable?: boolean, options?: { interval?: number; threshold?: number }): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface AutoCleanupOptions {
|
|
104
|
+
interval?: number;
|
|
105
|
+
threshold?: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ObservableStatic {
|
|
109
|
+
<T>(value: T): ObservableItem<T>;
|
|
110
|
+
array<T>(target: T[]): ObservableArray<T>;
|
|
111
|
+
|
|
112
|
+
init<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
113
|
+
object<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
114
|
+
json<T extends Record<string, any>>(value: T): ObservableProxy<T>;
|
|
115
|
+
|
|
116
|
+
computed<T>(callback: () => T, dependencies?: ObservableItem[]): ObservableItem<T>;
|
|
117
|
+
computed<T>(callback: () => T, batchFunction?: BatchFunction): ObservableItem<T>;
|
|
118
|
+
|
|
119
|
+
batch<TArgs extends any[], TReturn>(
|
|
120
|
+
callback: (...args: TArgs) => TReturn
|
|
121
|
+
): BatchFunction<TArgs, TReturn>;
|
|
122
|
+
|
|
123
|
+
value(data: any): any;
|
|
124
|
+
update(target: any, data: any): void;
|
|
125
|
+
|
|
126
|
+
getById(id: number): ObservableItem | null;
|
|
127
|
+
cleanup(observable: ObservableItem): void;
|
|
128
|
+
autoCleanup(enable?: boolean, options?: AutoCleanupOptions): void;
|
|
129
|
+
}
|