tiny-essentials 1.28.1 → 1.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog/1/28/2.md +43 -0
- package/dist/_/numbers.d.mts +91 -16
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/basics/array.d.mts +14 -14
- package/dist/v1/basics/clock.cjs +15 -15
- package/dist/v1/basics/clock.d.mts +21 -21
- package/dist/v1/basics/clock.mjs +15 -15
- package/dist/v1/basics/collision.d.mts +245 -104
- package/dist/v1/basics/deprecated/html.d.mts +33 -33
- package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
- package/dist/v1/basics/fullScreen.d.mts +47 -7
- package/dist/v1/basics/html.d.mts +52 -61
- package/dist/v1/basics/index.d.mts +11 -67
- package/dist/v1/basics/mediaContent.cjs +65 -23
- package/dist/v1/basics/mediaContent.d.mts +144 -73
- package/dist/v1/basics/mediaContent.mjs +65 -23
- package/dist/v1/basics/objChecker.d.mts +2 -2
- package/dist/v1/basics/objFilter.cjs +31 -7
- package/dist/v1/basics/objFilter.d.mts +10 -13
- package/dist/v1/basics/objFilter.mjs +31 -7
- package/dist/v1/basics/simpleMath.d.mts +21 -21
- package/dist/v1/basics/text.d.mts +34 -46
- package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
- package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
- package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
- package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
- package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
- package/dist/v1/build/TinyClassManager.d.mts +1 -1
- package/dist/v1/build/TinyClipboard.d.mts +1 -1
- package/dist/v1/build/TinyColorConverter.d.mts +1 -1
- package/dist/v1/build/TinyColorValidator.d.mts +1 -1
- package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
- package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
- package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
- package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
- package/dist/v1/build/TinyDragger.d.mts +1 -1
- package/dist/v1/build/TinyElementObserver.d.mts +1 -1
- package/dist/v1/build/TinyGamepad.d.mts +1 -1
- package/dist/v1/build/TinyHtml.d.mts +1 -1
- package/dist/v1/build/TinyI18.d.mts +1 -1
- package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
- package/dist/v1/build/TinyInventory.d.mts +1 -1
- package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
- package/dist/v1/build/TinyLevelUp.d.mts +1 -1
- package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
- package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
- package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
- package/dist/v1/build/TinyNeedBar.d.mts +1 -1
- package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
- package/dist/v1/build/TinyNotifications.d.mts +1 -1
- package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
- package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
- package/dist/v1/build/TinyRadioFm.d.mts +1 -1
- package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
- package/dist/v1/build/TinySimpleDice.d.mts +1 -1
- package/dist/v1/build/TinySmartScroller.d.mts +1 -1
- package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
- package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
- package/dist/v1/build/TinyTextarea.d.mts +1 -1
- package/dist/v1/build/TinyTimeout.d.mts +1 -1
- package/dist/v1/build/TinyToastNotify.d.mts +1 -1
- package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
- package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
- package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
- package/dist/v1/fileManager/index.d.mts +3 -29
- package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
- package/dist/v1/index.d.mts +53 -139
- package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
- package/dist/v1/libs/TinyAdvancedRaffle.d.mts +60 -103
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +11 -18
- package/dist/v1/libs/TinyAnalogClock.d.mts +8 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
- package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
- package/dist/v1/libs/TinyClassManager.cjs +5 -7
- package/dist/v1/libs/TinyClassManager.d.mts +16 -16
- package/dist/v1/libs/TinyClassManager.mjs +5 -6
- package/dist/v1/libs/TinyClipboard.d.mts +8 -3
- package/dist/v1/libs/TinyColorConverter.d.mts +8 -31
- package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
- package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
- package/dist/v1/libs/TinyDayNightCycle.d.mts +85 -110
- package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
- package/dist/v1/libs/TinyDragDropDetector.d.mts +30 -30
- package/dist/v1/libs/TinyDragger.d.mts +82 -81
- package/dist/v1/libs/TinyElementObserver.d.mts +25 -28
- package/dist/v1/libs/TinyGamepad.cjs +0 -1
- package/dist/v1/libs/TinyGamepad.d.mts +50 -122
- package/dist/v1/libs/TinyGamepad.mjs +0 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
- package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
- package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
- package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
- package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
- package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
- package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
- package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
- package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
- package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
- package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
- package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
- package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
- package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
- package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
- package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
- package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
- package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
- package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
- package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
- package/dist/v1/libs/TinyHtml.cjs +3 -4
- package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
- package/dist/v1/libs/TinyHtml.mjs +3 -4
- package/dist/v1/libs/TinyI18.d.mts +23 -61
- package/dist/v1/libs/TinyIframeEvents.cjs +1 -1
- package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
- package/dist/v1/libs/TinyIframeEvents.mjs +1 -1
- package/dist/v1/libs/TinyInventory.d.mts +78 -141
- package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
- package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
- package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
- package/dist/v1/libs/TinyLocalStorage.d.mts +11 -36
- package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
- package/dist/v1/libs/TinyMediaPlayer.cjs +5 -3
- package/dist/v1/libs/TinyMediaPlayer.d.mts +102 -109
- package/dist/v1/libs/TinyMediaPlayer.mjs +5 -3
- package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
- package/dist/v1/libs/TinyNewWinEvents.d.mts +29 -32
- package/dist/v1/libs/TinyNotifications.d.mts +6 -6
- package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -21
- package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
- package/dist/v1/libs/TinyRadioFm.cjs +32 -12
- package/dist/v1/libs/TinyRadioFm.d.mts +44 -80
- package/dist/v1/libs/TinyRadioFm.mjs +29 -12
- package/dist/v1/libs/TinyRateLimiter.d.mts +26 -39
- package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
- package/dist/v1/libs/TinySmartScroller.d.mts +50 -60
- package/dist/v1/libs/TinyTextDiffer.d.mts +11 -14
- package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
- package/dist/v1/libs/TinyTextarea.d.mts +31 -31
- package/dist/v1/libs/TinyTimeout.d.mts +14 -14
- package/dist/v1/libs/TinyToastNotify.cjs +1 -1
- package/dist/v1/libs/TinyToastNotify.d.mts +15 -23
- package/dist/v1/libs/TinyToastNotify.mjs +1 -1
- package/dist/v1/libs/TinyUploadClicker.d.mts +38 -14
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +44 -84
- package/dist/v1/libs/utils.d.mts +5 -1
- package/package.json +2 -2
|
@@ -1,147 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Represents a TinyHtml instance with any constructor element values.
|
|
4
|
-
*/
|
|
1
|
+
import * as TinyCollision from '../basics/collision.mjs';
|
|
2
|
+
import TinyElementObserver from './TinyElementObserver.mjs';
|
|
5
3
|
export type TinyHtmlAny = TinyHtml<ConstructorElValues>;
|
|
6
|
-
/**
|
|
7
|
-
* Represents the valid values that can be appended to a TinyNode.
|
|
8
|
-
*/
|
|
9
4
|
export type AppendCheckerTemplate = TinyNode | TinyNode[] | string | false | null | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* Represents the the collection of values that can be appended to a TinyNode.
|
|
12
|
-
*/
|
|
13
5
|
export type AppendCheckerValues = AppendCheckerTemplate | AppendCheckerTemplate[];
|
|
14
|
-
/**
|
|
15
|
-
* Callback function used for hover events.
|
|
16
|
-
*/
|
|
17
6
|
export type HoverEventCallback = (ev: MouseEvent) => void;
|
|
18
|
-
/**
|
|
19
|
-
* Represents a collection of active style-based animations.
|
|
20
|
-
*
|
|
21
|
-
* Each HTMLElement is associated with an array of its currently running
|
|
22
|
-
* `Animation` objects (from the Web Animations API).
|
|
23
|
-
*/
|
|
24
7
|
export type StyleFxResult = Map<HTMLElement, Animation | null>;
|
|
25
|
-
/**
|
|
26
|
-
* Represents a collection of animation keyframe data mapped by CSS property.
|
|
27
|
-
*
|
|
28
|
-
* - The **key** is the CSS property name (e.g. `"height"`, `"opacity"`).
|
|
29
|
-
* - The **value** is an array of values representing the start and end
|
|
30
|
-
* states of the property during the animation.
|
|
31
|
-
*/
|
|
32
8
|
export type AnimationSfxData = Record<string, (string | number)[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Function signature for style effects repeat detectors.
|
|
35
|
-
*/
|
|
36
9
|
export type StyleEffectsRdFn = (effects: AnimationSfxData) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Function signature for style effect property handlers.
|
|
39
|
-
*/
|
|
40
10
|
export type StyleEffectsFn = (el: HTMLElement, keyframes: AnimationSfxData, prop: string, style: CSSStyleDeclaration) => void;
|
|
41
|
-
/**
|
|
42
|
-
* A collection of style effect property handlers.
|
|
43
|
-
*/
|
|
44
11
|
export type StyleEffectsProps = Record<string, StyleEffectsFn>;
|
|
45
|
-
/**
|
|
46
|
-
* Callback invoked on each animation frame with the current scroll position,
|
|
47
|
-
* normalized animation time (`0` to `1`), and a completion flag.
|
|
48
|
-
*/
|
|
49
12
|
export type OnScrollAnimation = (progress: {
|
|
50
13
|
x: number;
|
|
51
14
|
y: number;
|
|
52
15
|
isComplete: boolean;
|
|
53
16
|
time: number;
|
|
54
17
|
}) => void;
|
|
55
|
-
|
|
56
|
-
* A list of supported easing function names for smooth animations.
|
|
57
|
-
*/
|
|
58
|
-
export type Easings = "linear" | "easeInQuad" | "easeOutQuad" | "easeInOutQuad" | "easeInCubic" | "easeOutCubic" | "easeInOutCubic";
|
|
59
|
-
/**
|
|
60
|
-
* Represents a raw Node element or an instance of TinyHtml.
|
|
61
|
-
* This type is used to abstract interactions with both plain elements
|
|
62
|
-
* and wrapped elements via the TinyHtml class.
|
|
63
|
-
*/
|
|
18
|
+
export type Easings = 'linear' | 'easeInQuad' | 'easeOutQuad' | 'easeInOutQuad' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic';
|
|
64
19
|
export type TinyNode = Node | TinyHtmlAny | null;
|
|
65
|
-
/**
|
|
66
|
-
* Represents a raw DOM element or an instance of TinyHtml.
|
|
67
|
-
* This type is used to abstract interactions with both plain elements
|
|
68
|
-
* and wrapped elements via the TinyHtml class.
|
|
69
|
-
*/
|
|
70
20
|
export type TinyElement = Element | TinyHtmlAny;
|
|
71
|
-
/**
|
|
72
|
-
* Represents a raw DOM html element or an instance of TinyHtml.
|
|
73
|
-
* This type is used to abstract interactions with both plain elements
|
|
74
|
-
* and wrapped elements via the TinyHtml class.
|
|
75
|
-
*/
|
|
76
21
|
export type TinyHtmlElement = HTMLElement | TinyHtmlAny;
|
|
77
|
-
/**
|
|
78
|
-
* Represents a raw DOM event target element or an instance of TinyHtml.
|
|
79
|
-
* This type is used to abstract interactions with both plain elements
|
|
80
|
-
* and wrapped elements via the TinyHtml class.
|
|
81
|
-
*/
|
|
82
22
|
export type TinyEventTarget = EventTarget | TinyHtmlAny;
|
|
83
|
-
/**
|
|
84
|
-
* Represents a raw DOM input element or an instance of TinyHtml.
|
|
85
|
-
* This type is used to abstract interactions with both plain elements
|
|
86
|
-
* and wrapped elements via the TinyHtml class.
|
|
87
|
-
*/
|
|
88
23
|
export type TinyInputElement = InputElement | TinyHtmlAny;
|
|
89
|
-
/**
|
|
90
|
-
* Represents a raw DOM element/window or an instance of TinyHtml.
|
|
91
|
-
* This type is used to abstract interactions with both plain elements
|
|
92
|
-
* and wrapped elements via the TinyHtml class.
|
|
93
|
-
*/
|
|
94
24
|
export type TinyElementAndWindow = ElementAndWindow | TinyHtmlAny;
|
|
95
|
-
/**
|
|
96
|
-
* Represents a value that can be either a DOM Element or the global Window object.
|
|
97
|
-
* Useful for functions that operate generically on scrollable or measurable targets.
|
|
98
|
-
*/
|
|
99
25
|
export type ElementAndWindow = Element | Window;
|
|
100
|
-
/**
|
|
101
|
-
* Represents a raw DOM element/window/document or an instance of TinyHtml.
|
|
102
|
-
* This type is used to abstract interactions with both plain elements
|
|
103
|
-
* and wrapped elements via the TinyHtml class.
|
|
104
|
-
*/
|
|
105
26
|
export type TinyElementAndWinAndDoc = ElementAndWinAndDoc | TinyHtmlAny;
|
|
106
|
-
/**
|
|
107
|
-
* Represents a value that can be either a DOM Element, or the global Window object, or the document object.
|
|
108
|
-
* Useful for functions that operate generically on scrollable or measurable targets.
|
|
109
|
-
*/
|
|
110
27
|
export type ElementAndWinAndDoc = Element | Window | Document;
|
|
111
|
-
/**
|
|
112
|
-
* Represents a raw DOM element with document or an instance of TinyHtml.
|
|
113
|
-
* This type is used to abstract interactions with both plain elements
|
|
114
|
-
* and wrapped elements via the TinyHtml class.
|
|
115
|
-
*/
|
|
116
28
|
export type TinyElementWithDoc = ElementWithDoc | TinyHtmlAny;
|
|
117
|
-
/**
|
|
118
|
-
* Represents a value that can be either a DOM Element, or the document object.
|
|
119
|
-
* Useful for functions that operate generically on measurable targets.
|
|
120
|
-
*/
|
|
121
29
|
export type ElementWithDoc = Element | Document;
|
|
122
|
-
/**
|
|
123
|
-
* A parameter type used for filtering or matching elements.
|
|
124
|
-
* It can be:
|
|
125
|
-
* - A string (CSS selector),
|
|
126
|
-
* - A raw DOM element,
|
|
127
|
-
* - An array of raw DOM elements,
|
|
128
|
-
* - A filtering function that receives an index and element,
|
|
129
|
-
* and returns true if it matches.
|
|
130
|
-
*/
|
|
131
30
|
export type WinnowRequest = string | Element | Element[] | ((index: number, el: Element) => boolean);
|
|
132
|
-
/**
|
|
133
|
-
* Elements accepted as constructor values for TinyHtml.
|
|
134
|
-
* These include common DOM elements and root containers.
|
|
135
|
-
*/
|
|
136
31
|
export type ConstructorElValues = Window | Element | Document | Text;
|
|
137
|
-
/**
|
|
138
|
-
* Options passed to `addEventListener` or `removeEventListener`.
|
|
139
|
-
* Can be a boolean or an object of type `AddEventListenerOptions`.
|
|
140
|
-
*/
|
|
141
32
|
export type EventRegistryOptions = boolean | AddEventListenerOptions;
|
|
142
|
-
/**
|
|
143
|
-
* Structure describing a registered event callback and its options.
|
|
144
|
-
*/
|
|
145
33
|
export type EventRegistryItem = {
|
|
146
34
|
/**
|
|
147
35
|
* - The function to be executed when the event is triggered.
|
|
@@ -150,26 +38,13 @@ export type EventRegistryItem = {
|
|
|
150
38
|
/**
|
|
151
39
|
* - Optional configuration passed to the listener.
|
|
152
40
|
*/
|
|
153
|
-
options?: EventRegistryOptions
|
|
41
|
+
options?: EventRegistryOptions;
|
|
154
42
|
};
|
|
155
|
-
/**
|
|
156
|
-
* Maps event names (e.g., `"click"`, `"keydown"`) to a list of registered handlers and options.
|
|
157
|
-
*/
|
|
158
43
|
export type EventRegistryList = Record<string, EventRegistryItem[]>;
|
|
159
|
-
/**
|
|
160
|
-
* A key-value store associated with a specific DOM element.
|
|
161
|
-
* Keys are strings, and values can be of any type.
|
|
162
|
-
*/
|
|
163
44
|
export type ElementDataStore = Record<string, any>;
|
|
164
|
-
/**
|
|
165
|
-
* Mapping of animation shortcuts to their effect definitions.
|
|
166
|
-
* Similar to jQuery's predefined effects (slideDown, fadeIn, etc.).
|
|
167
|
-
*/
|
|
168
45
|
export type StyleEffects = Record<string, string | (string | number)[]>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*/
|
|
172
|
-
export type CollisionDirLock = "top" | "bottom" | "left" | "right";
|
|
46
|
+
export type ObjRect = import('../basics/collision.mjs').ObjRect;
|
|
47
|
+
export type CollisionDirLock = 'top' | 'bottom' | 'left' | 'right';
|
|
173
48
|
export type HtmlElBoxSides = {
|
|
174
49
|
/**
|
|
175
50
|
* - Total horizontal size (left + right)
|
|
@@ -184,34 +59,15 @@ export type HtmlElBoxSides = {
|
|
|
184
59
|
top: number;
|
|
185
60
|
bottom: number;
|
|
186
61
|
};
|
|
187
|
-
/**
|
|
188
|
-
* - Primitive types accepted as input values.
|
|
189
|
-
*/
|
|
190
62
|
export type SetValueBase = string | number | Date | boolean | null;
|
|
191
|
-
|
|
192
|
-
* Types of value extractors supported by TinyHtml._valTypes.
|
|
193
|
-
*/
|
|
194
|
-
export type GetValueTypes = "string" | "date" | "number";
|
|
195
|
-
/**
|
|
196
|
-
* - A single value or an array of values to be assigned to the input element.
|
|
197
|
-
*/
|
|
63
|
+
export type GetValueTypes = 'string' | 'date' | 'number';
|
|
198
64
|
export type SetValueList = SetValueBase | SetValueBase[];
|
|
199
|
-
/**
|
|
200
|
-
* A list of HTML form elements that can have a `.value` property used by TinyHtml.
|
|
201
|
-
* Includes common input types used in forms.
|
|
202
|
-
*/
|
|
203
65
|
export type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLOptionElement;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
...children: (string | HtmlParsed)[]];
|
|
210
|
-
/**
|
|
211
|
-
* Represents all possible inputs accepted by the TinyHtml constructor.
|
|
212
|
-
* Can be a single element, an array of elements, array-like DOM collections,
|
|
213
|
-
* or a CSS selector string.
|
|
214
|
-
*/
|
|
66
|
+
export type HtmlParsed = [
|
|
67
|
+
tagName: string,
|
|
68
|
+
attributes: Record<string, string>,
|
|
69
|
+
...children: (string | HtmlParsed)[]
|
|
70
|
+
];
|
|
215
71
|
export type TinyHtmlConstructor = (ConstructorElValues | ConstructorElValues[] | NodeListOf<Element> | HTMLCollectionOf<Element> | NodeListOf<HTMLElement> | string);
|
|
216
72
|
/**
|
|
217
73
|
* Possible directions from which a collision was detected and locked.
|
|
@@ -278,24 +134,9 @@ export type TinyHtmlConstructor = (ConstructorElValues | ConstructorElValues[] |
|
|
|
278
134
|
* @class
|
|
279
135
|
*/
|
|
280
136
|
declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
137
|
+
#private;
|
|
281
138
|
/** @typedef {import('../basics/collision.mjs').ObjRect} ObjRect */
|
|
282
139
|
static Utils: {
|
|
283
|
-
getElsRelativeCenterOffset(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
284
|
-
x: number;
|
|
285
|
-
y: number;
|
|
286
|
-
};
|
|
287
|
-
getElsCollDirDepth(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
288
|
-
inDir: Dirs | null;
|
|
289
|
-
dirX: Dirs | null;
|
|
290
|
-
dirY: Dirs | null;
|
|
291
|
-
depthX: number;
|
|
292
|
-
depthY: number;
|
|
293
|
-
};
|
|
294
|
-
getElsCollDetails(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
295
|
-
depth: CollData;
|
|
296
|
-
dirs: CollDirs;
|
|
297
|
-
isNeg: NegCollDirs;
|
|
298
|
-
};
|
|
299
140
|
areElsCollTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
300
141
|
areElsCollBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
301
142
|
areElsCollLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
@@ -307,7 +148,7 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
307
148
|
areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
308
149
|
areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
309
150
|
getElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
|
|
310
|
-
getElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) =>
|
|
151
|
+
getElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => 'top' | 'bottom' | 'left' | 'right' | null;
|
|
311
152
|
getElsCollOverlap: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => {
|
|
312
153
|
overlapLeft: number;
|
|
313
154
|
overlapRight: number;
|
|
@@ -315,41 +156,48 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
315
156
|
overlapBottom: number;
|
|
316
157
|
};
|
|
317
158
|
getElsCollOverlapPos: ({ overlapLeft, overlapRight, overlapTop, overlapBottom, }?: {
|
|
318
|
-
overlapLeft?: number
|
|
319
|
-
overlapRight?: number
|
|
320
|
-
overlapTop?: number
|
|
321
|
-
overlapBottom?: number
|
|
159
|
+
overlapLeft?: number;
|
|
160
|
+
overlapRight?: number;
|
|
161
|
+
overlapTop?: number;
|
|
162
|
+
overlapBottom?: number;
|
|
322
163
|
}) => {
|
|
323
|
-
dirX: Dirs;
|
|
324
|
-
dirY: Dirs;
|
|
164
|
+
dirX: TinyCollision.Dirs;
|
|
165
|
+
dirY: TinyCollision.Dirs;
|
|
325
166
|
};
|
|
326
167
|
getRectCenter: (rect: TinyCollision.ObjRect) => {
|
|
327
168
|
x: number;
|
|
328
169
|
y: number;
|
|
329
170
|
};
|
|
171
|
+
getElsRelativeCenterOffset(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
172
|
+
x: number;
|
|
173
|
+
y: number;
|
|
174
|
+
};
|
|
175
|
+
getElsCollDirDepth(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
176
|
+
inDir: TinyCollision.Dirs | null;
|
|
177
|
+
dirX: TinyCollision.Dirs | null;
|
|
178
|
+
dirY: TinyCollision.Dirs | null;
|
|
179
|
+
depthX: number;
|
|
180
|
+
depthY: number;
|
|
181
|
+
};
|
|
182
|
+
getElsCollDetails(rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect): {
|
|
183
|
+
depth: TinyCollision.CollData;
|
|
184
|
+
dirs: TinyCollision.CollDirs;
|
|
185
|
+
isNeg: TinyCollision.NegCollDirs;
|
|
186
|
+
};
|
|
330
187
|
};
|
|
331
|
-
/** @type {number} */
|
|
332
|
-
static #version: number;
|
|
333
188
|
/** @returns {number} */
|
|
334
189
|
static get version(): number;
|
|
335
190
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* @type {boolean}
|
|
191
|
+
* Gets whether debug output is enabled.
|
|
192
|
+
* @returns {boolean} True if debug output is enabled; otherwise, false.
|
|
339
193
|
*/
|
|
340
|
-
static
|
|
194
|
+
static get elemDebug(): boolean;
|
|
341
195
|
/**
|
|
342
196
|
* Enables or disables debug output.
|
|
343
197
|
* @param {boolean} value True to enable debug output; false to disable.
|
|
344
198
|
* @throws {TypeError} Thrown if the provided value is not a boolean.
|
|
345
|
-
* @returns {void}
|
|
346
199
|
*/
|
|
347
200
|
static set elemDebug(value: boolean);
|
|
348
|
-
/**
|
|
349
|
-
* Gets whether debug output is enabled.
|
|
350
|
-
* @returns {boolean} True if debug output is enabled; otherwise, false.
|
|
351
|
-
*/
|
|
352
|
-
static get elemDebug(): boolean;
|
|
353
201
|
/**
|
|
354
202
|
* Logs a standardized debug error for element validation, including a console.table
|
|
355
203
|
* with the involved elements. Use this when an element argument is invalid, unexpected,
|
|
@@ -367,14 +215,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
367
215
|
* The specific element that triggered the error, if available.
|
|
368
216
|
* @returns {void}
|
|
369
217
|
*/
|
|
370
|
-
static _debugElemError(elems: (ConstructorElValues | EventTarget | TinyElement | null)[], elem?: ConstructorElValues | EventTarget | TinyElement | null
|
|
218
|
+
static _debugElemError(elems: (ConstructorElValues | EventTarget | TinyElement | null)[], elem?: ConstructorElValues | EventTarget | TinyElement | null): void;
|
|
371
219
|
/**
|
|
372
220
|
* Parse inline styles into an object.
|
|
373
221
|
* @param {string} styleText
|
|
374
222
|
* @returns {Record<string,string>}
|
|
375
223
|
*/
|
|
376
224
|
static parseStyle(styleText: string): Record<string, string>;
|
|
377
|
-
static #tinyObserver: TinyElementObserver<HTMLElement> | undefined;
|
|
378
225
|
static get tinyObserver(): TinyElementObserver<HTMLElement> | undefined;
|
|
379
226
|
/**
|
|
380
227
|
* Fetches an HTML file from the given URL, parses it to JSON.
|
|
@@ -397,9 +244,9 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
397
244
|
*
|
|
398
245
|
* @param {string} url - The URL of the HTML file.
|
|
399
246
|
* @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc).
|
|
400
|
-
*
|
|
247
|
+
* Returns the promise that resolves with the TinyHtml instances.
|
|
401
248
|
*/
|
|
402
|
-
static fetchHtmlTinyElems(url: string, ops?: RequestInit): Promise<TinyHtml<
|
|
249
|
+
static fetchHtmlTinyElems(url: string, ops?: RequestInit): Promise<TinyHtml<Element | Text>[]>;
|
|
403
250
|
/**
|
|
404
251
|
* Converts the content of a <template> to an array of HtmlParsed.
|
|
405
252
|
*
|
|
@@ -513,6 +360,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
513
360
|
* @returns {TinyHtml<Element>|null} A TinyHtml instance wrapping the matched element.
|
|
514
361
|
*/
|
|
515
362
|
static query(selector: string, elem?: Document | Element): TinyHtml<Element> | null;
|
|
363
|
+
/**
|
|
364
|
+
* Queries the element for the first element matching the CSS selector and wraps it in a TinyHtml instance.
|
|
365
|
+
*
|
|
366
|
+
* @param {string} selector - A valid CSS selector string.
|
|
367
|
+
* @returns {TinyHtml<Element>|null} A TinyHtml instance wrapping the matched element.
|
|
368
|
+
*/
|
|
369
|
+
querySelector(selector: string): TinyHtml<Element> | null;
|
|
516
370
|
/**
|
|
517
371
|
* Queries the document for all elements matching the CSS selector and wraps them in TinyHtml instances.
|
|
518
372
|
*
|
|
@@ -521,6 +375,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
521
375
|
* @returns {TinyHtml<NodeListOf<Element>>} An array of TinyHtml instances wrapping the matched elements.
|
|
522
376
|
*/
|
|
523
377
|
static queryAll(selector: string, elem?: Document | Element): TinyHtml<NodeListOf<Element>>;
|
|
378
|
+
/**
|
|
379
|
+
* Queries the element for all elements matching the CSS selector and wraps them in TinyHtml instances.
|
|
380
|
+
*
|
|
381
|
+
* @param {string} selector - A valid CSS selector string.
|
|
382
|
+
* @returns {TinyHtml<NodeListOf<Element>>} An array of TinyHtml instances wrapping the matched elements.
|
|
383
|
+
*/
|
|
384
|
+
querySelectorAll(selector: string): TinyHtml<NodeListOf<Element>>;
|
|
524
385
|
/**
|
|
525
386
|
* Retrieves an element by its ID and wraps it in a TinyHtml instance.
|
|
526
387
|
*
|
|
@@ -536,6 +397,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
536
397
|
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
537
398
|
*/
|
|
538
399
|
static getByClassName(selector: string, elem?: Document | Element): TinyHtml<HTMLCollectionOf<Element>>;
|
|
400
|
+
/**
|
|
401
|
+
* Retrieves all elements with the specified class name and wraps them in TinyHtml instances.
|
|
402
|
+
*
|
|
403
|
+
* @param {string} selector - The class name to search for.
|
|
404
|
+
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
405
|
+
*/
|
|
406
|
+
getElementsByClassName(selector: string): TinyHtml<HTMLCollectionOf<Element>>;
|
|
539
407
|
/**
|
|
540
408
|
* Retrieves all elements with the specified name attribute and wraps them in TinyHtml instances.
|
|
541
409
|
*
|
|
@@ -553,6 +421,70 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
553
421
|
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
554
422
|
*/
|
|
555
423
|
static getByTagNameNS(localName: string, namespaceURI?: string | null, elem?: Document | Element): TinyHtml<HTMLCollectionOf<Element>>;
|
|
424
|
+
/**
|
|
425
|
+
* Retrieves all elements with the specified local tag name within the given namespace URI,
|
|
426
|
+
* and wraps them in TinyHtml instances.
|
|
427
|
+
*
|
|
428
|
+
* @param {string} localName - The local name (tag) of the elements to search for.
|
|
429
|
+
* @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
|
|
430
|
+
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
431
|
+
*/
|
|
432
|
+
getElementsByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml<HTMLCollectionOf<Element>>;
|
|
433
|
+
/**
|
|
434
|
+
* Returns the current targets held by this instance.
|
|
435
|
+
*
|
|
436
|
+
* @returns {ConstructorElValues[]} - The instance's targets element.
|
|
437
|
+
*/
|
|
438
|
+
get elements(): ConstructorElValues[];
|
|
439
|
+
/**
|
|
440
|
+
* Iterates over all elements, executing the provided callback on each.
|
|
441
|
+
* @param {(element: TinyHtmlAny, index: number, items: TinyHtmlAny[]) => void} callback - Function invoked for each element.
|
|
442
|
+
* @returns {this} The current instance for chaining.
|
|
443
|
+
*/
|
|
444
|
+
forEach(callback: (element: TinyHtmlAny, index: number, items: TinyHtmlAny[]) => void): this;
|
|
445
|
+
/**
|
|
446
|
+
* Returns the current target held by this instance.
|
|
447
|
+
*
|
|
448
|
+
* @param {number} index - The index of the element to retrieve.
|
|
449
|
+
* @returns {ConstructorElValues} - The instance's target element.
|
|
450
|
+
*/
|
|
451
|
+
get(index: number): ConstructorElValues;
|
|
452
|
+
/**
|
|
453
|
+
* Extracts a single DOM element from the internal list at the specified index.
|
|
454
|
+
*
|
|
455
|
+
* @param {number} index - The index of the element to extract.
|
|
456
|
+
* @returns {TinyHtmlAny} A new TinyHtml instance wrapping the extracted element.
|
|
457
|
+
*/
|
|
458
|
+
extract(index: number): TinyHtmlAny;
|
|
459
|
+
/**
|
|
460
|
+
* Checks whether the element exists at the given index.
|
|
461
|
+
*
|
|
462
|
+
* @param {number} index - The index to check.
|
|
463
|
+
* @returns {boolean} - True if the element exists; otherwise, false.
|
|
464
|
+
*/
|
|
465
|
+
exists(index: number): boolean;
|
|
466
|
+
/**
|
|
467
|
+
* @deprecated Use the getter {@link elements} instead.
|
|
468
|
+
* Returns the current targets held by this instance.
|
|
469
|
+
*
|
|
470
|
+
* @returns {ConstructorElValues[]} - The instance's targets element.
|
|
471
|
+
*/
|
|
472
|
+
getAll(): ConstructorElValues[];
|
|
473
|
+
/**
|
|
474
|
+
* Returns the current Element held by this instance.
|
|
475
|
+
*
|
|
476
|
+
* @param {string} where - The method name or context calling this.
|
|
477
|
+
* @param {number} index - The index of the element to retrieve.
|
|
478
|
+
* @returns {ConstructorElValues} - The instance's element.
|
|
479
|
+
*/
|
|
480
|
+
_getElement(where: string, index: number): ConstructorElValues;
|
|
481
|
+
/**
|
|
482
|
+
* Returns the current Elements held by this instance.
|
|
483
|
+
*
|
|
484
|
+
* @param {string} where - The method name or context calling this.
|
|
485
|
+
* @returns {ConstructorElValues[]} - The instance's elements.
|
|
486
|
+
*/
|
|
487
|
+
_getElements(where: string): ConstructorElValues[];
|
|
556
488
|
/**
|
|
557
489
|
* Prepares and validates multiple elements against allowed types.
|
|
558
490
|
*
|
|
@@ -564,6 +496,16 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
564
496
|
* @throws {Error} - If any element is not an instance of one of the allowed types.
|
|
565
497
|
*/
|
|
566
498
|
static _preElemsTemplate(elems: TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[], where: string, TheTinyElements: any[], elemName: string[]): any[];
|
|
499
|
+
/**
|
|
500
|
+
* Prepares and validates multiple elements against allowed types.
|
|
501
|
+
*
|
|
502
|
+
* @param {string} where - The method name or context calling this.
|
|
503
|
+
* @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
|
|
504
|
+
* @param {string[]} elemName - The list of expected element names for error reporting.
|
|
505
|
+
* @returns {any[]} - A flat array of validated elements.
|
|
506
|
+
* @throws {Error} - If any element is not an instance of one of the allowed types.
|
|
507
|
+
*/
|
|
508
|
+
_preElemsTemplate(where: string, TheTinyElements: any[], elemName: string[]): any[];
|
|
567
509
|
/**
|
|
568
510
|
* Prepares and validates a single element against allowed types.
|
|
569
511
|
*
|
|
@@ -576,6 +518,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
576
518
|
* @throws {Error} - If the element is not valid or if multiple elements are provided.
|
|
577
519
|
*/
|
|
578
520
|
static _preElemTemplate(elems: TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[], where: string, TheTinyElements: any[], elemName: string[], canNull?: boolean): any;
|
|
521
|
+
/**
|
|
522
|
+
* Prepares and validates a single element against allowed types.
|
|
523
|
+
*
|
|
524
|
+
* @param {string} where - The method name or context calling this.
|
|
525
|
+
* @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
|
|
526
|
+
* @param {string[]} elemName - The list of expected element names for error reporting.
|
|
527
|
+
* @param {boolean} [canNull=false] - Whether `null` is allowed as a valid value.
|
|
528
|
+
* @returns {any} - The validated element or `null` if allowed.
|
|
529
|
+
* @throws {Error} - If the element is not valid or if multiple elements are provided.
|
|
530
|
+
*/
|
|
531
|
+
_preElemTemplate(where: string, TheTinyElements: any[], elemName: string[], canNull?: boolean): any;
|
|
579
532
|
/**
|
|
580
533
|
* Ensures the input is returned as an array.
|
|
581
534
|
* Useful to normalize operations across multiple or single elements.
|
|
@@ -585,6 +538,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
585
538
|
* @returns {Element[]} - Always returns an array of elements.
|
|
586
539
|
*/
|
|
587
540
|
static _preElems(elems: TinyElement | TinyElement[], where: string): Element[];
|
|
541
|
+
/**
|
|
542
|
+
* Ensures the input is returned as an array.
|
|
543
|
+
* Useful to normalize operations across multiple or single elements.
|
|
544
|
+
*
|
|
545
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
546
|
+
* @returns {Element[]} - Always returns an array of elements.
|
|
547
|
+
*/
|
|
548
|
+
_preElems(where: string): Element[];
|
|
588
549
|
/**
|
|
589
550
|
* Ensures the input is returned as an single element.
|
|
590
551
|
* Useful to normalize operations across multiple or single elements.
|
|
@@ -594,6 +555,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
594
555
|
* @returns {Element} - Always returns an single element.
|
|
595
556
|
*/
|
|
596
557
|
static _preElem(elems: TinyElement | TinyElement[], where: string): Element;
|
|
558
|
+
/**
|
|
559
|
+
* Ensures the input is returned as an single element.
|
|
560
|
+
* Useful to normalize operations across multiple or single elements.
|
|
561
|
+
*
|
|
562
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
563
|
+
* @returns {Element} - Always returns an single element.
|
|
564
|
+
*/
|
|
565
|
+
_preElem(where: string): Element;
|
|
597
566
|
/**
|
|
598
567
|
* Ensures the input is returned as an array.
|
|
599
568
|
* Useful to normalize operations across multiple or single nodes.
|
|
@@ -603,6 +572,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
603
572
|
* @returns {Node[]} - Always returns an array of nodes.
|
|
604
573
|
*/
|
|
605
574
|
static _preNodeElems(elems: TinyNode | TinyNode[], where: string): Node[];
|
|
575
|
+
/**
|
|
576
|
+
* Ensures the input is returned as an array.
|
|
577
|
+
* Useful to normalize operations across multiple or single nodes.
|
|
578
|
+
*
|
|
579
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
580
|
+
* @returns {Node[]} - Always returns an array of nodes.
|
|
581
|
+
*/
|
|
582
|
+
_preNodeElems(where: string): Node[];
|
|
606
583
|
/**
|
|
607
584
|
* Ensures the input is returned as an single node.
|
|
608
585
|
* Useful to normalize operations across multiple or single nodes.
|
|
@@ -612,6 +589,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
612
589
|
* @returns {Node} - Always returns an single node.
|
|
613
590
|
*/
|
|
614
591
|
static _preNodeElem(elems: TinyNode | TinyNode[], where: string): Node;
|
|
592
|
+
/**
|
|
593
|
+
* Ensures the input is returned as an single node.
|
|
594
|
+
* Useful to normalize operations across multiple or single nodes.
|
|
595
|
+
*
|
|
596
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
597
|
+
* @returns {Node} - Always returns an single node.
|
|
598
|
+
*/
|
|
599
|
+
_preNodeElem(where: string): Node;
|
|
615
600
|
/**
|
|
616
601
|
* Ensures the input is returned as an single node.
|
|
617
602
|
* Useful to normalize operations across multiple or single nodes.
|
|
@@ -622,14 +607,30 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
622
607
|
*/
|
|
623
608
|
static _preNodeElemWithNull(elems: TinyNode | TinyNode[], where: string): Node | null;
|
|
624
609
|
/**
|
|
625
|
-
* Ensures the input is returned as an
|
|
626
|
-
* Useful to normalize operations across multiple or single
|
|
627
|
-
*
|
|
610
|
+
* Ensures the input is returned as an single node.
|
|
611
|
+
* Useful to normalize operations across multiple or single nodes.
|
|
612
|
+
*
|
|
613
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
614
|
+
* @returns {Node|null} - Always returns an single node or null.
|
|
615
|
+
*/
|
|
616
|
+
_preNodeElemWithNull(where: string): Node | null;
|
|
617
|
+
/**
|
|
618
|
+
* Ensures the input is returned as an array.
|
|
619
|
+
* Useful to normalize operations across multiple or single html elements.
|
|
620
|
+
*
|
|
628
621
|
* @param {TinyElement|TinyElement[]} elems - A single html element or array of html elements.
|
|
629
622
|
* @param {string} where - The method or context name where validation is being called.
|
|
630
623
|
* @returns {HTMLElement[]} - Always returns an array of html elements.
|
|
631
624
|
*/
|
|
632
625
|
static _preHtmlElems(elems: TinyElement | TinyElement[], where: string): HTMLElement[];
|
|
626
|
+
/**
|
|
627
|
+
* Ensures the input is returned as an array.
|
|
628
|
+
* Useful to normalize operations across multiple or single html elements.
|
|
629
|
+
*
|
|
630
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
631
|
+
* @returns {HTMLElement[]} - Always returns an array of html elements.
|
|
632
|
+
*/
|
|
633
|
+
_preHtmlElems(where: string): HTMLElement[];
|
|
633
634
|
/**
|
|
634
635
|
* Ensures the input is returned as an single html element.
|
|
635
636
|
* Useful to normalize operations across multiple or single html elements.
|
|
@@ -639,6 +640,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
639
640
|
* @returns {HTMLElement} - Always returns an single html element.
|
|
640
641
|
*/
|
|
641
642
|
static _preHtmlElem(elems: TinyElement | TinyElement[], where: string): HTMLElement;
|
|
643
|
+
/**
|
|
644
|
+
* Ensures the input is returned as an single html element.
|
|
645
|
+
* Useful to normalize operations across multiple or single html elements.
|
|
646
|
+
*
|
|
647
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
648
|
+
* @returns {HTMLElement} - Always returns an single html element.
|
|
649
|
+
*/
|
|
650
|
+
_preHtmlElem(where: string): HTMLElement;
|
|
642
651
|
/**
|
|
643
652
|
* Ensures the input is returned as an array.
|
|
644
653
|
* Useful to normalize operations across multiple or single event target elements.
|
|
@@ -648,6 +657,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
648
657
|
* @returns {InputElement[]} - Always returns an array of event target elements.
|
|
649
658
|
*/
|
|
650
659
|
static _preInputElems(elems: TinyInputElement | TinyInputElement[], where: string): InputElement[];
|
|
660
|
+
/**
|
|
661
|
+
* Ensures the input is returned as an array.
|
|
662
|
+
* Useful to normalize operations across multiple or single event target elements.
|
|
663
|
+
*
|
|
664
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
665
|
+
* @returns {InputElement[]} - Always returns an array of event target elements.
|
|
666
|
+
*/
|
|
667
|
+
_preInputElems(where: string): InputElement[];
|
|
651
668
|
/**
|
|
652
669
|
* Ensures the input is returned as an single event target element.
|
|
653
670
|
* Useful to normalize operations across multiple or single event target elements.
|
|
@@ -657,6 +674,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
657
674
|
* @returns {InputElement} - Always returns an single event target element.
|
|
658
675
|
*/
|
|
659
676
|
static _preInputElem(elems: TinyInputElement | TinyInputElement[], where: string): InputElement;
|
|
677
|
+
/**
|
|
678
|
+
* Ensures the input is returned as an single event target element.
|
|
679
|
+
* Useful to normalize operations across multiple or single event target elements.
|
|
680
|
+
*
|
|
681
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
682
|
+
* @returns {InputElement} - Always returns an single event target element.
|
|
683
|
+
*/
|
|
684
|
+
_preInputElem(where: string): InputElement;
|
|
660
685
|
/**
|
|
661
686
|
* Ensures the input is returned as an array.
|
|
662
687
|
* Useful to normalize operations across multiple or single event target elements.
|
|
@@ -666,6 +691,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
666
691
|
* @returns {EventTarget[]} - Always returns an array of event target elements.
|
|
667
692
|
*/
|
|
668
693
|
static _preEventTargetElems(elems: TinyEventTarget | TinyEventTarget[], where: string): EventTarget[];
|
|
694
|
+
/**
|
|
695
|
+
* Ensures the input is returned as an array.
|
|
696
|
+
* Useful to normalize operations across multiple or single event target elements.
|
|
697
|
+
*
|
|
698
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
699
|
+
* @returns {EventTarget[]} - Always returns an array of event target elements.
|
|
700
|
+
*/
|
|
701
|
+
_preEventTargetElems(where: string): EventTarget[];
|
|
669
702
|
/**
|
|
670
703
|
* Ensures the input is returned as an single event target element.
|
|
671
704
|
* Useful to normalize operations across multiple or single event target elements.
|
|
@@ -675,6 +708,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
675
708
|
* @returns {EventTarget} - Always returns an single event target element.
|
|
676
709
|
*/
|
|
677
710
|
static _preEventTargetElem(elems: TinyEventTarget | TinyEventTarget[], where: string): EventTarget;
|
|
711
|
+
/**
|
|
712
|
+
* Ensures the input is returned as an single event target element.
|
|
713
|
+
* Useful to normalize operations across multiple or single event target elements.
|
|
714
|
+
*
|
|
715
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
716
|
+
* @returns {EventTarget} - Always returns an single event target element.
|
|
717
|
+
*/
|
|
718
|
+
_preEventTargetElem(where: string): EventTarget;
|
|
678
719
|
/**
|
|
679
720
|
* Ensures the input is returned as an array.
|
|
680
721
|
* Useful to normalize operations across multiple or single element/window elements.
|
|
@@ -684,6 +725,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
684
725
|
* @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
|
|
685
726
|
*/
|
|
686
727
|
static _preElemsAndWindow(elems: TinyElementAndWindow | TinyElementAndWindow[], where: string): ElementAndWindow[];
|
|
728
|
+
/**
|
|
729
|
+
* Ensures the input is returned as an array.
|
|
730
|
+
* Useful to normalize operations across multiple or single element/window elements.
|
|
731
|
+
*
|
|
732
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
733
|
+
* @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
|
|
734
|
+
*/
|
|
735
|
+
_preElemsAndWindow(where: string): ElementAndWindow[];
|
|
687
736
|
/**
|
|
688
737
|
* Ensures the input is returned as an single element/window element.
|
|
689
738
|
* Useful to normalize operations across multiple or single element/window elements.
|
|
@@ -693,6 +742,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
693
742
|
* @returns {ElementAndWindow} - Always returns an single element/window element.
|
|
694
743
|
*/
|
|
695
744
|
static _preElemAndWindow(elems: TinyElementAndWindow | TinyElementAndWindow[], where: string): ElementAndWindow;
|
|
745
|
+
/**
|
|
746
|
+
* Ensures the input is returned as an single element/window element.
|
|
747
|
+
* Useful to normalize operations across multiple or single element/window elements.
|
|
748
|
+
*
|
|
749
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
750
|
+
* @returns {ElementAndWindow} - Always returns an single element/window element.
|
|
751
|
+
*/
|
|
752
|
+
_preElemAndWindow(where: string): ElementAndWindow;
|
|
696
753
|
/**
|
|
697
754
|
* Ensures the input is returned as an array.
|
|
698
755
|
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
@@ -702,6 +759,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
702
759
|
* @returns {ElementAndWindow[]} - Always returns an array of element/document/window elements.
|
|
703
760
|
*/
|
|
704
761
|
static _preElemsAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow[];
|
|
762
|
+
/**
|
|
763
|
+
* Ensures the input is returned as an array.
|
|
764
|
+
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
765
|
+
*
|
|
766
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
767
|
+
* @returns {ElementAndWindow[]} - Always returns an array of element/document/window elements.
|
|
768
|
+
*/
|
|
769
|
+
_preElemsAndWinAndDoc(where: string): ElementAndWindow[];
|
|
705
770
|
/**
|
|
706
771
|
* Ensures the input is returned as an single element/window/document element.
|
|
707
772
|
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
@@ -711,6 +776,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
711
776
|
* @returns {ElementAndWindow} - Always returns an single element/document/window element.
|
|
712
777
|
*/
|
|
713
778
|
static _preElemAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow;
|
|
779
|
+
/**
|
|
780
|
+
* Ensures the input is returned as an single element/window/document element.
|
|
781
|
+
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
782
|
+
*
|
|
783
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
784
|
+
* @returns {ElementAndWindow} - Always returns an single element/document/window element.
|
|
785
|
+
*/
|
|
786
|
+
_preElemAndWinAndDoc(where: string): ElementAndWindow;
|
|
714
787
|
/**
|
|
715
788
|
* Ensures the input is returned as an array.
|
|
716
789
|
* Useful to normalize operations across multiple or single element with document elements.
|
|
@@ -720,6 +793,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
720
793
|
* @returns {ElementWithDoc[]} - Always returns an array of element with document elements.
|
|
721
794
|
*/
|
|
722
795
|
static _preElemsWithDoc(elems: TinyElementWithDoc | TinyElementWithDoc[], where: string): ElementWithDoc[];
|
|
796
|
+
/**
|
|
797
|
+
* Ensures the input is returned as an array.
|
|
798
|
+
* Useful to normalize operations across multiple or single element with document elements.
|
|
799
|
+
*
|
|
800
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
801
|
+
* @returns {ElementWithDoc[]} - Always returns an array of element with document elements.
|
|
802
|
+
*/
|
|
803
|
+
_preElemsWithDoc(where: string): ElementWithDoc[];
|
|
723
804
|
/**
|
|
724
805
|
* Ensures the input is returned as an single element with document element.
|
|
725
806
|
* Useful to normalize operations across multiple or single element with document elements.
|
|
@@ -729,6 +810,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
729
810
|
* @returns {ElementWithDoc} - Always returns an single element/window element.
|
|
730
811
|
*/
|
|
731
812
|
static _preElemWithDoc(elems: TinyElementWithDoc | TinyElementWithDoc[], where: string): ElementWithDoc;
|
|
813
|
+
/**
|
|
814
|
+
* Ensures the input is returned as an single element with document element.
|
|
815
|
+
* Useful to normalize operations across multiple or single element with document elements.
|
|
816
|
+
*
|
|
817
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
818
|
+
* @returns {ElementWithDoc} - Always returns an single element/window element.
|
|
819
|
+
*/
|
|
820
|
+
_preElemWithDoc(where: string): ElementWithDoc;
|
|
732
821
|
/**
|
|
733
822
|
* Normalizes and converts one or more DOM elements (or TinyHtml instances)
|
|
734
823
|
* into an array of `TinyHtml` instances.
|
|
@@ -741,9 +830,9 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
741
830
|
* of the input form.
|
|
742
831
|
*
|
|
743
832
|
* @param {TinyElement|Text|(TinyElement|Text)[]} elems - A single element or an array of elements (DOM or TinyHtml).
|
|
744
|
-
*
|
|
833
|
+
* Returns the array of TinyHtml instances corresponding to the input elements.
|
|
745
834
|
*/
|
|
746
|
-
static toTinyElm(elems: TinyElement | Text | (TinyElement | Text)[]): TinyHtml<
|
|
835
|
+
static toTinyElm(elems: TinyElement | Text | (TinyElement | Text)[]): TinyHtml<Element | Text>[];
|
|
747
836
|
/**
|
|
748
837
|
* Extracts native `Element` instances from one or more elements,
|
|
749
838
|
* which can be either raw DOM elements or wrapped in `TinyHtml`.
|
|
@@ -795,6 +884,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
795
884
|
* @returns {Element[]}
|
|
796
885
|
*/
|
|
797
886
|
static not(elems: TinyElement | TinyElement[], selector: WinnowRequest): Element[];
|
|
887
|
+
/**
|
|
888
|
+
* Returns only the elements **not** matching the given selector or function.
|
|
889
|
+
*
|
|
890
|
+
* @param {WinnowRequest} selector
|
|
891
|
+
* @returns {Element[]}
|
|
892
|
+
*/
|
|
893
|
+
not(selector: WinnowRequest): Element[];
|
|
798
894
|
/**
|
|
799
895
|
* Finds elements matching a selector within a context.
|
|
800
896
|
*
|
|
@@ -803,6 +899,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
803
899
|
* @returns {Element[]}
|
|
804
900
|
*/
|
|
805
901
|
static find(context: TinyElement | TinyElement[], selector: string): Element[];
|
|
902
|
+
/**
|
|
903
|
+
* Finds elements in your element matching a selector within a context.
|
|
904
|
+
*
|
|
905
|
+
* @param {string} selector
|
|
906
|
+
* @returns {Element[]}
|
|
907
|
+
*/
|
|
908
|
+
find(selector: string): Element[];
|
|
806
909
|
/**
|
|
807
910
|
* Checks if at least one element matches the selector.
|
|
808
911
|
*
|
|
@@ -811,6 +914,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
811
914
|
* @returns {boolean}
|
|
812
915
|
*/
|
|
813
916
|
static is(elems: TinyElement | TinyElement[], selector: WinnowRequest): boolean;
|
|
917
|
+
/**
|
|
918
|
+
* Checks if the element matches the selector.
|
|
919
|
+
*
|
|
920
|
+
* @param {WinnowRequest} selector
|
|
921
|
+
* @returns {boolean}
|
|
922
|
+
*/
|
|
923
|
+
is(selector: WinnowRequest): boolean;
|
|
814
924
|
/**
|
|
815
925
|
* Returns elements from the current list that contain the given target(s).
|
|
816
926
|
* @param {TinyElement|TinyElement[]} roots - A single element or an array of elements (DOM or TinyHtml).
|
|
@@ -818,6 +928,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
818
928
|
* @returns {Element[]} Elements that contain the target.
|
|
819
929
|
*/
|
|
820
930
|
static has(roots: TinyElement | TinyElement[], target: string | TinyElement | TinyElement[]): Element[];
|
|
931
|
+
/**
|
|
932
|
+
* Returns elements from the current list that contain the given target(s).
|
|
933
|
+
* @param {string|TinyElement|TinyElement[]} target - Selector or DOM element(s).
|
|
934
|
+
* @returns {Element[]} Elements that contain the target.
|
|
935
|
+
*/
|
|
936
|
+
has(target: string | TinyElement | TinyElement[]): Element[];
|
|
821
937
|
/**
|
|
822
938
|
* Finds the closest ancestor (including self) that matches the selector.
|
|
823
939
|
*
|
|
@@ -827,6 +943,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
827
943
|
* @returns {Element[]}
|
|
828
944
|
*/
|
|
829
945
|
static closest(els: TinyElement | TinyElement[], selector: string | Element, context?: Element | null): Element[];
|
|
946
|
+
/**
|
|
947
|
+
* Finds the closest ancestor (including self) that matches the selector.
|
|
948
|
+
*
|
|
949
|
+
* @param {string|Element} selector - A selector string or DOM element to match.
|
|
950
|
+
* @param {Element|null} [context] - An optional context to stop searching.
|
|
951
|
+
* @returns {Element[]}
|
|
952
|
+
*/
|
|
953
|
+
closest(selector: string | Element, context?: Element | null): Element[];
|
|
830
954
|
/**
|
|
831
955
|
* Compares two DOM elements to determine if they refer to the same node in the document.
|
|
832
956
|
*
|
|
@@ -837,6 +961,26 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
837
961
|
* @returns {boolean} `true` if both elements are the same DOM node; otherwise, `false`.
|
|
838
962
|
*/
|
|
839
963
|
static isSameDom(elem: TinyNode, otherElem: TinyNode): boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Compares two DOM elements to determine if they refer to the same node in the document.
|
|
966
|
+
*
|
|
967
|
+
* This performs a strict equality check (`===`) between the two elements.
|
|
968
|
+
*
|
|
969
|
+
* @param {TinyNode} elem - The DOM element to compare.
|
|
970
|
+
* @returns {boolean} `true` if both elements are the same DOM node; otherwise, `false`.
|
|
971
|
+
*/
|
|
972
|
+
isSameDom(elem: TinyNode): boolean;
|
|
973
|
+
/**
|
|
974
|
+
* Returns a shallow copy of the internal data.
|
|
975
|
+
* @type {ElementDataStore}
|
|
976
|
+
*/
|
|
977
|
+
get _data(): ElementDataStore;
|
|
978
|
+
/**
|
|
979
|
+
* Replaces the internal data with a new object.
|
|
980
|
+
* @param {ElementDataStore} value - Must be a non-null object.
|
|
981
|
+
* @throws {Error} If the value is not a valid object.
|
|
982
|
+
*/
|
|
983
|
+
set _data(value: ElementDataStore);
|
|
840
984
|
/**
|
|
841
985
|
* Internal data selectors for accessing public or private data stores.
|
|
842
986
|
*
|
|
@@ -855,6 +999,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
855
999
|
* @returns {ElementDataStore|undefined|any} - The stored value, all data, or undefined if the key doesn't exist.
|
|
856
1000
|
*/
|
|
857
1001
|
static data(el: TinyElement, key?: string | null, isPrivate?: boolean): ElementDataStore | undefined | any;
|
|
1002
|
+
/**
|
|
1003
|
+
* Retrieves data associated with a DOM element.
|
|
1004
|
+
*
|
|
1005
|
+
* If a `key` is provided, the corresponding value is returned.
|
|
1006
|
+
* If no `key` is given, a shallow copy of all stored data is returned.
|
|
1007
|
+
*
|
|
1008
|
+
* @param {string} [key] - The specific key to retrieve from the data store.
|
|
1009
|
+
* @param {boolean} [isPrivate=false] - Whether to access the private data store.
|
|
1010
|
+
* @returns {ElementDataStore|undefined|any} - The stored value, all data, or undefined if the key doesn't exist.
|
|
1011
|
+
*/
|
|
1012
|
+
data(key?: string, isPrivate?: boolean): ElementDataStore | undefined | any;
|
|
858
1013
|
/**
|
|
859
1014
|
* Stores a value associated with a specific key for a DOM element.
|
|
860
1015
|
*
|
|
@@ -866,6 +1021,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
866
1021
|
* @returns {T}
|
|
867
1022
|
*/
|
|
868
1023
|
static setData<T extends TinyElement>(el: T, key: string, value: any, isPrivate?: boolean): T;
|
|
1024
|
+
/**
|
|
1025
|
+
* Stores a value associated with a specific key for a DOM element.
|
|
1026
|
+
*
|
|
1027
|
+
* @param {string} key - The key under which the data will be stored.
|
|
1028
|
+
* @param {any} value - The value to store.
|
|
1029
|
+
* @param {boolean} [isPrivate=false] - Whether to store the data in the private store.
|
|
1030
|
+
* @returns {this}
|
|
1031
|
+
*/
|
|
1032
|
+
setData(key: string, value: any, isPrivate?: boolean): this;
|
|
869
1033
|
/**
|
|
870
1034
|
* Checks if a specific key exists in the data store of a DOM element.
|
|
871
1035
|
*
|
|
@@ -876,6 +1040,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
876
1040
|
* @returns {boolean}
|
|
877
1041
|
*/
|
|
878
1042
|
static hasData<T extends TinyElement>(el: T, key: string, isPrivate?: boolean): boolean;
|
|
1043
|
+
/**
|
|
1044
|
+
* Checks if a specific key exists in the data store of this element.
|
|
1045
|
+
*
|
|
1046
|
+
* @param {string} key - The key to check.
|
|
1047
|
+
* @param {boolean} [isPrivate=false] - Whether to check the private store.
|
|
1048
|
+
* @returns {boolean}
|
|
1049
|
+
*/
|
|
1050
|
+
hasData(key: string, isPrivate?: boolean): boolean;
|
|
879
1051
|
/**
|
|
880
1052
|
* Removes a value associated with a specific key from the data store of a DOM element.
|
|
881
1053
|
*
|
|
@@ -885,6 +1057,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
885
1057
|
* @returns {boolean}
|
|
886
1058
|
*/
|
|
887
1059
|
static removeData(el: TinyElement, key: string, isPrivate?: boolean): boolean;
|
|
1060
|
+
/**
|
|
1061
|
+
* Removes a value associated with a specific key from the data store of this element.
|
|
1062
|
+
*
|
|
1063
|
+
* @param {string} key - The key to remove.
|
|
1064
|
+
* @param {boolean} [isPrivate=false] - Whether to remove from the private store.
|
|
1065
|
+
* @returns {boolean}
|
|
1066
|
+
*/
|
|
1067
|
+
removeData(key: string, isPrivate?: boolean): boolean;
|
|
888
1068
|
/**
|
|
889
1069
|
* Get the sibling element in a given direction.
|
|
890
1070
|
*
|
|
@@ -919,6 +1099,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
919
1099
|
* @returns {ParentNode|null} The parent node or null if not found.
|
|
920
1100
|
*/
|
|
921
1101
|
static parent(el: TinyNode): ParentNode | null;
|
|
1102
|
+
/**
|
|
1103
|
+
* Returns the direct parent node of the given element, excluding document fragments.
|
|
1104
|
+
*
|
|
1105
|
+
* @returns {ParentNode|null} The parent node or null if not found.
|
|
1106
|
+
*/
|
|
1107
|
+
parent(): ParentNode | null;
|
|
922
1108
|
/**
|
|
923
1109
|
* Returns all ancestor nodes of the given element, optionally stopping before a specific ancestor.
|
|
924
1110
|
*
|
|
@@ -927,6 +1113,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
927
1113
|
* @returns {ChildNode[]} An array of ancestor nodes.
|
|
928
1114
|
*/
|
|
929
1115
|
static parents(el: TinyNode, until?: TinyNode | string): ChildNode[];
|
|
1116
|
+
/**
|
|
1117
|
+
* Returns all ancestor nodes of the given element, optionally stopping before a specific ancestor.
|
|
1118
|
+
*
|
|
1119
|
+
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
1120
|
+
* @returns {ChildNode[]} An array of ancestor nodes.
|
|
1121
|
+
*/
|
|
1122
|
+
parents(until?: TinyNode | string): ChildNode[];
|
|
930
1123
|
/**
|
|
931
1124
|
* Returns the next sibling of the given element.
|
|
932
1125
|
*
|
|
@@ -934,6 +1127,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
934
1127
|
* @returns {ChildNode|null} The next sibling or null if none found.
|
|
935
1128
|
*/
|
|
936
1129
|
static next(el: TinyNode): ChildNode | null;
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns the next sibling of the given element.
|
|
1132
|
+
*
|
|
1133
|
+
* @returns {ChildNode|null} The next sibling or null if none found.
|
|
1134
|
+
*/
|
|
1135
|
+
next(): ChildNode | null;
|
|
937
1136
|
/**
|
|
938
1137
|
* Returns the previous sibling of the given element.
|
|
939
1138
|
*
|
|
@@ -941,6 +1140,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
941
1140
|
* @returns {ChildNode|null} The previous sibling or null if none found.
|
|
942
1141
|
*/
|
|
943
1142
|
static prev(el: TinyNode): ChildNode | null;
|
|
1143
|
+
/**
|
|
1144
|
+
* Returns the previous sibling of the given element.
|
|
1145
|
+
*
|
|
1146
|
+
* @returns {ChildNode|null} The previous sibling or null if none found.
|
|
1147
|
+
*/
|
|
1148
|
+
prev(): ChildNode | null;
|
|
944
1149
|
/**
|
|
945
1150
|
* Returns all next sibling nodes after the given element.
|
|
946
1151
|
*
|
|
@@ -948,6 +1153,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
948
1153
|
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
949
1154
|
*/
|
|
950
1155
|
static nextAll(el: TinyNode): ChildNode[];
|
|
1156
|
+
/**
|
|
1157
|
+
* Returns all next sibling nodes after the given element.
|
|
1158
|
+
*
|
|
1159
|
+
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
1160
|
+
*/
|
|
1161
|
+
nextAll(): ChildNode[];
|
|
951
1162
|
/**
|
|
952
1163
|
* Returns all previous sibling nodes before the given element.
|
|
953
1164
|
*
|
|
@@ -955,6 +1166,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
955
1166
|
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
956
1167
|
*/
|
|
957
1168
|
static prevAll(el: TinyNode): ChildNode[];
|
|
1169
|
+
/**
|
|
1170
|
+
* Returns all previous sibling nodes before the given element.
|
|
1171
|
+
*
|
|
1172
|
+
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
1173
|
+
*/
|
|
1174
|
+
prevAll(): ChildNode[];
|
|
958
1175
|
/**
|
|
959
1176
|
* Returns all next sibling nodes up to (but not including) the node matched by a selector or element.
|
|
960
1177
|
*
|
|
@@ -963,6 +1180,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
963
1180
|
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
964
1181
|
*/
|
|
965
1182
|
static nextUntil(el: TinyNode, until?: TinyNode | string): ChildNode[];
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns all next sibling nodes up to (but not including) the node matched by a selector or element.
|
|
1185
|
+
*
|
|
1186
|
+
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
1187
|
+
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
1188
|
+
*/
|
|
1189
|
+
nextUntil(until?: TinyNode | string): ChildNode[];
|
|
966
1190
|
/**
|
|
967
1191
|
* Returns all previous sibling nodes up to (but not including) the node matched by a selector or element.
|
|
968
1192
|
*
|
|
@@ -971,6 +1195,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
971
1195
|
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
972
1196
|
*/
|
|
973
1197
|
static prevUntil(el: TinyNode, until?: TinyNode | string): ChildNode[];
|
|
1198
|
+
/**
|
|
1199
|
+
* Returns all previous sibling nodes up to (but not including) the node matched by a selector or element.
|
|
1200
|
+
*
|
|
1201
|
+
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
1202
|
+
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
1203
|
+
*/
|
|
1204
|
+
prevUntil(until?: TinyNode | string): ChildNode[];
|
|
974
1205
|
/**
|
|
975
1206
|
* Returns all sibling nodes of the given element, excluding itself.
|
|
976
1207
|
*
|
|
@@ -978,6 +1209,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
978
1209
|
* @returns {ChildNode[]} An array of sibling nodes.
|
|
979
1210
|
*/
|
|
980
1211
|
static siblings(el: TinyNode): ChildNode[];
|
|
1212
|
+
/**
|
|
1213
|
+
* Returns all sibling nodes of the given element, excluding itself.
|
|
1214
|
+
*
|
|
1215
|
+
* @returns {ChildNode[]} An array of sibling nodes.
|
|
1216
|
+
*/
|
|
1217
|
+
siblings(): ChildNode[];
|
|
981
1218
|
/**
|
|
982
1219
|
* Returns all child nodes of the given element.
|
|
983
1220
|
*
|
|
@@ -986,12 +1223,24 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
986
1223
|
*/
|
|
987
1224
|
static children(el: TinyNode): ChildNode[];
|
|
988
1225
|
/**
|
|
989
|
-
* Returns
|
|
1226
|
+
* Returns all child nodes of the given element.
|
|
1227
|
+
*
|
|
1228
|
+
* @returns {ChildNode[]} An array of child nodes.
|
|
1229
|
+
*/
|
|
1230
|
+
children(): ChildNode[];
|
|
1231
|
+
/**
|
|
1232
|
+
* Returns the contents of the given node. For `<template>` it returns its content; for `<iframe>`, the document.
|
|
990
1233
|
*
|
|
991
1234
|
* @param {TinyNode} el - The DOM node to get contents from.
|
|
992
1235
|
* @returns {(ChildNode|DocumentFragment)[]|Document[]} An array of child nodes or the content document of an iframe.
|
|
993
1236
|
*/
|
|
994
1237
|
static contents(el: TinyNode): (ChildNode | DocumentFragment)[] | Document[];
|
|
1238
|
+
/**
|
|
1239
|
+
* Returns the contents of the given node. For `<template>` it returns its content; for `<iframe>`, the document.
|
|
1240
|
+
*
|
|
1241
|
+
* @returns {(ChildNode|DocumentFragment)[]|Document[]} An array of child nodes or the content document of an iframe.
|
|
1242
|
+
*/
|
|
1243
|
+
contents(): (ChildNode | DocumentFragment)[] | Document[];
|
|
995
1244
|
/**
|
|
996
1245
|
* Clone each element.
|
|
997
1246
|
* @param {TinyNode|TinyNode[]} el
|
|
@@ -999,7 +1248,18 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
999
1248
|
* @returns {Node[]}
|
|
1000
1249
|
*/
|
|
1001
1250
|
static clone(el: TinyNode | TinyNode[], deep?: boolean): Node[];
|
|
1002
|
-
|
|
1251
|
+
/**
|
|
1252
|
+
* Clone the element.
|
|
1253
|
+
* @param {boolean} [deep=true]
|
|
1254
|
+
* @returns {Node}
|
|
1255
|
+
*/
|
|
1256
|
+
clone(deep?: boolean): Node;
|
|
1257
|
+
/**
|
|
1258
|
+
* Normalize and validate nodes before DOM insertion.
|
|
1259
|
+
* Converts TinyNode-like structures or strings into DOM-compatible nodes.
|
|
1260
|
+
* @type {(where: string, ...nodes: (AppendCheckerValues|Record<string, AppendCheckerValues>)[]) => (Node | string)[]}
|
|
1261
|
+
*/
|
|
1262
|
+
static _appendChecker(where: string, ...nodes: (Record<string, AppendCheckerValues> | AppendCheckerValues)[]): (string | Node)[];
|
|
1003
1263
|
/**
|
|
1004
1264
|
* Appends child elements or strings to the end of the target element(s).
|
|
1005
1265
|
*
|
|
@@ -1009,6 +1269,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1009
1269
|
* @returns {T}
|
|
1010
1270
|
*/
|
|
1011
1271
|
static append<T extends TinyElement>(el: T, ...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): T;
|
|
1272
|
+
/**
|
|
1273
|
+
* Appends child elements or strings to the end of the target element(s).
|
|
1274
|
+
*
|
|
1275
|
+
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - The child elements or text to append.
|
|
1276
|
+
* @returns {this}
|
|
1277
|
+
*/
|
|
1278
|
+
append(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
1012
1279
|
/**
|
|
1013
1280
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
1014
1281
|
*
|
|
@@ -1018,6 +1285,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1018
1285
|
* @returns {T}
|
|
1019
1286
|
*/
|
|
1020
1287
|
static prepend<T extends TinyElement>(el: T, ...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): T;
|
|
1288
|
+
/**
|
|
1289
|
+
* Prepends child elements or strings to the beginning of the target element(s).
|
|
1290
|
+
*
|
|
1291
|
+
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - The child elements or text to prepend.
|
|
1292
|
+
* @returns {this}
|
|
1293
|
+
*/
|
|
1294
|
+
prepend(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
1021
1295
|
/**
|
|
1022
1296
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
1023
1297
|
*
|
|
@@ -1027,6 +1301,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1027
1301
|
* @returns {T}
|
|
1028
1302
|
*/
|
|
1029
1303
|
static before<T extends TinyElement>(el: T, ...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): T;
|
|
1304
|
+
/**
|
|
1305
|
+
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
1306
|
+
*
|
|
1307
|
+
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - Elements or text to insert before the target.
|
|
1308
|
+
* @returns {this}
|
|
1309
|
+
*/
|
|
1310
|
+
before(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
1030
1311
|
/**
|
|
1031
1312
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
1032
1313
|
*
|
|
@@ -1036,6 +1317,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1036
1317
|
* @returns {T}
|
|
1037
1318
|
*/
|
|
1038
1319
|
static after<T extends TinyElement>(el: T, ...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): T;
|
|
1320
|
+
/**
|
|
1321
|
+
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
1322
|
+
*
|
|
1323
|
+
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - Elements or text to insert after the target.
|
|
1324
|
+
* @returns {this}
|
|
1325
|
+
*/
|
|
1326
|
+
after(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
1039
1327
|
/**
|
|
1040
1328
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
1041
1329
|
*
|
|
@@ -1045,6 +1333,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1045
1333
|
* @returns {T}
|
|
1046
1334
|
*/
|
|
1047
1335
|
static replaceWith<T extends TinyElement>(el: T, ...newNodes: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): T;
|
|
1336
|
+
/**
|
|
1337
|
+
* Replaces the target element(s) in the DOM with new elements or text.
|
|
1338
|
+
*
|
|
1339
|
+
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} newNodes - New elements or text to replace the target.
|
|
1340
|
+
* @returns {this}
|
|
1341
|
+
*/
|
|
1342
|
+
replaceWith(...newNodes: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
1048
1343
|
/**
|
|
1049
1344
|
* Appends the given element(s) to each target element in sequence.
|
|
1050
1345
|
*
|
|
@@ -1054,6 +1349,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1054
1349
|
* @returns {T}
|
|
1055
1350
|
*/
|
|
1056
1351
|
static appendTo<T extends TinyNode | TinyNode[]>(el: T, targets: TinyNode | TinyNode[]): T;
|
|
1352
|
+
/**
|
|
1353
|
+
* Appends the given element(s) to each target element in sequence.
|
|
1354
|
+
*
|
|
1355
|
+
* @param {TinyNode | TinyNode[]} targets - Target element(s) where content will be appended.
|
|
1356
|
+
* @returns {this}
|
|
1357
|
+
*/
|
|
1358
|
+
appendTo(targets: TinyNode | TinyNode[]): this;
|
|
1057
1359
|
/**
|
|
1058
1360
|
* Prepends the given element(s) to each target element in sequence.
|
|
1059
1361
|
*
|
|
@@ -1063,6 +1365,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1063
1365
|
* @returns {T}
|
|
1064
1366
|
*/
|
|
1065
1367
|
static prependTo<T extends TinyElement | TinyElement[]>(el: T, targets: TinyElement | TinyElement[]): T;
|
|
1368
|
+
/**
|
|
1369
|
+
* Prepends the given element(s) to each target element in sequence.
|
|
1370
|
+
*
|
|
1371
|
+
* @param {TinyElement | TinyElement[]} targets - Target element(s) where content will be prepended.
|
|
1372
|
+
* @returns {this}
|
|
1373
|
+
*/
|
|
1374
|
+
prependTo(targets: TinyElement | TinyElement[]): this;
|
|
1066
1375
|
/**
|
|
1067
1376
|
* Inserts the element before a child of a given target, or before the target itself.
|
|
1068
1377
|
*
|
|
@@ -1073,6 +1382,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1073
1382
|
* @returns {T}
|
|
1074
1383
|
*/
|
|
1075
1384
|
static insertBefore<T extends TinyNode | TinyNode[]>(el: T, target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): T;
|
|
1385
|
+
/**
|
|
1386
|
+
* Inserts the element before a child of a given target, or before the target itself.
|
|
1387
|
+
*
|
|
1388
|
+
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
1389
|
+
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert before, defaults to target.
|
|
1390
|
+
* @returns {this}
|
|
1391
|
+
*/
|
|
1392
|
+
insertBefore(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): this;
|
|
1076
1393
|
/**
|
|
1077
1394
|
* Inserts the element after a child of a given target, or after the target itself.
|
|
1078
1395
|
*
|
|
@@ -1083,6 +1400,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1083
1400
|
* @returns {T}
|
|
1084
1401
|
*/
|
|
1085
1402
|
static insertAfter<T extends TinyNode | TinyNode[]>(el: T, target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): T;
|
|
1403
|
+
/**
|
|
1404
|
+
* Inserts the element after a child of a given target, or after the target itself.
|
|
1405
|
+
*
|
|
1406
|
+
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
1407
|
+
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert after, defaults to target.
|
|
1408
|
+
* @returns {this}
|
|
1409
|
+
*/
|
|
1410
|
+
insertAfter(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): this;
|
|
1086
1411
|
/**
|
|
1087
1412
|
* Replaces all target elements with the provided element(s).
|
|
1088
1413
|
* If multiple targets exist, the inserted elements are cloned accordingly.
|
|
@@ -1093,6 +1418,20 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1093
1418
|
* @returns {T}
|
|
1094
1419
|
*/
|
|
1095
1420
|
static replaceAll<T extends TinyNode | TinyNode[]>(el: T, targets: TinyNode | TinyNode[]): T;
|
|
1421
|
+
/**
|
|
1422
|
+
* Replaces all target elements with the provided element(s).
|
|
1423
|
+
* If multiple targets exist, the inserted elements are cloned accordingly.
|
|
1424
|
+
*
|
|
1425
|
+
* @param {TinyNode | TinyNode[]} targets - The elements to be replaced.
|
|
1426
|
+
* @returns {this}
|
|
1427
|
+
*/
|
|
1428
|
+
replaceAll(targets: TinyNode | TinyNode[]): this;
|
|
1429
|
+
/**
|
|
1430
|
+
* Returns the number of elements currently stored in the internal element list.
|
|
1431
|
+
*
|
|
1432
|
+
* @returns {number} The total count of elements.
|
|
1433
|
+
*/
|
|
1434
|
+
get size(): number;
|
|
1096
1435
|
/**
|
|
1097
1436
|
* Validates if all provided items are acceptable constructor values.
|
|
1098
1437
|
*
|
|
@@ -1100,6 +1439,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1100
1439
|
* @throws {Error} If any element is not a valid target.
|
|
1101
1440
|
*/
|
|
1102
1441
|
static _elCheck(els: any[] | NodeListOf<Element> | HTMLCollectionOf<Element> | NodeListOf<HTMLElement>): void;
|
|
1442
|
+
/**
|
|
1443
|
+
* A new TinyHtml object containing the combined elements.
|
|
1444
|
+
*
|
|
1445
|
+
* @template {TinyHtmlConstructor} T
|
|
1446
|
+
* @param {T} el - The elements to add.
|
|
1447
|
+
* @returns {TinyHtml<TinyHtmlT|T>} The new length of the internal collection.
|
|
1448
|
+
*/
|
|
1449
|
+
add<T extends TinyHtmlConstructor>(el: T): TinyHtml<TinyHtmlT | T>;
|
|
1103
1450
|
/**
|
|
1104
1451
|
* Resolves the given constructor input into a normalized array of elements.
|
|
1105
1452
|
*
|
|
@@ -1109,6 +1456,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1109
1456
|
* @throws {Error} If the resolved elements are not valid constructor values.
|
|
1110
1457
|
*/
|
|
1111
1458
|
static _selector(el: TinyHtmlConstructor): ConstructorElValues[];
|
|
1459
|
+
/**
|
|
1460
|
+
* Creates an instance of TinyHtml for a specific Element.
|
|
1461
|
+
* Useful when you want to operate repeatedly on the same element using instance methods.
|
|
1462
|
+
* @param {TinyHtmlT} el - The element to wrap and manipulate.
|
|
1463
|
+
*/
|
|
1464
|
+
constructor(el: TinyHtmlT);
|
|
1112
1465
|
/**
|
|
1113
1466
|
* Checks whether the given object is a window.
|
|
1114
1467
|
* @param {*} obj - The object to test.
|
|
@@ -1122,6 +1475,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1122
1475
|
* @returns {CSSStyleDeclaration} The computed style object for the element.
|
|
1123
1476
|
*/
|
|
1124
1477
|
static css(el: TinyElement): CSSStyleDeclaration;
|
|
1478
|
+
/**
|
|
1479
|
+
* Returns the full computed CSS styles for the given element.
|
|
1480
|
+
*
|
|
1481
|
+
* @returns {CSSStyleDeclaration} The computed style object for the element.
|
|
1482
|
+
*/
|
|
1483
|
+
css(): CSSStyleDeclaration;
|
|
1125
1484
|
/**
|
|
1126
1485
|
* Returns the value of a specific computed CSS property from the given element as a string.
|
|
1127
1486
|
*
|
|
@@ -1130,6 +1489,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1130
1489
|
* @returns {string|null} The value of the CSS property as a string, or null if not found or invalid.
|
|
1131
1490
|
*/
|
|
1132
1491
|
static cssString(el: TinyElement, prop: string): string | null;
|
|
1492
|
+
/**
|
|
1493
|
+
* Returns the value of a specific computed CSS property from the given element as a string.
|
|
1494
|
+
*
|
|
1495
|
+
* @param {string} prop - The name of the CSS property (camelCase or kebab-case).
|
|
1496
|
+
* @returns {string|null} The value of the CSS property as a string, or null if not found or invalid.
|
|
1497
|
+
*/
|
|
1498
|
+
cssString(prop: string): string | null;
|
|
1133
1499
|
/**
|
|
1134
1500
|
* Returns a subset of computed CSS styles based on the given list of properties.
|
|
1135
1501
|
*
|
|
@@ -1138,6 +1504,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1138
1504
|
* @returns {Partial<CSSStyleDeclaration>} An object containing the requested styles.
|
|
1139
1505
|
*/
|
|
1140
1506
|
static cssList(el: TinyElement, prop: string[]): Partial<CSSStyleDeclaration>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Returns a subset of computed CSS styles based on the given list of properties.
|
|
1509
|
+
*
|
|
1510
|
+
* @param {string[]} prop - An array of CSS property names to retrieve.
|
|
1511
|
+
* @returns {Partial<CSSStyleDeclaration>} An object containing the requested styles.
|
|
1512
|
+
*/
|
|
1513
|
+
cssList(prop: string[]): Partial<CSSStyleDeclaration>;
|
|
1141
1514
|
/**
|
|
1142
1515
|
* Returns the computed CSS float value of a property.
|
|
1143
1516
|
* @param {TinyElement} el - The element to inspect.
|
|
@@ -1145,6 +1518,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1145
1518
|
* @returns {number} - The parsed float value.
|
|
1146
1519
|
*/
|
|
1147
1520
|
static cssFloat(el: TinyElement, prop: string): number;
|
|
1521
|
+
/**
|
|
1522
|
+
* Returns the computed CSS float value of a property.
|
|
1523
|
+
* @param {string} prop - The CSS property.
|
|
1524
|
+
* @returns {number} - The parsed float value.
|
|
1525
|
+
*/
|
|
1526
|
+
cssFloat(prop: string): number;
|
|
1148
1527
|
/**
|
|
1149
1528
|
* Returns computed float values of multiple CSS properties.
|
|
1150
1529
|
* @param {TinyElement} el - The element to inspect.
|
|
@@ -1153,23 +1532,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1153
1532
|
*/
|
|
1154
1533
|
static cssFloats(el: TinyElement, prop: string[]): Record<string, number>;
|
|
1155
1534
|
/**
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1159
|
-
*
|
|
1160
|
-
* ⚠️ This object should not be modified directly. Use `TinyHtml.cssPropAliases` instead to ensure reverse mappings stay in sync.
|
|
1161
|
-
*
|
|
1162
|
-
* Example of how to add a new alias:
|
|
1163
|
-
*
|
|
1164
|
-
* ```js
|
|
1165
|
-
* TinyHtml.cssPropAliases.tinyPudding = 'tiny-pudding';
|
|
1166
|
-
* ```
|
|
1167
|
-
*
|
|
1168
|
-
* This will automatically update `TinyHtml.cssPropRevAliases['tiny-pudding']` with `'tinyPudding'`.
|
|
1169
|
-
*
|
|
1170
|
-
* @type {Record<string | symbol, string>}
|
|
1535
|
+
* Returns computed float values of multiple CSS properties.
|
|
1536
|
+
* @param {string[]} prop - An array of CSS properties.
|
|
1537
|
+
* @returns {Record<string, number>} - Map of property to float value.
|
|
1171
1538
|
*/
|
|
1172
|
-
|
|
1539
|
+
cssFloats(prop: string[]): Record<string, number>;
|
|
1173
1540
|
/**
|
|
1174
1541
|
* Public proxy to manage camelCase ➝ kebab-case CSS property aliasing.
|
|
1175
1542
|
*
|
|
@@ -1211,6 +1578,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1211
1578
|
* @returns {T}
|
|
1212
1579
|
*/
|
|
1213
1580
|
static setStyle<T extends TinyHtmlElement | TinyHtmlElement[]>(el: T, prop: string | Object, value?: string | null): T;
|
|
1581
|
+
/**
|
|
1582
|
+
* Sets one or more CSS inline style properties on the given element(s).
|
|
1583
|
+
*
|
|
1584
|
+
* - If `prop` is a string, the `value` will be applied to that property.
|
|
1585
|
+
* - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
|
|
1586
|
+
*
|
|
1587
|
+
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
1588
|
+
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
1589
|
+
* @returns {this}
|
|
1590
|
+
*/
|
|
1591
|
+
setStyle(prop: string | Object, value?: string | null): this;
|
|
1214
1592
|
/**
|
|
1215
1593
|
* Gets the value of a specific inline style property.
|
|
1216
1594
|
*
|
|
@@ -1221,6 +1599,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1221
1599
|
* @returns {string} The style value of the specified property.
|
|
1222
1600
|
*/
|
|
1223
1601
|
static getStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string): string;
|
|
1602
|
+
/**
|
|
1603
|
+
* Gets the value of a specific inline style property.
|
|
1604
|
+
*
|
|
1605
|
+
* Returns only the value set directly via the `style` attribute.
|
|
1606
|
+
*
|
|
1607
|
+
* @param {string} prop - The style property name to retrieve.
|
|
1608
|
+
* @returns {string} The style value of the specified property.
|
|
1609
|
+
*/
|
|
1610
|
+
getStyle(prop: string): string;
|
|
1224
1611
|
/**
|
|
1225
1612
|
* Gets all inline styles defined directly on the element (`style` attribute).
|
|
1226
1613
|
*
|
|
@@ -1235,8 +1622,22 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1235
1622
|
* @throws {TypeError} If `camelCase` or `rawAttr` is not a boolean.
|
|
1236
1623
|
*/
|
|
1237
1624
|
static style(el: TinyHtmlElement | TinyHtmlElement[], { camelCase, rawAttr }?: {
|
|
1238
|
-
camelCase?: boolean
|
|
1239
|
-
rawAttr?: boolean
|
|
1625
|
+
camelCase?: boolean;
|
|
1626
|
+
rawAttr?: boolean;
|
|
1627
|
+
}): Record<string, string>;
|
|
1628
|
+
/**
|
|
1629
|
+
* Gets all inline styles defined directly on the element (`style` attribute).
|
|
1630
|
+
*
|
|
1631
|
+
* Returns an object with all property-value pairs in kebab-case format.
|
|
1632
|
+
*
|
|
1633
|
+
* @param {Object} [settings={}] - Optional configuration settings.
|
|
1634
|
+
* @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
|
|
1635
|
+
* @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
|
|
1636
|
+
* @returns {Record<string, string>} All inline styles as an object.
|
|
1637
|
+
*/
|
|
1638
|
+
style(settings?: {
|
|
1639
|
+
camelCase?: boolean;
|
|
1640
|
+
rawAttr?: boolean;
|
|
1240
1641
|
}): Record<string, string>;
|
|
1241
1642
|
/**
|
|
1242
1643
|
* Removes one or more inline CSS properties from the given element(s).
|
|
@@ -1247,6 +1648,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1247
1648
|
* @returns {T}
|
|
1248
1649
|
*/
|
|
1249
1650
|
static removeStyle<T extends TinyHtmlElement | TinyHtmlElement[]>(el: T, prop: string | string[]): T;
|
|
1651
|
+
/**
|
|
1652
|
+
* Removes one or more inline CSS properties from the given element(s).
|
|
1653
|
+
*
|
|
1654
|
+
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
1655
|
+
* @returns {this}
|
|
1656
|
+
*/
|
|
1657
|
+
removeStyle(prop: string | string[]): this;
|
|
1250
1658
|
/**
|
|
1251
1659
|
* Toggles a CSS property value between two given values.
|
|
1252
1660
|
*
|
|
@@ -1260,6 +1668,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1260
1668
|
* @returns {T}
|
|
1261
1669
|
*/
|
|
1262
1670
|
static toggleStyle<T extends TinyHtmlElement | TinyHtmlElement[]>(el: T, prop: string, val1: string, val2: string): T;
|
|
1671
|
+
/**
|
|
1672
|
+
* Toggles a CSS property value between two given values.
|
|
1673
|
+
*
|
|
1674
|
+
* The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
|
|
1675
|
+
*
|
|
1676
|
+
* @param {string} prop - The CSS property to toggle.
|
|
1677
|
+
* @param {string} val1 - The first value (used as "current" check).
|
|
1678
|
+
* @param {string} val2 - The second value (used as the "alternative").
|
|
1679
|
+
* @returns {this}
|
|
1680
|
+
*/
|
|
1681
|
+
toggleStyle(prop: string, val1: string, val2: string): this;
|
|
1263
1682
|
/**
|
|
1264
1683
|
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
1265
1684
|
*
|
|
@@ -1268,6 +1687,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1268
1687
|
* @returns {T}
|
|
1269
1688
|
*/
|
|
1270
1689
|
static clearStyle<T extends TinyElement | TinyElement[]>(el: T): T;
|
|
1690
|
+
/**
|
|
1691
|
+
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
1692
|
+
* @returns {this}
|
|
1693
|
+
*/
|
|
1694
|
+
clearStyle(): this;
|
|
1271
1695
|
/**
|
|
1272
1696
|
* Focus the element.
|
|
1273
1697
|
*
|
|
@@ -1276,6 +1700,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1276
1700
|
* @returns {T}
|
|
1277
1701
|
*/
|
|
1278
1702
|
static focus<T extends TinyHtmlElement>(el: T): T;
|
|
1703
|
+
/**
|
|
1704
|
+
* Focus the element.
|
|
1705
|
+
* @returns {this}
|
|
1706
|
+
*/
|
|
1707
|
+
focus(): this;
|
|
1279
1708
|
/**
|
|
1280
1709
|
* Blur the element.
|
|
1281
1710
|
*
|
|
@@ -1284,6 +1713,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1284
1713
|
* @returns {T}
|
|
1285
1714
|
*/
|
|
1286
1715
|
static blur<T extends TinyHtmlElement>(el: T): T;
|
|
1716
|
+
/**
|
|
1717
|
+
* Blur the element.
|
|
1718
|
+
* @returns {this}
|
|
1719
|
+
*/
|
|
1720
|
+
blur(): this;
|
|
1287
1721
|
/**
|
|
1288
1722
|
* Select the text content of an input or textarea element.
|
|
1289
1723
|
*
|
|
@@ -1292,6 +1726,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1292
1726
|
* @returns {T}
|
|
1293
1727
|
*/
|
|
1294
1728
|
static select<T extends TinyHtmlAny | HTMLInputElement | HTMLTextAreaElement>(el: T): T;
|
|
1729
|
+
/**
|
|
1730
|
+
* Select the text content of an input or textarea element.
|
|
1731
|
+
* @returns {this}
|
|
1732
|
+
*/
|
|
1733
|
+
select(): this;
|
|
1295
1734
|
/**
|
|
1296
1735
|
* Interprets a value as a boolean `true` if it matches a common truthy representation.
|
|
1297
1736
|
*
|
|
@@ -1359,6 +1798,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1359
1798
|
* @throws {TypeError} If `type` or `extra` is not a string.
|
|
1360
1799
|
*/
|
|
1361
1800
|
static getDimension(el: TinyElementAndWinAndDoc, type: "width" | "height", extra?: "content" | "padding" | "border" | "margin"): number;
|
|
1801
|
+
/**
|
|
1802
|
+
* Gets the width or height of an element based on the box model.
|
|
1803
|
+
* @param {"width"|"height"} type - Dimension type.
|
|
1804
|
+
* @param {"content"|"padding"|"border"|"margin"} extra - Box model context.
|
|
1805
|
+
* @returns {number} - Computed dimension.
|
|
1806
|
+
*/
|
|
1807
|
+
getDimension(type: "width" | "height", extra: "content" | "padding" | "border" | "margin"): number;
|
|
1362
1808
|
/**
|
|
1363
1809
|
* Sets the height of the element.
|
|
1364
1810
|
* @template {TinyHtmlElement} T
|
|
@@ -1368,6 +1814,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1368
1814
|
* @returns {T}
|
|
1369
1815
|
*/
|
|
1370
1816
|
static setHeight<T extends TinyHtmlElement>(el: T, value: string | number): T;
|
|
1817
|
+
/**
|
|
1818
|
+
* Sets the height of the element.
|
|
1819
|
+
* @param {string|number} value - Height value.
|
|
1820
|
+
* @returns {this}
|
|
1821
|
+
*/
|
|
1822
|
+
setHeight(value: string | number): this;
|
|
1823
|
+
/**
|
|
1824
|
+
* Sets the height of the element.
|
|
1825
|
+
* @param {string|number} value - Height value.
|
|
1826
|
+
*/
|
|
1827
|
+
set height(value: string | number);
|
|
1371
1828
|
/**
|
|
1372
1829
|
* Sets the width of the element.
|
|
1373
1830
|
* @template {TinyHtmlElement} T
|
|
@@ -1377,6 +1834,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1377
1834
|
* @returns {T}
|
|
1378
1835
|
*/
|
|
1379
1836
|
static setWidth<T extends TinyHtmlElement>(el: T, value: string | number): T;
|
|
1837
|
+
/**
|
|
1838
|
+
* Sets the width of the element.
|
|
1839
|
+
* @param {string|number} value - Width value.
|
|
1840
|
+
* @returns {this}
|
|
1841
|
+
*/
|
|
1842
|
+
setWidth(value: string | number): this;
|
|
1843
|
+
/**
|
|
1844
|
+
* Sets the width of the element.
|
|
1845
|
+
* @param {string|number} value - Width value.
|
|
1846
|
+
*/
|
|
1847
|
+
set width(value: string | number);
|
|
1380
1848
|
/**
|
|
1381
1849
|
* Returns content box height.
|
|
1382
1850
|
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
@@ -1384,23 +1852,43 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1384
1852
|
*/
|
|
1385
1853
|
static height(el: TinyElementAndWinAndDoc): number;
|
|
1386
1854
|
/**
|
|
1387
|
-
* Returns content box
|
|
1388
|
-
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
1855
|
+
* Returns content box height.
|
|
1389
1856
|
* @returns {number}
|
|
1390
1857
|
*/
|
|
1391
|
-
|
|
1858
|
+
get height(): number;
|
|
1859
|
+
/**
|
|
1860
|
+
* Returns content box width.
|
|
1861
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
1862
|
+
* @returns {number}
|
|
1863
|
+
*/
|
|
1864
|
+
static width(el: TinyElementAndWinAndDoc): number;
|
|
1865
|
+
/**
|
|
1866
|
+
* Returns content box width.
|
|
1867
|
+
* @returns {number}
|
|
1868
|
+
*/
|
|
1869
|
+
get width(): number;
|
|
1392
1870
|
/**
|
|
1393
1871
|
* Returns padding box height.
|
|
1394
1872
|
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
1395
1873
|
* @returns {number}
|
|
1396
1874
|
*/
|
|
1397
1875
|
static innerHeight(el: TinyElementAndWinAndDoc): number;
|
|
1876
|
+
/**
|
|
1877
|
+
* Returns padding box height.
|
|
1878
|
+
* @returns {number}
|
|
1879
|
+
*/
|
|
1880
|
+
innerHeight(): number;
|
|
1398
1881
|
/**
|
|
1399
1882
|
* Returns padding box width.
|
|
1400
1883
|
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
1401
1884
|
* @returns {number}
|
|
1402
1885
|
*/
|
|
1403
1886
|
static innerWidth(el: TinyElementAndWinAndDoc): number;
|
|
1887
|
+
/**
|
|
1888
|
+
* Returns padding box width.
|
|
1889
|
+
* @returns {number}
|
|
1890
|
+
*/
|
|
1891
|
+
innerWidth(): number;
|
|
1404
1892
|
/**
|
|
1405
1893
|
* Returns outer height of the element, optionally including margin.
|
|
1406
1894
|
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
@@ -1408,6 +1896,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1408
1896
|
* @returns {number}
|
|
1409
1897
|
*/
|
|
1410
1898
|
static outerHeight(el: TinyElementAndWinAndDoc, includeMargin?: boolean): number;
|
|
1899
|
+
/**
|
|
1900
|
+
* Returns outer height of the element, optionally including margin.
|
|
1901
|
+
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
1902
|
+
* @returns {number}
|
|
1903
|
+
*/
|
|
1904
|
+
outerHeight(includeMargin?: boolean): number;
|
|
1411
1905
|
/**
|
|
1412
1906
|
* Returns outer width of the element, optionally including margin.
|
|
1413
1907
|
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
@@ -1415,19 +1909,34 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1415
1909
|
* @returns {number}
|
|
1416
1910
|
*/
|
|
1417
1911
|
static outerWidth(el: TinyElementAndWinAndDoc, includeMargin?: boolean): number;
|
|
1418
|
-
/** @type {string} */
|
|
1419
|
-
static #defaultDisplay: string;
|
|
1420
1912
|
/**
|
|
1421
|
-
*
|
|
1913
|
+
* Returns outer width of the element, optionally including margin.
|
|
1914
|
+
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
1915
|
+
* @returns {number}
|
|
1916
|
+
*/
|
|
1917
|
+
outerWidth(includeMargin?: boolean): number;
|
|
1918
|
+
/**
|
|
1919
|
+
* Gets the current display value.
|
|
1920
|
+
* @returns {string}
|
|
1921
|
+
*/
|
|
1922
|
+
get mainDisplay(): string;
|
|
1923
|
+
/**
|
|
1924
|
+
* Sets the display value.
|
|
1422
1925
|
* @param {string} value
|
|
1423
1926
|
* @throws {TypeError} If the value is not a string.
|
|
1424
1927
|
*/
|
|
1425
|
-
|
|
1928
|
+
set mainDisplay(value: string);
|
|
1426
1929
|
/**
|
|
1427
1930
|
* Gets the default display value.
|
|
1428
1931
|
* @returns {string}
|
|
1429
1932
|
*/
|
|
1430
1933
|
static get defaultDisplay(): string;
|
|
1934
|
+
/**
|
|
1935
|
+
* Sets the default display value.
|
|
1936
|
+
* @param {string} value
|
|
1937
|
+
* @throws {TypeError} If the value is not a string.
|
|
1938
|
+
*/
|
|
1939
|
+
static set defaultDisplay(value: string);
|
|
1431
1940
|
/**
|
|
1432
1941
|
* Retrieves stored animation data for a given element and key.
|
|
1433
1942
|
* If no data exists yet, initializes storage for that element.
|
|
@@ -1447,12 +1956,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1447
1956
|
*/
|
|
1448
1957
|
static setAnimateData(el: HTMLElement, where: string, value: string | number): void;
|
|
1449
1958
|
/**
|
|
1450
|
-
*
|
|
1451
|
-
* are cancelled before a new one starts. Defaults to true.
|
|
1959
|
+
* Returns the current global setting for cancelling old style-based animations.
|
|
1452
1960
|
*
|
|
1453
|
-
* @
|
|
1961
|
+
* @returns {boolean} True if old animations are cancelled by default, false otherwise.
|
|
1454
1962
|
*/
|
|
1455
|
-
static
|
|
1963
|
+
static get cancelOldStyleFx(): boolean;
|
|
1456
1964
|
/**
|
|
1457
1965
|
* Updates the global setting that determines whether old style-based animations
|
|
1458
1966
|
* are cancelled before new ones start.
|
|
@@ -1462,33 +1970,16 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1462
1970
|
*/
|
|
1463
1971
|
static set cancelOldStyleFx(value: boolean);
|
|
1464
1972
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
* @returns {boolean} True if old animations are cancelled by default, false otherwise.
|
|
1468
|
-
*/
|
|
1469
|
-
static get cancelOldStyleFx(): boolean;
|
|
1470
|
-
/**
|
|
1471
|
-
* Predefined animation speed options, inspired by jQuery.fx.speeds.
|
|
1472
|
-
* Each entry can be either a number (duration in ms) or a KeyframeAnimationOptions object.
|
|
1473
|
-
*
|
|
1474
|
-
* Usage example:
|
|
1475
|
-
* TinyHtml.animate(el, keyframes, TinyHtml.#fxSpeeds.fast);
|
|
1476
|
-
* TinyHtml.slideDown(el, TinyHtml.#fxSpeeds.slow);
|
|
1477
|
-
*
|
|
1478
|
-
* @type {Record<string, number | KeyframeAnimationOptions>}
|
|
1973
|
+
* Get a cloned copy of predefined animation speeds.
|
|
1974
|
+
* @returns {Record<string, number | KeyframeAnimationOptions>}
|
|
1479
1975
|
*/
|
|
1480
|
-
static
|
|
1976
|
+
static get styleFxSpeeds(): Record<string, number | KeyframeAnimationOptions>;
|
|
1481
1977
|
/**
|
|
1482
1978
|
* Replace the predefined animation speeds.
|
|
1483
1979
|
* @param {Record<string, number | KeyframeAnimationOptions>} speeds
|
|
1484
1980
|
* @throws {TypeError} If input is not a valid object of speed definitions.
|
|
1485
1981
|
*/
|
|
1486
1982
|
static set styleFxSpeeds(speeds: Record<string, number | KeyframeAnimationOptions>);
|
|
1487
|
-
/**
|
|
1488
|
-
* Get a cloned copy of predefined animation speeds.
|
|
1489
|
-
* @returns {Record<string, number | KeyframeAnimationOptions>}
|
|
1490
|
-
*/
|
|
1491
|
-
static get styleFxSpeeds(): Record<string, number | KeyframeAnimationOptions>;
|
|
1492
1983
|
/**
|
|
1493
1984
|
* Get a predefined animation speed by name.
|
|
1494
1985
|
*
|
|
@@ -1519,27 +2010,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1519
2010
|
*/
|
|
1520
2011
|
static hasStyleFxSpeed(name: string): boolean;
|
|
1521
2012
|
/**
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
|
|
1525
|
-
static #cssExpand: string[];
|
|
1526
|
-
/**
|
|
1527
|
-
* Generate shortcuts
|
|
1528
|
-
* @type {Record<string, StyleEffects>}
|
|
2013
|
+
* Returns a deep-cloned copy of the registered style effects.
|
|
2014
|
+
*
|
|
2015
|
+
* @returns {Record<string, StyleEffects>}
|
|
1529
2016
|
*/
|
|
1530
|
-
static
|
|
2017
|
+
static get styleEffects(): Record<string, StyleEffects>;
|
|
1531
2018
|
/**
|
|
1532
2019
|
* Replace the entire styleEffects map with a new one.
|
|
1533
2020
|
*
|
|
1534
2021
|
* @param {Record<string, StyleEffects>} value
|
|
1535
2022
|
*/
|
|
1536
2023
|
static set styleEffects(value: Record<string, StyleEffects>);
|
|
1537
|
-
/**
|
|
1538
|
-
* Returns a deep-cloned copy of the registered style effects.
|
|
1539
|
-
*
|
|
1540
|
-
* @returns {Record<string, StyleEffects>}
|
|
1541
|
-
*/
|
|
1542
|
-
static get styleEffects(): Record<string, StyleEffects>;
|
|
1543
2024
|
/**
|
|
1544
2025
|
* Get a deep-cloned style effect by name.
|
|
1545
2026
|
* @param {string} name
|
|
@@ -1565,21 +2046,16 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1565
2046
|
*/
|
|
1566
2047
|
static hasStyleEffect(name: string): boolean;
|
|
1567
2048
|
/**
|
|
1568
|
-
*
|
|
1569
|
-
* @
|
|
2049
|
+
* Get a cloned copy of style inverse values.
|
|
2050
|
+
* @returns {Record<string, string>}
|
|
1570
2051
|
*/
|
|
1571
|
-
static
|
|
2052
|
+
static get styleEffectInverse(): Record<string, string>;
|
|
1572
2053
|
/**
|
|
1573
2054
|
* Replace the style inverse values.
|
|
1574
2055
|
* @param {Record<string, string>} values
|
|
1575
2056
|
* @throws {TypeError} If not a valid object with functions as values.
|
|
1576
2057
|
*/
|
|
1577
2058
|
static set styleEffectInverse(values: Record<string, string>);
|
|
1578
|
-
/**
|
|
1579
|
-
* Get a cloned copy of style inverse values.
|
|
1580
|
-
* @returns {Record<string, string>}
|
|
1581
|
-
*/
|
|
1582
|
-
static get styleEffectInverse(): Record<string, string>;
|
|
1583
2059
|
/**
|
|
1584
2060
|
* Get a registered inverse values.
|
|
1585
2061
|
*
|
|
@@ -1610,21 +2086,16 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1610
2086
|
*/
|
|
1611
2087
|
static hasStyleEffectInverse(name: string): boolean;
|
|
1612
2088
|
/**
|
|
1613
|
-
*
|
|
1614
|
-
* @
|
|
2089
|
+
* Get a cloned copy of style effects repeat detectors.
|
|
2090
|
+
* @returns {Record<string, StyleEffectsRdFn>}
|
|
1615
2091
|
*/
|
|
1616
|
-
static
|
|
2092
|
+
static get styleEffectsRd(): Record<string, StyleEffectsRdFn>;
|
|
1617
2093
|
/**
|
|
1618
2094
|
* Replace the style effects repeat detectors.
|
|
1619
2095
|
* @param {Record<string, StyleEffectsRdFn>} detectors
|
|
1620
2096
|
* @throws {TypeError} If not a valid object with functions as values.
|
|
1621
2097
|
*/
|
|
1622
2098
|
static set styleEffectsRd(detectors: Record<string, StyleEffectsRdFn>);
|
|
1623
|
-
/**
|
|
1624
|
-
* Get a cloned copy of style effects repeat detectors.
|
|
1625
|
-
* @returns {Record<string, StyleEffectsRdFn>}
|
|
1626
|
-
*/
|
|
1627
|
-
static get styleEffectsRd(): Record<string, StyleEffectsRdFn>;
|
|
1628
2099
|
/**
|
|
1629
2100
|
* Get a registered repeat detector function by name.
|
|
1630
2101
|
*
|
|
@@ -1655,24 +2126,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1655
2126
|
*/
|
|
1656
2127
|
static hasStyleEffectRd(name: string): boolean;
|
|
1657
2128
|
/**
|
|
1658
|
-
*
|
|
1659
|
-
* Each function builds keyframes depending on the property being animated.
|
|
2129
|
+
* Returns a shallow-cloned copy of the property effect handlers.
|
|
1660
2130
|
*
|
|
1661
|
-
* @
|
|
2131
|
+
* @returns {StyleEffectsProps}
|
|
1662
2132
|
*/
|
|
1663
|
-
static
|
|
2133
|
+
static get styleEffectsProps(): StyleEffectsProps;
|
|
1664
2134
|
/**
|
|
1665
2135
|
* Replace the entire styleEffectsProps map with a new one.
|
|
1666
2136
|
*
|
|
1667
2137
|
* @param {StyleEffectsProps} value
|
|
1668
2138
|
*/
|
|
1669
2139
|
static set styleEffectsProps(value: StyleEffectsProps);
|
|
1670
|
-
/**
|
|
1671
|
-
* Returns a shallow-cloned copy of the property effect handlers.
|
|
1672
|
-
*
|
|
1673
|
-
* @returns {StyleEffectsProps}
|
|
1674
|
-
*/
|
|
1675
|
-
static get styleEffectsProps(): StyleEffectsProps;
|
|
1676
2140
|
/**
|
|
1677
2141
|
* Get a style effect property handler by name.
|
|
1678
2142
|
*
|
|
@@ -1722,6 +2186,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1722
2186
|
* @returns {StyleFxResult}
|
|
1723
2187
|
*/
|
|
1724
2188
|
static applyStyleFx(el: TinyHtmlElement | TinyHtmlElement[], id: string, props: StyleEffects, ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2189
|
+
/**
|
|
2190
|
+
* Applies style-based effects (slide, fade) to one or more elements.
|
|
2191
|
+
* Converts abstract effect definitions (e.g., `{ height: "show" }`)
|
|
2192
|
+
* into concrete Web Animations API keyframes.
|
|
2193
|
+
*
|
|
2194
|
+
* @param {string} id - The style effect id.
|
|
2195
|
+
* @param {StyleEffects} props - The style effect definition.
|
|
2196
|
+
* @param {number | KeyframeAnimationOptions} [ops] - Timing options.
|
|
2197
|
+
* @returns {StyleFxResult}
|
|
2198
|
+
*/
|
|
2199
|
+
applyStyleFx(id: string, props: StyleEffects, ops?: number | KeyframeAnimationOptions): StyleFxResult;
|
|
1725
2200
|
/**
|
|
1726
2201
|
* Get the current animation entry for a given element.
|
|
1727
2202
|
* @param {HTMLElement} el - The target element.
|
|
@@ -1742,6 +2217,19 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1742
2217
|
* @returns {Animation[]}
|
|
1743
2218
|
*/
|
|
1744
2219
|
static animate(el: TinyHtmlElement | TinyHtmlElement[], keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions | string, id?: string | null, cancelOldAnim?: boolean): Animation[];
|
|
2220
|
+
/**
|
|
2221
|
+
* Applies an animation to one or multiple TinyElement instances.
|
|
2222
|
+
*
|
|
2223
|
+
* If `cancelOldAnim` is true, any currently running animation on the same element
|
|
2224
|
+
* will be cancelled before the new one starts.
|
|
2225
|
+
*
|
|
2226
|
+
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - Keyframes that define the animation.
|
|
2227
|
+
* @param {number | KeyframeAnimationOptions | string} [ops] - Timing or configuration options for the animation.
|
|
2228
|
+
* @param {string|null} [id] - The style effect id.
|
|
2229
|
+
* @param {boolean} [cancelOldAnim=TinyHtml.cancelOldStyleFx] - Whether to cancel previous animations on the same element.
|
|
2230
|
+
* @returns {Animation[]}
|
|
2231
|
+
*/
|
|
2232
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions | string, id?: string | null, cancelOldAnim?: boolean): Animation[];
|
|
1745
2233
|
/**
|
|
1746
2234
|
* Stops the current animation(s) on one or multiple TinyElement instances.
|
|
1747
2235
|
*
|
|
@@ -1751,6 +2239,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1751
2239
|
* @returns {boolean[]} The same element(s) provided as input, for chaining.
|
|
1752
2240
|
*/
|
|
1753
2241
|
static stop(el: TinyHtmlElement | TinyHtmlElement[]): boolean[];
|
|
2242
|
+
/**
|
|
2243
|
+
* Stops the current animation(s) on this TinyElement instance.
|
|
2244
|
+
*
|
|
2245
|
+
* @returns {boolean[]}
|
|
2246
|
+
*/
|
|
2247
|
+
stop(): boolean[];
|
|
1754
2248
|
/**
|
|
1755
2249
|
* Show animation (slideDown).
|
|
1756
2250
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1758,6 +2252,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1758
2252
|
* @returns {StyleFxResult}
|
|
1759
2253
|
*/
|
|
1760
2254
|
static slideDown(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2255
|
+
/**
|
|
2256
|
+
* Show animation (slideDown).
|
|
2257
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2258
|
+
* @returns {StyleFxResult}
|
|
2259
|
+
*/
|
|
2260
|
+
slideDown(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1761
2261
|
/**
|
|
1762
2262
|
* Hide animation (slideUp).
|
|
1763
2263
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1765,6 +2265,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1765
2265
|
* @returns {StyleFxResult}
|
|
1766
2266
|
*/
|
|
1767
2267
|
static slideUp(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2268
|
+
/**
|
|
2269
|
+
* Hide animation (slideUp).
|
|
2270
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2271
|
+
* @returns {StyleFxResult}
|
|
2272
|
+
*/
|
|
2273
|
+
slideUp(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1768
2274
|
/**
|
|
1769
2275
|
* Toggle slide animation.
|
|
1770
2276
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1772,6 +2278,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1772
2278
|
* @returns {StyleFxResult}
|
|
1773
2279
|
*/
|
|
1774
2280
|
static slideToggle(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2281
|
+
/**
|
|
2282
|
+
* Toggle slide animation.
|
|
2283
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2284
|
+
* @returns {StyleFxResult}
|
|
2285
|
+
*/
|
|
2286
|
+
slideToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1775
2287
|
/**
|
|
1776
2288
|
* Fade in animation.
|
|
1777
2289
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1779,6 +2291,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1779
2291
|
* @returns {StyleFxResult}
|
|
1780
2292
|
*/
|
|
1781
2293
|
static fadeIn(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2294
|
+
/**
|
|
2295
|
+
* Fade in animation.
|
|
2296
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2297
|
+
* @returns {StyleFxResult}
|
|
2298
|
+
*/
|
|
2299
|
+
fadeIn(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1782
2300
|
/**
|
|
1783
2301
|
* Fade out animation.
|
|
1784
2302
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1786,6 +2304,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1786
2304
|
* @returns {StyleFxResult}
|
|
1787
2305
|
*/
|
|
1788
2306
|
static fadeOut(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2307
|
+
/**
|
|
2308
|
+
* Fade out animation.
|
|
2309
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2310
|
+
* @returns {StyleFxResult}
|
|
2311
|
+
*/
|
|
2312
|
+
fadeOut(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1789
2313
|
/**
|
|
1790
2314
|
* Fade toggle animation.
|
|
1791
2315
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el
|
|
@@ -1793,6 +2317,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1793
2317
|
* @returns {StyleFxResult}
|
|
1794
2318
|
*/
|
|
1795
2319
|
static fadeToggle(el: TinyHtmlElement | TinyHtmlElement[], ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
2320
|
+
/**
|
|
2321
|
+
* Fade toggle animation.
|
|
2322
|
+
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
2323
|
+
* @returns {StyleFxResult}
|
|
2324
|
+
*/
|
|
2325
|
+
fadeToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
1796
2326
|
/**
|
|
1797
2327
|
* Animate the opacity of elements to a target value.
|
|
1798
2328
|
* If the element is hidden (display:none), it will be made visible first
|
|
@@ -1807,6 +2337,19 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1807
2337
|
* @throws {TypeError} If ops is not number|string|object when provided.
|
|
1808
2338
|
*/
|
|
1809
2339
|
static fadeTo(el: TinyHtmlElement | TinyHtmlElement[], opacity: number, ops?: number | KeyframeAnimationOptions | string, mainDisplay?: string): StyleFxResult;
|
|
2340
|
+
/**
|
|
2341
|
+
* Animate the opacity of elements to a target value.
|
|
2342
|
+
* If the element is hidden (display:none), it will be made visible first
|
|
2343
|
+
* so the fade animation can occur.
|
|
2344
|
+
*
|
|
2345
|
+
* @param {number} opacity - Final opacity value (between 0 and 1).
|
|
2346
|
+
* @param {number | KeyframeAnimationOptions | string} [ops] - Duration or animation options.
|
|
2347
|
+
* @param {string} [mainDisplay=this.#mainDisplay] - Sets the main display value.
|
|
2348
|
+
* @returns {StyleFxResult}
|
|
2349
|
+
* @throws {TypeError} If opacity is not a number between 0 and 1.
|
|
2350
|
+
* @throws {TypeError} If ops is not number|string|object when provided.
|
|
2351
|
+
*/
|
|
2352
|
+
fadeTo(opacity: number, ops?: number | KeyframeAnimationOptions | string, mainDisplay?: string): StyleFxResult;
|
|
1810
2353
|
/**
|
|
1811
2354
|
* Gets the offset of the element relative to the document.
|
|
1812
2355
|
* @param {TinyElement} el - Target element.
|
|
@@ -1816,6 +2359,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1816
2359
|
top: number;
|
|
1817
2360
|
left: number;
|
|
1818
2361
|
};
|
|
2362
|
+
/**
|
|
2363
|
+
* Gets the offset of the element relative to the document.
|
|
2364
|
+
* @returns {{top: number, left: number}}
|
|
2365
|
+
*/
|
|
2366
|
+
offset(): {
|
|
2367
|
+
top: number;
|
|
2368
|
+
left: number;
|
|
2369
|
+
};
|
|
1819
2370
|
/**
|
|
1820
2371
|
* Gets the position of the element relative to its offset parent.
|
|
1821
2372
|
* @param {TinyHtmlElement} el - Target element.
|
|
@@ -1825,24 +2376,47 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1825
2376
|
top: number;
|
|
1826
2377
|
left: number;
|
|
1827
2378
|
};
|
|
2379
|
+
/**
|
|
2380
|
+
* Gets the position of the element relative to its offset parent.
|
|
2381
|
+
* @returns {{top: number, left: number}}
|
|
2382
|
+
*/
|
|
2383
|
+
position(): {
|
|
2384
|
+
top: number;
|
|
2385
|
+
left: number;
|
|
2386
|
+
};
|
|
1828
2387
|
/**
|
|
1829
2388
|
* Gets the closest positioned ancestor element.
|
|
1830
2389
|
* @param {TinyHtmlElement} el - Target element.
|
|
1831
2390
|
* @returns {HTMLElement} - Offset parent element.
|
|
1832
2391
|
*/
|
|
1833
2392
|
static offsetParent(el: TinyHtmlElement): HTMLElement;
|
|
2393
|
+
/**
|
|
2394
|
+
* Gets the closest positioned ancestor element.
|
|
2395
|
+
* @returns {HTMLElement} - Offset parent element.
|
|
2396
|
+
*/
|
|
2397
|
+
offsetParent(): HTMLElement;
|
|
1834
2398
|
/**
|
|
1835
2399
|
* Gets the vertical scroll position.
|
|
1836
2400
|
* @param {TinyElementAndWindow} el - Element or window.
|
|
1837
2401
|
* @returns {number}
|
|
1838
2402
|
*/
|
|
1839
2403
|
static scrollTop(el: TinyElementAndWindow): number;
|
|
2404
|
+
/**
|
|
2405
|
+
* Gets the vertical scroll position.
|
|
2406
|
+
* @returns {number}
|
|
2407
|
+
*/
|
|
2408
|
+
scrollTop(): number;
|
|
1840
2409
|
/**
|
|
1841
2410
|
* Gets the horizontal scroll position.
|
|
1842
2411
|
* @param {TinyElementAndWindow} el - Element or window.
|
|
1843
2412
|
* @returns {number}
|
|
1844
2413
|
*/
|
|
1845
2414
|
static scrollLeft(el: TinyElementAndWindow): number;
|
|
2415
|
+
/**
|
|
2416
|
+
* Gets the horizontal scroll position.
|
|
2417
|
+
* @returns {number}
|
|
2418
|
+
*/
|
|
2419
|
+
scrollLeft(): number;
|
|
1846
2420
|
/**
|
|
1847
2421
|
* Collection of easing functions used for scroll and animation calculations.
|
|
1848
2422
|
* Each function receives a normalized time value (`t` from 0 to 1) and returns the eased progress.
|
|
@@ -1873,12 +2447,34 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1873
2447
|
* @throws {TypeError} If `onAnimation` is defined but not a function.
|
|
1874
2448
|
*/
|
|
1875
2449
|
static scrollToXY<T extends TinyElementAndWindow | TinyElementAndWindow[]>(el: T, { targetX, targetY, duration, easing, onAnimation }?: {
|
|
1876
|
-
targetX?: number
|
|
1877
|
-
targetY?: number
|
|
1878
|
-
duration?: number
|
|
1879
|
-
easing?: Easings
|
|
1880
|
-
onAnimation?: OnScrollAnimation
|
|
2450
|
+
targetX?: number;
|
|
2451
|
+
targetY?: number;
|
|
2452
|
+
duration?: number;
|
|
2453
|
+
easing?: Easings;
|
|
2454
|
+
onAnimation?: OnScrollAnimation;
|
|
1881
2455
|
}): T;
|
|
2456
|
+
/**
|
|
2457
|
+
* Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
|
|
2458
|
+
* using a custom duration and easing function.
|
|
2459
|
+
*
|
|
2460
|
+
* If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
|
|
2461
|
+
*
|
|
2462
|
+
* @param {Object} [settings={}] - Configuration object for the scroll animation.
|
|
2463
|
+
* @param {number} [settings.targetX] - The horizontal scroll target in pixels.
|
|
2464
|
+
* @param {number} [settings.targetY] - The vertical scroll target in pixels.
|
|
2465
|
+
* @param {number} [settings.duration] - The duration of the animation in milliseconds.
|
|
2466
|
+
* @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
|
|
2467
|
+
* @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
|
|
2468
|
+
* frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
|
|
2469
|
+
* @returns {this}
|
|
2470
|
+
*/
|
|
2471
|
+
scrollToXY({ targetX, targetY, duration, easing, onAnimation }?: {
|
|
2472
|
+
targetX?: number;
|
|
2473
|
+
targetY?: number;
|
|
2474
|
+
duration?: number;
|
|
2475
|
+
easing?: Easings;
|
|
2476
|
+
onAnimation?: OnScrollAnimation;
|
|
2477
|
+
}): this;
|
|
1882
2478
|
/**
|
|
1883
2479
|
* Sets the vertical scroll position.
|
|
1884
2480
|
* @template {TinyElementAndWindow|TinyElementAndWindow[]} T
|
|
@@ -1887,6 +2483,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1887
2483
|
* @returns {T}
|
|
1888
2484
|
*/
|
|
1889
2485
|
static setScrollTop<T extends TinyElementAndWindow | TinyElementAndWindow[]>(el: T, value: number): T;
|
|
2486
|
+
/**
|
|
2487
|
+
* Sets the vertical scroll position.
|
|
2488
|
+
* @param {number} value - Scroll top value.
|
|
2489
|
+
* @returns {this}
|
|
2490
|
+
*/
|
|
2491
|
+
setScrollTop(value: number): this;
|
|
1890
2492
|
/**
|
|
1891
2493
|
* Sets the horizontal scroll position.
|
|
1892
2494
|
* @template {TinyElementAndWindow|TinyElementAndWindow[]} T
|
|
@@ -1895,6 +2497,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1895
2497
|
* @returns {T}
|
|
1896
2498
|
*/
|
|
1897
2499
|
static setScrollLeft<T extends TinyElementAndWindow | TinyElementAndWindow[]>(el: T, value: number): T;
|
|
2500
|
+
/**
|
|
2501
|
+
* Sets the horizontal scroll position.
|
|
2502
|
+
* @param {number} value - Scroll left value.
|
|
2503
|
+
* @returns {this}
|
|
2504
|
+
*/
|
|
2505
|
+
setScrollLeft(value: number): this;
|
|
1898
2506
|
/**
|
|
1899
2507
|
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
1900
2508
|
*
|
|
@@ -1902,6 +2510,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1902
2510
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
|
|
1903
2511
|
*/
|
|
1904
2512
|
static borderWidth(el: TinyElement): HtmlElBoxSides;
|
|
2513
|
+
/**
|
|
2514
|
+
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
2515
|
+
*
|
|
2516
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
|
|
2517
|
+
*/
|
|
2518
|
+
borderWidth(): HtmlElBoxSides;
|
|
1905
2519
|
/**
|
|
1906
2520
|
* Returns the total border size and individual sides from `border{Side}` CSS properties.
|
|
1907
2521
|
*
|
|
@@ -1909,6 +2523,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1909
2523
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
|
|
1910
2524
|
*/
|
|
1911
2525
|
static border(el: TinyElement): HtmlElBoxSides;
|
|
2526
|
+
/**
|
|
2527
|
+
* Returns the total border size and individual sides from `border{Side}` CSS properties.
|
|
2528
|
+
*
|
|
2529
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
|
|
2530
|
+
*/
|
|
2531
|
+
border(): HtmlElBoxSides;
|
|
1912
2532
|
/**
|
|
1913
2533
|
* Returns the total margin and individual sides from `margin{Side}` CSS properties.
|
|
1914
2534
|
*
|
|
@@ -1916,6 +2536,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1916
2536
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
|
|
1917
2537
|
*/
|
|
1918
2538
|
static margin(el: TinyElement): HtmlElBoxSides;
|
|
2539
|
+
/**
|
|
2540
|
+
* Returns the total margin and individual sides from `margin{Side}` CSS properties.
|
|
2541
|
+
*
|
|
2542
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
|
|
2543
|
+
*/
|
|
2544
|
+
margin(): HtmlElBoxSides;
|
|
1919
2545
|
/**
|
|
1920
2546
|
* Returns the total padding and individual sides from `padding{Side}` CSS properties.
|
|
1921
2547
|
*
|
|
@@ -1923,18 +2549,22 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1923
2549
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
1924
2550
|
*/
|
|
1925
2551
|
static padding(el: TinyElement): HtmlElBoxSides;
|
|
1926
|
-
/** @type {boolean} */
|
|
1927
|
-
static #classCanWhitespace: boolean;
|
|
1928
2552
|
/**
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
2553
|
+
* Returns the total padding and individual sides from `padding{Side}` CSS properties.
|
|
2554
|
+
*
|
|
2555
|
+
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
1931
2556
|
*/
|
|
1932
|
-
|
|
2557
|
+
padding(): HtmlElBoxSides;
|
|
1933
2558
|
/**
|
|
1934
2559
|
* Gets the value of classCanWhitespace.
|
|
1935
2560
|
* @returns {boolean}
|
|
1936
2561
|
*/
|
|
1937
2562
|
static get classCanWhitespace(): boolean;
|
|
2563
|
+
/**
|
|
2564
|
+
* Sets the value of classCanWhitespace.
|
|
2565
|
+
* @param {boolean} value
|
|
2566
|
+
*/
|
|
2567
|
+
static set classCanWhitespace(value: boolean);
|
|
1938
2568
|
/**
|
|
1939
2569
|
* Adds one or more CSS class names to the element.
|
|
1940
2570
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -1943,6 +2573,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1943
2573
|
* @returns {T}
|
|
1944
2574
|
*/
|
|
1945
2575
|
static addClass<T extends TinyElement | TinyElement[]>(el: T, ...args: string[]): T;
|
|
2576
|
+
/**
|
|
2577
|
+
* Adds one or more CSS class names to the element.
|
|
2578
|
+
* @param {...string} args - One or more class names to add.
|
|
2579
|
+
* @returns {this}
|
|
2580
|
+
*/
|
|
2581
|
+
addClass(...args: string[]): this;
|
|
1946
2582
|
/**
|
|
1947
2583
|
* Removes one or more CSS class names from the element.
|
|
1948
2584
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -1951,6 +2587,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1951
2587
|
* @returns {T}
|
|
1952
2588
|
*/
|
|
1953
2589
|
static removeClass<T extends TinyElement | TinyElement[]>(el: T, ...args: string[]): T;
|
|
2590
|
+
/**
|
|
2591
|
+
* Removes one or more CSS class names from the element.
|
|
2592
|
+
* @param {...string} args - One or more class names to remove.
|
|
2593
|
+
* @returns {this}
|
|
2594
|
+
*/
|
|
2595
|
+
removeClass(...args: string[]): this;
|
|
1954
2596
|
/**
|
|
1955
2597
|
* Replaces an existing class name with a new one.
|
|
1956
2598
|
* @param {TinyElement|TinyElement[]} el - Target element.
|
|
@@ -1960,6 +2602,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1960
2602
|
* @throws {TypeError} If either argument is not a string.
|
|
1961
2603
|
*/
|
|
1962
2604
|
static replaceClass(el: TinyElement | TinyElement[], token: string, newToken: string): boolean[];
|
|
2605
|
+
/**
|
|
2606
|
+
* Replaces an existing class name with a new one.
|
|
2607
|
+
* @param {string} token - The class name to be replaced.
|
|
2608
|
+
* @param {string} newToken - The new class name to apply.
|
|
2609
|
+
* @returns {boolean} Whether the replacement was successful.
|
|
2610
|
+
* @throws {TypeError} If either argument is not a string.
|
|
2611
|
+
*/
|
|
2612
|
+
replaceClass(token: string, newToken: string): boolean;
|
|
1963
2613
|
/**
|
|
1964
2614
|
* Returns the class name at the specified index.
|
|
1965
2615
|
* @param {TinyElement} el - Target element.
|
|
@@ -1968,6 +2618,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1968
2618
|
* @throws {TypeError} If the index is not a number.
|
|
1969
2619
|
*/
|
|
1970
2620
|
static classItem(el: TinyElement, index: number): string | null;
|
|
2621
|
+
/**
|
|
2622
|
+
* Returns the class name at the specified index.
|
|
2623
|
+
* @param {number} index - The index of the class name.
|
|
2624
|
+
* @returns {string|null} The class name at the index or null if not found.
|
|
2625
|
+
* @throws {TypeError} If the index is not a number.
|
|
2626
|
+
*/
|
|
2627
|
+
classItem(index: number): string | null;
|
|
1971
2628
|
/**
|
|
1972
2629
|
* Toggles a class name on the element with an optional force boolean.
|
|
1973
2630
|
* @param {TinyElement|TinyElement[]} el - Target element.
|
|
@@ -1977,6 +2634,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1977
2634
|
* @throws {TypeError} If token is not a string or force is not a boolean.
|
|
1978
2635
|
*/
|
|
1979
2636
|
static toggleClass(el: TinyElement | TinyElement[], token: string, force?: boolean): boolean[];
|
|
2637
|
+
/**
|
|
2638
|
+
* Toggles a class name on the element with an optional force boolean.
|
|
2639
|
+
* @param {string} token - The class name to toggle.
|
|
2640
|
+
* @param {boolean} force - If true, adds the class; if false, removes it.
|
|
2641
|
+
* @returns {boolean} Whether the class is present after the toggle.
|
|
2642
|
+
* @throws {TypeError} If token is not a string or force is not a boolean.
|
|
2643
|
+
*/
|
|
2644
|
+
toggleClass(token: string, force: boolean): boolean;
|
|
1980
2645
|
/**
|
|
1981
2646
|
* Checks if the element contains the given class name.
|
|
1982
2647
|
* @param {TinyElement} el - Target element.
|
|
@@ -1985,36 +2650,73 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
1985
2650
|
* @throws {TypeError} If token is not a string.
|
|
1986
2651
|
*/
|
|
1987
2652
|
static hasClass(el: TinyElement, token: string): boolean;
|
|
2653
|
+
/**
|
|
2654
|
+
* Checks if the element contains the given class name.
|
|
2655
|
+
* @param {string} token - The class name to check.
|
|
2656
|
+
* @returns {boolean} True if the class is present, false otherwise.
|
|
2657
|
+
* @throws {TypeError} If token is not a string.
|
|
2658
|
+
*/
|
|
2659
|
+
hasClass(token: string): boolean;
|
|
1988
2660
|
/**
|
|
1989
2661
|
* Returns the number of classes applied to the element.
|
|
1990
2662
|
* @param {TinyElement} el - Target element.
|
|
1991
2663
|
* @returns {number} The number of classes.
|
|
1992
2664
|
*/
|
|
1993
2665
|
static classLength(el: TinyElement): number;
|
|
2666
|
+
/**
|
|
2667
|
+
* Returns the number of classes applied to the element.
|
|
2668
|
+
* @returns {number} The number of classes.
|
|
2669
|
+
*/
|
|
2670
|
+
classLength(): number;
|
|
1994
2671
|
/**
|
|
1995
2672
|
* Returns all class names as an array of strings.
|
|
1996
2673
|
* @param {TinyElement} el - Target element.
|
|
1997
2674
|
* @returns {string[]} An array of class names.
|
|
1998
2675
|
*/
|
|
1999
2676
|
static classList(el: TinyElement): string[];
|
|
2677
|
+
/**
|
|
2678
|
+
* Returns all class names as an array of strings.
|
|
2679
|
+
* @returns {string[]} An array of class names.
|
|
2680
|
+
*/
|
|
2681
|
+
classList(): string[];
|
|
2000
2682
|
/**
|
|
2001
2683
|
* Returns the tag name of the element.
|
|
2002
2684
|
* @param {TinyElement} el - Target element.
|
|
2003
2685
|
* @returns {string} The tag name in uppercase.
|
|
2004
2686
|
*/
|
|
2005
2687
|
static tagName(el: TinyElement): string;
|
|
2688
|
+
/**
|
|
2689
|
+
* Returns the tag name of the element.
|
|
2690
|
+
* @returns {string} The tag name in uppercase.
|
|
2691
|
+
*/
|
|
2692
|
+
tagName(): string;
|
|
2006
2693
|
/**
|
|
2007
2694
|
* Returns the ID of the element.
|
|
2008
2695
|
* @param {TinyElement} el - Target element.
|
|
2009
2696
|
* @returns {string} The element's ID.
|
|
2010
2697
|
*/
|
|
2011
2698
|
static id(el: TinyElement): string;
|
|
2699
|
+
/**
|
|
2700
|
+
* Returns the ID of the element.
|
|
2701
|
+
* @returns {string} The element's ID.
|
|
2702
|
+
*/
|
|
2703
|
+
get id(): string;
|
|
2704
|
+
/**
|
|
2705
|
+
* Set the id on an element.
|
|
2706
|
+
* @param {string} value - Id name.
|
|
2707
|
+
*/
|
|
2708
|
+
set id(value: string);
|
|
2012
2709
|
/**
|
|
2013
2710
|
* Returns the BigInt content of the element.
|
|
2014
2711
|
* @param {TinyElement} el - Target element.
|
|
2015
2712
|
* @returns {bigint|null} The BigInt content or null if none.
|
|
2016
2713
|
*/
|
|
2017
2714
|
static toBigInt(el: TinyElement): bigint | null;
|
|
2715
|
+
/**
|
|
2716
|
+
* Returns the BigInt content of the element.
|
|
2717
|
+
* @returns {bigint|null}
|
|
2718
|
+
*/
|
|
2719
|
+
toBigInt(): bigint | null;
|
|
2018
2720
|
/**
|
|
2019
2721
|
* Set BigInt content of elements.
|
|
2020
2722
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2023,12 +2725,23 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2023
2725
|
* @returns {T}
|
|
2024
2726
|
*/
|
|
2025
2727
|
static setBigInt<T extends TinyElement | TinyElement[]>(el: T, value: bigint): T;
|
|
2728
|
+
/**
|
|
2729
|
+
* Set BigInt content of the element.
|
|
2730
|
+
* @param {bigint} value
|
|
2731
|
+
* @returns {this}
|
|
2732
|
+
*/
|
|
2733
|
+
setBigInt(value: bigint): this;
|
|
2026
2734
|
/**
|
|
2027
2735
|
* Returns the Date content of the element.
|
|
2028
2736
|
* @param {TinyElement} el - Target element.
|
|
2029
2737
|
* @returns {Date|null} The Date content or null if invalid.
|
|
2030
2738
|
*/
|
|
2031
2739
|
static toDate(el: TinyElement): Date | null;
|
|
2740
|
+
/**
|
|
2741
|
+
* Returns the Date content of the element.
|
|
2742
|
+
* @returns {Date|null}
|
|
2743
|
+
*/
|
|
2744
|
+
toDate(): Date | null;
|
|
2032
2745
|
/**
|
|
2033
2746
|
* Set Date content of elements.
|
|
2034
2747
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2037,12 +2750,23 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2037
2750
|
* @returns {T}
|
|
2038
2751
|
*/
|
|
2039
2752
|
static setDate<T extends TinyElement | TinyElement[]>(el: T, value: Date): T;
|
|
2753
|
+
/**
|
|
2754
|
+
* Set Date content of the element.
|
|
2755
|
+
* @param {Date} value
|
|
2756
|
+
* @returns {this}
|
|
2757
|
+
*/
|
|
2758
|
+
setDate(value: Date): this;
|
|
2040
2759
|
/**
|
|
2041
2760
|
* Returns the JSON content of the element.
|
|
2042
2761
|
* @param {TinyElement} el - Target element.
|
|
2043
2762
|
* @returns {any|null} The parsed JSON content or null if invalid.
|
|
2044
2763
|
*/
|
|
2045
2764
|
static toJson(el: TinyElement): any | null;
|
|
2765
|
+
/**
|
|
2766
|
+
* Returns the JSON content of the element.
|
|
2767
|
+
* @returns {any|null}
|
|
2768
|
+
*/
|
|
2769
|
+
toJson(): any | null;
|
|
2046
2770
|
/**
|
|
2047
2771
|
* Set JSON content of elements.
|
|
2048
2772
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2053,12 +2777,25 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2053
2777
|
* @returns {T}
|
|
2054
2778
|
*/
|
|
2055
2779
|
static setJson<T extends TinyElement | TinyElement[]>(el: T, value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): T;
|
|
2780
|
+
/**
|
|
2781
|
+
* Set JSON content of the element.
|
|
2782
|
+
* @param {any} value - A JavaScript value, usually an object or array, to be converted.
|
|
2783
|
+
* @param {(this: any, key: string, value: any) => any} [replacer] - A function that transforms the results.
|
|
2784
|
+
* @param {number|string} [space] - Indentation level or string for formatting.
|
|
2785
|
+
* @returns {this}
|
|
2786
|
+
*/
|
|
2787
|
+
setJson(value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): this;
|
|
2056
2788
|
/**
|
|
2057
2789
|
* Returns the number content of the element.
|
|
2058
2790
|
* @param {TinyElement} el - Target element.
|
|
2059
2791
|
* @returns {number|null} The text content or null if none.
|
|
2060
2792
|
*/
|
|
2061
2793
|
static toNumber(el: TinyElement): number | null;
|
|
2794
|
+
/**
|
|
2795
|
+
* Returns the number content of the element.
|
|
2796
|
+
* @returns {number|null} The text content or null if none.
|
|
2797
|
+
*/
|
|
2798
|
+
toNumber(): number | null;
|
|
2062
2799
|
/**
|
|
2063
2800
|
* Set number content of elements.
|
|
2064
2801
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2067,12 +2804,23 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2067
2804
|
* @returns {T}
|
|
2068
2805
|
*/
|
|
2069
2806
|
static setNumber<T extends TinyElement | TinyElement[]>(el: T, value: number): T;
|
|
2807
|
+
/**
|
|
2808
|
+
* Set number content of the element.
|
|
2809
|
+
* @param {number} value
|
|
2810
|
+
* @returns {this}
|
|
2811
|
+
*/
|
|
2812
|
+
setNumber(value: number): this;
|
|
2070
2813
|
/**
|
|
2071
2814
|
* Returns the boolean content of the element.
|
|
2072
2815
|
* @param {TinyElement} el - Target element.
|
|
2073
2816
|
* @returns {boolean|null} The boolean value or null if empty.
|
|
2074
2817
|
*/
|
|
2075
2818
|
static toBoolean(el: TinyElement): boolean | null;
|
|
2819
|
+
/**
|
|
2820
|
+
* Returns the boolean content of the element.
|
|
2821
|
+
* @returns {boolean|null}
|
|
2822
|
+
*/
|
|
2823
|
+
toBoolean(): boolean | null;
|
|
2076
2824
|
/**
|
|
2077
2825
|
* Set boolean content of elements.
|
|
2078
2826
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2081,12 +2829,23 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2081
2829
|
* @returns {T}
|
|
2082
2830
|
*/
|
|
2083
2831
|
static setBoolean<T extends TinyElement | TinyElement[]>(el: T, value: boolean): T;
|
|
2832
|
+
/**
|
|
2833
|
+
* Set boolean content of the element.
|
|
2834
|
+
* @param {boolean} value
|
|
2835
|
+
* @returns {this}
|
|
2836
|
+
*/
|
|
2837
|
+
setBoolean(value: boolean): this;
|
|
2084
2838
|
/**
|
|
2085
2839
|
* Returns the string content of the element.
|
|
2086
2840
|
* @param {TinyElement} el - Target element.
|
|
2087
2841
|
* @returns {string|null} The string content or null if none.
|
|
2088
2842
|
*/
|
|
2089
2843
|
static toString(el: TinyElement): string | null;
|
|
2844
|
+
/**
|
|
2845
|
+
* Returns the string content of the element.
|
|
2846
|
+
* @returns {string|null} The string content or null if none.
|
|
2847
|
+
*/
|
|
2848
|
+
toString(): string | null;
|
|
2090
2849
|
/**
|
|
2091
2850
|
* Set string content of elements.
|
|
2092
2851
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2095,12 +2854,23 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2095
2854
|
* @returns {T}
|
|
2096
2855
|
*/
|
|
2097
2856
|
static setString<T extends TinyElement | TinyElement[]>(el: T, value: string): T;
|
|
2857
|
+
/**
|
|
2858
|
+
* Set string content of the element.
|
|
2859
|
+
* @param {string} value
|
|
2860
|
+
* @returns {this}
|
|
2861
|
+
*/
|
|
2862
|
+
setString(value: string): this;
|
|
2098
2863
|
/**
|
|
2099
2864
|
* Returns the text content of the element.
|
|
2100
2865
|
* @param {TinyElement} el - Target element.
|
|
2101
2866
|
* @returns {string|null} The text content or null if none.
|
|
2102
2867
|
*/
|
|
2103
2868
|
static text(el: TinyElement): string | null;
|
|
2869
|
+
/**
|
|
2870
|
+
* Returns the text content of the element.
|
|
2871
|
+
* @returns {string|null} The text content or null if none.
|
|
2872
|
+
*/
|
|
2873
|
+
text(): string | null;
|
|
2104
2874
|
/**
|
|
2105
2875
|
* Set text content of elements.
|
|
2106
2876
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2109,6 +2879,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2109
2879
|
* @returns {T}
|
|
2110
2880
|
*/
|
|
2111
2881
|
static setText<T extends TinyElement | TinyElement[]>(el: T, value: any): T;
|
|
2882
|
+
/**
|
|
2883
|
+
* Set text content of the element.
|
|
2884
|
+
* @param {*} value
|
|
2885
|
+
* @returns {this}
|
|
2886
|
+
*/
|
|
2887
|
+
setText(value: any): this;
|
|
2112
2888
|
/**
|
|
2113
2889
|
* Remove all child nodes from each element.
|
|
2114
2890
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2116,6 +2892,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2116
2892
|
* @returns {T}
|
|
2117
2893
|
*/
|
|
2118
2894
|
static empty<T extends TinyElement | TinyElement[]>(el: T): T;
|
|
2895
|
+
/**
|
|
2896
|
+
* Remove all child nodes of the element.
|
|
2897
|
+
* @returns {this}
|
|
2898
|
+
*/
|
|
2899
|
+
empty(): this;
|
|
2119
2900
|
/**
|
|
2120
2901
|
* Get the innerHTML of the element.
|
|
2121
2902
|
* @param {TinyElement} el
|
|
@@ -2123,6 +2904,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2123
2904
|
* @returns {string}
|
|
2124
2905
|
*/
|
|
2125
2906
|
static html(el: TinyElement, ops?: GetHTMLOptions): string;
|
|
2907
|
+
/**
|
|
2908
|
+
* Get the innerHTML of the element.
|
|
2909
|
+
* @param {GetHTMLOptions} [ops]
|
|
2910
|
+
* @returns {string}
|
|
2911
|
+
*/
|
|
2912
|
+
html(ops?: GetHTMLOptions): string;
|
|
2126
2913
|
/**
|
|
2127
2914
|
* Set the innerHTML of each element.
|
|
2128
2915
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2131,6 +2918,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2131
2918
|
* @returns {T}
|
|
2132
2919
|
*/
|
|
2133
2920
|
static setHtml<T extends TinyElement | TinyElement[]>(el: T, value: string): T;
|
|
2921
|
+
/**
|
|
2922
|
+
* Set the innerHTML of the element.
|
|
2923
|
+
* @param {string} value
|
|
2924
|
+
* @returns {this}
|
|
2925
|
+
*/
|
|
2926
|
+
setHtml(value: string): this;
|
|
2134
2927
|
static _valHooks: {
|
|
2135
2928
|
option: {
|
|
2136
2929
|
/**
|
|
@@ -2187,6 +2980,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2187
2980
|
* @returns {T}
|
|
2188
2981
|
*/
|
|
2189
2982
|
static setVal<T extends TinyInputElement | TinyInputElement[]>(el: T, value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)): T;
|
|
2983
|
+
/**
|
|
2984
|
+
* Sets the value of the current HTML value element (input, select, textarea, etc.).
|
|
2985
|
+
* Accepts strings, numbers, booleans or arrays of these values, or a callback function that computes them.
|
|
2986
|
+
*
|
|
2987
|
+
* @param {SetValueList|((el: InputElement, val: SetValueList) => SetValueList)} value - The value to assign or a function that returns it.
|
|
2988
|
+
* @returns {this}
|
|
2989
|
+
* @throws {Error} If the computed value is not a valid string or boolean.
|
|
2990
|
+
*/
|
|
2991
|
+
setVal(value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)): this;
|
|
2190
2992
|
/**
|
|
2191
2993
|
* Maps value types to their corresponding getter functions.
|
|
2192
2994
|
* Each function extracts a value of a specific type from a compatible HTMLInputElement.
|
|
@@ -2236,6 +3038,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2236
3038
|
* @returns {any} The raw value retrieved from the element or hook.
|
|
2237
3039
|
*/
|
|
2238
3040
|
static _val(el: TinyInputElement, where: string, type: GetValueTypes): any;
|
|
3041
|
+
/**
|
|
3042
|
+
* Retrieves the raw value from the HTML input element.
|
|
3043
|
+
* If a custom value hook exists, it will be used first.
|
|
3044
|
+
*
|
|
3045
|
+
* @param {GetValueTypes} type - The type of value to retrieve ("string", "date", or "number").
|
|
3046
|
+
* @param {string} where - The context/method name using this validation.
|
|
3047
|
+
* @returns {any} The raw value retrieved from the element or hook.
|
|
3048
|
+
*/
|
|
3049
|
+
_val(where: string, type: GetValueTypes): any;
|
|
2239
3050
|
/**
|
|
2240
3051
|
* Gets the value of the current HTML value element.
|
|
2241
3052
|
*
|
|
@@ -2243,6 +3054,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2243
3054
|
* @returns {SetValueList} The normalized value, with carriage returns removed.
|
|
2244
3055
|
*/
|
|
2245
3056
|
static val(el: TinyInputElement): SetValueList;
|
|
3057
|
+
/**
|
|
3058
|
+
* Gets the value of the current HTML value element.
|
|
3059
|
+
*
|
|
3060
|
+
* @returns {SetValueList} The normalized value, with carriage returns removed.
|
|
3061
|
+
*/
|
|
3062
|
+
val(): SetValueList;
|
|
2246
3063
|
/**
|
|
2247
3064
|
* Gets the text of the current HTML value element (for text).
|
|
2248
3065
|
*
|
|
@@ -2251,6 +3068,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2251
3068
|
* @throws {Error} If the element is not a string value.
|
|
2252
3069
|
*/
|
|
2253
3070
|
static valTxt(el: TinyInputElement): string;
|
|
3071
|
+
/**
|
|
3072
|
+
* Gets the text of the current HTML value element (for text).
|
|
3073
|
+
*
|
|
3074
|
+
* @returns {string} The text value.
|
|
3075
|
+
* @throws {Error} If the element is not a string value.
|
|
3076
|
+
*/
|
|
3077
|
+
valTxt(): string;
|
|
2254
3078
|
/**
|
|
2255
3079
|
* Internal helper to get a value from an input expected to return an array.
|
|
2256
3080
|
*
|
|
@@ -2261,6 +3085,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2261
3085
|
* @throws {Error} If the returned value is not an array.
|
|
2262
3086
|
*/
|
|
2263
3087
|
static _valArr(el: TinyInputElement, where: string, type: GetValueTypes): SetValueBase[];
|
|
3088
|
+
/**
|
|
3089
|
+
* Internal helper to get a value from an input expected to return an array.
|
|
3090
|
+
*
|
|
3091
|
+
* @param {string} where - The method name or context using this validation (for error reporting).
|
|
3092
|
+
* @param {GetValueTypes} type - The type of value to retrieve ("string", "date", or "number").
|
|
3093
|
+
* @returns {SetValueBase[]} - The validated value as an array.
|
|
3094
|
+
* @throws {Error} If the returned value is not an array.
|
|
3095
|
+
*/
|
|
3096
|
+
_valArr(where: string, type: GetValueTypes): SetValueBase[];
|
|
2264
3097
|
/**
|
|
2265
3098
|
* Gets the raw value as a generic array of the current HTML value element (for select).
|
|
2266
3099
|
*
|
|
@@ -2269,6 +3102,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2269
3102
|
* @throws {Error} If the value is not a valid array.
|
|
2270
3103
|
*/
|
|
2271
3104
|
static valArr(el: TinyInputElement): SetValueBase[];
|
|
3105
|
+
/**
|
|
3106
|
+
* Gets the raw value as a generic array of the current HTML value element (for select).
|
|
3107
|
+
*
|
|
3108
|
+
* @returns {SetValueBase[]} - The value cast as a generic array.
|
|
3109
|
+
* @throws {Error} If the value is not a valid array.
|
|
3110
|
+
*/
|
|
3111
|
+
valArr(): SetValueBase[];
|
|
2272
3112
|
/**
|
|
2273
3113
|
* Gets the current value parsed as a number (for number/text).
|
|
2274
3114
|
*
|
|
@@ -2277,6 +3117,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2277
3117
|
* @throws {Error} If the element is not a number-compatible input or value is NaN.
|
|
2278
3118
|
*/
|
|
2279
3119
|
static valNb(el: TinyInputElement): number;
|
|
3120
|
+
/**
|
|
3121
|
+
* Gets the current value parsed as a number (for number/text).
|
|
3122
|
+
*
|
|
3123
|
+
* @returns {number} The numeric value.
|
|
3124
|
+
* @throws {Error} If the element is not a number-compatible input or value is NaN.
|
|
3125
|
+
*/
|
|
3126
|
+
valNb(): number;
|
|
2280
3127
|
/**
|
|
2281
3128
|
* Gets the current value parsed as a Date (for time/date).
|
|
2282
3129
|
*
|
|
@@ -2285,6 +3132,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2285
3132
|
* @throws {Error} If the element is not a date-compatible input.
|
|
2286
3133
|
*/
|
|
2287
3134
|
static valDate(el: TinyInputElement): Date;
|
|
3135
|
+
/**
|
|
3136
|
+
* Gets the current value parsed as a Date (for time/date).
|
|
3137
|
+
*
|
|
3138
|
+
* @returns {Date} The date value.
|
|
3139
|
+
* @throws {Error} If the element is not a date-compatible input.
|
|
3140
|
+
*/
|
|
3141
|
+
valDate(): Date;
|
|
2288
3142
|
/**
|
|
2289
3143
|
* Checks if the input element is boolean (for checkboxes/radios).
|
|
2290
3144
|
*
|
|
@@ -2293,6 +3147,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2293
3147
|
* @throws {Error} If the element is not a checkbox/radio input.
|
|
2294
3148
|
*/
|
|
2295
3149
|
static valBool(el: TinyInputElement): boolean;
|
|
3150
|
+
/**
|
|
3151
|
+
* Checks if the input element is boolean (for checkboxes/radios).
|
|
3152
|
+
*
|
|
3153
|
+
* @returns {boolean} True if the input is considered checked (value === "on"), false otherwise.
|
|
3154
|
+
* @throws {Error} If the element is not a checkbox/radio input.
|
|
3155
|
+
*/
|
|
3156
|
+
valBool(): boolean;
|
|
2296
3157
|
/**
|
|
2297
3158
|
* Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
|
|
2298
3159
|
*
|
|
@@ -2306,17 +3167,39 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2306
3167
|
* @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
|
|
2307
3168
|
*/
|
|
2308
3169
|
static listenForPaste(el: TinyElementWithDoc | TinyElementWithDoc[], { onFilePaste, onTextPaste }?: {
|
|
2309
|
-
onFilePaste?: (
|
|
2310
|
-
onTextPaste?: (
|
|
3170
|
+
onFilePaste?: (data: DataTransferItem, file: File) => void;
|
|
3171
|
+
onTextPaste?: (data: DataTransferItem, text: string) => void;
|
|
2311
3172
|
}): EventListenerOrEventListenerObject;
|
|
2312
3173
|
/**
|
|
2313
|
-
*
|
|
3174
|
+
* Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
|
|
2314
3175
|
*
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
|
|
2319
|
-
|
|
3176
|
+
* This method allows reacting to pasted content by providing separate callbacks for files and plain text.
|
|
3177
|
+
* Useful for building file upload areas, rich-text editors, or input enhancements.
|
|
3178
|
+
*
|
|
3179
|
+
* @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
|
|
3180
|
+
* @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
|
|
3181
|
+
* @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
|
|
3182
|
+
* @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
|
|
3183
|
+
*/
|
|
3184
|
+
listenForPaste({ onFilePaste, onTextPaste }?: {
|
|
3185
|
+
onFilePaste?: (data: DataTransferItem, file: File) => void;
|
|
3186
|
+
onTextPaste?: (data: DataTransferItem, text: string) => void;
|
|
3187
|
+
}): EventListenerOrEventListenerObject;
|
|
3188
|
+
/**
|
|
3189
|
+
* Checks if the element has a listener for a specific event.
|
|
3190
|
+
*
|
|
3191
|
+
* @param {TinyEventTarget} el - The element to check.
|
|
3192
|
+
* @param {string} event - The event name to check.
|
|
3193
|
+
* @returns {boolean}
|
|
3194
|
+
*/
|
|
3195
|
+
static hasEventListener(el: TinyEventTarget, event: string): boolean;
|
|
3196
|
+
/**
|
|
3197
|
+
* Checks if the element has a listener for a specific event.
|
|
3198
|
+
*
|
|
3199
|
+
* @param {string} event - The event name to check.
|
|
3200
|
+
* @returns {boolean}
|
|
3201
|
+
*/
|
|
3202
|
+
hasEventListener(event: string): boolean;
|
|
2320
3203
|
/**
|
|
2321
3204
|
* Checks if the element has the exact handler registered for a specific event.
|
|
2322
3205
|
*
|
|
@@ -2326,6 +3209,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2326
3209
|
* @returns {boolean}
|
|
2327
3210
|
*/
|
|
2328
3211
|
static hasExactEventListener(el: TinyEventTarget, event: string, handler: EventListenerOrEventListenerObject): boolean;
|
|
3212
|
+
/**
|
|
3213
|
+
* Checks if the element has the exact handler registered for a specific event.
|
|
3214
|
+
*
|
|
3215
|
+
* @param {string} event - The event name to check.
|
|
3216
|
+
* @param {EventListenerOrEventListenerObject} handler - The handler function to check.
|
|
3217
|
+
* @returns {boolean}
|
|
3218
|
+
*/
|
|
3219
|
+
hasExactEventListener(event: string, handler: EventListenerOrEventListenerObject): boolean;
|
|
2329
3220
|
/**
|
|
2330
3221
|
* Hover event shortcut.
|
|
2331
3222
|
*
|
|
@@ -2340,6 +3231,18 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2340
3231
|
* @returns {T}
|
|
2341
3232
|
*/
|
|
2342
3233
|
static hover<T extends TinyEventTarget | TinyEventTarget[]>(el: T, fnOver: HoverEventCallback, fnOut?: HoverEventCallback | null, options?: EventRegistryOptions): T;
|
|
3234
|
+
/**
|
|
3235
|
+
* Hover event shortcut.
|
|
3236
|
+
*
|
|
3237
|
+
* Adds `mouseenter` and `mouseleave` event listeners to the target.
|
|
3238
|
+
*
|
|
3239
|
+
* @param {HoverEventCallback} fnOver - Callback executed when the mouse enters the target.
|
|
3240
|
+
* @param {HoverEventCallback|null} [fnOut] - Optional callback executed when the mouse leaves
|
|
3241
|
+
* the target. If not provided, `fnOver` will be used for both events.
|
|
3242
|
+
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
3243
|
+
* @returns {this}
|
|
3244
|
+
*/
|
|
3245
|
+
hover(fnOver: HoverEventCallback, fnOut?: HoverEventCallback | null, options?: EventRegistryOptions): this;
|
|
2343
3246
|
/**
|
|
2344
3247
|
* Registers an event listener on the specified element.
|
|
2345
3248
|
*
|
|
@@ -2351,6 +3254,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2351
3254
|
* @returns {T}
|
|
2352
3255
|
*/
|
|
2353
3256
|
static on<T extends TinyEventTarget | TinyEventTarget[]>(el: T, events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: EventRegistryOptions): T;
|
|
3257
|
+
/**
|
|
3258
|
+
* Registers an event listener on the specified element.
|
|
3259
|
+
*
|
|
3260
|
+
* @param {string|string[]} events - The event type (e.g. 'click', 'keydown').
|
|
3261
|
+
* @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
|
|
3262
|
+
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
3263
|
+
* @returns {this}
|
|
3264
|
+
*/
|
|
3265
|
+
on(events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: EventRegistryOptions): this;
|
|
2354
3266
|
/**
|
|
2355
3267
|
* Registers an event listener that runs only once, then is removed.
|
|
2356
3268
|
*
|
|
@@ -2362,6 +3274,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2362
3274
|
* @returns {T}
|
|
2363
3275
|
*/
|
|
2364
3276
|
static once<T extends TinyEventTarget | TinyEventTarget[]>(el: T, events: string | string[], handler: EventListenerOrEventListenerObject, options?: EventRegistryOptions): T;
|
|
3277
|
+
/**
|
|
3278
|
+
* Registers an event listener that runs only once, then is removed.
|
|
3279
|
+
*
|
|
3280
|
+
* @param {string|string[]} events - The event type (e.g. 'click', 'keydown').
|
|
3281
|
+
* @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
|
|
3282
|
+
* @param {EventRegistryOptions} [options={}] - Optional event listener options.
|
|
3283
|
+
* @returns {this}
|
|
3284
|
+
*/
|
|
3285
|
+
once(events: string | string[], handler: EventListenerOrEventListenerObject, options?: EventRegistryOptions): this;
|
|
2365
3286
|
/**
|
|
2366
3287
|
* Removes a specific event listener from an element.
|
|
2367
3288
|
*
|
|
@@ -2373,6 +3294,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2373
3294
|
* @returns {T}
|
|
2374
3295
|
*/
|
|
2375
3296
|
static off<T extends TinyEventTarget | TinyEventTarget[]>(el: T, events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): T;
|
|
3297
|
+
/**
|
|
3298
|
+
* Removes a specific event listener from an element.
|
|
3299
|
+
*
|
|
3300
|
+
* @param {string|string[]} events - The event type.
|
|
3301
|
+
* @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
|
|
3302
|
+
* @param {boolean|EventListenerOptions} [options] - Optional listener options.
|
|
3303
|
+
* @returns {this}
|
|
3304
|
+
*/
|
|
3305
|
+
off(events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): this;
|
|
2376
3306
|
/**
|
|
2377
3307
|
* Removes all event listeners of a specific type from the element.
|
|
2378
3308
|
*
|
|
@@ -2382,6 +3312,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2382
3312
|
* @returns {T}
|
|
2383
3313
|
*/
|
|
2384
3314
|
static offAll<T extends TinyEventTarget | TinyEventTarget[]>(el: T, events: string | string[]): T;
|
|
3315
|
+
/**
|
|
3316
|
+
* Removes all event listeners of a specific type from the element.
|
|
3317
|
+
*
|
|
3318
|
+
* @param {string|string[]} events - The event type to remove (e.g. 'click').
|
|
3319
|
+
* @returns {this}
|
|
3320
|
+
*/
|
|
3321
|
+
offAll(events: string | string[]): this;
|
|
2385
3322
|
/**
|
|
2386
3323
|
* Removes all event listeners of all types from the element.
|
|
2387
3324
|
*
|
|
@@ -2392,6 +3329,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2392
3329
|
* @returns {T}
|
|
2393
3330
|
*/
|
|
2394
3331
|
static offAllTypes<T extends TinyEventTarget | TinyEventTarget[]>(el: T, filterFn?: ((handler: EventListenerOrEventListenerObject | null, event: string) => boolean) | null): T;
|
|
3332
|
+
/**
|
|
3333
|
+
* Removes all event listeners of all types from the element.
|
|
3334
|
+
*
|
|
3335
|
+
* @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
|
|
3336
|
+
* Optional filter function to selectively remove specific handlers.
|
|
3337
|
+
* @returns {this}
|
|
3338
|
+
*/
|
|
3339
|
+
offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject | null, event: string) => boolean) | null): this;
|
|
2395
3340
|
/**
|
|
2396
3341
|
* Triggers all handlers associated with a specific event on the given element.
|
|
2397
3342
|
*
|
|
@@ -2403,16 +3348,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2403
3348
|
*/
|
|
2404
3349
|
static trigger<T extends TinyEventTarget | TinyEventTarget[]>(el: T, events: string | string[], payload?: Event | CustomEvent | CustomEventInit): T;
|
|
2405
3350
|
/**
|
|
2406
|
-
*
|
|
2407
|
-
* Maps attribute-like names to their JavaScript DOM property equivalents.
|
|
2408
|
-
*
|
|
2409
|
-
* Example: `'for'` ➝ `'htmlFor'`, `'class'` ➝ `'className'`.
|
|
2410
|
-
*
|
|
2411
|
-
* ⚠️ Do not modify this object directly. Use `TinyHtml.propFix` to ensure reverse mapping (`attrFix`) remains in sync.
|
|
3351
|
+
* Triggers all handlers associated with a specific event on the given element.
|
|
2412
3352
|
*
|
|
2413
|
-
* @
|
|
3353
|
+
* @param {string|string[]} events - Name of the event to trigger.
|
|
3354
|
+
* @param {Event|CustomEvent|CustomEventInit} [payload] - Optional event object or data to pass.
|
|
3355
|
+
* @returns {this}
|
|
2414
3356
|
*/
|
|
2415
|
-
|
|
3357
|
+
trigger(events: string | string[], payload?: Event | CustomEvent | CustomEventInit): this;
|
|
2416
3358
|
/**
|
|
2417
3359
|
* Public proxy for normalized DOM property names.
|
|
2418
3360
|
*
|
|
@@ -2456,6 +3398,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2456
3398
|
* @returns {bigint|null}
|
|
2457
3399
|
*/
|
|
2458
3400
|
static attrBigInt(el: TinyElement, name: string): bigint | null;
|
|
3401
|
+
/**
|
|
3402
|
+
* Returns the BigInt value of an attribute.
|
|
3403
|
+
* @param {string} name
|
|
3404
|
+
* @returns {bigint|null}
|
|
3405
|
+
*/
|
|
3406
|
+
attrBigInt(name: string): bigint | null;
|
|
2459
3407
|
/**
|
|
2460
3408
|
* Set a BigInt attribute.
|
|
2461
3409
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2465,6 +3413,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2465
3413
|
* @returns {T}
|
|
2466
3414
|
*/
|
|
2467
3415
|
static setAttrBigInt<T extends TinyElement | TinyElement[]>(el: T, name: string, value: bigint): T;
|
|
3416
|
+
/**
|
|
3417
|
+
* Set a BigInt attribute.
|
|
3418
|
+
* @param {string} name
|
|
3419
|
+
* @param {bigint} value
|
|
3420
|
+
* @returns {this}
|
|
3421
|
+
*/
|
|
3422
|
+
setAttrBigInt(name: string, value: bigint): this;
|
|
2468
3423
|
/**
|
|
2469
3424
|
* Returns the Date value of an attribute.
|
|
2470
3425
|
* @param {TinyElement} el
|
|
@@ -2472,6 +3427,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2472
3427
|
* @returns {Date|null}
|
|
2473
3428
|
*/
|
|
2474
3429
|
static attrDate(el: TinyElement, name: string): Date | null;
|
|
3430
|
+
/**
|
|
3431
|
+
* Returns the Date value of an attribute.
|
|
3432
|
+
* @param {string} name
|
|
3433
|
+
* @returns {Date|null}
|
|
3434
|
+
*/
|
|
3435
|
+
attrDate(name: string): Date | null;
|
|
2475
3436
|
/**
|
|
2476
3437
|
* Set a Date attribute.
|
|
2477
3438
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2481,6 +3442,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2481
3442
|
* @returns {T}
|
|
2482
3443
|
*/
|
|
2483
3444
|
static setAttrDate<T extends TinyElement | TinyElement[]>(el: T, name: string, value: Date): T;
|
|
3445
|
+
/**
|
|
3446
|
+
* Set a Date attribute.
|
|
3447
|
+
* @param {string} name
|
|
3448
|
+
* @param {Date} value
|
|
3449
|
+
* @returns {this}
|
|
3450
|
+
*/
|
|
3451
|
+
setAttrDate(name: string, value: Date): this;
|
|
2484
3452
|
/**
|
|
2485
3453
|
* Returns the JSON value of an attribute.
|
|
2486
3454
|
* @param {TinyElement} el
|
|
@@ -2488,6 +3456,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2488
3456
|
* @returns {any|null}
|
|
2489
3457
|
*/
|
|
2490
3458
|
static attrJson(el: TinyElement, name: string): any | null;
|
|
3459
|
+
/**
|
|
3460
|
+
* Returns the JSON value of an attribute.
|
|
3461
|
+
* @param {string} name
|
|
3462
|
+
* @returns {any|null}
|
|
3463
|
+
*/
|
|
3464
|
+
attrJson(name: string): any | null;
|
|
2491
3465
|
/**
|
|
2492
3466
|
* Set a JSON attribute.
|
|
2493
3467
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2499,6 +3473,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2499
3473
|
* @returns {T}
|
|
2500
3474
|
*/
|
|
2501
3475
|
static setAttrJson<T extends TinyElement | TinyElement[]>(el: T, name: string, value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): T;
|
|
3476
|
+
/**
|
|
3477
|
+
* Set a JSON attribute.
|
|
3478
|
+
* @param {string} name
|
|
3479
|
+
* @param {any} value
|
|
3480
|
+
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
3481
|
+
* @param {number|string} [space]
|
|
3482
|
+
* @returns {this}
|
|
3483
|
+
*/
|
|
3484
|
+
setAttrJson(name: string, value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): this;
|
|
2502
3485
|
/**
|
|
2503
3486
|
* Returns the number value of an attribute.
|
|
2504
3487
|
* @param {TinyElement} el
|
|
@@ -2506,6 +3489,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2506
3489
|
* @returns {number|null}
|
|
2507
3490
|
*/
|
|
2508
3491
|
static attrNumber(el: TinyElement, name: string): number | null;
|
|
3492
|
+
/**
|
|
3493
|
+
* Returns the number value of an attribute.
|
|
3494
|
+
* @param {string} name
|
|
3495
|
+
* @returns {number|null}
|
|
3496
|
+
*/
|
|
3497
|
+
attrNumber(name: string): number | null;
|
|
2509
3498
|
/**
|
|
2510
3499
|
* Set a number attribute.
|
|
2511
3500
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2515,6 +3504,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2515
3504
|
* @returns {T}
|
|
2516
3505
|
*/
|
|
2517
3506
|
static setAttrNumber<T extends TinyElement | TinyElement[]>(el: T, name: string, value: number): T;
|
|
3507
|
+
/**
|
|
3508
|
+
* Set a number attribute.
|
|
3509
|
+
* @param {string} name
|
|
3510
|
+
* @param {number} value
|
|
3511
|
+
* @returns {this}
|
|
3512
|
+
*/
|
|
3513
|
+
setAttrNumber(name: string, value: number): this;
|
|
2518
3514
|
/**
|
|
2519
3515
|
* Returns the boolean value of an attribute.
|
|
2520
3516
|
* @param {TinyElement} el
|
|
@@ -2522,6 +3518,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2522
3518
|
* @returns {boolean|null}
|
|
2523
3519
|
*/
|
|
2524
3520
|
static attrBoolean(el: TinyElement, name: string): boolean | null;
|
|
3521
|
+
/**
|
|
3522
|
+
* Returns the boolean value of an attribute.
|
|
3523
|
+
* @param {string} name
|
|
3524
|
+
* @returns {boolean|null}
|
|
3525
|
+
*/
|
|
3526
|
+
attrBoolean(name: string): boolean | null;
|
|
2525
3527
|
/**
|
|
2526
3528
|
* Set a boolean attribute.
|
|
2527
3529
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2531,6 +3533,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2531
3533
|
* @returns {T}
|
|
2532
3534
|
*/
|
|
2533
3535
|
static setAttrBoolean<T extends TinyElement | TinyElement[]>(el: T, name: string, value: boolean): T;
|
|
3536
|
+
/**
|
|
3537
|
+
* Set a boolean attribute.
|
|
3538
|
+
* @param {string} name
|
|
3539
|
+
* @param {boolean} value
|
|
3540
|
+
* @returns {this}
|
|
3541
|
+
*/
|
|
3542
|
+
setAttrBoolean(name: string, value: boolean): this;
|
|
2534
3543
|
/**
|
|
2535
3544
|
* Returns the string value of an attribute.
|
|
2536
3545
|
* @param {TinyElement} el
|
|
@@ -2538,6 +3547,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2538
3547
|
* @returns {string|null}
|
|
2539
3548
|
*/
|
|
2540
3549
|
static attrString(el: TinyElement, name: string): string | null;
|
|
3550
|
+
/**
|
|
3551
|
+
* Returns the string value of an attribute.
|
|
3552
|
+
* @param {string} name
|
|
3553
|
+
* @returns {string|null}
|
|
3554
|
+
*/
|
|
3555
|
+
attrString(name: string): string | null;
|
|
2541
3556
|
/**
|
|
2542
3557
|
* Set a string attribute.
|
|
2543
3558
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2547,6 +3562,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2547
3562
|
* @returns {T}
|
|
2548
3563
|
*/
|
|
2549
3564
|
static setAttrString<T extends TinyElement | TinyElement[]>(el: T, name: string, value: string): T;
|
|
3565
|
+
/**
|
|
3566
|
+
* Set a string attribute.
|
|
3567
|
+
* @param {string} name
|
|
3568
|
+
* @param {string} value
|
|
3569
|
+
* @returns {this}
|
|
3570
|
+
*/
|
|
3571
|
+
setAttrString(name: string, value: string): this;
|
|
2550
3572
|
/**
|
|
2551
3573
|
* Get an attribute on an element.
|
|
2552
3574
|
* @param {TinyElement} el
|
|
@@ -2554,6 +3576,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2554
3576
|
* @returns {string|null}
|
|
2555
3577
|
*/
|
|
2556
3578
|
static attr(el: TinyElement, name: string): string | null;
|
|
3579
|
+
/**
|
|
3580
|
+
* Get an attribute on an element.
|
|
3581
|
+
* @param {string} name
|
|
3582
|
+
* @returns {string|null}
|
|
3583
|
+
*/
|
|
3584
|
+
attr(name: string): string | null;
|
|
2557
3585
|
/**
|
|
2558
3586
|
* Set one or multiple attributes on an element.
|
|
2559
3587
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2563,6 +3591,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2563
3591
|
* @returns {T}
|
|
2564
3592
|
*/
|
|
2565
3593
|
static setAttr<T extends TinyElement | TinyElement[]>(el: T, name: string | Record<string, any>, value?: any): T;
|
|
3594
|
+
/**
|
|
3595
|
+
* Set one or multiple attributes on an element.
|
|
3596
|
+
* @param {string|Record<string, any>} name - Attribute name or an object of attributes.
|
|
3597
|
+
* @param {any} [value=null] - Attribute value (ignored if "name" is an object).
|
|
3598
|
+
* @returns {this}
|
|
3599
|
+
*/
|
|
3600
|
+
setAttr(name: string | Record<string, any>, value?: any): this;
|
|
2566
3601
|
/**
|
|
2567
3602
|
* Remove attribute(s) from an element.
|
|
2568
3603
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2571,6 +3606,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2571
3606
|
* @returns {T}
|
|
2572
3607
|
*/
|
|
2573
3608
|
static removeAttr<T extends TinyElement | TinyElement[]>(el: T, name: string): T;
|
|
3609
|
+
/**
|
|
3610
|
+
* Remove attribute(s) from an element.
|
|
3611
|
+
* @param {string} name Space-separated list of attributes.
|
|
3612
|
+
* @returns {this}
|
|
3613
|
+
*/
|
|
3614
|
+
removeAttr(name: string): this;
|
|
2574
3615
|
/**
|
|
2575
3616
|
* Check if an attribute exists on an element.
|
|
2576
3617
|
* @param {TinyElement} el
|
|
@@ -2578,6 +3619,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2578
3619
|
* @returns {boolean}
|
|
2579
3620
|
*/
|
|
2580
3621
|
static hasAttr(el: TinyElement, name: string): boolean;
|
|
3622
|
+
/**
|
|
3623
|
+
* Check if an attribute exists on an element.
|
|
3624
|
+
* @param {string} name
|
|
3625
|
+
* @returns {boolean}
|
|
3626
|
+
*/
|
|
3627
|
+
hasAttr(name: string): boolean;
|
|
2581
3628
|
/**
|
|
2582
3629
|
* Check if a property exists.
|
|
2583
3630
|
* @param {TinyElement} el
|
|
@@ -2585,6 +3632,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2585
3632
|
* @returns {boolean}
|
|
2586
3633
|
*/
|
|
2587
3634
|
static hasProp(el: TinyElement, name: string): boolean;
|
|
3635
|
+
/**
|
|
3636
|
+
* Check if a property exists.
|
|
3637
|
+
* @param {string} name
|
|
3638
|
+
* @returns {boolean}
|
|
3639
|
+
*/
|
|
3640
|
+
hasProp(name: string): boolean;
|
|
2588
3641
|
/**
|
|
2589
3642
|
* Set one or multiple properties on an element.
|
|
2590
3643
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2593,6 +3646,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2593
3646
|
* @returns {T}
|
|
2594
3647
|
*/
|
|
2595
3648
|
static addProp<T extends TinyElement | TinyElement[]>(el: T, ...names: string[]): T;
|
|
3649
|
+
/**
|
|
3650
|
+
* Set a property on an element.
|
|
3651
|
+
* @param {...string} names - Property name(s).
|
|
3652
|
+
* @returns {this}
|
|
3653
|
+
*/
|
|
3654
|
+
addProp(...names: string[]): this;
|
|
2596
3655
|
/**
|
|
2597
3656
|
* Remove one or multiple properties from an element.
|
|
2598
3657
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2601,6 +3660,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2601
3660
|
* @returns {T}
|
|
2602
3661
|
*/
|
|
2603
3662
|
static removeProp<T extends TinyElement | TinyElement[]>(el: T, ...names: string[]): T;
|
|
3663
|
+
/**
|
|
3664
|
+
* Remove a property from an element.
|
|
3665
|
+
* @param {...string} names - Property name(s).
|
|
3666
|
+
* @returns {this}
|
|
3667
|
+
*/
|
|
3668
|
+
removeProp(...names: string[]): this;
|
|
2604
3669
|
/**
|
|
2605
3670
|
* Toggle one or multiple boolean properties.
|
|
2606
3671
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2610,6 +3675,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2610
3675
|
* @returns {T}
|
|
2611
3676
|
*/
|
|
2612
3677
|
static toggleProp<T extends TinyElement | TinyElement[]>(el: T, name: string | string[], force?: boolean): T;
|
|
3678
|
+
/**
|
|
3679
|
+
* Toggle one or multiple boolean properties.
|
|
3680
|
+
* @param {string|string[]} name - Property name or a list of property names.
|
|
3681
|
+
* @param {boolean} [force] - Force true/false instead of toggling.
|
|
3682
|
+
* @returns {this}
|
|
3683
|
+
*/
|
|
3684
|
+
toggleProp(name: string | string[], force?: boolean): this;
|
|
2613
3685
|
/**
|
|
2614
3686
|
* Get properties on an element.
|
|
2615
3687
|
*
|
|
@@ -2618,6 +3690,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2618
3690
|
* @returns {any} - Property value if getting, otherwise `undefined`.
|
|
2619
3691
|
*/
|
|
2620
3692
|
static prop(el: TinyHtmlElement, name: string): any;
|
|
3693
|
+
/**
|
|
3694
|
+
* Get properties on an element.
|
|
3695
|
+
*
|
|
3696
|
+
* @param {string} name - Property name.
|
|
3697
|
+
* @returns {any} - Property value if getting, otherwise `undefined`.
|
|
3698
|
+
*/
|
|
3699
|
+
prop(name: string): any;
|
|
2621
3700
|
/**
|
|
2622
3701
|
* Set a property on elements.
|
|
2623
3702
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2627,6 +3706,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2627
3706
|
* @returns {T}
|
|
2628
3707
|
*/
|
|
2629
3708
|
static setProp<T extends TinyElement | TinyElement[]>(el: T, name: string, value: any): T;
|
|
3709
|
+
/**
|
|
3710
|
+
* Set a property on this element.
|
|
3711
|
+
* @param {string} name - Property name.
|
|
3712
|
+
* @param {any} value - Value to set.
|
|
3713
|
+
* @returns {this} The same element.
|
|
3714
|
+
*/
|
|
3715
|
+
setProp(name: string, value: any): this;
|
|
2630
3716
|
/**
|
|
2631
3717
|
* Removes an element from the DOM.
|
|
2632
3718
|
* @template {TinyElement|TinyElement[]} T
|
|
@@ -2634,6 +3720,11 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2634
3720
|
* @returns {T}
|
|
2635
3721
|
*/
|
|
2636
3722
|
static remove<T extends TinyElement | TinyElement[]>(el: T): T;
|
|
3723
|
+
/**
|
|
3724
|
+
* Removes the element from the DOM.
|
|
3725
|
+
* @returns {this}
|
|
3726
|
+
*/
|
|
3727
|
+
remove(): this;
|
|
2637
3728
|
/**
|
|
2638
3729
|
* Returns the index of the first element within its parent or relative to a selector/element.
|
|
2639
3730
|
*
|
|
@@ -2642,6 +3733,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2642
3733
|
* @returns {number}
|
|
2643
3734
|
*/
|
|
2644
3735
|
static index(el: TinyElement, el2?: string | TinyElement | null): number;
|
|
3736
|
+
/**
|
|
3737
|
+
* Returns the index of the first element within its parent or relative to a selector/element.
|
|
3738
|
+
*
|
|
3739
|
+
* @param {string|TinyElement|null} [elem] - Optional target to compare index against.
|
|
3740
|
+
* @returns {number}
|
|
3741
|
+
*/
|
|
3742
|
+
index(elem?: string | TinyElement | null): number;
|
|
2645
3743
|
/**
|
|
2646
3744
|
* Creates a new DOMRect object by copying the base rect and applying optional additional dimensions.
|
|
2647
3745
|
*
|
|
@@ -2658,16 +3756,32 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2658
3756
|
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
2659
3757
|
* @returns {boolean} - `true` if the elements are colliding, `false` otherwise.
|
|
2660
3758
|
*/
|
|
2661
|
-
static isCollWith(el1: TinyElement, el2: TinyElement, extraRect?: Partial<
|
|
3759
|
+
static isCollWith(el1: TinyElement, el2: TinyElement, extraRect?: Partial<ObjRect>): boolean;
|
|
2662
3760
|
/**
|
|
2663
|
-
* Determines if two HTML elements are colliding using a
|
|
3761
|
+
* Determines if two HTML elements are colliding, using a simple bounding box comparison.
|
|
2664
3762
|
*
|
|
2665
|
-
* @param {TinyElement} el1 - The first element to compare.
|
|
2666
3763
|
* @param {TinyElement} el2 - The second element to compare.
|
|
2667
3764
|
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
2668
|
-
* @returns {boolean} - `true` if the elements are colliding
|
|
3765
|
+
* @returns {boolean} - `true` if the elements are colliding, `false` otherwise.
|
|
2669
3766
|
*/
|
|
2670
|
-
|
|
3767
|
+
isCollWith(el2: TinyElement, extraRect?: Partial<ObjRect>): boolean;
|
|
3768
|
+
/**
|
|
3769
|
+
* Determines if two HTML elements are colliding using a pixel-perfect collision algorithm.
|
|
3770
|
+
*
|
|
3771
|
+
* @param {TinyElement} el1 - The first element to compare.
|
|
3772
|
+
* @param {TinyElement} el2 - The second element to compare.
|
|
3773
|
+
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
3774
|
+
* @returns {boolean} - `true` if the elements are colliding with higher precision, `false` otherwise.
|
|
3775
|
+
*/
|
|
3776
|
+
static isCollPerfWith(el1: TinyElement, el2: TinyElement, extraRect?: Partial<ObjRect>): boolean;
|
|
3777
|
+
/**
|
|
3778
|
+
* Determines if two HTML elements are colliding using a pixel-perfect collision algorithm.
|
|
3779
|
+
*
|
|
3780
|
+
* @param {TinyElement} el2 - The second element to compare.
|
|
3781
|
+
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
3782
|
+
* @returns {boolean} - `true` if the elements are colliding with higher precision, `false` otherwise.
|
|
3783
|
+
*/
|
|
3784
|
+
isCollPerfWith(el2: TinyElement, extraRect?: Partial<ObjRect>): boolean;
|
|
2671
3785
|
/**
|
|
2672
3786
|
* Determines whether two elements are colliding with a directional lock mechanism.
|
|
2673
3787
|
*
|
|
@@ -2696,7 +3810,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2696
3810
|
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
2697
3811
|
* @returns {boolean} True if collision is still active.
|
|
2698
3812
|
*/
|
|
2699
|
-
static isCollWithLock(el1: TinyElement, el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<
|
|
3813
|
+
static isCollWithLock(el1: TinyElement, el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<ObjRect>): boolean;
|
|
3814
|
+
/**
|
|
3815
|
+
* Checks if two DOM elements are colliding on the screen, and locks the collision
|
|
3816
|
+
* until the element exits through the same side it entered.
|
|
3817
|
+
*
|
|
3818
|
+
* @param {TinyElement} el2 - Second DOM element (e.g. a container or boundary element).
|
|
3819
|
+
* @param {CollisionDirLock} lockDirection - Direction that must be respected to unlock the collision.
|
|
3820
|
+
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
3821
|
+
* @returns {boolean} True if collision is still active.
|
|
3822
|
+
*/
|
|
3823
|
+
isCollWithLock(el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<ObjRect>): boolean;
|
|
2700
3824
|
/**
|
|
2701
3825
|
* Checks if two DOM elements are colliding on the screen, and locks the collision
|
|
2702
3826
|
* until the element exits through the same side it entered.
|
|
@@ -2707,7 +3831,17 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2707
3831
|
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
2708
3832
|
* @returns {boolean} True if collision is still active.
|
|
2709
3833
|
*/
|
|
2710
|
-
static isCollPerfWithLock(el1: TinyElement, el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<
|
|
3834
|
+
static isCollPerfWithLock(el1: TinyElement, el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<ObjRect>): boolean;
|
|
3835
|
+
/**
|
|
3836
|
+
* Checks if two DOM elements are colliding on the screen, and locks the collision
|
|
3837
|
+
* until the element exits through the same side it entered.
|
|
3838
|
+
*
|
|
3839
|
+
* @param {TinyElement} el2 - Second DOM element (e.g. a container or boundary element).
|
|
3840
|
+
* @param {CollisionDirLock} lockDirection - Direction that must be respected to unlock the collision.
|
|
3841
|
+
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
3842
|
+
* @returns {boolean} True if collision is still active.
|
|
3843
|
+
*/
|
|
3844
|
+
isCollPerfWithLock(el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<ObjRect>): boolean;
|
|
2711
3845
|
/**
|
|
2712
3846
|
* Resets all collision locks for a specific element (for all directions).
|
|
2713
3847
|
*
|
|
@@ -2715,6 +3849,15 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2715
3849
|
* @returns {boolean} True if at least one lock was removed.
|
|
2716
3850
|
*/
|
|
2717
3851
|
static resetCollLock(el: TinyElement): boolean;
|
|
3852
|
+
/**
|
|
3853
|
+
* Resets the collision lock for a specific element.
|
|
3854
|
+
*
|
|
3855
|
+
* This removes any previously stored collision direction for the given element,
|
|
3856
|
+
* effectively unlocking its collision state.
|
|
3857
|
+
*
|
|
3858
|
+
* @returns {boolean} Returns `true` if a lock was removed, `false` if no lock was present.
|
|
3859
|
+
*/
|
|
3860
|
+
resetCollLock(): boolean;
|
|
2718
3861
|
/**
|
|
2719
3862
|
* Resets the collision lock for a specific element and direction.
|
|
2720
3863
|
*
|
|
@@ -2723,6 +3866,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2723
3866
|
* @returns {boolean} True if the lock was removed.
|
|
2724
3867
|
*/
|
|
2725
3868
|
static resetCollLockDir(el: TinyElement, direction: CollisionDirLock): boolean;
|
|
3869
|
+
/**
|
|
3870
|
+
* Resets the collision lock for a specific element and direction.
|
|
3871
|
+
*
|
|
3872
|
+
* @param {CollisionDirLock} direction - The direction to clear the lock from.
|
|
3873
|
+
* @returns {boolean} True if the lock was removed.
|
|
3874
|
+
*/
|
|
3875
|
+
resetCollLockDir(direction: CollisionDirLock): boolean;
|
|
2726
3876
|
/**
|
|
2727
3877
|
* Checks if the given element is at least partially visible in the viewport.
|
|
2728
3878
|
*
|
|
@@ -2730,6 +3880,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2730
3880
|
* @returns {boolean} True if the element is partially in the viewport, false otherwise.
|
|
2731
3881
|
*/
|
|
2732
3882
|
static isInViewport(el: TinyElement): boolean;
|
|
3883
|
+
/**
|
|
3884
|
+
* Checks if the given element is at least partially visible in the viewport.
|
|
3885
|
+
*
|
|
3886
|
+
* @returns {boolean} True if the element is partially in the viewport, false otherwise.
|
|
3887
|
+
*/
|
|
3888
|
+
isInViewport(): boolean;
|
|
2733
3889
|
/**
|
|
2734
3890
|
* Checks if the given element is fully visible in the viewport (top and bottom).
|
|
2735
3891
|
*
|
|
@@ -2737,6 +3893,12 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2737
3893
|
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
2738
3894
|
*/
|
|
2739
3895
|
static isScrolledIntoView(el: TinyElement): boolean;
|
|
3896
|
+
/**
|
|
3897
|
+
* Checks if the given element is fully visible in the viewport (top and bottom).
|
|
3898
|
+
*
|
|
3899
|
+
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
3900
|
+
*/
|
|
3901
|
+
isScrolledIntoView(): boolean;
|
|
2740
3902
|
/**
|
|
2741
3903
|
* Checks if the given element is at least partially visible within the boundaries of a container.
|
|
2742
3904
|
*
|
|
@@ -2745,6 +3907,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2745
3907
|
* @returns {boolean} True if the element is partially visible within the container, false otherwise.
|
|
2746
3908
|
*/
|
|
2747
3909
|
static isInContainer(el: TinyElement, cont: TinyElement): boolean;
|
|
3910
|
+
/**
|
|
3911
|
+
* Checks if the given element is at least partially visible within the boundaries of a container.
|
|
3912
|
+
*
|
|
3913
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
3914
|
+
* @returns {boolean} True if the element is partially visible within the container, false otherwise.
|
|
3915
|
+
*/
|
|
3916
|
+
isInContainer(cont: TinyElement): boolean;
|
|
2748
3917
|
/**
|
|
2749
3918
|
* Checks if the given element is fully visible within the boundaries of a container (top and bottom).
|
|
2750
3919
|
*
|
|
@@ -2753,6 +3922,13 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2753
3922
|
* @returns {boolean} True if the element is fully visible within the container, false otherwise.
|
|
2754
3923
|
*/
|
|
2755
3924
|
static isFullyInContainer(el: TinyElement, cont: TinyElement): boolean;
|
|
3925
|
+
/**
|
|
3926
|
+
* Checks if the given element is fully visible within the boundaries of a container (top and bottom).
|
|
3927
|
+
*
|
|
3928
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
3929
|
+
* @returns {boolean} True if the element is fully visible within the container, false otherwise.
|
|
3930
|
+
*/
|
|
3931
|
+
isFullyInContainer(cont: TinyElement): boolean;
|
|
2756
3932
|
/**
|
|
2757
3933
|
* Checks if an element has scrollable content.
|
|
2758
3934
|
*
|
|
@@ -2764,1418 +3940,14 @@ declare class TinyHtml<TinyHtmlT extends TinyHtmlConstructor> {
|
|
|
2764
3940
|
h: boolean;
|
|
2765
3941
|
};
|
|
2766
3942
|
/**
|
|
2767
|
-
*
|
|
2768
|
-
* Useful when you want to operate repeatedly on the same element using instance methods.
|
|
2769
|
-
* @param {TinyHtmlT} el - The element to wrap and manipulate.
|
|
2770
|
-
*/
|
|
2771
|
-
constructor(el: TinyHtmlT);
|
|
2772
|
-
/**
|
|
2773
|
-
* Queries the element for the first element matching the CSS selector and wraps it in a TinyHtml instance.
|
|
2774
|
-
*
|
|
2775
|
-
* @param {string} selector - A valid CSS selector string.
|
|
2776
|
-
* @returns {TinyHtml<Element>|null} A TinyHtml instance wrapping the matched element.
|
|
2777
|
-
*/
|
|
2778
|
-
querySelector(selector: string): TinyHtml<Element> | null;
|
|
2779
|
-
/**
|
|
2780
|
-
* Queries the element for all elements matching the CSS selector and wraps them in TinyHtml instances.
|
|
2781
|
-
*
|
|
2782
|
-
* @param {string} selector - A valid CSS selector string.
|
|
2783
|
-
* @returns {TinyHtml<NodeListOf<Element>>} An array of TinyHtml instances wrapping the matched elements.
|
|
2784
|
-
*/
|
|
2785
|
-
querySelectorAll(selector: string): TinyHtml<NodeListOf<Element>>;
|
|
2786
|
-
/**
|
|
2787
|
-
* Retrieves all elements with the specified class name and wraps them in TinyHtml instances.
|
|
2788
|
-
*
|
|
2789
|
-
* @param {string} selector - The class name to search for.
|
|
2790
|
-
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
2791
|
-
*/
|
|
2792
|
-
getElementsByClassName(selector: string): TinyHtml<HTMLCollectionOf<Element>>;
|
|
2793
|
-
/**
|
|
2794
|
-
* Retrieves all elements with the specified local tag name within the given namespace URI,
|
|
2795
|
-
* and wraps them in TinyHtml instances.
|
|
2796
|
-
*
|
|
2797
|
-
* @param {string} localName - The local name (tag) of the elements to search for.
|
|
2798
|
-
* @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
|
|
2799
|
-
* @returns {TinyHtml<HTMLCollectionOf<Element>>} An array of TinyHtml instances wrapping the found elements.
|
|
2800
|
-
*/
|
|
2801
|
-
getElementsByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml<HTMLCollectionOf<Element>>;
|
|
2802
|
-
/**
|
|
2803
|
-
* Returns the current targets held by this instance.
|
|
2804
|
-
*
|
|
2805
|
-
* @returns {ConstructorElValues[]} - The instance's targets element.
|
|
2806
|
-
*/
|
|
2807
|
-
get elements(): ConstructorElValues[];
|
|
2808
|
-
/**
|
|
2809
|
-
* Iterates over all elements, executing the provided callback on each.
|
|
2810
|
-
* @param {(element: TinyHtmlAny, index: number, items: TinyHtmlAny[]) => void} callback - Function invoked for each element.
|
|
2811
|
-
* @returns {this} The current instance for chaining.
|
|
2812
|
-
*/
|
|
2813
|
-
forEach(callback: (element: TinyHtmlAny, index: number, items: TinyHtmlAny[]) => void): this;
|
|
2814
|
-
/**
|
|
2815
|
-
* Returns the current target held by this instance.
|
|
2816
|
-
*
|
|
2817
|
-
* @param {number} index - The index of the element to retrieve.
|
|
2818
|
-
* @returns {ConstructorElValues} - The instance's target element.
|
|
2819
|
-
*/
|
|
2820
|
-
get(index: number): ConstructorElValues;
|
|
2821
|
-
/**
|
|
2822
|
-
* Extracts a single DOM element from the internal list at the specified index.
|
|
2823
|
-
*
|
|
2824
|
-
* @param {number} index - The index of the element to extract.
|
|
2825
|
-
* @returns {TinyHtmlAny} A new TinyHtml instance wrapping the extracted element.
|
|
2826
|
-
*/
|
|
2827
|
-
extract(index: number): TinyHtmlAny;
|
|
2828
|
-
/**
|
|
2829
|
-
* Checks whether the element exists at the given index.
|
|
2830
|
-
*
|
|
2831
|
-
* @param {number} index - The index to check.
|
|
2832
|
-
* @returns {boolean} - True if the element exists; otherwise, false.
|
|
2833
|
-
*/
|
|
2834
|
-
exists(index: number): boolean;
|
|
2835
|
-
/**
|
|
2836
|
-
* @deprecated Use the getter {@link elements} instead.
|
|
2837
|
-
* Returns the current targets held by this instance.
|
|
2838
|
-
*
|
|
2839
|
-
* @returns {ConstructorElValues[]} - The instance's targets element.
|
|
2840
|
-
*/
|
|
2841
|
-
getAll(): ConstructorElValues[];
|
|
2842
|
-
/**
|
|
2843
|
-
* Returns the current Element held by this instance.
|
|
2844
|
-
*
|
|
2845
|
-
* @param {string} where - The method name or context calling this.
|
|
2846
|
-
* @param {number} index - The index of the element to retrieve.
|
|
2847
|
-
* @returns {ConstructorElValues} - The instance's element.
|
|
2848
|
-
*/
|
|
2849
|
-
_getElement(where: string, index: number): ConstructorElValues;
|
|
2850
|
-
/**
|
|
2851
|
-
* Returns the current Elements held by this instance.
|
|
2852
|
-
*
|
|
2853
|
-
* @param {string} where - The method name or context calling this.
|
|
2854
|
-
* @returns {ConstructorElValues[]} - The instance's elements.
|
|
2855
|
-
*/
|
|
2856
|
-
_getElements(where: string): ConstructorElValues[];
|
|
2857
|
-
/**
|
|
2858
|
-
* Prepares and validates multiple elements against allowed types.
|
|
2859
|
-
*
|
|
2860
|
-
* @param {string} where - The method name or context calling this.
|
|
2861
|
-
* @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
|
|
2862
|
-
* @param {string[]} elemName - The list of expected element names for error reporting.
|
|
2863
|
-
* @returns {any[]} - A flat array of validated elements.
|
|
2864
|
-
* @throws {Error} - If any element is not an instance of one of the allowed types.
|
|
2865
|
-
*/
|
|
2866
|
-
_preElemsTemplate(where: string, TheTinyElements: any[], elemName: string[]): any[];
|
|
2867
|
-
/**
|
|
2868
|
-
* Prepares and validates a single element against allowed types.
|
|
2869
|
-
*
|
|
2870
|
-
* @param {string} where - The method name or context calling this.
|
|
2871
|
-
* @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
|
|
2872
|
-
* @param {string[]} elemName - The list of expected element names for error reporting.
|
|
2873
|
-
* @param {boolean} [canNull=false] - Whether `null` is allowed as a valid value.
|
|
2874
|
-
* @returns {any} - The validated element or `null` if allowed.
|
|
2875
|
-
* @throws {Error} - If the element is not valid or if multiple elements are provided.
|
|
2876
|
-
*/
|
|
2877
|
-
_preElemTemplate(where: string, TheTinyElements: any[], elemName: string[], canNull?: boolean): any;
|
|
2878
|
-
/**
|
|
2879
|
-
* Ensures the input is returned as an array.
|
|
2880
|
-
* Useful to normalize operations across multiple or single elements.
|
|
2881
|
-
*
|
|
2882
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2883
|
-
* @returns {Element[]} - Always returns an array of elements.
|
|
2884
|
-
*/
|
|
2885
|
-
_preElems(where: string): Element[];
|
|
2886
|
-
/**
|
|
2887
|
-
* Ensures the input is returned as an single element.
|
|
2888
|
-
* Useful to normalize operations across multiple or single elements.
|
|
2889
|
-
*
|
|
2890
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2891
|
-
* @returns {Element} - Always returns an single element.
|
|
2892
|
-
*/
|
|
2893
|
-
_preElem(where: string): Element;
|
|
2894
|
-
/**
|
|
2895
|
-
* Ensures the input is returned as an array.
|
|
2896
|
-
* Useful to normalize operations across multiple or single nodes.
|
|
2897
|
-
*
|
|
2898
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2899
|
-
* @returns {Node[]} - Always returns an array of nodes.
|
|
2900
|
-
*/
|
|
2901
|
-
_preNodeElems(where: string): Node[];
|
|
2902
|
-
/**
|
|
2903
|
-
* Ensures the input is returned as an single node.
|
|
2904
|
-
* Useful to normalize operations across multiple or single nodes.
|
|
2905
|
-
*
|
|
2906
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2907
|
-
* @returns {Node} - Always returns an single node.
|
|
2908
|
-
*/
|
|
2909
|
-
_preNodeElem(where: string): Node;
|
|
2910
|
-
/**
|
|
2911
|
-
* Ensures the input is returned as an single node.
|
|
2912
|
-
* Useful to normalize operations across multiple or single nodes.
|
|
2913
|
-
*
|
|
2914
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2915
|
-
* @returns {Node|null} - Always returns an single node or null.
|
|
2916
|
-
*/
|
|
2917
|
-
_preNodeElemWithNull(where: string): Node | null;
|
|
2918
|
-
/**
|
|
2919
|
-
* Ensures the input is returned as an array.
|
|
2920
|
-
* Useful to normalize operations across multiple or single html elements.
|
|
2921
|
-
*
|
|
2922
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2923
|
-
* @returns {HTMLElement[]} - Always returns an array of html elements.
|
|
2924
|
-
*/
|
|
2925
|
-
_preHtmlElems(where: string): HTMLElement[];
|
|
2926
|
-
/**
|
|
2927
|
-
* Ensures the input is returned as an single html element.
|
|
2928
|
-
* Useful to normalize operations across multiple or single html elements.
|
|
2929
|
-
*
|
|
2930
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2931
|
-
* @returns {HTMLElement} - Always returns an single html element.
|
|
2932
|
-
*/
|
|
2933
|
-
_preHtmlElem(where: string): HTMLElement;
|
|
2934
|
-
/**
|
|
2935
|
-
* Ensures the input is returned as an array.
|
|
2936
|
-
* Useful to normalize operations across multiple or single event target elements.
|
|
3943
|
+
* Checks if an element has scrollable content.
|
|
2937
3944
|
*
|
|
2938
|
-
* @
|
|
2939
|
-
* @returns {InputElement[]} - Always returns an array of event target elements.
|
|
2940
|
-
*/
|
|
2941
|
-
_preInputElems(where: string): InputElement[];
|
|
2942
|
-
/**
|
|
2943
|
-
* Ensures the input is returned as an single event target element.
|
|
2944
|
-
* Useful to normalize operations across multiple or single event target elements.
|
|
2945
|
-
*
|
|
2946
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2947
|
-
* @returns {InputElement} - Always returns an single event target element.
|
|
2948
|
-
*/
|
|
2949
|
-
_preInputElem(where: string): InputElement;
|
|
2950
|
-
/**
|
|
2951
|
-
* Ensures the input is returned as an array.
|
|
2952
|
-
* Useful to normalize operations across multiple or single event target elements.
|
|
2953
|
-
*
|
|
2954
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2955
|
-
* @returns {EventTarget[]} - Always returns an array of event target elements.
|
|
2956
|
-
*/
|
|
2957
|
-
_preEventTargetElems(where: string): EventTarget[];
|
|
2958
|
-
/**
|
|
2959
|
-
* Ensures the input is returned as an single event target element.
|
|
2960
|
-
* Useful to normalize operations across multiple or single event target elements.
|
|
2961
|
-
*
|
|
2962
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2963
|
-
* @returns {EventTarget} - Always returns an single event target element.
|
|
2964
|
-
*/
|
|
2965
|
-
_preEventTargetElem(where: string): EventTarget;
|
|
2966
|
-
/**
|
|
2967
|
-
* Ensures the input is returned as an array.
|
|
2968
|
-
* Useful to normalize operations across multiple or single element/window elements.
|
|
2969
|
-
*
|
|
2970
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2971
|
-
* @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
|
|
2972
|
-
*/
|
|
2973
|
-
_preElemsAndWindow(where: string): ElementAndWindow[];
|
|
2974
|
-
/**
|
|
2975
|
-
* Ensures the input is returned as an single element/window element.
|
|
2976
|
-
* Useful to normalize operations across multiple or single element/window elements.
|
|
2977
|
-
*
|
|
2978
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2979
|
-
* @returns {ElementAndWindow} - Always returns an single element/window element.
|
|
2980
|
-
*/
|
|
2981
|
-
_preElemAndWindow(where: string): ElementAndWindow;
|
|
2982
|
-
/**
|
|
2983
|
-
* Ensures the input is returned as an array.
|
|
2984
|
-
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
2985
|
-
*
|
|
2986
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2987
|
-
* @returns {ElementAndWindow[]} - Always returns an array of element/document/window elements.
|
|
2988
|
-
*/
|
|
2989
|
-
_preElemsAndWinAndDoc(where: string): ElementAndWindow[];
|
|
2990
|
-
/**
|
|
2991
|
-
* Ensures the input is returned as an single element/window/document element.
|
|
2992
|
-
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
2993
|
-
*
|
|
2994
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
2995
|
-
* @returns {ElementAndWindow} - Always returns an single element/document/window element.
|
|
2996
|
-
*/
|
|
2997
|
-
_preElemAndWinAndDoc(where: string): ElementAndWindow;
|
|
2998
|
-
/**
|
|
2999
|
-
* Ensures the input is returned as an array.
|
|
3000
|
-
* Useful to normalize operations across multiple or single element with document elements.
|
|
3001
|
-
*
|
|
3002
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
3003
|
-
* @returns {ElementWithDoc[]} - Always returns an array of element with document elements.
|
|
3004
|
-
*/
|
|
3005
|
-
_preElemsWithDoc(where: string): ElementWithDoc[];
|
|
3006
|
-
/**
|
|
3007
|
-
* Ensures the input is returned as an single element with document element.
|
|
3008
|
-
* Useful to normalize operations across multiple or single element with document elements.
|
|
3009
|
-
*
|
|
3010
|
-
* @param {string} where - The method or context name where validation is being called.
|
|
3011
|
-
* @returns {ElementWithDoc} - Always returns an single element/window element.
|
|
3012
|
-
*/
|
|
3013
|
-
_preElemWithDoc(where: string): ElementWithDoc;
|
|
3014
|
-
/**
|
|
3015
|
-
* Returns only the elements **not** matching the given selector or function.
|
|
3016
|
-
*
|
|
3017
|
-
* @param {WinnowRequest} selector
|
|
3018
|
-
* @returns {Element[]}
|
|
3019
|
-
*/
|
|
3020
|
-
not(selector: WinnowRequest): Element[];
|
|
3021
|
-
/**
|
|
3022
|
-
* Finds elements in your element matching a selector within a context.
|
|
3023
|
-
*
|
|
3024
|
-
* @param {string} selector
|
|
3025
|
-
* @returns {Element[]}
|
|
3026
|
-
*/
|
|
3027
|
-
find(selector: string): Element[];
|
|
3028
|
-
/**
|
|
3029
|
-
* Checks if the element matches the selector.
|
|
3030
|
-
*
|
|
3031
|
-
* @param {WinnowRequest} selector
|
|
3032
|
-
* @returns {boolean}
|
|
3033
|
-
*/
|
|
3034
|
-
is(selector: WinnowRequest): boolean;
|
|
3035
|
-
/**
|
|
3036
|
-
* Returns elements from the current list that contain the given target(s).
|
|
3037
|
-
* @param {string|TinyElement|TinyElement[]} target - Selector or DOM element(s).
|
|
3038
|
-
* @returns {Element[]} Elements that contain the target.
|
|
3039
|
-
*/
|
|
3040
|
-
has(target: string | TinyElement | TinyElement[]): Element[];
|
|
3041
|
-
/**
|
|
3042
|
-
* Finds the closest ancestor (including self) that matches the selector.
|
|
3043
|
-
*
|
|
3044
|
-
* @param {string|Element} selector - A selector string or DOM element to match.
|
|
3045
|
-
* @param {Element|null} [context] - An optional context to stop searching.
|
|
3046
|
-
* @returns {Element[]}
|
|
3047
|
-
*/
|
|
3048
|
-
closest(selector: string | Element, context?: Element | null): Element[];
|
|
3049
|
-
/**
|
|
3050
|
-
* Compares two DOM elements to determine if they refer to the same node in the document.
|
|
3051
|
-
*
|
|
3052
|
-
* This performs a strict equality check (`===`) between the two elements.
|
|
3053
|
-
*
|
|
3054
|
-
* @param {TinyNode} elem - The DOM element to compare.
|
|
3055
|
-
* @returns {boolean} `true` if both elements are the same DOM node; otherwise, `false`.
|
|
3056
|
-
*/
|
|
3057
|
-
isSameDom(elem: TinyNode): boolean;
|
|
3058
|
-
/**
|
|
3059
|
-
* Replaces the internal data with a new object.
|
|
3060
|
-
* @param {ElementDataStore} value - Must be a non-null object.
|
|
3061
|
-
* @throws {Error} If the value is not a valid object.
|
|
3062
|
-
*/
|
|
3063
|
-
set _data(value: ElementDataStore);
|
|
3064
|
-
/**
|
|
3065
|
-
* Returns a shallow copy of the internal data.
|
|
3066
|
-
* @type {ElementDataStore}
|
|
3067
|
-
*/
|
|
3068
|
-
get _data(): ElementDataStore;
|
|
3069
|
-
/**
|
|
3070
|
-
* Retrieves data associated with a DOM element.
|
|
3071
|
-
*
|
|
3072
|
-
* If a `key` is provided, the corresponding value is returned.
|
|
3073
|
-
* If no `key` is given, a shallow copy of all stored data is returned.
|
|
3074
|
-
*
|
|
3075
|
-
* @param {string} [key] - The specific key to retrieve from the data store.
|
|
3076
|
-
* @param {boolean} [isPrivate=false] - Whether to access the private data store.
|
|
3077
|
-
* @returns {ElementDataStore|undefined|any} - The stored value, all data, or undefined if the key doesn't exist.
|
|
3078
|
-
*/
|
|
3079
|
-
data(key?: string, isPrivate?: boolean): ElementDataStore | undefined | any;
|
|
3080
|
-
/**
|
|
3081
|
-
* Stores a value associated with a specific key for a DOM element.
|
|
3082
|
-
*
|
|
3083
|
-
* @param {string} key - The key under which the data will be stored.
|
|
3084
|
-
* @param {any} value - The value to store.
|
|
3085
|
-
* @param {boolean} [isPrivate=false] - Whether to store the data in the private store.
|
|
3086
|
-
* @returns {this}
|
|
3087
|
-
*/
|
|
3088
|
-
setData(key: string, value: any, isPrivate?: boolean): this;
|
|
3089
|
-
/**
|
|
3090
|
-
* Checks if a specific key exists in the data store of this element.
|
|
3091
|
-
*
|
|
3092
|
-
* @param {string} key - The key to check.
|
|
3093
|
-
* @param {boolean} [isPrivate=false] - Whether to check the private store.
|
|
3094
|
-
* @returns {boolean}
|
|
3095
|
-
*/
|
|
3096
|
-
hasData(key: string, isPrivate?: boolean): boolean;
|
|
3097
|
-
/**
|
|
3098
|
-
* Removes a value associated with a specific key from the data store of this element.
|
|
3099
|
-
*
|
|
3100
|
-
* @param {string} key - The key to remove.
|
|
3101
|
-
* @param {boolean} [isPrivate=false] - Whether to remove from the private store.
|
|
3102
|
-
* @returns {boolean}
|
|
3103
|
-
*/
|
|
3104
|
-
removeData(key: string, isPrivate?: boolean): boolean;
|
|
3105
|
-
/**
|
|
3106
|
-
* Returns the direct parent node of the given element, excluding document fragments.
|
|
3107
|
-
*
|
|
3108
|
-
* @returns {ParentNode|null} The parent node or null if not found.
|
|
3109
|
-
*/
|
|
3110
|
-
parent(): ParentNode | null;
|
|
3111
|
-
/**
|
|
3112
|
-
* Returns all ancestor nodes of the given element, optionally stopping before a specific ancestor.
|
|
3113
|
-
*
|
|
3114
|
-
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
3115
|
-
* @returns {ChildNode[]} An array of ancestor nodes.
|
|
3116
|
-
*/
|
|
3117
|
-
parents(until?: TinyNode | string): ChildNode[];
|
|
3118
|
-
/**
|
|
3119
|
-
* Returns the next sibling of the given element.
|
|
3120
|
-
*
|
|
3121
|
-
* @returns {ChildNode|null} The next sibling or null if none found.
|
|
3122
|
-
*/
|
|
3123
|
-
next(): ChildNode | null;
|
|
3124
|
-
/**
|
|
3125
|
-
* Returns the previous sibling of the given element.
|
|
3126
|
-
*
|
|
3127
|
-
* @returns {ChildNode|null} The previous sibling or null if none found.
|
|
3128
|
-
*/
|
|
3129
|
-
prev(): ChildNode | null;
|
|
3130
|
-
/**
|
|
3131
|
-
* Returns all next sibling nodes after the given element.
|
|
3132
|
-
*
|
|
3133
|
-
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
3134
|
-
*/
|
|
3135
|
-
nextAll(): ChildNode[];
|
|
3136
|
-
/**
|
|
3137
|
-
* Returns all previous sibling nodes before the given element.
|
|
3138
|
-
*
|
|
3139
|
-
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
3140
|
-
*/
|
|
3141
|
-
prevAll(): ChildNode[];
|
|
3142
|
-
/**
|
|
3143
|
-
* Returns all next sibling nodes up to (but not including) the node matched by a selector or element.
|
|
3144
|
-
*
|
|
3145
|
-
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
3146
|
-
* @returns {ChildNode[]} An array of next sibling nodes.
|
|
3147
|
-
*/
|
|
3148
|
-
nextUntil(until?: TinyNode | string): ChildNode[];
|
|
3149
|
-
/**
|
|
3150
|
-
* Returns all previous sibling nodes up to (but not including) the node matched by a selector or element.
|
|
3151
|
-
*
|
|
3152
|
-
* @param {TinyNode|string} [until] - A node or selector to stop before.
|
|
3153
|
-
* @returns {ChildNode[]} An array of previous sibling nodes.
|
|
3154
|
-
*/
|
|
3155
|
-
prevUntil(until?: TinyNode | string): ChildNode[];
|
|
3156
|
-
/**
|
|
3157
|
-
* Returns all sibling nodes of the given element, excluding itself.
|
|
3158
|
-
*
|
|
3159
|
-
* @returns {ChildNode[]} An array of sibling nodes.
|
|
3160
|
-
*/
|
|
3161
|
-
siblings(): ChildNode[];
|
|
3162
|
-
/**
|
|
3163
|
-
* Returns all child nodes of the given element.
|
|
3164
|
-
*
|
|
3165
|
-
* @returns {ChildNode[]} An array of child nodes.
|
|
3166
|
-
*/
|
|
3167
|
-
children(): ChildNode[];
|
|
3168
|
-
/**
|
|
3169
|
-
* Returns the contents of the given node. For `<template>` it returns its content; for `<iframe>`, the document.
|
|
3170
|
-
*
|
|
3171
|
-
* @returns {(ChildNode|DocumentFragment)[]|Document[]} An array of child nodes or the content document of an iframe.
|
|
3172
|
-
*/
|
|
3173
|
-
contents(): (ChildNode | DocumentFragment)[] | Document[];
|
|
3174
|
-
/**
|
|
3175
|
-
* Clone the element.
|
|
3176
|
-
* @param {boolean} [deep=true]
|
|
3177
|
-
* @returns {Node}
|
|
3178
|
-
*/
|
|
3179
|
-
clone(deep?: boolean): Node;
|
|
3180
|
-
/**
|
|
3181
|
-
* Appends child elements or strings to the end of the target element(s).
|
|
3182
|
-
*
|
|
3183
|
-
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - The child elements or text to append.
|
|
3184
|
-
* @returns {this}
|
|
3185
|
-
*/
|
|
3186
|
-
append(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
3187
|
-
/**
|
|
3188
|
-
* Prepends child elements or strings to the beginning of the target element(s).
|
|
3189
|
-
*
|
|
3190
|
-
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - The child elements or text to prepend.
|
|
3191
|
-
* @returns {this}
|
|
3192
|
-
*/
|
|
3193
|
-
prepend(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
3194
|
-
/**
|
|
3195
|
-
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
3196
|
-
*
|
|
3197
|
-
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - Elements or text to insert before the target.
|
|
3198
|
-
* @returns {this}
|
|
3199
|
-
*/
|
|
3200
|
-
before(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
3201
|
-
/**
|
|
3202
|
-
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
3203
|
-
*
|
|
3204
|
-
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} children - Elements or text to insert after the target.
|
|
3205
|
-
* @returns {this}
|
|
3206
|
-
*/
|
|
3207
|
-
after(...children: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
3208
|
-
/**
|
|
3209
|
-
* Replaces the target element(s) in the DOM with new elements or text.
|
|
3210
|
-
*
|
|
3211
|
-
* @param {...(AppendCheckerValues|Record<string, AppendCheckerValues>)} newNodes - New elements or text to replace the target.
|
|
3212
|
-
* @returns {this}
|
|
3213
|
-
*/
|
|
3214
|
-
replaceWith(...newNodes: (AppendCheckerValues | Record<string, AppendCheckerValues>)[]): this;
|
|
3215
|
-
/**
|
|
3216
|
-
* Appends the given element(s) to each target element in sequence.
|
|
3217
|
-
*
|
|
3218
|
-
* @param {TinyNode | TinyNode[]} targets - Target element(s) where content will be appended.
|
|
3219
|
-
* @returns {this}
|
|
3220
|
-
*/
|
|
3221
|
-
appendTo(targets: TinyNode | TinyNode[]): this;
|
|
3222
|
-
/**
|
|
3223
|
-
* Prepends the given element(s) to each target element in sequence.
|
|
3224
|
-
*
|
|
3225
|
-
* @param {TinyElement | TinyElement[]} targets - Target element(s) where content will be prepended.
|
|
3226
|
-
* @returns {this}
|
|
3227
|
-
*/
|
|
3228
|
-
prependTo(targets: TinyElement | TinyElement[]): this;
|
|
3229
|
-
/**
|
|
3230
|
-
* Inserts the element before a child of a given target, or before the target itself.
|
|
3231
|
-
*
|
|
3232
|
-
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
3233
|
-
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert before, defaults to target.
|
|
3234
|
-
* @returns {this}
|
|
3235
|
-
*/
|
|
3236
|
-
insertBefore(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): this;
|
|
3237
|
-
/**
|
|
3238
|
-
* Inserts the element after a child of a given target, or after the target itself.
|
|
3239
|
-
*
|
|
3240
|
-
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
3241
|
-
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert after, defaults to target.
|
|
3242
|
-
* @returns {this}
|
|
3243
|
-
*/
|
|
3244
|
-
insertAfter(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): this;
|
|
3245
|
-
/**
|
|
3246
|
-
* Replaces all target elements with the provided element(s).
|
|
3247
|
-
* If multiple targets exist, the inserted elements are cloned accordingly.
|
|
3248
|
-
*
|
|
3249
|
-
* @param {TinyNode | TinyNode[]} targets - The elements to be replaced.
|
|
3250
|
-
* @returns {this}
|
|
3251
|
-
*/
|
|
3252
|
-
replaceAll(targets: TinyNode | TinyNode[]): this;
|
|
3253
|
-
/**
|
|
3254
|
-
* Returns the number of elements currently stored in the internal element list.
|
|
3255
|
-
*
|
|
3256
|
-
* @returns {number} The total count of elements.
|
|
3257
|
-
*/
|
|
3258
|
-
get size(): number;
|
|
3259
|
-
/**
|
|
3260
|
-
* A new TinyHtml object containing the combined elements.
|
|
3261
|
-
*
|
|
3262
|
-
* @template {TinyHtmlConstructor} T
|
|
3263
|
-
* @param {T} el - The elements to add.
|
|
3264
|
-
* @returns {TinyHtml<TinyHtmlT|T>} The new length of the internal collection.
|
|
3265
|
-
*/
|
|
3266
|
-
add<T extends TinyHtmlConstructor>(el: T): TinyHtml<TinyHtmlT | T>;
|
|
3267
|
-
/**
|
|
3268
|
-
* Returns the full computed CSS styles for the given element.
|
|
3269
|
-
*
|
|
3270
|
-
* @returns {CSSStyleDeclaration} The computed style object for the element.
|
|
3271
|
-
*/
|
|
3272
|
-
css(): CSSStyleDeclaration;
|
|
3273
|
-
/**
|
|
3274
|
-
* Returns the value of a specific computed CSS property from the given element as a string.
|
|
3275
|
-
*
|
|
3276
|
-
* @param {string} prop - The name of the CSS property (camelCase or kebab-case).
|
|
3277
|
-
* @returns {string|null} The value of the CSS property as a string, or null if not found or invalid.
|
|
3278
|
-
*/
|
|
3279
|
-
cssString(prop: string): string | null;
|
|
3280
|
-
/**
|
|
3281
|
-
* Returns a subset of computed CSS styles based on the given list of properties.
|
|
3282
|
-
*
|
|
3283
|
-
* @param {string[]} prop - An array of CSS property names to retrieve.
|
|
3284
|
-
* @returns {Partial<CSSStyleDeclaration>} An object containing the requested styles.
|
|
3285
|
-
*/
|
|
3286
|
-
cssList(prop: string[]): Partial<CSSStyleDeclaration>;
|
|
3287
|
-
/**
|
|
3288
|
-
* Returns the computed CSS float value of a property.
|
|
3289
|
-
* @param {string} prop - The CSS property.
|
|
3290
|
-
* @returns {number} - The parsed float value.
|
|
3291
|
-
*/
|
|
3292
|
-
cssFloat(prop: string): number;
|
|
3293
|
-
/**
|
|
3294
|
-
* Returns computed float values of multiple CSS properties.
|
|
3295
|
-
* @param {string[]} prop - An array of CSS properties.
|
|
3296
|
-
* @returns {Record<string, number>} - Map of property to float value.
|
|
3297
|
-
*/
|
|
3298
|
-
cssFloats(prop: string[]): Record<string, number>;
|
|
3299
|
-
/**
|
|
3300
|
-
* Sets one or more CSS inline style properties on the given element(s).
|
|
3301
|
-
*
|
|
3302
|
-
* - If `prop` is a string, the `value` will be applied to that property.
|
|
3303
|
-
* - If `prop` is an object, each key-value pair will be applied as a CSS property and value.
|
|
3304
|
-
*
|
|
3305
|
-
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
3306
|
-
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
3307
|
-
* @returns {this}
|
|
3308
|
-
*/
|
|
3309
|
-
setStyle(prop: string | Object, value?: string | null): this;
|
|
3310
|
-
/**
|
|
3311
|
-
* Gets the value of a specific inline style property.
|
|
3312
|
-
*
|
|
3313
|
-
* Returns only the value set directly via the `style` attribute.
|
|
3314
|
-
*
|
|
3315
|
-
* @param {string} prop - The style property name to retrieve.
|
|
3316
|
-
* @returns {string} The style value of the specified property.
|
|
3317
|
-
*/
|
|
3318
|
-
getStyle(prop: string): string;
|
|
3319
|
-
/**
|
|
3320
|
-
* Gets all inline styles defined directly on the element (`style` attribute).
|
|
3321
|
-
*
|
|
3322
|
-
* Returns an object with all property-value pairs in kebab-case format.
|
|
3323
|
-
*
|
|
3324
|
-
* @param {Object} [settings={}] - Optional configuration settings.
|
|
3325
|
-
* @param {boolean} [settings.camelCase=false] - If `true`, the property names will be converted to camelCase.
|
|
3326
|
-
* @param {boolean} [settings.rawAttr=false] - If `true`, reads the style string from the `style` attribute instead of using the style object.
|
|
3327
|
-
* @returns {Record<string, string>} All inline styles as an object.
|
|
3328
|
-
*/
|
|
3329
|
-
style(settings?: {
|
|
3330
|
-
camelCase?: boolean | undefined;
|
|
3331
|
-
rawAttr?: boolean | undefined;
|
|
3332
|
-
}): Record<string, string>;
|
|
3333
|
-
/**
|
|
3334
|
-
* Removes one or more inline CSS properties from the given element(s).
|
|
3335
|
-
*
|
|
3336
|
-
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
3337
|
-
* @returns {this}
|
|
3338
|
-
*/
|
|
3339
|
-
removeStyle(prop: string | string[]): this;
|
|
3340
|
-
/**
|
|
3341
|
-
* Toggles a CSS property value between two given values.
|
|
3342
|
-
*
|
|
3343
|
-
* The current computed value is compared to `val1`. If it matches, the property is set to `val2`. Otherwise, it is set to `val1`.
|
|
3344
|
-
*
|
|
3345
|
-
* @param {string} prop - The CSS property to toggle.
|
|
3346
|
-
* @param {string} val1 - The first value (used as "current" check).
|
|
3347
|
-
* @param {string} val2 - The second value (used as the "alternative").
|
|
3348
|
-
* @returns {this}
|
|
3349
|
-
*/
|
|
3350
|
-
toggleStyle(prop: string, val1: string, val2: string): this;
|
|
3351
|
-
/**
|
|
3352
|
-
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
3353
|
-
* @returns {this}
|
|
3354
|
-
*/
|
|
3355
|
-
clearStyle(): this;
|
|
3356
|
-
/**
|
|
3357
|
-
* Focus the element.
|
|
3358
|
-
* @returns {this}
|
|
3359
|
-
*/
|
|
3360
|
-
focus(): this;
|
|
3361
|
-
/**
|
|
3362
|
-
* Blur the element.
|
|
3363
|
-
* @returns {this}
|
|
3364
|
-
*/
|
|
3365
|
-
blur(): this;
|
|
3366
|
-
/**
|
|
3367
|
-
* Select the text content of an input or textarea element.
|
|
3368
|
-
* @returns {this}
|
|
3369
|
-
*/
|
|
3370
|
-
select(): this;
|
|
3371
|
-
/**
|
|
3372
|
-
* Gets the width or height of an element based on the box model.
|
|
3373
|
-
* @param {"width"|"height"} type - Dimension type.
|
|
3374
|
-
* @param {"content"|"padding"|"border"|"margin"} extra - Box model context.
|
|
3375
|
-
* @returns {number} - Computed dimension.
|
|
3376
|
-
*/
|
|
3377
|
-
getDimension(type: "width" | "height", extra: "content" | "padding" | "border" | "margin"): number;
|
|
3378
|
-
/**
|
|
3379
|
-
* Sets the height of the element.
|
|
3380
|
-
* @param {string|number} value - Height value.
|
|
3381
|
-
* @returns {this}
|
|
3382
|
-
*/
|
|
3383
|
-
setHeight(value: string | number): this;
|
|
3384
|
-
/**
|
|
3385
|
-
* Sets the height of the element.
|
|
3386
|
-
* @param {string|number} value - Height value.
|
|
3387
|
-
*/
|
|
3388
|
-
set height(value: string | number);
|
|
3389
|
-
/**
|
|
3390
|
-
* Returns content box height.
|
|
3391
|
-
* @returns {number}
|
|
3392
|
-
*/
|
|
3393
|
-
get height(): number;
|
|
3394
|
-
/**
|
|
3395
|
-
* Sets the width of the element.
|
|
3396
|
-
* @param {string|number} value - Width value.
|
|
3397
|
-
* @returns {this}
|
|
3398
|
-
*/
|
|
3399
|
-
setWidth(value: string | number): this;
|
|
3400
|
-
/**
|
|
3401
|
-
* Sets the width of the element.
|
|
3402
|
-
* @param {string|number} value - Width value.
|
|
3403
|
-
*/
|
|
3404
|
-
set width(value: string | number);
|
|
3405
|
-
/**
|
|
3406
|
-
* Returns content box width.
|
|
3407
|
-
* @returns {number}
|
|
3408
|
-
*/
|
|
3409
|
-
get width(): number;
|
|
3410
|
-
/**
|
|
3411
|
-
* Returns padding box height.
|
|
3412
|
-
* @returns {number}
|
|
3413
|
-
*/
|
|
3414
|
-
innerHeight(): number;
|
|
3415
|
-
/**
|
|
3416
|
-
* Returns padding box width.
|
|
3417
|
-
* @returns {number}
|
|
3418
|
-
*/
|
|
3419
|
-
innerWidth(): number;
|
|
3420
|
-
/**
|
|
3421
|
-
* Returns outer height of the element, optionally including margin.
|
|
3422
|
-
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
3423
|
-
* @returns {number}
|
|
3424
|
-
*/
|
|
3425
|
-
outerHeight(includeMargin?: boolean): number;
|
|
3426
|
-
/**
|
|
3427
|
-
* Returns outer width of the element, optionally including margin.
|
|
3428
|
-
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
3429
|
-
* @returns {number}
|
|
3430
|
-
*/
|
|
3431
|
-
outerWidth(includeMargin?: boolean): number;
|
|
3432
|
-
/**
|
|
3433
|
-
* Sets the display value.
|
|
3434
|
-
* @param {string} value
|
|
3435
|
-
* @throws {TypeError} If the value is not a string.
|
|
3436
|
-
*/
|
|
3437
|
-
set mainDisplay(value: string);
|
|
3438
|
-
/**
|
|
3439
|
-
* Gets the current display value.
|
|
3440
|
-
* @returns {string}
|
|
3441
|
-
*/
|
|
3442
|
-
get mainDisplay(): string;
|
|
3443
|
-
/**
|
|
3444
|
-
* Applies style-based effects (slide, fade) to one or more elements.
|
|
3445
|
-
* Converts abstract effect definitions (e.g., `{ height: "show" }`)
|
|
3446
|
-
* into concrete Web Animations API keyframes.
|
|
3447
|
-
*
|
|
3448
|
-
* @param {string} id - The style effect id.
|
|
3449
|
-
* @param {StyleEffects} props - The style effect definition.
|
|
3450
|
-
* @param {number | KeyframeAnimationOptions} [ops] - Timing options.
|
|
3451
|
-
* @returns {StyleFxResult}
|
|
3452
|
-
*/
|
|
3453
|
-
applyStyleFx(id: string, props: StyleEffects, ops?: number | KeyframeAnimationOptions): StyleFxResult;
|
|
3454
|
-
/**
|
|
3455
|
-
* Applies an animation to one or multiple TinyElement instances.
|
|
3456
|
-
*
|
|
3457
|
-
* If `cancelOldAnim` is true, any currently running animation on the same element
|
|
3458
|
-
* will be cancelled before the new one starts.
|
|
3459
|
-
*
|
|
3460
|
-
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - Keyframes that define the animation.
|
|
3461
|
-
* @param {number | KeyframeAnimationOptions | string} [ops] - Timing or configuration options for the animation.
|
|
3462
|
-
* @param {string|null} [id] - The style effect id.
|
|
3463
|
-
* @param {boolean} [cancelOldAnim=TinyHtml.cancelOldStyleFx] - Whether to cancel previous animations on the same element.
|
|
3464
|
-
* @returns {Animation[]}
|
|
3465
|
-
*/
|
|
3466
|
-
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions | string, id?: string | null, cancelOldAnim?: boolean): Animation[];
|
|
3467
|
-
/**
|
|
3468
|
-
* Stops the current animation(s) on this TinyElement instance.
|
|
3469
|
-
*
|
|
3470
|
-
* @returns {boolean[]}
|
|
3471
|
-
*/
|
|
3472
|
-
stop(): boolean[];
|
|
3473
|
-
/**
|
|
3474
|
-
* Show animation (slideDown).
|
|
3475
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3476
|
-
* @returns {StyleFxResult}
|
|
3477
|
-
*/
|
|
3478
|
-
slideDown(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3479
|
-
/**
|
|
3480
|
-
* Hide animation (slideUp).
|
|
3481
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3482
|
-
* @returns {StyleFxResult}
|
|
3483
|
-
*/
|
|
3484
|
-
slideUp(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3485
|
-
/**
|
|
3486
|
-
* Toggle slide animation.
|
|
3487
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3488
|
-
* @returns {StyleFxResult}
|
|
3489
|
-
*/
|
|
3490
|
-
slideToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3491
|
-
/**
|
|
3492
|
-
* Fade in animation.
|
|
3493
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3494
|
-
* @returns {StyleFxResult}
|
|
3495
|
-
*/
|
|
3496
|
-
fadeIn(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3497
|
-
/**
|
|
3498
|
-
* Fade out animation.
|
|
3499
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3500
|
-
* @returns {StyleFxResult}
|
|
3501
|
-
*/
|
|
3502
|
-
fadeOut(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3503
|
-
/**
|
|
3504
|
-
* Fade toggle animation.
|
|
3505
|
-
* @param {number | KeyframeAnimationOptions | string} [ops]
|
|
3506
|
-
* @returns {StyleFxResult}
|
|
3507
|
-
*/
|
|
3508
|
-
fadeToggle(ops?: number | KeyframeAnimationOptions | string): StyleFxResult;
|
|
3509
|
-
/**
|
|
3510
|
-
* Animate the opacity of elements to a target value.
|
|
3511
|
-
* If the element is hidden (display:none), it will be made visible first
|
|
3512
|
-
* so the fade animation can occur.
|
|
3513
|
-
*
|
|
3514
|
-
* @param {number} opacity - Final opacity value (between 0 and 1).
|
|
3515
|
-
* @param {number | KeyframeAnimationOptions | string} [ops] - Duration or animation options.
|
|
3516
|
-
* @param {string} [mainDisplay=this.#mainDisplay] - Sets the main display value.
|
|
3517
|
-
* @returns {StyleFxResult}
|
|
3518
|
-
* @throws {TypeError} If opacity is not a number between 0 and 1.
|
|
3519
|
-
* @throws {TypeError} If ops is not number|string|object when provided.
|
|
3520
|
-
*/
|
|
3521
|
-
fadeTo(opacity: number, ops?: number | KeyframeAnimationOptions | string, mainDisplay?: string): StyleFxResult;
|
|
3522
|
-
/**
|
|
3523
|
-
* Gets the offset of the element relative to the document.
|
|
3524
|
-
* @returns {{top: number, left: number}}
|
|
3525
|
-
*/
|
|
3526
|
-
offset(): {
|
|
3527
|
-
top: number;
|
|
3528
|
-
left: number;
|
|
3529
|
-
};
|
|
3530
|
-
/**
|
|
3531
|
-
* Gets the position of the element relative to its offset parent.
|
|
3532
|
-
* @returns {{top: number, left: number}}
|
|
3533
|
-
*/
|
|
3534
|
-
position(): {
|
|
3535
|
-
top: number;
|
|
3536
|
-
left: number;
|
|
3537
|
-
};
|
|
3538
|
-
/**
|
|
3539
|
-
* Gets the closest positioned ancestor element.
|
|
3540
|
-
* @returns {HTMLElement} - Offset parent element.
|
|
3541
|
-
*/
|
|
3542
|
-
offsetParent(): HTMLElement;
|
|
3543
|
-
/**
|
|
3544
|
-
* Gets the vertical scroll position.
|
|
3545
|
-
* @returns {number}
|
|
3546
|
-
*/
|
|
3547
|
-
scrollTop(): number;
|
|
3548
|
-
/**
|
|
3549
|
-
* Gets the horizontal scroll position.
|
|
3550
|
-
* @returns {number}
|
|
3551
|
-
*/
|
|
3552
|
-
scrollLeft(): number;
|
|
3553
|
-
/**
|
|
3554
|
-
* Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
|
|
3555
|
-
* using a custom duration and easing function.
|
|
3556
|
-
*
|
|
3557
|
-
* If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
|
|
3558
|
-
*
|
|
3559
|
-
* @param {Object} [settings={}] - Configuration object for the scroll animation.
|
|
3560
|
-
* @param {number} [settings.targetX] - The horizontal scroll target in pixels.
|
|
3561
|
-
* @param {number} [settings.targetY] - The vertical scroll target in pixels.
|
|
3562
|
-
* @param {number} [settings.duration] - The duration of the animation in milliseconds.
|
|
3563
|
-
* @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
|
|
3564
|
-
* @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
|
|
3565
|
-
* frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
|
|
3566
|
-
* @returns {this}
|
|
3567
|
-
*/
|
|
3568
|
-
scrollToXY({ targetX, targetY, duration, easing, onAnimation }?: {
|
|
3569
|
-
targetX?: number | undefined;
|
|
3570
|
-
targetY?: number | undefined;
|
|
3571
|
-
duration?: number | undefined;
|
|
3572
|
-
easing?: Easings | undefined;
|
|
3573
|
-
onAnimation?: OnScrollAnimation | undefined;
|
|
3574
|
-
}): this;
|
|
3575
|
-
/**
|
|
3576
|
-
* Sets the vertical scroll position.
|
|
3577
|
-
* @param {number} value - Scroll top value.
|
|
3578
|
-
* @returns {this}
|
|
3579
|
-
*/
|
|
3580
|
-
setScrollTop(value: number): this;
|
|
3581
|
-
/**
|
|
3582
|
-
* Sets the horizontal scroll position.
|
|
3583
|
-
* @param {number} value - Scroll left value.
|
|
3584
|
-
* @returns {this}
|
|
3585
|
-
*/
|
|
3586
|
-
setScrollLeft(value: number): this;
|
|
3587
|
-
/**
|
|
3588
|
-
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
3589
|
-
*
|
|
3590
|
-
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
|
|
3591
|
-
*/
|
|
3592
|
-
borderWidth(): HtmlElBoxSides;
|
|
3593
|
-
/**
|
|
3594
|
-
* Returns the total border size and individual sides from `border{Side}` CSS properties.
|
|
3595
|
-
*
|
|
3596
|
-
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
|
|
3597
|
-
*/
|
|
3598
|
-
border(): HtmlElBoxSides;
|
|
3599
|
-
/**
|
|
3600
|
-
* Returns the total margin and individual sides from `margin{Side}` CSS properties.
|
|
3601
|
-
*
|
|
3602
|
-
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
|
|
3603
|
-
*/
|
|
3604
|
-
margin(): HtmlElBoxSides;
|
|
3605
|
-
/**
|
|
3606
|
-
* Returns the total padding and individual sides from `padding{Side}` CSS properties.
|
|
3607
|
-
*
|
|
3608
|
-
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
3609
|
-
*/
|
|
3610
|
-
padding(): HtmlElBoxSides;
|
|
3611
|
-
/**
|
|
3612
|
-
* Adds one or more CSS class names to the element.
|
|
3613
|
-
* @param {...string} args - One or more class names to add.
|
|
3614
|
-
* @returns {this}
|
|
3615
|
-
*/
|
|
3616
|
-
addClass(...args: string[]): this;
|
|
3617
|
-
/**
|
|
3618
|
-
* Removes one or more CSS class names from the element.
|
|
3619
|
-
* @param {...string} args - One or more class names to remove.
|
|
3620
|
-
* @returns {this}
|
|
3621
|
-
*/
|
|
3622
|
-
removeClass(...args: string[]): this;
|
|
3623
|
-
/**
|
|
3624
|
-
* Replaces an existing class name with a new one.
|
|
3625
|
-
* @param {string} token - The class name to be replaced.
|
|
3626
|
-
* @param {string} newToken - The new class name to apply.
|
|
3627
|
-
* @returns {boolean} Whether the replacement was successful.
|
|
3628
|
-
* @throws {TypeError} If either argument is not a string.
|
|
3629
|
-
*/
|
|
3630
|
-
replaceClass(token: string, newToken: string): boolean;
|
|
3631
|
-
/**
|
|
3632
|
-
* Returns the class name at the specified index.
|
|
3633
|
-
* @param {number} index - The index of the class name.
|
|
3634
|
-
* @returns {string|null} The class name at the index or null if not found.
|
|
3635
|
-
* @throws {TypeError} If the index is not a number.
|
|
3636
|
-
*/
|
|
3637
|
-
classItem(index: number): string | null;
|
|
3638
|
-
/**
|
|
3639
|
-
* Toggles a class name on the element with an optional force boolean.
|
|
3640
|
-
* @param {string} token - The class name to toggle.
|
|
3641
|
-
* @param {boolean} force - If true, adds the class; if false, removes it.
|
|
3642
|
-
* @returns {boolean} Whether the class is present after the toggle.
|
|
3643
|
-
* @throws {TypeError} If token is not a string or force is not a boolean.
|
|
3644
|
-
*/
|
|
3645
|
-
toggleClass(token: string, force: boolean): boolean;
|
|
3646
|
-
/**
|
|
3647
|
-
* Checks if the element contains the given class name.
|
|
3648
|
-
* @param {string} token - The class name to check.
|
|
3649
|
-
* @returns {boolean} True if the class is present, false otherwise.
|
|
3650
|
-
* @throws {TypeError} If token is not a string.
|
|
3651
|
-
*/
|
|
3652
|
-
hasClass(token: string): boolean;
|
|
3653
|
-
/**
|
|
3654
|
-
* Returns the number of classes applied to the element.
|
|
3655
|
-
* @returns {number} The number of classes.
|
|
3656
|
-
*/
|
|
3657
|
-
classLength(): number;
|
|
3658
|
-
/**
|
|
3659
|
-
* Returns all class names as an array of strings.
|
|
3660
|
-
* @returns {string[]} An array of class names.
|
|
3661
|
-
*/
|
|
3662
|
-
classList(): string[];
|
|
3663
|
-
/**
|
|
3664
|
-
* Returns the tag name of the element.
|
|
3665
|
-
* @returns {string} The tag name in uppercase.
|
|
3666
|
-
*/
|
|
3667
|
-
tagName(): string;
|
|
3668
|
-
/**
|
|
3669
|
-
* Set the id on an element.
|
|
3670
|
-
* @param {string} value - Id name.
|
|
3671
|
-
*/
|
|
3672
|
-
set id(value: string);
|
|
3673
|
-
/**
|
|
3674
|
-
* Returns the ID of the element.
|
|
3675
|
-
* @returns {string} The element's ID.
|
|
3676
|
-
*/
|
|
3677
|
-
get id(): string;
|
|
3678
|
-
/**
|
|
3679
|
-
* Returns the BigInt content of the element.
|
|
3680
|
-
* @returns {bigint|null}
|
|
3681
|
-
*/
|
|
3682
|
-
toBigInt(): bigint | null;
|
|
3683
|
-
/**
|
|
3684
|
-
* Set BigInt content of the element.
|
|
3685
|
-
* @param {bigint} value
|
|
3686
|
-
* @returns {this}
|
|
3687
|
-
*/
|
|
3688
|
-
setBigInt(value: bigint): this;
|
|
3689
|
-
/**
|
|
3690
|
-
* Returns the Date content of the element.
|
|
3691
|
-
* @returns {Date|null}
|
|
3692
|
-
*/
|
|
3693
|
-
toDate(): Date | null;
|
|
3694
|
-
/**
|
|
3695
|
-
* Set Date content of the element.
|
|
3696
|
-
* @param {Date} value
|
|
3697
|
-
* @returns {this}
|
|
3698
|
-
*/
|
|
3699
|
-
setDate(value: Date): this;
|
|
3700
|
-
/**
|
|
3701
|
-
* Returns the JSON content of the element.
|
|
3702
|
-
* @returns {any|null}
|
|
3703
|
-
*/
|
|
3704
|
-
toJson(): any | null;
|
|
3705
|
-
/**
|
|
3706
|
-
* Set JSON content of the element.
|
|
3707
|
-
* @param {any} value - A JavaScript value, usually an object or array, to be converted.
|
|
3708
|
-
* @param {(this: any, key: string, value: any) => any} [replacer] - A function that transforms the results.
|
|
3709
|
-
* @param {number|string} [space] - Indentation level or string for formatting.
|
|
3710
|
-
* @returns {this}
|
|
3711
|
-
*/
|
|
3712
|
-
setJson(value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): this;
|
|
3713
|
-
/**
|
|
3714
|
-
* Returns the number content of the element.
|
|
3715
|
-
* @returns {number|null} The text content or null if none.
|
|
3716
|
-
*/
|
|
3717
|
-
toNumber(): number | null;
|
|
3718
|
-
/**
|
|
3719
|
-
* Set number content of the element.
|
|
3720
|
-
* @param {number} value
|
|
3721
|
-
* @returns {this}
|
|
3722
|
-
*/
|
|
3723
|
-
setNumber(value: number): this;
|
|
3724
|
-
/**
|
|
3725
|
-
* Returns the boolean content of the element.
|
|
3726
|
-
* @returns {boolean|null}
|
|
3727
|
-
*/
|
|
3728
|
-
toBoolean(): boolean | null;
|
|
3729
|
-
/**
|
|
3730
|
-
* Set boolean content of the element.
|
|
3731
|
-
* @param {boolean} value
|
|
3732
|
-
* @returns {this}
|
|
3733
|
-
*/
|
|
3734
|
-
setBoolean(value: boolean): this;
|
|
3735
|
-
/**
|
|
3736
|
-
* Returns the string content of the element.
|
|
3737
|
-
* @returns {string|null} The string content or null if none.
|
|
3738
|
-
*/
|
|
3739
|
-
toString(): string | null;
|
|
3740
|
-
/**
|
|
3741
|
-
* Set string content of the element.
|
|
3742
|
-
* @param {string} value
|
|
3743
|
-
* @returns {this}
|
|
3744
|
-
*/
|
|
3745
|
-
setString(value: string): this;
|
|
3746
|
-
/**
|
|
3747
|
-
* Returns the text content of the element.
|
|
3748
|
-
* @returns {string|null} The text content or null if none.
|
|
3749
|
-
*/
|
|
3750
|
-
text(): string | null;
|
|
3751
|
-
/**
|
|
3752
|
-
* Set text content of the element.
|
|
3753
|
-
* @param {*} value
|
|
3754
|
-
* @returns {this}
|
|
3755
|
-
*/
|
|
3756
|
-
setText(value: any): this;
|
|
3757
|
-
/**
|
|
3758
|
-
* Remove all child nodes of the element.
|
|
3759
|
-
* @returns {this}
|
|
3760
|
-
*/
|
|
3761
|
-
empty(): this;
|
|
3762
|
-
/**
|
|
3763
|
-
* Get the innerHTML of the element.
|
|
3764
|
-
* @param {GetHTMLOptions} [ops]
|
|
3765
|
-
* @returns {string}
|
|
3766
|
-
*/
|
|
3767
|
-
html(ops?: GetHTMLOptions): string;
|
|
3768
|
-
/**
|
|
3769
|
-
* Set the innerHTML of the element.
|
|
3770
|
-
* @param {string} value
|
|
3771
|
-
* @returns {this}
|
|
3772
|
-
*/
|
|
3773
|
-
setHtml(value: string): this;
|
|
3774
|
-
/**
|
|
3775
|
-
* Sets the value of the current HTML value element (input, select, textarea, etc.).
|
|
3776
|
-
* Accepts strings, numbers, booleans or arrays of these values, or a callback function that computes them.
|
|
3777
|
-
*
|
|
3778
|
-
* @param {SetValueList|((el: InputElement, val: SetValueList) => SetValueList)} value - The value to assign or a function that returns it.
|
|
3779
|
-
* @returns {this}
|
|
3780
|
-
* @throws {Error} If the computed value is not a valid string or boolean.
|
|
3781
|
-
*/
|
|
3782
|
-
setVal(value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)): this;
|
|
3783
|
-
/**
|
|
3784
|
-
* Retrieves the raw value from the HTML input element.
|
|
3785
|
-
* If a custom value hook exists, it will be used first.
|
|
3786
|
-
*
|
|
3787
|
-
* @param {GetValueTypes} type - The type of value to retrieve ("string", "date", or "number").
|
|
3788
|
-
* @param {string} where - The context/method name using this validation.
|
|
3789
|
-
* @returns {any} The raw value retrieved from the element or hook.
|
|
3790
|
-
*/
|
|
3791
|
-
_val(where: string, type: GetValueTypes): any;
|
|
3792
|
-
/**
|
|
3793
|
-
* Gets the value of the current HTML value element.
|
|
3794
|
-
*
|
|
3795
|
-
* @returns {SetValueList} The normalized value, with carriage returns removed.
|
|
3796
|
-
*/
|
|
3797
|
-
val(): SetValueList;
|
|
3798
|
-
/**
|
|
3799
|
-
* Gets the text of the current HTML value element (for text).
|
|
3800
|
-
*
|
|
3801
|
-
* @returns {string} The text value.
|
|
3802
|
-
* @throws {Error} If the element is not a string value.
|
|
3803
|
-
*/
|
|
3804
|
-
valTxt(): string;
|
|
3805
|
-
/**
|
|
3806
|
-
* Internal helper to get a value from an input expected to return an array.
|
|
3807
|
-
*
|
|
3808
|
-
* @param {string} where - The method name or context using this validation (for error reporting).
|
|
3809
|
-
* @param {GetValueTypes} type - The type of value to retrieve ("string", "date", or "number").
|
|
3810
|
-
* @returns {SetValueBase[]} - The validated value as an array.
|
|
3811
|
-
* @throws {Error} If the returned value is not an array.
|
|
3812
|
-
*/
|
|
3813
|
-
_valArr(where: string, type: GetValueTypes): SetValueBase[];
|
|
3814
|
-
/**
|
|
3815
|
-
* Gets the raw value as a generic array of the current HTML value element (for select).
|
|
3816
|
-
*
|
|
3817
|
-
* @returns {SetValueBase[]} - The value cast as a generic array.
|
|
3818
|
-
* @throws {Error} If the value is not a valid array.
|
|
3819
|
-
*/
|
|
3820
|
-
valArr(): SetValueBase[];
|
|
3821
|
-
/**
|
|
3822
|
-
* Gets the current value parsed as a number (for number/text).
|
|
3823
|
-
*
|
|
3824
|
-
* @returns {number} The numeric value.
|
|
3825
|
-
* @throws {Error} If the element is not a number-compatible input or value is NaN.
|
|
3826
|
-
*/
|
|
3827
|
-
valNb(): number;
|
|
3828
|
-
/**
|
|
3829
|
-
* Gets the current value parsed as a Date (for time/date).
|
|
3830
|
-
*
|
|
3831
|
-
* @returns {Date} The date value.
|
|
3832
|
-
* @throws {Error} If the element is not a date-compatible input.
|
|
3833
|
-
*/
|
|
3834
|
-
valDate(): Date;
|
|
3835
|
-
/**
|
|
3836
|
-
* Checks if the input element is boolean (for checkboxes/radios).
|
|
3837
|
-
*
|
|
3838
|
-
* @returns {boolean} True if the input is considered checked (value === "on"), false otherwise.
|
|
3839
|
-
* @throws {Error} If the element is not a checkbox/radio input.
|
|
3840
|
-
*/
|
|
3841
|
-
valBool(): boolean;
|
|
3842
|
-
/**
|
|
3843
|
-
* Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
|
|
3844
|
-
*
|
|
3845
|
-
* This method allows reacting to pasted content by providing separate callbacks for files and plain text.
|
|
3846
|
-
* Useful for building file upload areas, rich-text editors, or input enhancements.
|
|
3847
|
-
*
|
|
3848
|
-
* @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
|
|
3849
|
-
* @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
|
|
3850
|
-
* @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
|
|
3851
|
-
* @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
|
|
3852
|
-
*/
|
|
3853
|
-
listenForPaste({ onFilePaste, onTextPaste }?: {
|
|
3854
|
-
onFilePaste?: ((data: DataTransferItem, file: File) => void) | undefined;
|
|
3855
|
-
onTextPaste?: ((data: DataTransferItem, text: string) => void) | undefined;
|
|
3856
|
-
}): EventListenerOrEventListenerObject;
|
|
3857
|
-
/**
|
|
3858
|
-
* Checks if the element has a listener for a specific event.
|
|
3859
|
-
*
|
|
3860
|
-
* @param {string} event - The event name to check.
|
|
3861
|
-
* @returns {boolean}
|
|
3862
|
-
*/
|
|
3863
|
-
hasEventListener(event: string): boolean;
|
|
3864
|
-
/**
|
|
3865
|
-
* Checks if the element has the exact handler registered for a specific event.
|
|
3866
|
-
*
|
|
3867
|
-
* @param {string} event - The event name to check.
|
|
3868
|
-
* @param {EventListenerOrEventListenerObject} handler - The handler function to check.
|
|
3869
|
-
* @returns {boolean}
|
|
3870
|
-
*/
|
|
3871
|
-
hasExactEventListener(event: string, handler: EventListenerOrEventListenerObject): boolean;
|
|
3872
|
-
/**
|
|
3873
|
-
* Hover event shortcut.
|
|
3874
|
-
*
|
|
3875
|
-
* Adds `mouseenter` and `mouseleave` event listeners to the target.
|
|
3876
|
-
*
|
|
3877
|
-
* @param {HoverEventCallback} fnOver - Callback executed when the mouse enters the target.
|
|
3878
|
-
* @param {HoverEventCallback|null} [fnOut] - Optional callback executed when the mouse leaves
|
|
3879
|
-
* the target. If not provided, `fnOver` will be used for both events.
|
|
3880
|
-
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
3881
|
-
* @returns {this}
|
|
3882
|
-
*/
|
|
3883
|
-
hover(fnOver: HoverEventCallback, fnOut?: HoverEventCallback | null, options?: EventRegistryOptions): this;
|
|
3884
|
-
/**
|
|
3885
|
-
* Registers an event listener on the specified element.
|
|
3886
|
-
*
|
|
3887
|
-
* @param {string|string[]} events - The event type (e.g. 'click', 'keydown').
|
|
3888
|
-
* @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
|
|
3889
|
-
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
3890
|
-
* @returns {this}
|
|
3891
|
-
*/
|
|
3892
|
-
on(events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: EventRegistryOptions): this;
|
|
3893
|
-
/**
|
|
3894
|
-
* Registers an event listener that runs only once, then is removed.
|
|
3895
|
-
*
|
|
3896
|
-
* @param {string|string[]} events - The event type (e.g. 'click', 'keydown').
|
|
3897
|
-
* @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
|
|
3898
|
-
* @param {EventRegistryOptions} [options={}] - Optional event listener options.
|
|
3899
|
-
* @returns {this}
|
|
3900
|
-
*/
|
|
3901
|
-
once(events: string | string[], handler: EventListenerOrEventListenerObject, options?: EventRegistryOptions): this;
|
|
3902
|
-
/**
|
|
3903
|
-
* Removes a specific event listener from an element.
|
|
3904
|
-
*
|
|
3905
|
-
* @param {string|string[]} events - The event type.
|
|
3906
|
-
* @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
|
|
3907
|
-
* @param {boolean|EventListenerOptions} [options] - Optional listener options.
|
|
3908
|
-
* @returns {this}
|
|
3909
|
-
*/
|
|
3910
|
-
off(events: string | string[], handler: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): this;
|
|
3911
|
-
/**
|
|
3912
|
-
* Removes all event listeners of a specific type from the element.
|
|
3913
|
-
*
|
|
3914
|
-
* @param {string|string[]} events - The event type to remove (e.g. 'click').
|
|
3915
|
-
* @returns {this}
|
|
3916
|
-
*/
|
|
3917
|
-
offAll(events: string | string[]): this;
|
|
3918
|
-
/**
|
|
3919
|
-
* Removes all event listeners of all types from the element.
|
|
3920
|
-
*
|
|
3921
|
-
* @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
|
|
3922
|
-
* Optional filter function to selectively remove specific handlers.
|
|
3923
|
-
* @returns {this}
|
|
3924
|
-
*/
|
|
3925
|
-
offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject | null, event: string) => boolean) | null): this;
|
|
3926
|
-
/**
|
|
3927
|
-
* Triggers all handlers associated with a specific event on the given element.
|
|
3928
|
-
*
|
|
3929
|
-
* @param {string|string[]} events - Name of the event to trigger.
|
|
3930
|
-
* @param {Event|CustomEvent|CustomEventInit} [payload] - Optional event object or data to pass.
|
|
3931
|
-
* @returns {this}
|
|
3932
|
-
*/
|
|
3933
|
-
trigger(events: string | string[], payload?: Event | CustomEvent | CustomEventInit): this;
|
|
3934
|
-
/**
|
|
3935
|
-
* Returns the BigInt value of an attribute.
|
|
3936
|
-
* @param {string} name
|
|
3937
|
-
* @returns {bigint|null}
|
|
3938
|
-
*/
|
|
3939
|
-
attrBigInt(name: string): bigint | null;
|
|
3940
|
-
/**
|
|
3941
|
-
* Set a BigInt attribute.
|
|
3942
|
-
* @param {string} name
|
|
3943
|
-
* @param {bigint} value
|
|
3944
|
-
* @returns {this}
|
|
3945
|
-
*/
|
|
3946
|
-
setAttrBigInt(name: string, value: bigint): this;
|
|
3947
|
-
/**
|
|
3948
|
-
* Returns the Date value of an attribute.
|
|
3949
|
-
* @param {string} name
|
|
3950
|
-
* @returns {Date|null}
|
|
3951
|
-
*/
|
|
3952
|
-
attrDate(name: string): Date | null;
|
|
3953
|
-
/**
|
|
3954
|
-
* Set a Date attribute.
|
|
3955
|
-
* @param {string} name
|
|
3956
|
-
* @param {Date} value
|
|
3957
|
-
* @returns {this}
|
|
3958
|
-
*/
|
|
3959
|
-
setAttrDate(name: string, value: Date): this;
|
|
3960
|
-
/**
|
|
3961
|
-
* Returns the JSON value of an attribute.
|
|
3962
|
-
* @param {string} name
|
|
3963
|
-
* @returns {any|null}
|
|
3964
|
-
*/
|
|
3965
|
-
attrJson(name: string): any | null;
|
|
3966
|
-
/**
|
|
3967
|
-
* Set a JSON attribute.
|
|
3968
|
-
* @param {string} name
|
|
3969
|
-
* @param {any} value
|
|
3970
|
-
* @param {(this: any, key: string, value: any) => any} [replacer]
|
|
3971
|
-
* @param {number|string} [space]
|
|
3972
|
-
* @returns {this}
|
|
3973
|
-
*/
|
|
3974
|
-
setAttrJson(name: string, value: any, replacer?: (this: any, key: string, value: any) => any, space?: number | string): this;
|
|
3975
|
-
/**
|
|
3976
|
-
* Returns the number value of an attribute.
|
|
3977
|
-
* @param {string} name
|
|
3978
|
-
* @returns {number|null}
|
|
3979
|
-
*/
|
|
3980
|
-
attrNumber(name: string): number | null;
|
|
3981
|
-
/**
|
|
3982
|
-
* Set a number attribute.
|
|
3983
|
-
* @param {string} name
|
|
3984
|
-
* @param {number} value
|
|
3985
|
-
* @returns {this}
|
|
3986
|
-
*/
|
|
3987
|
-
setAttrNumber(name: string, value: number): this;
|
|
3988
|
-
/**
|
|
3989
|
-
* Returns the boolean value of an attribute.
|
|
3990
|
-
* @param {string} name
|
|
3991
|
-
* @returns {boolean|null}
|
|
3992
|
-
*/
|
|
3993
|
-
attrBoolean(name: string): boolean | null;
|
|
3994
|
-
/**
|
|
3995
|
-
* Set a boolean attribute.
|
|
3996
|
-
* @param {string} name
|
|
3997
|
-
* @param {boolean} value
|
|
3998
|
-
* @returns {this}
|
|
3999
|
-
*/
|
|
4000
|
-
setAttrBoolean(name: string, value: boolean): this;
|
|
4001
|
-
/**
|
|
4002
|
-
* Returns the string value of an attribute.
|
|
4003
|
-
* @param {string} name
|
|
4004
|
-
* @returns {string|null}
|
|
4005
|
-
*/
|
|
4006
|
-
attrString(name: string): string | null;
|
|
4007
|
-
/**
|
|
4008
|
-
* Set a string attribute.
|
|
4009
|
-
* @param {string} name
|
|
4010
|
-
* @param {string} value
|
|
4011
|
-
* @returns {this}
|
|
4012
|
-
*/
|
|
4013
|
-
setAttrString(name: string, value: string): this;
|
|
4014
|
-
/**
|
|
4015
|
-
* Get an attribute on an element.
|
|
4016
|
-
* @param {string} name
|
|
4017
|
-
* @returns {string|null}
|
|
4018
|
-
*/
|
|
4019
|
-
attr(name: string): string | null;
|
|
4020
|
-
/**
|
|
4021
|
-
* Set one or multiple attributes on an element.
|
|
4022
|
-
* @param {string|Record<string, any>} name - Attribute name or an object of attributes.
|
|
4023
|
-
* @param {any} [value=null] - Attribute value (ignored if "name" is an object).
|
|
4024
|
-
* @returns {this}
|
|
4025
|
-
*/
|
|
4026
|
-
setAttr(name: string | Record<string, any>, value?: any): this;
|
|
4027
|
-
/**
|
|
4028
|
-
* Remove attribute(s) from an element.
|
|
4029
|
-
* @param {string} name Space-separated list of attributes.
|
|
4030
|
-
* @returns {this}
|
|
4031
|
-
*/
|
|
4032
|
-
removeAttr(name: string): this;
|
|
4033
|
-
/**
|
|
4034
|
-
* Check if an attribute exists on an element.
|
|
4035
|
-
* @param {string} name
|
|
4036
|
-
* @returns {boolean}
|
|
4037
|
-
*/
|
|
4038
|
-
hasAttr(name: string): boolean;
|
|
4039
|
-
/**
|
|
4040
|
-
* Check if a property exists.
|
|
4041
|
-
* @param {string} name
|
|
4042
|
-
* @returns {boolean}
|
|
4043
|
-
*/
|
|
4044
|
-
hasProp(name: string): boolean;
|
|
4045
|
-
/**
|
|
4046
|
-
* Set a property on an element.
|
|
4047
|
-
* @param {...string} names - Property name(s).
|
|
4048
|
-
* @returns {this}
|
|
4049
|
-
*/
|
|
4050
|
-
addProp(...names: string[]): this;
|
|
4051
|
-
/**
|
|
4052
|
-
* Remove a property from an element.
|
|
4053
|
-
* @param {...string} names - Property name(s).
|
|
4054
|
-
* @returns {this}
|
|
4055
|
-
*/
|
|
4056
|
-
removeProp(...names: string[]): this;
|
|
4057
|
-
/**
|
|
4058
|
-
* Toggle one or multiple boolean properties.
|
|
4059
|
-
* @param {string|string[]} name - Property name or a list of property names.
|
|
4060
|
-
* @param {boolean} [force] - Force true/false instead of toggling.
|
|
4061
|
-
* @returns {this}
|
|
4062
|
-
*/
|
|
4063
|
-
toggleProp(name: string | string[], force?: boolean): this;
|
|
4064
|
-
/**
|
|
4065
|
-
* Get properties on an element.
|
|
4066
|
-
*
|
|
4067
|
-
* @param {string} name - Property name.
|
|
4068
|
-
* @returns {any} - Property value if getting, otherwise `undefined`.
|
|
4069
|
-
*/
|
|
4070
|
-
prop(name: string): any;
|
|
4071
|
-
/**
|
|
4072
|
-
* Set a property on this element.
|
|
4073
|
-
* @param {string} name - Property name.
|
|
4074
|
-
* @param {any} value - Value to set.
|
|
4075
|
-
* @returns {this} The same element.
|
|
4076
|
-
*/
|
|
4077
|
-
setProp(name: string, value: any): this;
|
|
4078
|
-
/**
|
|
4079
|
-
* Removes the element from the DOM.
|
|
4080
|
-
* @returns {this}
|
|
4081
|
-
*/
|
|
4082
|
-
remove(): this;
|
|
4083
|
-
/**
|
|
4084
|
-
* Returns the index of the first element within its parent or relative to a selector/element.
|
|
4085
|
-
*
|
|
4086
|
-
* @param {string|TinyElement|null} [elem] - Optional target to compare index against.
|
|
4087
|
-
* @returns {number}
|
|
4088
|
-
*/
|
|
4089
|
-
index(elem?: string | TinyElement | null): number;
|
|
4090
|
-
/**
|
|
4091
|
-
* Determines if two HTML elements are colliding, using a simple bounding box comparison.
|
|
4092
|
-
*
|
|
4093
|
-
* @param {TinyElement} el2 - The second element to compare.
|
|
4094
|
-
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
4095
|
-
* @returns {boolean} - `true` if the elements are colliding, `false` otherwise.
|
|
4096
|
-
*/
|
|
4097
|
-
isCollWith(el2: TinyElement, extraRect?: Partial<TinyCollision.ObjRect>): boolean;
|
|
4098
|
-
/**
|
|
4099
|
-
* Determines if two HTML elements are colliding using a pixel-perfect collision algorithm.
|
|
4100
|
-
*
|
|
4101
|
-
* @param {TinyElement} el2 - The second element to compare.
|
|
4102
|
-
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
4103
|
-
* @returns {boolean} - `true` if the elements are colliding with higher precision, `false` otherwise.
|
|
4104
|
-
*/
|
|
4105
|
-
isCollPerfWith(el2: TinyElement, extraRect?: Partial<TinyCollision.ObjRect>): boolean;
|
|
4106
|
-
/**
|
|
4107
|
-
* Checks if two DOM elements are colliding on the screen, and locks the collision
|
|
4108
|
-
* until the element exits through the same side it entered.
|
|
4109
|
-
*
|
|
4110
|
-
* @param {TinyElement} el2 - Second DOM element (e.g. a container or boundary element).
|
|
4111
|
-
* @param {CollisionDirLock} lockDirection - Direction that must be respected to unlock the collision.
|
|
4112
|
-
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
4113
|
-
* @returns {boolean} True if collision is still active.
|
|
4114
|
-
*/
|
|
4115
|
-
isCollWithLock(el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<TinyCollision.ObjRect>): boolean;
|
|
4116
|
-
/**
|
|
4117
|
-
* Checks if two DOM elements are colliding on the screen, and locks the collision
|
|
4118
|
-
* until the element exits through the same side it entered.
|
|
4119
|
-
*
|
|
4120
|
-
* @param {TinyElement} el2 - Second DOM element (e.g. a container or boundary element).
|
|
4121
|
-
* @param {CollisionDirLock} lockDirection - Direction that must be respected to unlock the collision.
|
|
4122
|
-
* @param {Partial<ObjRect>} [extraRect] - Optional values to expand the size of the first element's rect.
|
|
4123
|
-
* @returns {boolean} True if collision is still active.
|
|
4124
|
-
*/
|
|
4125
|
-
isCollPerfWithLock(el2: TinyElement, lockDirection: CollisionDirLock, extraRect?: Partial<TinyCollision.ObjRect>): boolean;
|
|
4126
|
-
/**
|
|
4127
|
-
* Resets the collision lock for a specific element.
|
|
4128
|
-
*
|
|
4129
|
-
* This removes any previously stored collision direction for the given element,
|
|
4130
|
-
* effectively unlocking its collision state.
|
|
4131
|
-
*
|
|
4132
|
-
* @returns {boolean} Returns `true` if a lock was removed, `false` if no lock was present.
|
|
4133
|
-
*/
|
|
4134
|
-
resetCollLock(): boolean;
|
|
4135
|
-
/**
|
|
4136
|
-
* Resets the collision lock for a specific element and direction.
|
|
4137
|
-
*
|
|
4138
|
-
* @param {CollisionDirLock} direction - The direction to clear the lock from.
|
|
4139
|
-
* @returns {boolean} True if the lock was removed.
|
|
4140
|
-
*/
|
|
4141
|
-
resetCollLockDir(direction: CollisionDirLock): boolean;
|
|
4142
|
-
/**
|
|
4143
|
-
* Checks if the given element is at least partially visible in the viewport.
|
|
4144
|
-
*
|
|
4145
|
-
* @returns {boolean} True if the element is partially in the viewport, false otherwise.
|
|
4146
|
-
*/
|
|
4147
|
-
isInViewport(): boolean;
|
|
4148
|
-
/**
|
|
4149
|
-
* Checks if the given element is fully visible in the viewport (top and bottom).
|
|
4150
|
-
*
|
|
4151
|
-
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
4152
|
-
*/
|
|
4153
|
-
isScrolledIntoView(): boolean;
|
|
4154
|
-
/**
|
|
4155
|
-
* Checks if the given element is at least partially visible within the boundaries of a container.
|
|
4156
|
-
*
|
|
4157
|
-
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
4158
|
-
* @returns {boolean} True if the element is partially visible within the container, false otherwise.
|
|
4159
|
-
*/
|
|
4160
|
-
isInContainer(cont: TinyElement): boolean;
|
|
4161
|
-
/**
|
|
4162
|
-
* Checks if the given element is fully visible within the boundaries of a container (top and bottom).
|
|
4163
|
-
*
|
|
4164
|
-
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
4165
|
-
* @returns {boolean} True if the element is fully visible within the container, false otherwise.
|
|
4166
|
-
*/
|
|
4167
|
-
isFullyInContainer(cont: TinyElement): boolean;
|
|
4168
|
-
/**
|
|
4169
|
-
* Checks if an element has scrollable content.
|
|
4170
|
-
*
|
|
4171
|
-
* @returns {{ v: boolean, h: boolean }} - True if scroll is needed in that direction.
|
|
3945
|
+
* @returns {{ v: boolean, h: boolean }} - True if scroll is needed in that direction.
|
|
4172
3946
|
*/
|
|
4173
3947
|
hasScroll(): {
|
|
4174
3948
|
v: boolean;
|
|
4175
3949
|
h: boolean;
|
|
4176
3950
|
};
|
|
4177
|
-
#private;
|
|
4178
3951
|
}
|
|
4179
|
-
|
|
4180
|
-
import TinyElementObserver from './TinyElementObserver.mjs';
|
|
3952
|
+
export default TinyHtml;
|
|
4181
3953
|
//# sourceMappingURL=TinyHtml.d.mts.map
|