@thednp/shorty 2.0.11 → 2.0.13

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/shorty.d.ts DELETED
@@ -1,2145 +0,0 @@
1
- import { CustomElement as CustomElement_2 } from '..';
2
- import { version } from '../package.json';
3
-
4
- /**
5
- * A global namespace for `abort` event.
6
- */
7
- export declare const abortEvent = "abort";
8
-
9
- declare interface AbstractView {
10
- styleMedia: StyleMedia;
11
- document: Document;
12
- }
13
-
14
- /**
15
- * Add one or more CSS classes to `Element.classList`.
16
- *
17
- * @param element target
18
- * @param classNAME to add
19
- */
20
- export declare const addClass: (element: Element, ...classNAME: string[]) => void;
21
-
22
- /**
23
- * A global namespace for 'addEventListener' string.
24
- */
25
- declare const addEventListener_2 = "addEventListener";
26
- export { addEventListener_2 as addEventListener }
27
-
28
- /**
29
- * Utility to add focus trap inside a designated target element;
30
- * @param target
31
- */
32
- export declare const addFocusTrap: (target: Element) => void;
33
-
34
- /**
35
- * A global namespace for 'animationDelay' string.
36
- */
37
- export declare const animationDelay = "animationDelay";
38
-
39
- /**
40
- * A global namespace for 'animationDuration' string.
41
- */
42
- export declare const animationDuration = "animationDuration";
43
-
44
- /**
45
- * A global namespace for 'animationend' string.
46
- */
47
- export declare const animationEndEvent = "animationend";
48
-
49
- declare interface AnimationEvent_2<T extends EventTarget = HTMLElement>
50
- extends NativeEvent<T, NativeAnimationEvent> {
51
- animationName: string;
52
- elapsedTime: number;
53
- pseudoElement: string;
54
- }
55
- export { AnimationEvent_2 as AnimationEvent }
56
-
57
- export declare type AnimationEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
58
- T,
59
- AnimationEvent_2<T>
60
- >;
61
-
62
- /**
63
- * A global namespace for 'animationName' string.
64
- */
65
- export declare const animationName = "animationName";
66
-
67
- /**
68
- * A global namespace for aria-checked.
69
- */
70
- export declare const ariaChecked = "aria-checked";
71
-
72
- /**
73
- * A global namespace for aria-describedby.
74
- */
75
- export declare const ariaDescribedBy = "aria-describedby";
76
-
77
- /**
78
- * A global namespace for aria-description.
79
- */
80
- export declare const ariaDescription = "aria-description";
81
-
82
- /**
83
- * A global namespace for aria-expanded.
84
- */
85
- export declare const ariaExpanded = "aria-expanded";
86
-
87
- /**
88
- * A global namespace for aria-haspopup.
89
- */
90
- export declare const ariaHasPopup = "aria-haspopup";
91
-
92
- /**
93
- * A global namespace for aria-hidden.
94
- */
95
- export declare const ariaHidden = "aria-hidden";
96
-
97
- /**
98
- * A global namespace for aria-label.
99
- */
100
- export declare const ariaLabel = "aria-label";
101
-
102
- /**
103
- * A global namespace for aria-labelledby.
104
- */
105
- export declare const ariaLabelledBy = "aria-labelledby";
106
-
107
- /**
108
- * A global namespace for aria-modal.
109
- */
110
- export declare const ariaModal = "aria-modal";
111
-
112
- /**
113
- * A global namespace for aria-pressed.
114
- */
115
- export declare const ariaPressed = "aria-pressed";
116
-
117
- /**
118
- * A global namespace for aria-selected.
119
- */
120
- export declare const ariaSelected = "aria-selected";
121
-
122
- /**
123
- * A global namespace for aria-valuemax.
124
- */
125
- export declare const ariaValueMax = "aria-valuemax";
126
-
127
- /**
128
- * A global namespace for aria-valuemin.
129
- */
130
- export declare const ariaValueMin = "aria-valuemin";
131
-
132
- /**
133
- * A global namespace for aria-valuenow.
134
- */
135
- export declare const ariaValueNow = "aria-valuenow";
136
-
137
- /**
138
- * A global namespace for aria-valuetext.
139
- */
140
- export declare const ariaValueText = "aria-valuetext";
141
-
142
- /**
143
- * Shortie for `Array.from()` static method.
144
- * The utility should also work with any typed arrays
145
- * like Float64Array or Int32Array.
146
- *
147
- * @param arr array-like iterable object
148
- * @returns a new array from iterable object
149
- */
150
- export declare const ArrayFrom: <T>(arr: ArrayLike<T> | Iterable<T>) => T[];
151
-
152
- declare interface BaseEvent<E = Event, C = unknown, T = unknown> {
153
- nativeEvent: E;
154
- currentTarget: C | null;
155
- target: T & EventTarget;
156
- bubbles: boolean;
157
- cancelable: boolean;
158
- defaultPrevented: boolean;
159
- eventPhase: number;
160
- isTrusted: boolean;
161
- preventDefault(): void;
162
- isDefaultPrevented(): boolean;
163
- stopPropagation(): void;
164
- isPropagationStopped(): boolean;
165
- persist(): void;
166
- timeStamp: number;
167
- type: string;
168
- }
169
-
170
- /**
171
- * A global namespace for `beforeunload` event.
172
- */
173
- export declare const beforeunloadEvent = "beforeunload";
174
-
175
- /**
176
- * A global namespace for predefined
177
- * CSS3 'cubic-bezier()' easing functions.
178
- */
179
- export declare const bezierEasings: {
180
- linear: string;
181
- easingSinusoidalIn: string;
182
- easingSinusoidalOut: string;
183
- easingSinusoidalInOut: string;
184
- easingQuadraticIn: string;
185
- easingQuadraticOut: string;
186
- easingQuadraticInOut: string;
187
- easingCubicIn: string;
188
- easingCubicOut: string;
189
- easingCubicInOut: string;
190
- easingQuarticIn: string;
191
- easingQuarticOut: string;
192
- easingQuarticInOut: string;
193
- easingQuinticIn: string;
194
- easingQuinticOut: string;
195
- easingQuinticInOut: string;
196
- easingExponentialIn: string;
197
- easingExponentialOut: string;
198
- easingExponentialInOut: string;
199
- easingCircularIn: string;
200
- easingCircularOut: string;
201
- easingCircularInOut: string;
202
- easingBackIn: string;
203
- easingBackOut: string;
204
- easingBackInOut: string;
205
- };
206
-
207
- /**
208
- * A global namespace for `blur` event.
209
- */
210
- export declare const blurEvent = "blur";
211
-
212
- export declare interface BoundingClientRect {
213
- width: number;
214
- height: number;
215
- top: number;
216
- left: number;
217
- right: number;
218
- bottom: number;
219
- x: number;
220
- y: number;
221
- }
222
-
223
- /**
224
- * Transform a string to camel case.
225
- * @param input source string
226
- */
227
- export declare const camelCase: (input: string) => string;
228
-
229
- /**
230
- * Capitalize first character in a string.
231
- * @param input source string
232
- */
233
- export declare const capitalize: (input: string) => string;
234
-
235
- export declare interface ChangeEvent<T extends EventTarget = FormControl>
236
- extends FormEvent<T> {
237
- target: EventTarget & T;
238
- }
239
-
240
- /**
241
- * A global namespace for `change` event.
242
- */
243
- export declare const changeEvent = "change";
244
-
245
- export declare type ChangeEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
246
- T,
247
- ChangeEvent<T>
248
- >;
249
-
250
- declare interface ClipboardEvent_2<T extends EventTarget = HTMLElement>
251
- extends NativeEvent<T, NativeClipboardEvent> {
252
- clipboardData: DataTransfer;
253
- }
254
- export { ClipboardEvent_2 as ClipboardEvent }
255
-
256
- export declare type ClipboardEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
257
- T,
258
- ClipboardEvent_2<T>
259
- >;
260
-
261
- /**
262
- * Shortcut for `HTMLElement.closest` method which also works
263
- * with children of `ShadowRoot`. The order of the parameters
264
- * is intentional since they're both required.
265
- *
266
- * @see https://stackoverflow.com/q/54520554/803358
267
- *
268
- * @param element target Element to check
269
- * @param selector the selector string
270
- * @return the query result
271
- */
272
- export declare const closest: <T extends Element>(element: T, selector: string) => T | null;
273
-
274
- declare interface CompositionEvent_2<T extends EventTarget = HTMLElement>
275
- extends NativeEvent<T, NativeCompositionEvent> {
276
- data: string;
277
- }
278
- export { CompositionEvent_2 as CompositionEvent }
279
-
280
- export declare type CompositionEventHandler<T extends EventTarget = HTMLElement> =
281
- EventHandler<
282
- T,
283
- CompositionEvent_2<T>
284
- >;
285
-
286
- /**
287
- * A global namespace for `contextmenu` event.
288
- */
289
- export declare const contextmenuEvent = "contextmenu";
290
-
291
- /**
292
- * Returns a namespaced `CustomEvent` specific to each component.
293
- *
294
- * @param eventType Event.type
295
- * @param config Event.options | Event.properties
296
- * @returns a new namespaced event
297
- */
298
- export declare const createCustomEvent: <O extends unknown & Record<string, unknown>, T extends OriginalEvent>(eventType: string, config?: O) => T;
299
-
300
- /**
301
- * Shortie for `document.createElement` method
302
- * which allows you to create a new `HTMLElement` for a given `tagName`
303
- * or based on an object with specific non-readonly attributes with string values:
304
- * `id`, `className`, `textContent`, `style`, etc.
305
- *
306
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement
307
- *
308
- * @param param `tagName` or object
309
- * @return a new `HTMLElement`
310
- */
311
- export declare const createElement: <T extends HTMLElement>(param?: string | Partial<T>) => T | undefined;
312
-
313
- /**
314
- * Shortie for `document.createElementNS` method
315
- * which allows you to create a new `Element` for a given `tagName`
316
- * or based on an object with specific non-readonly attributes with string values:
317
- * `id`, `className`, `textContent`, `style`, etc.
318
- * Note: some elements resulted from this function call may not be compatible with
319
- * some attributes.
320
- *
321
- * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS
322
- *
323
- * @param ns `namespaceURI` to associate with the new `Element`
324
- * @param param `tagName` or object
325
- * @return a new `Element`
326
- */
327
- export declare const createElementNS: <T extends Element>(ns: string, param?: string | Partial<T>) => T | undefined;
328
-
329
- export declare interface CSS4Declaration
330
- extends Exclude<() => string | symbol, CSSStyleDeclaration> {
331
- [key: string]: string;
332
- }
333
-
334
- export declare interface CustomElement extends HTMLElement {
335
- shadowRoot: ShadowRoot;
336
- connectedCallback?: () => void;
337
- disconnectedCallback?: () => void;
338
- adoptedCallback?: () => void;
339
- attributeChangedCallback?: () => void;
340
- // [key: PropertyKey]: any;
341
- }
342
-
343
- /**
344
- * An interface for web components background data.
345
- *
346
- * @see https://github.com/thednp/bootstrap.native/blob/master/src/components/base-component.js
347
- */
348
- export declare const Data: {
349
- data: Map<string, Map<Element, unknown>>;
350
- /**
351
- * Sets web components data.
352
- *
353
- * @param element target element
354
- * @param component the component's name or a unique key
355
- * @param instance the component instance
356
- */
357
- set: <T>(element: Element, component: string, instance: T) => void;
358
- /**
359
- * Returns all instances for specified component.
360
- *
361
- * @param component the component's name or a unique key
362
- * @returns all the component instances
363
- */
364
- getAllFor: <T>(component: string) => Map<Element, T> | null;
365
- /**
366
- * Returns the instance associated with the target.
367
- *
368
- * @param element target element
369
- * @param component the component's name or a unique key
370
- * @returns the instance
371
- */
372
- get: <T>(element: Element, component: string) => T | null;
373
- /**
374
- * Removes web components data.
375
- *
376
- * @param element target element
377
- * @param component the component's name or a unique key
378
- */
379
- remove: <T>(element: Element, component: string) => void;
380
- };
381
-
382
- /**
383
- * Shortcut for the `Element.dispatchEvent(Event)` method.
384
- *
385
- * @param element is the target
386
- * @param event is the `Event` object
387
- */
388
- declare const dispatchEvent_2: (element: EventTarget, event: Event) => boolean;
389
- export { dispatchEvent_2 as dispatchEvent }
390
-
391
- /**
392
- * JavaScript `Array` distinct.
393
- *
394
- * @see https://codeburst.io/javascript-array-distinct-5edc93501dc4
395
- *
396
- * @example
397
- * ```
398
- * [0,1,1,2].filter(distinct)
399
- * // => [0,1,2]
400
- * ```
401
- * @param value array item value
402
- * @param index array item index
403
- * @param arr a clone of the target array
404
- * @returns the query result
405
- */
406
- export declare const distinct: <T>(value: T, index: number, arr: T[]) => boolean;
407
-
408
- /**
409
- * A global namespace for `document.body`.
410
- */
411
- export declare const documentBody: HTMLElement;
412
-
413
- /**
414
- * A global namespace for `document.documentElement` or the `<HTML>`.
415
- */
416
- export declare const documentElement: HTMLElement;
417
-
418
- /**
419
- * A global namespace for `document.head`.
420
- */
421
- export declare const documentHead: HTMLHeadElement;
422
-
423
- /**
424
- * A global namespace for `DOMContentLoaded` event.
425
- */
426
- export declare const DOMContentLoadedEvent = "DOMContentLoaded";
427
-
428
- /**
429
- * A global namespace for `DOMMouseScroll` event.
430
- */
431
- export declare const DOMMouseScrollEvent = "DOMMouseScroll";
432
-
433
- /**
434
- * A global namespace for `dragend` event.
435
- */
436
- export declare const dragendEvent = "dragend";
437
-
438
- /**
439
- * A global namespace for `dragenter` event.
440
- */
441
- export declare const dragenterEvent = "dragenter";
442
-
443
- /**
444
- * A global namespace for `drag` event.
445
- */
446
- export declare const dragEvent = "drag";
447
-
448
- declare interface DragEvent_2<T extends EventTarget = HTMLElement>
449
- extends MouseEvent_2<T, NativeDragEvent> {
450
- dataTransfer: DataTransfer;
451
- }
452
- export { DragEvent_2 as DragEvent }
453
-
454
- export declare type DragEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
455
- T,
456
- DragEvent_2<T>
457
- >;
458
-
459
- /**
460
- * A global namespace for `dragleave` event.
461
- */
462
- export declare const dragleaveEvent = "dragleave";
463
-
464
- /**
465
- * A global namespace for `dragover` event.
466
- */
467
- export declare const dragoverEvent = "dragover";
468
-
469
- /**
470
- * A global namespace for `dragstart` event.
471
- */
472
- export declare const dragstartEvent = "dragstart";
473
-
474
- /**
475
- * Utility to make sure callbacks are consistently
476
- * called when animation ends.
477
- *
478
- * @param element target
479
- * @param handler `animationend` callback
480
- */
481
- export declare const emulateAnimationEnd: (element: Element, handler: EventListener) => void;
482
-
483
- /**
484
- * Utility to make sure callbacks are consistently
485
- * called when transition ends.
486
- *
487
- * @param element element target
488
- * @param handler `transitionend` callback
489
- */
490
- export declare const emulateTransitionEnd: (element: Element, handler: EventListener) => void;
491
-
492
- /**
493
- * A global namespace for `error` event.
494
- */
495
- export declare const errorEvent = "error";
496
-
497
- declare type EventHandler<
498
- T extends EventTarget = HTMLElement,
499
- E = Event | NativeEvent<T>,
500
- > = (event: E) => void;
501
-
502
- /**
503
- * Shortcut for `Float32Array.from()` static method.
504
- *
505
- * @param arr array-like iterable object
506
- * @returns a new Float32Array
507
- */
508
- export declare const Float32ArrayFrom: (arr: ArrayLike<number> | Iterable<number>) => Float32Array;
509
-
510
- /**
511
- * Shortcut for `Float64Array.from()` static method.
512
- *
513
- * @param arr array-like iterable object
514
- * @returns a new Float64Array
515
- */
516
- export declare const Float64ArrayFrom: (arr: ArrayLike<number> | Iterable<number>) => Float64Array;
517
-
518
- declare type Fn = (...args: unknown[]) => unknown;
519
-
520
- /**
521
- * Shortie for `HTMLOrSVGElement.focus()` method.
522
- *
523
- * @param element is the target
524
- * @param options allows to pass additional options such as `preventScroll: boolean`
525
- */
526
- declare const focus_2: (element: HTMLOrSVGElement, options?: FocusOptions) => void;
527
- export { focus_2 as focus }
528
-
529
- export declare type FocusableElement = HTMLAnchorElement | HTMLButtonElement | HTMLInputElement | HTMLTextAreaElement | HTMLDataListElement | HTMLDetailsElement | HTMLSelectElement;
530
-
531
- export declare const focusableSelector = "a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]";
532
-
533
- /**
534
- * A global namespace for `focus` event.
535
- */
536
- export declare const focusEvent = "focus";
537
-
538
- declare interface FocusEvent_2<
539
- T extends EventTarget = HTMLElement,
540
- R extends Element = HTMLElement,
541
- > extends NativeEvent<T, NativeFocusEvent> {
542
- relatedTarget: (EventTarget & R) | null;
543
- target: EventTarget & T;
544
- }
545
- export { FocusEvent_2 as FocusEvent }
546
-
547
- export declare type FocusEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
548
- T,
549
- FocusEvent_2<T>
550
- >;
551
-
552
- /**
553
- * A global namespace for focus event names.
554
- */
555
- export declare const focusEvents: {
556
- in: string;
557
- out: string;
558
- };
559
-
560
- /**
561
- * A global namespace for `focusin` event.
562
- */
563
- export declare const focusinEvent = "focusin";
564
-
565
- /**
566
- * A global namespace for `focusout` event.
567
- */
568
- export declare const focusoutEvent = "focusout";
569
-
570
- declare type FormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
571
-
572
- export declare type FormEvent<T extends EventTarget = FormControl> = NativeEvent<T>;
573
-
574
- export declare type FormEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
575
- T,
576
- FormEvent<T>
577
- >;
578
-
579
- /**
580
- * A global namespace for `gesturechange` event.
581
- */
582
- export declare const gesturechangeEvent = "gesturechange";
583
-
584
- /**
585
- * A global namespace for `gestureend` event.
586
- */
587
- export declare const gestureendEvent = "gestureend";
588
-
589
- /**
590
- * A global namespace for `gesturestart` event.
591
- */
592
- export declare const gesturestartEvent = "gesturestart";
593
-
594
- /**
595
- * Shortcut for `Element.getAttribute()` method.
596
- *
597
- * @param element target element
598
- * @param att attribute name
599
- * @returns attribute value
600
- */
601
- export declare const getAttribute: (element: Element, att: string) => string | null;
602
-
603
- /**
604
- * Shortcut for `Element.getAttributeNS()` method.
605
- *
606
- * @param ns attribute namespace
607
- * @param element target element
608
- * @param att attribute name
609
- * @returns attribute value
610
- */
611
- export declare const getAttributeNS: (ns: string, element: Element, att: string) => string | null;
612
-
613
- /**
614
- * Returns the bounding client rect of a target `Element`.
615
- *
616
- * @see https://github.com/floating-ui/floating-ui
617
- *
618
- * @param element event.target
619
- * @param includeScale when *true*, the target scale is also computed
620
- * @returns the bounding client rect object
621
- */
622
- export declare const getBoundingClientRect: (element: Element, includeScale?: boolean) => BoundingClientRect;
623
-
624
- /**
625
- * Returns an `Array` of `Node` elements that are registered as
626
- * `CustomElement`.
627
- *
628
- * @see https://stackoverflow.com/questions/27334365/how-to-get-list-of-registered-custom-elements
629
- *
630
- * @param parent parent to look into
631
- * @returns the query result
632
- */
633
- export declare const getCustomElements: (parent?: ParentNode) => CustomElement_2[];
634
-
635
- /**
636
- * Returns the `document` or the `#document` element.
637
- *
638
- * @see https://github.com/floating-ui/floating-ui
639
- *
640
- * @param node the reference node
641
- * @returns the parent document of the given node
642
- */
643
- export declare const getDocument: (node?: Node | Document | Window) => Document;
644
-
645
- /**
646
- * Returns the `document.body` or the `<body>` element.
647
- *
648
- * @param node the reference node
649
- * @returns the parent `<body>` of the specified node
650
- */
651
- export declare const getDocumentBody: (node?: Node | Document | Window) => HTMLElement;
652
-
653
- /**
654
- * Returns the `document.documentElement` or the `<HTML>` element.
655
- *
656
- * @param node the reference node
657
- * @returns the parent `<HTML>` of the node's parent document
658
- */
659
- export declare const getDocumentElement: (node?: Node | Document | Window) => HTMLElement;
660
-
661
- /**
662
- * Returns the `document.head` or the `<head>` element.
663
- *
664
- * @param node the reference node
665
- * @returns the `<head>` of the node's parent document
666
- */
667
- export declare const getDocumentHead: (node?: Node | Document | Window) => HTMLHeadElement;
668
-
669
- /**
670
- * Utility to get the computed `animationDelay`
671
- * from Element in miliseconds.
672
- *
673
- * @param element target
674
- * @return the `animationDelay` value in miliseconds
675
- */
676
- export declare const getElementAnimationDelay: (element: Element) => number;
677
-
678
- /**
679
- * Utility to get the computed `animationDuration`
680
- * from `Element` in miliseconds.
681
- *
682
- * @param element target
683
- * @return the `animationDuration` value in miliseconds
684
- */
685
- export declare const getElementAnimationDuration: (element: Element) => number;
686
-
687
- /**
688
- * Returns an `HTMLElement` that matches the id in the document.
689
- * Within multiple <iframe> elements, a `parent` parameter
690
- * would decisively locate the correct element.
691
- *
692
- * @param id the ID selector
693
- * @param context an element in it's document or document
694
- * @returns the requested element
695
- */
696
- export declare const getElementById: (id: string, context?: Node) => HTMLElement | null;
697
-
698
- /**
699
- * Shortcut for `Element.getElementsByClassName` method. Some `Node` elements
700
- * like `ShadowRoot` do not support `getElementsByClassName`.
701
- *
702
- * @param selector the class name
703
- * @param parent optional Element to look into
704
- * @return the 'HTMLCollection'
705
- */
706
- export declare const getElementsByClassName: <T extends Element>(selector: string, parent?: ParentNode) => HTMLCollectionOf<T>;
707
-
708
- /**
709
- * Shortcut for `Element.getElementsByTagName` method. Some `Node` elements
710
- * like `ShadowRoot` do not support `getElementsByTagName`.
711
- *
712
- * @param selector the tag name
713
- * @param parent optional Element to look into
714
- * @return the 'HTMLCollection'
715
- */
716
- export declare const getElementsByTagName: <T extends Element>(selector: string, parent?: ParentNode) => HTMLCollectionOf<T>;
717
-
718
- /**
719
- * Shortcut for `window.getComputedStyle(element).propertyName`
720
- * static method.
721
- *
722
- * * If `element` parameter is not an `Element`, `getComputedStyle`
723
- * throws a `ReferenceError`.
724
- *
725
- * @param element target `Element`
726
- * @param property the css property
727
- * @param pseudoElt pseudo-elements
728
- * @return the css property value
729
- */
730
- export declare const getElementStyle: (element: Element, property: string, pseudoElt?: string | null) => string;
731
-
732
- /**
733
- * Utility to get the computed `transitionDelay`
734
- * from Element in miliseconds.
735
- *
736
- * @param element target
737
- * @return the `transitionDelay` value in miliseconds
738
- */
739
- export declare const getElementTransitionDelay: (element: Element) => number;
740
-
741
- /**
742
- * Utility to get the computed `transitionDuration`
743
- * from Element in miliseconds.
744
- *
745
- * @param element target
746
- * @return the `transitionDuration` value in miliseconds
747
- */
748
- export declare const getElementTransitionDuration: (element: Element) => number;
749
-
750
- /**
751
- * An alias for `Data.get()`.
752
- */
753
- export declare const getInstance: <T>(target: Element, component: string) => T | null;
754
-
755
- /**
756
- * Returns the value of `node.nodeName` for the given node.
757
- * @param node target node
758
- * @returns the node name
759
- */
760
- export declare const getNodeName: (node: Node | Window) => string;
761
-
762
- /**
763
- * Returns an `{x, y}` object with the target
764
- * `Element` / `Node` scroll position.
765
- *
766
- * @see https://github.com/floating-ui/floating-ui
767
- *
768
- * @param element target node / element
769
- * @returns the scroll tuple
770
- */
771
- export declare const getNodeScroll: (element: Element | Window) => {
772
- x: number;
773
- y: number;
774
- };
775
-
776
- /**
777
- * Returns the `offsetParent` for a given target.
778
- *
779
- * @see https://github.com/floating-ui/floating-ui
780
- *
781
- * @param element the target node
782
- * @returns the offset parent node
783
- */
784
- export declare const getOffsetParent: (element: Element) => Element | Window;
785
-
786
- /**
787
- * Returns the `parentNode` also going through `ShadowRoot`.
788
- *
789
- * @see https://github.com/floating-ui/floating-ui
790
- *
791
- * @param node the target node
792
- * @returns the apropriate parent node
793
- */
794
- export declare const getParentNode: (node: Node) => ParentNode;
795
-
796
- /**
797
- * Returns the rect relative to a given offset parent and its scroll position.
798
- *
799
- * @see https://github.com/floating-ui/floating-ui
800
- *
801
- * @param element target
802
- * @param offsetParent the container / offset parent
803
- * @param scroll the offsetParent scroll position
804
- * @returns a DOMRect like object
805
- */
806
- export declare const getRectRelativeToOffsetParent: (element: Element, offsetParent: Element | Window, scroll: {
807
- x: number;
808
- y: number;
809
- }) => OffsetRect;
810
-
811
- /**
812
- * Returns a unique identifier for popover, tooltip, scrollspy.
813
- *
814
- * @param element target element
815
- * @param key optional identifier key
816
- * @returns an existing or new unique ID
817
- */
818
- export declare const getUID: (element: Element, key?: string) => number;
819
-
820
- /**
821
- * Returns the `Window` object of a target node.
822
- *
823
- * @see https://github.com/floating-ui/floating-ui
824
- *
825
- * @param node target node
826
- * @returns the `Window` object
827
- */
828
- export declare const getWindow: (node?: Node) => Window;
829
-
830
- export declare function handleKeyboardNavigation<T extends Element & EventTarget>(this: T, event: KeyboardEvent_2<T>): void;
831
-
832
- /**
833
- * Shortcut for `Element.hasAttribute()` method.
834
- *
835
- * @param element target element
836
- * @param att attribute name
837
- * @returns the query result
838
- */
839
- export declare const hasAttribute: (element: Element, att: string) => boolean;
840
-
841
- /**
842
- * Shortcut for `Element.hasAttributeNS()` method.
843
- *
844
- * @param ns attribute namespace
845
- * @param element target element
846
- * @param att attribute name
847
- * @returns the query result
848
- */
849
- export declare const hasAttributeNS: (ns: string, element: Element, att: string) => boolean;
850
-
851
- /**
852
- * Check class in `Element.classList`.
853
- *
854
- * @param element target
855
- * @param classNAME to check
856
- */
857
- export declare const hasClass: (element: Element, classNAME: string) => boolean;
858
-
859
- /**
860
- * Utility to check if a designated element is affected by focus trap;
861
- * @param target
862
- */
863
- export declare const hasFocusTrap: (target: Element) => boolean;
864
-
865
- /**
866
- * An accessor that checks for Apple browsers.
867
- */
868
- export declare const isApple: () => boolean;
869
-
870
- /**
871
- * Shortie for the `Array.isArray()` static method.
872
- *
873
- * @param obj array-like iterable object
874
- * @returns the query result
875
- */
876
- export declare const isArray: (obj?: unknown) => obj is unknown[];
877
-
878
- /**
879
- * Checks if an element is an `HTMLCanvasElement` or `<canvas>`.
880
- *
881
- * @param element the target element
882
- * @returns the query result
883
- */
884
- export declare const isCanvas: (element?: unknown) => element is HTMLCanvasElement;
885
-
886
- /**
887
- * Checks if an object is a `CustomElement`.
888
- *
889
- * @param element the target object
890
- * @returns the query result
891
- */
892
- export declare const isCustomElement: <T extends CustomElement>(element?: unknown) => element is T;
893
-
894
- /**
895
- * Checks if an object is a `Document`.
896
- *
897
- * @see https://dom.spec.whatwg.org/#node
898
- *
899
- * @param obj the target object
900
- * @returns the query result
901
- */
902
- export declare const isDocument: (obj?: unknown) => obj is Document;
903
-
904
- /**
905
- * Checks if an object is an `Element`.
906
- *
907
- * @param element the target object
908
- * @returns the query result
909
- */
910
- export declare const isElement: (element?: unknown) => element is Element;
911
-
912
- /**
913
- * Utility to determine if an `Element`
914
- * is partially visible in viewport.
915
- *
916
- * @param element target
917
- * @return the query result
918
- */
919
- export declare const isElementInScrollRange: (element?: Element) => boolean;
920
-
921
- /**
922
- * Utility to determine if an `Element`
923
- * is fully visible in the viewport.
924
- *
925
- * @param element target
926
- * @return the query result
927
- */
928
- export declare const isElementInViewport: (element?: Element) => boolean;
929
-
930
- /**
931
- * Checks if an object is an `Array` in which all items are `Element`.
932
- *
933
- * @param obj the target object
934
- * @returns the query result
935
- */
936
- export declare const isElementsArray: (obj?: unknown) => obj is Element[];
937
-
938
- /**
939
- * An accessor that checks for Gecko browsers. When writing this file,
940
- * Gecko was not supporting `userAgentData`.
941
- */
942
- export declare const isFirefox: () => boolean;
943
-
944
- /**
945
- * Checks if an object is a `Function`.
946
- *
947
- * @param fn the target object
948
- * @returns the query result
949
- */
950
- export declare const isFunction: (fn?: unknown) => fn is Fn;
951
-
952
- /**
953
- * Checks if an object is an `HTMLCollection`.
954
- *
955
- * @param obj the target object
956
- * @returns the query result
957
- */
958
- export declare const isHTMLCollection: (obj?: unknown) => obj is HTMLCollection;
959
-
960
- /**
961
- * Checks if an element is an `HTMLElement`.
962
- *
963
- * @see https://dom.spec.whatwg.org/#node
964
- *
965
- * @param element the target object
966
- * @returns the query result
967
- */
968
- export declare const isHTMLElement: (element?: unknown) => element is HTMLElement;
969
-
970
- /**
971
- * Check if a target element is an `<img>`.
972
- *
973
- * @param element the target element
974
- * @returns the query result
975
- */
976
- export declare const isHTMLImageElement: (element?: unknown) => element is HTMLImageElement;
977
-
978
- /**
979
- * Checks if a string is a `JSON` string.
980
- *
981
- * @param str the target string
982
- * @returns the query result
983
- */
984
- export declare const isJSON: (str?: string) => boolean;
985
-
986
- /**
987
- * Checks if an element is a `Map`.
988
- *
989
- * @param obj the target object
990
- * @returns the query result
991
- */
992
- export declare const isMap: (obj?: unknown) => obj is Map<unknown, unknown>;
993
-
994
- /**
995
- * Checks if an element is an `<svg>` (or any type of SVG element),
996
- * `<img>`, `<video>` or `<canvas>`.
997
- *
998
- * *Tooltip* / *Popover* works different with media elements.
999
- *
1000
- * @param element the target element
1001
- * @returns the query result
1002
- */
1003
- export declare const isMedia: (element?: unknown) => element is SVGElement | HTMLImageElement | HTMLVideoElement | HTMLCanvasElement;
1004
-
1005
- /**
1006
- * An accessor that checks for mobile detection.
1007
- */
1008
- export declare const isMobile: () => boolean;
1009
-
1010
- /**
1011
- * Checks if an object is a `Node`.
1012
- *
1013
- * @param node the target object
1014
- * @see https://dom.spec.whatwg.org/#node
1015
- *
1016
- * ```
1017
- * ELEMENT_NODE = 1;
1018
- * ATTRIBUTE_NODE = 2;
1019
- * TEXT_NODE = 3;
1020
- * CDATA_SECTION_NODE = 4;
1021
- * ENTITY_REFERENCE_NODE = 5; // legacy
1022
- * ENTITY_NODE = 6; // legacy
1023
- * PROCESSING_INSTRUCTION_NODE = 7;
1024
- * COMMENT_NODE = 8;
1025
- * DOCUMENT_NODE = 9;
1026
- * DOCUMENT_TYPE_NODE = 10;
1027
- * DOCUMENT_FRAGMENT_NODE = 11;
1028
- * @returns the query result
1029
- */
1030
- export declare const isNode: (node?: unknown) => node is Node;
1031
-
1032
- /**
1033
- * Checks if an object is a `NodeList`.
1034
- * => equivalent to `object instanceof NodeList`
1035
- *
1036
- * @param obj the target object
1037
- * @returns the query result
1038
- */
1039
- export declare const isNodeList: (obj?: unknown) => obj is NodeList;
1040
-
1041
- /**
1042
- * Shortie for `typeof SOMETHING === "number"`.
1043
- *
1044
- * @param num input value
1045
- * @returns the query result
1046
- */
1047
- export declare const isNumber: (num?: unknown) => num is number;
1048
-
1049
- /**
1050
- * Checks if a value is an `Object`.
1051
- *
1052
- * @param obj the target object
1053
- * @returns the query result
1054
- */
1055
- export declare const isObject: (obj?: unknown) => obj is object;
1056
-
1057
- /**
1058
- * Checks if a page is Right To Left.
1059
- *
1060
- * @param node the target
1061
- * @returns the query result
1062
- */
1063
- export declare const isRTL: (node?: Node) => boolean;
1064
-
1065
- /**
1066
- * Checks if a target `Element` is affected by scale.
1067
- *
1068
- * @see https://github.com/floating-ui/floating-ui
1069
- *
1070
- * @param element target
1071
- * @returns the query result
1072
- */
1073
- export declare const isScaledElement: (element?: Element) => boolean;
1074
-
1075
- /**
1076
- * Check if target is a `ShadowRoot`.
1077
- *
1078
- * @param element target
1079
- * @returns the query result
1080
- */
1081
- export declare const isShadowRoot: (element?: unknown) => element is ShadowRoot;
1082
-
1083
- /**
1084
- * Shortie for `typeof SOMETHING === "string"`.
1085
- *
1086
- * @param str input value
1087
- * @returns the query result
1088
- */
1089
- export declare const isString: (str?: unknown) => str is string;
1090
-
1091
- /**
1092
- * Check if an element is an `<svg>` or any other SVG element,
1093
- * an equivalent to `SOMETHING instanceof SVGElement`.
1094
- *
1095
- * @param element the target element
1096
- * @returns the query result
1097
- */
1098
- export declare const isSVGElement: (element?: unknown) => element is SVGElement;
1099
-
1100
- /**
1101
- * Check if a target element is a `<table>`, `<td>` or `<th>`.
1102
- * This specific check is important for determining
1103
- * the `offsetParent` of a given element.
1104
- *
1105
- * @param element the target element
1106
- * @returns the query result
1107
- */
1108
- export declare const isTableElement: (element?: unknown) => element is HTMLTableElement | HTMLTableCellElement;
1109
-
1110
- /**
1111
- * Checks if an element is a `WeakMap`.
1112
- *
1113
- * @param obj the target object
1114
- * @returns the query result
1115
- */
1116
- export declare const isWeakMap: (obj?: unknown) => obj is WeakMap<WeakKey, unknown>;
1117
-
1118
- export declare const isWebKit: () => boolean;
1119
-
1120
- /**
1121
- * Check if a target object is `Window`.
1122
- * => equivalent to `object instanceof Window`
1123
- *
1124
- * @param obj the target object
1125
- * @returns the query result
1126
- */
1127
- export declare const isWindow: (obj?: unknown) => obj is Window;
1128
-
1129
- /**
1130
- * Transform a string to kebab case.
1131
- * @param input source string
1132
- */
1133
- export declare const kebabCase: (input: string) => string;
1134
-
1135
- /**
1136
- * A global namespace for `Alt` key.
1137
- * e.which = 18
1138
- */
1139
- export declare const keyAlt = "Alt";
1140
-
1141
- /**
1142
- * A global namespace for `ArrowDown` key.
1143
- * e.which = 40 equivalent
1144
- */
1145
- export declare const keyArrowDown = "ArrowDown";
1146
-
1147
- /**
1148
- * A global namespace for `ArrowLeft` key.
1149
- * e.which = 37 equivalent
1150
- */
1151
- export declare const keyArrowLeft = "ArrowLeft";
1152
-
1153
- /**
1154
- * A global namespace for `ArrowRight` key.
1155
- * e.which = 39 equivalent
1156
- */
1157
- export declare const keyArrowRight = "ArrowRight";
1158
-
1159
- /**
1160
- * A global namespace for `ArrowUp` key.
1161
- * e.which = 38 equivalent
1162
- */
1163
- export declare const keyArrowUp = "ArrowUp";
1164
-
1165
- /**
1166
- * A global namespace for `Backspace` key.
1167
- * e.which === 8 equivalent
1168
- */
1169
- export declare const keyBackspace = "Backspace";
1170
-
1171
- declare interface KeyboardEvent_2<T extends EventTarget = HTMLElement>
1172
- extends UIEvent_2<T, NativeKeyboardEvent> {
1173
- altKey: boolean;
1174
- /** @deprecated */
1175
- charCode: number;
1176
- ctrlKey: boolean;
1177
- code: string;
1178
- /**
1179
- * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
1180
- */
1181
- getModifierState(key: ModifierKey): boolean;
1182
- /**
1183
- * See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values
1184
- */
1185
- key: string;
1186
- /** @deprecated */
1187
- keyCode: number;
1188
- locale: string;
1189
- location: number;
1190
- metaKey: boolean;
1191
- repeat: boolean;
1192
- shiftKey: boolean;
1193
- /** @deprecated */
1194
- which: number;
1195
- }
1196
- export { KeyboardEvent_2 as KeyboardEvent }
1197
-
1198
- export declare type KeyboardEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
1199
- T,
1200
- KeyboardEvent_2<T>
1201
- >;
1202
-
1203
- /**
1204
- * A global namespace for keyboard event keys.
1205
- */
1206
- export declare const keyboardEventKeys: {
1207
- Backspace: string;
1208
- Tab: string;
1209
- Enter: string;
1210
- Shift: string;
1211
- Control: string;
1212
- Alt: string;
1213
- Pause: string;
1214
- CapsLock: string;
1215
- Escape: string;
1216
- Scape: string;
1217
- ArrowLeft: string;
1218
- ArrowUp: string;
1219
- ArrowRight: string;
1220
- ArrowDown: string;
1221
- Insert: string;
1222
- Delete: string;
1223
- Meta: string;
1224
- ContextMenu: string;
1225
- ScrollLock: string;
1226
- };
1227
-
1228
- /**
1229
- * A global namespace for `CapsLock` key.
1230
- * e.which = 20 equivalent
1231
- */
1232
- export declare const keyCapsLock = "CapsLock";
1233
-
1234
- /**
1235
- * A global namespace for `Control` key.
1236
- * e.which = 17
1237
- */
1238
- export declare const keyControl = "Control";
1239
-
1240
- /**
1241
- * A global namespace for `Delete` key.
1242
- * e.which = 46 equivalent
1243
- */
1244
- export declare const keyDelete = "Delete";
1245
-
1246
- /**
1247
- * A global namespace for `keydown` event.
1248
- */
1249
- export declare const keydownEvent = "keydown";
1250
-
1251
- /**
1252
- * A global namespace for `Enter` key.
1253
- * e.which = 13 equivalent
1254
- */
1255
- export declare const keyEnter = "Enter";
1256
-
1257
- /**
1258
- * A global namespace for `Escape` key.
1259
- * e.which = 27 equivalent
1260
- */
1261
- export declare const keyEscape = "Escape";
1262
-
1263
- /**
1264
- * A global namespace for `Insert` key.
1265
- * e.which = 45 equivalent
1266
- */
1267
- export declare const keyInsert = "Insert";
1268
-
1269
- /**
1270
- * A global namespace for `Meta` key.
1271
- * e.which = 93 equivalent
1272
- */
1273
- export declare const keyMeta = "Meta";
1274
-
1275
- /**
1276
- * A global namespace for `Enter` key.
1277
- * e.which = 13 equivalent
1278
- */
1279
- export declare const keyNumpadEnter = "NumpadEnter";
1280
-
1281
- /**
1282
- * A global namespace for `Pause` key.
1283
- * e.which = 19
1284
- */
1285
- export declare const keyPause = "Pause";
1286
-
1287
- /**
1288
- * A global namespace for `keypress` event.
1289
- */
1290
- export declare const keypressEvent = "keypress";
1291
-
1292
- /**
1293
- * A global namespace for `ScrollLock` key.
1294
- * e.which = 145 equivalent
1295
- */
1296
- export declare const keyScrollLock = "ScrollLock";
1297
-
1298
- /**
1299
- * A global namespace for `Shift` key.
1300
- * e.which = 16
1301
- */
1302
- export declare const keyShift = "Shift";
1303
-
1304
- /**
1305
- * A global namespace for `Space` key.
1306
- * e.which = 32 equivalent
1307
- */
1308
- export declare const keySpace = "Space";
1309
-
1310
- /**
1311
- * A global namespace for `Tab` key.
1312
- * e.which = 9 equivalent
1313
- */
1314
- export declare const keyTab = "Tab";
1315
-
1316
- /**
1317
- * A global namespace for `keyup` event.
1318
- */
1319
- export declare const keyupEvent = "keyup";
1320
-
1321
- /**
1322
- * A global namespace for `load` event.
1323
- */
1324
- export declare const loadEvent = "load";
1325
-
1326
- /**
1327
- * A global namespace for `loadstart` event.
1328
- */
1329
- export declare const loadstartEvent = "loadstart";
1330
-
1331
- /**
1332
- * Check if element matches a CSS selector.
1333
- *
1334
- * @param target the target element
1335
- * @param selector the selector to match
1336
- * @returns the query result
1337
- */
1338
- export declare const matches: (target: Element, selector: string) => boolean;
1339
-
1340
- declare type ModifierKey =
1341
- | "Alt"
1342
- | "AltGraph"
1343
- | "CapsLock"
1344
- | "Control"
1345
- | "Fn"
1346
- | "FnLock"
1347
- | "Hyper"
1348
- | "Meta"
1349
- | "NumLock"
1350
- | "ScrollLock"
1351
- | "Shift"
1352
- | "Super"
1353
- | "Symbol"
1354
- | "SymbolLock";
1355
-
1356
- /**
1357
- * A global namespace for `click` event.
1358
- */
1359
- export declare const mouseclickEvent = "click";
1360
-
1361
- /**
1362
- * A global namespace for mouse click events.
1363
- */
1364
- export declare const mouseClickEvents: {
1365
- down: string;
1366
- up: string;
1367
- };
1368
-
1369
- /**
1370
- * A global namespace for `dblclick` event.
1371
- */
1372
- export declare const mousedblclickEvent = "dblclick";
1373
-
1374
- /**
1375
- * A global namespace for `mousedown` event.
1376
- */
1377
- export declare const mousedownEvent = "mousedown";
1378
-
1379
- /**
1380
- * A global namespace for `mouseenter` event.
1381
- */
1382
- export declare const mouseenterEvent = "mouseenter";
1383
-
1384
- declare interface MouseEvent_2<T extends EventTarget = HTMLElement, E = NativeMouseEvent>
1385
- extends UIEvent_2<T, E> {
1386
- altKey: boolean;
1387
- button: number;
1388
- buttons: number;
1389
- clientX: number;
1390
- clientY: number;
1391
- ctrlKey: boolean;
1392
- /**
1393
- * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
1394
- */
1395
- getModifierState(key: ModifierKey): boolean;
1396
- metaKey: boolean;
1397
- movementX: number;
1398
- movementY: number;
1399
- pageX: number;
1400
- pageY: number;
1401
- relatedTarget: EventTarget | null;
1402
- screenX: number;
1403
- screenY: number;
1404
- shiftKey: boolean;
1405
- }
1406
- export { MouseEvent_2 as MouseEvent }
1407
-
1408
- export declare type MouseEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
1409
- T,
1410
- MouseEvent_2<T>
1411
- >;
1412
-
1413
- /**
1414
- * A global namespace for `hover` event.
1415
- */
1416
- export declare const mousehoverEvent = "hover";
1417
-
1418
- /**
1419
- * A global namespace for mouse hover events.
1420
- */
1421
- export declare const mouseHoverEvents: string[];
1422
-
1423
- /**
1424
- * A global namespace for `mousein` event.
1425
- */
1426
- export declare const mouseinEvent = "mousein";
1427
-
1428
- /**
1429
- * A global namespace for `mouseleave` event.
1430
- */
1431
- export declare const mouseleaveEvent = "mouseleave";
1432
-
1433
- /**
1434
- * A global namespace for `mousemove` event.
1435
- */
1436
- export declare const mousemoveEvent = "mousemove";
1437
-
1438
- /**
1439
- * A global namespace for `mouseout` event.
1440
- */
1441
- export declare const mouseoutEvent = "mouseout";
1442
-
1443
- /**
1444
- * A global namespace for `mouseover` event.
1445
- */
1446
- export declare const mouseoverEvent = "mouseover";
1447
-
1448
- /**
1449
- * A global namespace for mouse events equivalent to touch events.
1450
- */
1451
- export declare const mouseSwipeEvents: {
1452
- start: string;
1453
- end: string;
1454
- move: string;
1455
- cancel: string;
1456
- };
1457
-
1458
- /**
1459
- * A global namespace for `mouseup` event.
1460
- */
1461
- export declare const mouseupEvent = "mouseup";
1462
-
1463
- /**
1464
- * A global namespace for `mousewheel` event.
1465
- */
1466
- export declare const mousewheelEvent = "mousewheel";
1467
-
1468
- /**
1469
- * A global namespace for `move` event.
1470
- */
1471
- export declare const moveEvent = "move";
1472
-
1473
- /**
1474
- * Type definitions addapted from React 18.2
1475
- * Project: https://react.dev/
1476
- */
1477
-
1478
- declare type NativeAnimationEvent = AnimationEvent_2;
1479
-
1480
- declare type NativeClipboardEvent = ClipboardEvent_2;
1481
-
1482
- declare type NativeCompositionEvent = CompositionEvent_2;
1483
-
1484
- declare type NativeDragEvent = DragEvent_2;
1485
-
1486
- /**
1487
- * currentTarget - a reference to the element on which the event listener is registered.
1488
- *
1489
- * target - a reference to the element from which the event was originally dispatched.
1490
- * This might be a child element to the element on which the event listener is registered.
1491
- * If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682
1492
- */
1493
- export declare type NativeEvent<T extends EventTarget = HTMLElement, E = Event> = BaseEvent<
1494
- E,
1495
- T,
1496
- T
1497
- >;
1498
-
1499
- export declare type NativeEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
1500
- T,
1501
- NativeEvent<T>
1502
- >;
1503
-
1504
- /**
1505
- * A global namespace for all browser native events.
1506
- */
1507
- export declare const nativeEvents: {
1508
- DOMContentLoaded: string;
1509
- DOMMouseScroll: string;
1510
- abort: string;
1511
- beforeunload: string;
1512
- blur: string;
1513
- change: string;
1514
- click: string;
1515
- contextmenu: string;
1516
- dblclick: string;
1517
- error: string;
1518
- focus: string;
1519
- focusin: string;
1520
- focusout: string;
1521
- gesturechange: string;
1522
- gestureend: string;
1523
- gesturestart: string;
1524
- hover: string;
1525
- keydown: string;
1526
- keypress: string;
1527
- keyup: string;
1528
- load: string;
1529
- mousedown: string;
1530
- mousemove: string;
1531
- mousein: string;
1532
- mouseout: string;
1533
- mouseenter: string;
1534
- mouseleave: string;
1535
- mouseover: string;
1536
- mouseup: string;
1537
- mousewheel: string;
1538
- move: string;
1539
- orientationchange: string;
1540
- pointercancel: string;
1541
- pointerdown: string;
1542
- pointerleave: string;
1543
- pointermove: string;
1544
- pointerup: string;
1545
- readystatechange: string;
1546
- reset: string;
1547
- resize: string;
1548
- scroll: string;
1549
- select: string;
1550
- selectend: string;
1551
- selectstart: string;
1552
- submit: string;
1553
- touchcancel: string;
1554
- touchend: string;
1555
- touchmove: string;
1556
- touchstart: string;
1557
- unload: string;
1558
- };
1559
-
1560
- declare type NativeFocusEvent = FocusEvent_2;
1561
-
1562
- declare type NativeKeyboardEvent = KeyboardEvent_2;
1563
-
1564
- declare type NativeMouseEvent = MouseEvent_2;
1565
-
1566
- declare type NativePointerEvent = PointerEvent_2;
1567
-
1568
- declare type NativeTouchEvent = TouchEvent_2;
1569
-
1570
- declare type NativeTransitionEvent = TransitionEvent_2;
1571
-
1572
- declare type NativeUIEvent = UIEvent_2;
1573
-
1574
- declare type NativeWheelEvent = WheelEvent_2;
1575
-
1576
- export declare interface NavigatorUA extends Navigator {
1577
- readonly userAgentData: NavigatorUAData;
1578
- }
1579
-
1580
- export declare interface NavigatorUABrand {
1581
- readonly brand: string;
1582
- readonly version: string;
1583
- }
1584
-
1585
- export declare interface NavigatorUAData {
1586
- readonly brands: NavigatorUABrand[];
1587
- readonly mobile: boolean;
1588
- readonly platform: string;
1589
- }
1590
-
1591
- /** A generic function with empty body. */
1592
- export declare const noop: () => void;
1593
-
1594
- /**
1595
- * Utility to normalize component options.
1596
- *
1597
- * @param element target
1598
- * @param defaultOps component default options
1599
- * @param inputOps component instance options
1600
- * @param ns component namespace
1601
- * @return normalized component options object
1602
- */
1603
- export declare const normalizeOptions: <T extends {
1604
- [key: string]: unknown;
1605
- }>(element: Element, defaultOps: T, inputOps: Partial<T>, ns?: string) => T;
1606
-
1607
- /**
1608
- * Utility to normalize component options
1609
- *
1610
- * @param value the input value
1611
- * @return the normalized value
1612
- */
1613
- export declare const normalizeValue: (value?: unknown) => NormalValue;
1614
-
1615
- declare type NormalValue = boolean | number | string | Fn | null;
1616
-
1617
- /**
1618
- * Shortcut for `Object.assign()` static method.
1619
- *
1620
- * @param obj a target object
1621
- * @param source source object(s)
1622
- * @see https://github.com/devinrhode2/ObjectTyped/blob/master/src/index.ts
1623
- */
1624
- export declare const ObjectAssign: typeof ObjectAssignTyped;
1625
-
1626
- /**
1627
- * Overloads for Object.assign.
1628
- *
1629
- * @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/object-assign/index.d.ts
1630
- */
1631
- declare function ObjectAssignTyped<T, U>(target: T, source: U): T & U;
1632
-
1633
- declare function ObjectAssignTyped<T, U, V>(target: T, source1: U, source2: V): T & U & V;
1634
-
1635
- declare function ObjectAssignTyped<T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
1636
-
1637
- declare function ObjectAssignTyped<T, U, V, W, Q>(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q;
1638
-
1639
- declare function ObjectAssignTyped<T, U, V, W, Q, R>(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R;
1640
-
1641
- declare function ObjectAssignTyped(target: unknown, ...sources: unknown[]): unknown;
1642
-
1643
- /**
1644
- * Shortcut for `Object.entries()` static method.
1645
- *
1646
- * @param obj a target object
1647
- * @returns the entries of an object in an array format [key, value][]
1648
- * @see https://github.com/devinrhode2/ObjectTyped/blob/master/src/index.ts
1649
- */
1650
- export declare const ObjectEntries: <O extends Record<keyof O, unknown>>(obj: O) => [keyof O, O[keyof O]][];
1651
-
1652
- /**
1653
- * Shortcut for `Object.fromEntries()` static method.
1654
- *
1655
- * @param entries a target entries object
1656
- * @returns a new Object created from the specified entries in array format [key, value][]
1657
- * @see https://github.com/devinrhode2/ObjectTyped/blob/master/src/index.ts
1658
- */
1659
- export declare const ObjectFromEntries: <K extends string, V>(entries: [K, V][]) => Record<K, V>;
1660
-
1661
- /**
1662
- * A shortcut to `Object.hasOwn()` static method to work
1663
- * with regular `Object` elements.
1664
- *
1665
- * @see https://fettblog.eu/typescript-hasownproperty/
1666
- * @param obj the target object
1667
- * @param prop the property to check
1668
- * @returns the query result
1669
- */
1670
- export declare const ObjectHasOwn: <T extends object, K extends PropertyKey>(obj: T, prop: K) => obj is T & Record<K, unknown>;
1671
-
1672
- /**
1673
- * Shortcut for `Object.keys()` static method.
1674
- *
1675
- * @param obj a target object
1676
- * @returns an array with object keys
1677
- * @see https://github.com/devinrhode2/ObjectTyped/blob/master/src/index.ts
1678
- */
1679
- export declare const ObjectKeys: <O extends Record<keyof O, unknown>>(obj: O) => (keyof O)[];
1680
-
1681
- /**
1682
- * Shortcut for `Object.values()` static method.
1683
- *
1684
- * @param obj a target object
1685
- * @returns an array with the object values
1686
- * @see https://github.com/devinrhode2/ObjectTyped/blob/master/src/index.ts
1687
- */
1688
- export declare const ObjectValues: <O extends Record<string, unknown>>(obj: O) => O[keyof O][];
1689
-
1690
- /**
1691
- * Remove eventListener from an `EventTarget` object.
1692
- */
1693
- export declare const off: <T extends EventTarget, L = EventListener>(element: T, eventName: string, listener: L, options?: AddEventListenerOptions) => void;
1694
-
1695
- /**
1696
- * A global namespace for `offsetHeight` property.
1697
- */
1698
- export declare const offsetHeight = "offsetHeight";
1699
-
1700
- export declare interface OffsetRect {
1701
- width: number;
1702
- height: number;
1703
- x: number;
1704
- y: number;
1705
- }
1706
-
1707
- /**
1708
- * A global namespace for `offsetWidth` property.
1709
- */
1710
- export declare const offsetWidth = "offsetWidth";
1711
-
1712
- /**
1713
- * Add eventListener to an `EventTarget` object.
1714
- */
1715
- export declare const on: <T extends EventTarget, L = EventListener>(element: T, eventName: string, listener: L, options?: AddEventListenerOptions) => void;
1716
-
1717
- /**
1718
- * Add an `eventListener` to an `EventTarget`
1719
- * element and remove it once callback is called.
1720
- */
1721
- export declare const one: <T extends EventTarget, L = EventListener>(element: T, eventName: string, listener: L, options?: AddEventListenerOptions) => void;
1722
-
1723
- /**
1724
- * A global namespace for `orientationchange` event.
1725
- */
1726
- export declare const orientationchangeEvent = "orientationchange";
1727
-
1728
- export declare interface OriginalEvent extends CustomEvent<unknown> {
1729
- readonly type: string;
1730
- relatedTarget?: EventTarget & HTMLElement;
1731
- }
1732
-
1733
- /**
1734
- * A global namespace for most scroll event listeners.
1735
- */
1736
- export declare const passiveHandler: Partial<AddEventListenerOptions>;
1737
-
1738
- /**
1739
- * A global namespace for `pointercancel` event.
1740
- */
1741
- export declare const pointercancelEvent = "pointercancel";
1742
-
1743
- /**
1744
- * A global namespace for `pointerdown` event.
1745
- */
1746
- export declare const pointerdownEvent = "pointerdown";
1747
-
1748
- declare interface PointerEvent_2<T extends EventTarget = HTMLElement>
1749
- extends MouseEvent_2<T, NativePointerEvent> {
1750
- pointerId: number;
1751
- pressure: number;
1752
- tangentialPressure: number;
1753
- tiltX: number;
1754
- tiltY: number;
1755
- twist: number;
1756
- width: number;
1757
- height: number;
1758
- pointerType: "mouse" | "pen" | "touch";
1759
- isPrimary: boolean;
1760
- }
1761
- export { PointerEvent_2 as PointerEvent }
1762
-
1763
- export declare type PointerEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
1764
- T,
1765
- PointerEvent_2<T>
1766
- >;
1767
-
1768
- /**
1769
- * A global namespace for `pointerleave` event.
1770
- */
1771
- export declare const pointerleaveEvent = "pointerleave";
1772
-
1773
- /**
1774
- * A global namespace for `pointermove` event.
1775
- */
1776
- export declare const pointermoveEvent = "pointermove";
1777
-
1778
- /**
1779
- * A global namespace for `pointerup` event.
1780
- */
1781
- export declare const pointerupEvent = "pointerup";
1782
-
1783
- export declare type PossibleEventTarget = EventTarget & (Element | Document | Window);
1784
-
1785
- /**
1786
- * Utility to check if target is typeof `Element`, `Node`
1787
- * or find one that matches a selector.
1788
- *
1789
- * @param selector the input selector or target element
1790
- * @param parent optional node to look into
1791
- * @return the `Element` or null
1792
- */
1793
- export declare const querySelector: <T extends Element>(selector: T | string, parent?: ParentNode) => T | null;
1794
-
1795
- /**
1796
- * A shortcut for `(document|Element).querySelectorAll`.
1797
- *
1798
- * @param selector the input selector
1799
- * @param parent optional node to look into
1800
- * @return the query result
1801
- */
1802
- export declare const querySelectorAll: <T extends Element>(selector: string, parent?: ParentNode) => NodeListOf<T>;
1803
-
1804
- /**
1805
- * A global namespace for `readystatechange` event.
1806
- */
1807
- export declare const readystatechangeEvent = "readystatechange";
1808
-
1809
- /**
1810
- * Utility to force re-paint of an `HTMLElement` target.
1811
- *
1812
- * @param element is the target
1813
- * @return the `Element.offsetHeight` value
1814
- */
1815
- export declare const reflow: (element: HTMLElement) => number;
1816
-
1817
- /**
1818
- * Shortcut for `Element.removeAttribute()` method.
1819
- *
1820
- * @param element target element
1821
- * @param att attribute name
1822
- */
1823
- export declare const removeAttribute: (element: Element, att: string) => void;
1824
-
1825
- /**
1826
- * Shortcut for `Element.removeAttributeNS()` method.
1827
- *
1828
- * @param ns attribute namespace
1829
- * @param element target element
1830
- * @param att attribute name
1831
- */
1832
- export declare const removeAttributeNS: (ns: string, element: Element, att: string) => void;
1833
-
1834
- /**
1835
- * Remove one or more classes from `Element.classList`.
1836
- *
1837
- * @param element target
1838
- * @param classNAME to remove
1839
- */
1840
- export declare const removeClass: (element: Element, ...classNAME: string[]) => void;
1841
-
1842
- /**
1843
- * A global namespace for 'removeEventListener' string.
1844
- */
1845
- declare const removeEventListener_2 = "removeEventListener";
1846
- export { removeEventListener_2 as removeEventListener }
1847
-
1848
- /**
1849
- * Utility to remove focus trap inside a designated target element;
1850
- * @param target
1851
- */
1852
- export declare const removeFocusTrap: (target: Element) => void;
1853
-
1854
- /**
1855
- * A global namespace for `reset` event.
1856
- */
1857
- export declare const resetEvent = "reset";
1858
-
1859
- /**
1860
- * A global namespace for `resize` event.
1861
- */
1862
- export declare const resizeEvent = "resize";
1863
-
1864
- /**
1865
- * A global namespace for `scroll` event.
1866
- */
1867
- export declare const scrollEvent = "scroll";
1868
-
1869
- /**
1870
- * A global namespace for `scrollHeight` property.
1871
- */
1872
- export declare const scrollHeight = "scrollHeight";
1873
-
1874
- /**
1875
- * A global namespace for `scrollWidth` property.
1876
- */
1877
- export declare const scrollWidth = "scrollWidth";
1878
-
1879
- /**
1880
- * A global namespace for the `selectend` event.
1881
- */
1882
- export declare const selectendEvent = "selectend";
1883
-
1884
- /**
1885
- * A global namespace for `select` event.
1886
- */
1887
- export declare const selectEvent = "select";
1888
-
1889
- /**
1890
- * A global namespace for the `selectstart` event.
1891
- */
1892
- export declare const selectstartEvent = "selectstart";
1893
-
1894
- /**
1895
- * Shortcut for `Element.setAttribute()` method.
1896
- *
1897
- * @param element target element
1898
- * @param att attribute name
1899
- * @param value attribute value
1900
- */
1901
- export declare const setAttribute: (element: Element, att: string, value: string) => void;
1902
-
1903
- /**
1904
- * Shortcut for `Element.setAttributeNS()` method.
1905
- *
1906
- * @param ns attribute namespace
1907
- * @param element target element
1908
- * @param att attribute name
1909
- * @param value attribute value
1910
- */
1911
- export declare const setAttributeNS: (ns: string, element: Element, att: string, value: string) => void;
1912
-
1913
- /**
1914
- * Shortcut for multiple uses of `HTMLElement.style.propertyName` method.
1915
- *
1916
- * @param element target element
1917
- * @param styles attribute value
1918
- */
1919
- export declare const setElementStyle: (element: Element, styles: Partial<CSS4Declaration>) => void;
1920
-
1921
- /**
1922
- * A global namespace for `submit` event.
1923
- */
1924
- export declare const submitEvent = "submit";
1925
-
1926
- /**
1927
- * An accessor that checks for CSS3 3D transform support.
1928
- */
1929
- export declare const support3DTransform: () => boolean;
1930
-
1931
- /**
1932
- * An accessor that checks for CSS3 animation support.
1933
- */
1934
- export declare const supportAnimation: () => boolean;
1935
-
1936
- /**
1937
- * An accessor that checks for passive events support,
1938
- * in general event options are not suited for scroll prevention.
1939
- *
1940
- * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
1941
- */
1942
- export declare const supportPassive: () => boolean;
1943
-
1944
- /**
1945
- * An accessor that checks for touch events support.
1946
- */
1947
- export declare const supportTouch: () => boolean;
1948
-
1949
- /**
1950
- * An accessor that checks for CSS3 transform support.
1951
- */
1952
- export declare const supportTransform: () => boolean;
1953
-
1954
- /**
1955
- * An accessor that checks for CSS3 transition support.
1956
- */
1957
- export declare const supportTransition: () => boolean;
1958
-
1959
- /**
1960
- * A global namespace for `touchcancel` event.
1961
- */
1962
- export declare const tabindex = "tabindex";
1963
-
1964
- /**
1965
- * An interface for one or more `TimerHandler`s per `Element`.
1966
- *
1967
- * @see https://github.com/thednp/navbar/
1968
- */
1969
- export declare const Timer: {
1970
- /**
1971
- * Sets a new timeout timer for an element, or element -> key association.
1972
- *
1973
- * @param element target element
1974
- * @param callback the callback
1975
- * @param delay the execution delay
1976
- * @param key a unique key
1977
- */
1978
- set: (element: Element, callback: TimerHandler, delay: number, key?: string) => void;
1979
- /**
1980
- * Returns the timer associated with the target.
1981
- *
1982
- * @param element target element
1983
- * @param key a unique
1984
- * @returns the timer
1985
- */
1986
- get: (element: Element, key?: string) => number | null;
1987
- /**
1988
- * Clears the element's timer.
1989
- *
1990
- * @param element target element
1991
- * @param key a unique key
1992
- */
1993
- clear: (element: Element, key?: string) => void;
1994
- };
1995
-
1996
- /**
1997
- * Utility to toggle focus trap inside a designated target element;
1998
- * @param target
1999
- */
2000
- export declare const toggleFocusTrap: (target: Element) => void;
2001
-
2002
- /**
2003
- * Shortcut for `String.toLowerCase()`.
2004
- *
2005
- * @param source input string
2006
- * @returns lowercase output string
2007
- */
2008
- export declare const toLowerCase: (source: string) => string;
2009
-
2010
- /**
2011
- * A global namespace for `touchcancel` event.
2012
- */
2013
- export declare const touchcancelEvent = "touchcancel";
2014
-
2015
- /**
2016
- * A global namespace for `touchend` event.
2017
- */
2018
- export declare const touchendEvent = "touchend";
2019
-
2020
- declare interface TouchEvent_2<T extends EventTarget = HTMLElement>
2021
- extends UIEvent_2<T, NativeTouchEvent> {
2022
- altKey: boolean;
2023
- changedTouches: TouchList;
2024
- ctrlKey: boolean;
2025
- /**
2026
- * See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
2027
- */
2028
- getModifierState(key: ModifierKey): boolean;
2029
- metaKey: boolean;
2030
- shiftKey: boolean;
2031
- targetTouches: TouchList;
2032
- touches: TouchList;
2033
- }
2034
- export { TouchEvent_2 as TouchEvent }
2035
-
2036
- export declare type TouchEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
2037
- T,
2038
- TouchEvent_2<T>
2039
- >;
2040
-
2041
- /**
2042
- * A global namespace for touch events.
2043
- */
2044
- export declare const touchEvents: {
2045
- start: string;
2046
- end: string;
2047
- move: string;
2048
- cancel: string;
2049
- };
2050
-
2051
- /**
2052
- * A global namespace for `touchmove` event.
2053
- */
2054
- export declare const touchmoveEvent = "touchmove";
2055
-
2056
- /**
2057
- * A global namespace for `touchstart` event.
2058
- */
2059
- export declare const touchstartEvent = "touchstart";
2060
-
2061
- /**
2062
- * Shortcut for `String.toUpperCase()`.
2063
- *
2064
- * @param source input string
2065
- * @returns uppercase output string
2066
- */
2067
- export declare const toUpperCase: (source: string) => string;
2068
-
2069
- /**
2070
- * A global namespace for 'transitionDelay' string.
2071
- */
2072
- export declare const transitionDelay = "transitionDelay";
2073
-
2074
- /**
2075
- * A global namespace for 'transitionDuration' string.
2076
- */
2077
- export declare const transitionDuration = "transitionDuration";
2078
-
2079
- /**
2080
- * A global namespace for 'transitionend' string.
2081
- */
2082
- export declare const transitionEndEvent = "transitionend";
2083
-
2084
- declare interface TransitionEvent_2<T extends EventTarget = HTMLElement>
2085
- extends NativeEvent<T, NativeTransitionEvent> {
2086
- elapsedTime: number;
2087
- propertyName: string;
2088
- pseudoElement: string;
2089
- }
2090
- export { TransitionEvent_2 as TransitionEvent }
2091
-
2092
- export declare type TransitionEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
2093
- T,
2094
- TransitionEvent_2<T>
2095
- >;
2096
-
2097
- /**
2098
- * A global namespace for `transitionProperty` string for modern browsers.
2099
- */
2100
- export declare const transitionProperty = "transitionProperty";
2101
-
2102
- declare interface UIEvent_2<T extends EventTarget = HTMLElement, E = NativeUIEvent>
2103
- extends NativeEvent<T, E> {
2104
- detail: number;
2105
- view: AbstractView;
2106
- }
2107
- export { UIEvent_2 as UIEvent }
2108
-
2109
- export declare type UIEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
2110
- T,
2111
- UIEvent_2<T>
2112
- >;
2113
-
2114
- /**
2115
- * A global namespace for `unload` event.
2116
- */
2117
- export declare const unloadEvent = "unload";
2118
-
2119
- /**
2120
- * A global namespace for `navigator.userAgent` string.
2121
- */
2122
- export declare const userAgent: string;
2123
-
2124
- /**
2125
- * A global namespace for `userAgentData` object.
2126
- */
2127
- export declare const userAgentData: NavigatorUA["userAgentData"];
2128
-
2129
- export { version }
2130
-
2131
- declare interface WheelEvent_2<T extends EventTarget = HTMLElement>
2132
- extends MouseEvent_2<T, NativeWheelEvent> {
2133
- deltaMode: number;
2134
- deltaX: number;
2135
- deltaY: number;
2136
- deltaZ: number;
2137
- }
2138
- export { WheelEvent_2 as WheelEvent }
2139
-
2140
- export declare type WheelEventHandler<T extends EventTarget = HTMLElement> = EventHandler<
2141
- T,
2142
- WheelEvent_2<T>
2143
- >;
2144
-
2145
- export { }