tiny-essentials 1.16.2 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/legacy/crypto/decrypt.cjs +1 -0
- package/dist/legacy/crypto/decrypt.d.mts +1 -0
- package/dist/legacy/crypto/decrypt.mjs +1 -0
- package/dist/legacy/crypto/encrypt.cjs +1 -0
- package/dist/legacy/crypto/encrypt.d.mts +1 -0
- package/dist/legacy/crypto/encrypt.mjs +1 -0
- package/dist/legacy/get/decimalColor.cjs +1 -0
- package/dist/legacy/get/decimalColor.d.mts +1 -0
- package/dist/legacy/get/decimalColor.mjs +1 -0
- package/dist/legacy/get/pagination.cjs +1 -0
- package/dist/legacy/get/pagination.d.mts +1 -0
- package/dist/legacy/get/pagination.mjs +1 -0
- package/dist/legacy/get/queryUrlByName.cjs +1 -0
- package/dist/legacy/get/queryUrlByName.d.mts +1 -0
- package/dist/legacy/get/queryUrlByName.mjs +1 -0
- package/dist/legacy/get/queryUrlJSON.cjs +1 -0
- package/dist/legacy/get/queryUrlJSON.d.mts +1 -0
- package/dist/legacy/get/queryUrlJSON.mjs +1 -0
- package/dist/legacy/get/super_string_filter.cjs +1 -0
- package/dist/legacy/get/super_string_filter.d.mts +1 -0
- package/dist/legacy/get/super_string_filter.mjs +1 -0
- package/dist/legacy/get/versionCheck.cjs +1 -0
- package/dist/legacy/get/versionCheck.d.mts +1 -0
- package/dist/legacy/get/versionCheck.mjs +1 -0
- package/dist/legacy/http/HTTP-1.0.cjs +2 -0
- package/dist/legacy/http/HTTP-1.0.mjs +2 -0
- package/dist/legacy/http/auth.cjs +1 -0
- package/dist/legacy/http/auth.d.mts +1 -0
- package/dist/legacy/http/auth.mjs +1 -0
- package/dist/legacy/http/check_domain.cjs +11 -0
- package/dist/legacy/http/check_domain.d.mts +3 -0
- package/dist/legacy/http/check_domain.mjs +11 -0
- package/dist/legacy/http/csrfTokenAnalyze.cjs +1 -0
- package/dist/legacy/http/csrfTokenAnalyze.d.mts +1 -0
- package/dist/legacy/http/csrfTokenAnalyze.mjs +1 -0
- package/dist/legacy/http/domainValidator.cjs +1 -0
- package/dist/legacy/http/domainValidator.d.mts +1 -0
- package/dist/legacy/http/domainValidator.mjs +1 -0
- package/dist/legacy/http/errorsCallback.cjs +1 -0
- package/dist/legacy/http/errorsCallback.d.mts +1 -0
- package/dist/legacy/http/errorsCallback.mjs +1 -0
- package/dist/legacy/http/fetch/json.cjs +1 -0
- package/dist/legacy/http/fetch/json.d.mts +1 -0
- package/dist/legacy/http/fetch/json.mjs +1 -0
- package/dist/legacy/http/fetch/text.cjs +1 -0
- package/dist/legacy/http/fetch/text.d.mts +1 -0
- package/dist/legacy/http/fetch/text.mjs +1 -0
- package/dist/legacy/http/fileCache.cjs +1 -0
- package/dist/legacy/http/fileCache.d.mts +1 -0
- package/dist/legacy/http/fileCache.mjs +1 -0
- package/dist/legacy/http/getDomainURL.cjs +1 -0
- package/dist/legacy/http/getDomainURL.d.mts +1 -0
- package/dist/legacy/http/getDomainURL.mjs +1 -0
- package/dist/legacy/http/userIP.cjs +1 -0
- package/dist/legacy/http/userIP.d.mts +1 -0
- package/dist/legacy/http/userIP.mjs +1 -0
- package/dist/legacy/libs/capitalize.cjs +1 -0
- package/dist/legacy/libs/capitalize.d.mts +1 -0
- package/dist/legacy/libs/capitalize.mjs +1 -0
- package/dist/legacy/libs/convertBytes.cjs +2 -0
- package/dist/legacy/libs/convertBytes.mjs +2 -0
- package/dist/legacy/libs/custom_module_loader.cjs +2 -0
- package/dist/legacy/libs/custom_module_loader.mjs +2 -0
- package/dist/legacy/libs/dice.cjs +2 -0
- package/dist/legacy/libs/dice.mjs +2 -0
- package/dist/legacy/libs/markdown.cjs +1 -0
- package/dist/legacy/libs/markdown.mjs +1 -0
- package/dist/legacy/libs/percentage.cjs +1 -0
- package/dist/legacy/libs/percentage.mjs +1 -0
- package/dist/legacy/libs/regex/getLetter.cjs +2 -0
- package/dist/legacy/libs/regex/getLetter.d.mts +2 -0
- package/dist/legacy/libs/regex/getLetter.mjs +2 -0
- package/dist/legacy/libs/rule3.cjs +1 -0
- package/dist/legacy/libs/rule3.mjs +1 -0
- package/dist/legacy/momentjs/getAge.cjs +1 -0
- package/dist/legacy/momentjs/getAge.d.mts +1 -0
- package/dist/legacy/momentjs/getAge.mjs +1 -0
- package/dist/legacy/momentjs/timeDuration.cjs +1 -0
- package/dist/legacy/momentjs/timeDuration.d.mts +1 -0
- package/dist/legacy/momentjs/timeDuration.mjs +1 -0
- package/dist/legacy/socket.io/antiFlood/install.cjs +1 -0
- package/dist/legacy/socket.io/antiFlood/install.d.mts +1 -0
- package/dist/legacy/socket.io/antiFlood/install.mjs +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.cjs +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.d.mts +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.mjs +1 -0
- package/dist/legacy/socket.io/cookie-session.cjs +1 -0
- package/dist/legacy/socket.io/cookie-session.d.mts +1 -0
- package/dist/legacy/socket.io/cookie-session.mjs +1 -0
- package/dist/legacy/socket.io/discord.cjs +1 -0
- package/dist/legacy/socket.io/discord.d.mts +1 -0
- package/dist/legacy/socket.io/discord.mjs +1 -0
- package/dist/v1/TinyBasicsEs.js +729 -93
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDragger.js +656 -69
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyEssentials.js +2688 -116
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyHtml.js +656 -69
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinySmartScroller.js +6378 -0
- package/dist/v1/TinySmartScroller.min.js +1 -0
- package/dist/v1/TinyUploadClicker.js +1732 -118
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.js +995 -0
- package/dist/v1/UltraRandomMsgGen.min.js +1 -0
- package/dist/v1/basics/html.cjs +74 -24
- package/dist/v1/basics/html.d.mts +38 -15
- package/dist/v1/basics/html.mjs +63 -20
- package/dist/v1/build/TinySmartScroller.cjs +7 -0
- package/dist/v1/build/TinySmartScroller.d.mts +3 -0
- package/dist/v1/build/TinySmartScroller.mjs +2 -0
- package/dist/v1/build/UltraRandomMsgGen.cjs +7 -0
- package/dist/v1/build/UltraRandomMsgGen.d.mts +3 -0
- package/dist/v1/build/UltraRandomMsgGen.mjs +2 -0
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +3 -1
- package/dist/v1/index.mjs +3 -1
- package/dist/v1/libs/TinyHtml.cjs +656 -69
- package/dist/v1/libs/TinyHtml.d.mts +440 -139
- package/dist/v1/libs/TinyHtml.mjs +591 -72
- package/dist/v1/libs/TinySmartScroller.cjs +976 -0
- package/dist/v1/libs/TinySmartScroller.d.mts +458 -0
- package/dist/v1/libs/TinySmartScroller.mjs +856 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +956 -0
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +390 -0
- package/dist/v1/libs/UltraRandomMsgGen.mjs +825 -0
- package/docs/v1/README.md +2 -0
- package/docs/v1/basics/html.md +17 -2
- package/docs/v1/libs/TinyHtml.md +296 -8
- package/docs/v1/libs/TinySmartScroller.md +523 -0
- package/docs/v1/libs/UltraRandomMsgGen.md +289 -0
- package/package.json +1 -1
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
export default TinyHtml;
|
|
2
|
+
/**
|
|
3
|
+
* Callback invoked on each animation frame with the current scroll position,
|
|
4
|
+
* normalized animation time (`0` to `1`), and a completion flag.
|
|
5
|
+
*/
|
|
6
|
+
export type OnScrollAnimation = (progress: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
isComplete: boolean;
|
|
10
|
+
time: number;
|
|
11
|
+
}) => void;
|
|
12
|
+
/**
|
|
13
|
+
* A list of supported easing function names for smooth animations.
|
|
14
|
+
*/
|
|
15
|
+
export type Easings = "linear" | "easeInQuad" | "easeOutQuad" | "easeInOutQuad" | "easeInCubic" | "easeOutCubic" | "easeInOutCubic";
|
|
2
16
|
/**
|
|
3
17
|
* Represents a raw Node element or an instance of TinyHtml.
|
|
4
18
|
* This type is used to abstract interactions with both plain elements
|
|
@@ -40,6 +54,17 @@ export type TinyElementAndWindow = ElementAndWindow | TinyHtml;
|
|
|
40
54
|
* Useful for functions that operate generically on scrollable or measurable targets.
|
|
41
55
|
*/
|
|
42
56
|
export type ElementAndWindow = Element | Window;
|
|
57
|
+
/**
|
|
58
|
+
* Represents a raw DOM element/window/document or an instance of TinyHtml.
|
|
59
|
+
* This type is used to abstract interactions with both plain elements
|
|
60
|
+
* and wrapped elements via the TinyHtml class.
|
|
61
|
+
*/
|
|
62
|
+
export type TinyElementAndWinAndDoc = ElementAndWinAndDoc | TinyHtml;
|
|
63
|
+
/**
|
|
64
|
+
* Represents a value that can be either a DOM Element, or the global Window object, or the document object.
|
|
65
|
+
* Useful for functions that operate generically on scrollable or measurable targets.
|
|
66
|
+
*/
|
|
67
|
+
export type ElementAndWinAndDoc = Element | Window | Document;
|
|
43
68
|
/**
|
|
44
69
|
* A parameter type used for filtering or matching elements.
|
|
45
70
|
* It can be:
|
|
@@ -54,7 +79,7 @@ export type WinnowRequest = string | Element | Element[] | ((index: number, el:
|
|
|
54
79
|
* Elements accepted as constructor values for TinyHtml.
|
|
55
80
|
* These include common DOM elements and root containers.
|
|
56
81
|
*/
|
|
57
|
-
export type ConstructorElValues = Window | Element | Document;
|
|
82
|
+
export type ConstructorElValues = Window | Element | Document | Text;
|
|
58
83
|
/**
|
|
59
84
|
* The handler function used in event listeners.
|
|
60
85
|
*/
|
|
@@ -186,34 +211,7 @@ declare class TinyHtml {
|
|
|
186
211
|
areElsCollRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
187
212
|
areElsCollPerfTop: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
188
213
|
areElsCollPerfBottom: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
189
|
-
areElsCollPerfLeft: (rect1: TinyCollision.ObjRect,
|
|
190
|
-
/**
|
|
191
|
-
* @typedef {string | number | Date | boolean | null} SetValueBase - Primitive types accepted as input values.
|
|
192
|
-
*/
|
|
193
|
-
/**
|
|
194
|
-
* @typedef {'string' | 'date' | 'number'} GetValueTypes
|
|
195
|
-
* Types of value extractors supported by TinyHtml._valTypes.
|
|
196
|
-
*/
|
|
197
|
-
/**
|
|
198
|
-
* @typedef {SetValueBase|SetValueBase[]} SetValueList - A single value or an array of values to be assigned to the input element.
|
|
199
|
-
*/
|
|
200
|
-
/**
|
|
201
|
-
* A list of HTML form elements that can have a `.value` property used by TinyHtml.
|
|
202
|
-
* Includes common input types used in forms.
|
|
203
|
-
*
|
|
204
|
-
* @typedef {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLOptionElement} InputElement
|
|
205
|
-
*/
|
|
206
|
-
/**
|
|
207
|
-
* TinyHtml is a utility class that provides static and instance-level methods
|
|
208
|
-
* for precise dimension and position computations on HTML elements.
|
|
209
|
-
* It mimics some jQuery functionalities while using native browser APIs.
|
|
210
|
-
*
|
|
211
|
-
* Inspired by the jQuery project's open source implementations of element dimension
|
|
212
|
-
* and offset utilities. This class serves as a lightweight alternative using modern DOM APIs.
|
|
213
|
-
*
|
|
214
|
-
* @class
|
|
215
|
-
*/
|
|
216
|
-
rect2: TinyCollision.ObjRect) => boolean;
|
|
214
|
+
areElsCollPerfLeft: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
217
215
|
areElsCollPerfRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
218
216
|
areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
219
217
|
areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
|
|
@@ -239,36 +237,66 @@ declare class TinyHtml {
|
|
|
239
237
|
y: number;
|
|
240
238
|
};
|
|
241
239
|
};
|
|
240
|
+
/**
|
|
241
|
+
* Creates a new DOM element with the specified tag name and options, then wraps it in a TinyHtml instance.
|
|
242
|
+
*
|
|
243
|
+
* @param {string} tagName - The tag name of the element to create (e.g., 'div', 'span').
|
|
244
|
+
* @param {ElementCreationOptions} ops - Optional settings for creating the element.
|
|
245
|
+
* @returns {TinyHtml} A TinyHtml instance wrapping the newly created DOM element.
|
|
246
|
+
* @throws {TypeError} If tagName is not a string or ops is not an object.
|
|
247
|
+
*/
|
|
248
|
+
static createElement(tagName: string, ops: ElementCreationOptions): TinyHtml;
|
|
249
|
+
/**
|
|
250
|
+
* Creates a new TinyHtml instance that wraps a DOM TextNode.
|
|
251
|
+
*
|
|
252
|
+
* This method is useful when you want to insert raw text content into the DOM
|
|
253
|
+
* without it being interpreted as HTML. The returned instance behaves like any
|
|
254
|
+
* other TinyHtml element and can be appended or manipulated as needed.
|
|
255
|
+
*
|
|
256
|
+
* @param {string} value - The plain text content to be wrapped in a TextNode.
|
|
257
|
+
* @returns {TinyHtml} A TinyHtml instance wrapping the newly created DOM TextNode.
|
|
258
|
+
* @throws {TypeError} If the provided value is not a string.
|
|
259
|
+
*/
|
|
260
|
+
static createTextNode(value: string): TinyHtml;
|
|
261
|
+
/**
|
|
262
|
+
* Creates an HTMLElement or TextNode from an HTML string.
|
|
263
|
+
* Supports both elements and plain text.
|
|
264
|
+
*
|
|
265
|
+
* @param {string} htmlString - The HTML string to convert.
|
|
266
|
+
* @returns {TinyHtml} - A single HTMLElement or TextNode.
|
|
267
|
+
*/
|
|
268
|
+
static createElementFromHTML(htmlString: string): TinyHtml;
|
|
242
269
|
/**
|
|
243
270
|
* Queries the document for the first element matching the CSS selector and wraps it in a TinyHtml instance.
|
|
244
271
|
*
|
|
245
272
|
* @param {string} selector - A valid CSS selector string.
|
|
246
|
-
* @
|
|
247
|
-
* @
|
|
273
|
+
* @param {Document|Element} elem - Target element.
|
|
274
|
+
* @returns {TinyHtml|null} A TinyHtml instance wrapping the matched element.
|
|
248
275
|
*/
|
|
249
|
-
static query(selector: string): TinyHtml;
|
|
276
|
+
static query(selector: string, elem?: Document | Element): TinyHtml | null;
|
|
250
277
|
/**
|
|
251
278
|
* Queries the document for all elements matching the CSS selector and wraps them in TinyHtml instances.
|
|
252
279
|
*
|
|
253
280
|
* @param {string} selector - A valid CSS selector string.
|
|
281
|
+
* @param {Document|Element} elem - Target element.
|
|
254
282
|
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the matched elements.
|
|
255
283
|
*/
|
|
256
|
-
static queryAll(selector: string): TinyHtml[];
|
|
284
|
+
static queryAll(selector: string, elem?: Document | Element): TinyHtml[];
|
|
257
285
|
/**
|
|
258
286
|
* Retrieves an element by its ID and wraps it in a TinyHtml instance.
|
|
259
287
|
*
|
|
260
288
|
* @param {string} selector - The ID of the element to retrieve.
|
|
261
|
-
* @returns {TinyHtml} A TinyHtml instance wrapping the found element.
|
|
262
|
-
* @throws {Error} If no element is found with the specified ID.
|
|
289
|
+
* @returns {TinyHtml|null} A TinyHtml instance wrapping the found element.
|
|
263
290
|
*/
|
|
264
|
-
static getById(selector: string): TinyHtml;
|
|
291
|
+
static getById(selector: string): TinyHtml | null;
|
|
265
292
|
/**
|
|
266
293
|
* Retrieves all elements with the specified class name and wraps them in TinyHtml instances.
|
|
267
294
|
*
|
|
268
295
|
* @param {string} selector - The class name to search for.
|
|
296
|
+
* @param {Document|Element} elem - Target element.
|
|
269
297
|
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
|
|
270
298
|
*/
|
|
271
|
-
static getByClassName(selector: string): TinyHtml[];
|
|
299
|
+
static getByClassName(selector: string, elem?: Document | Element): TinyHtml[];
|
|
272
300
|
/**
|
|
273
301
|
* Retrieves all elements with the specified name attribute and wraps them in TinyHtml instances.
|
|
274
302
|
*
|
|
@@ -282,9 +310,10 @@ declare class TinyHtml {
|
|
|
282
310
|
*
|
|
283
311
|
* @param {string} localName - The local name (tag) of the elements to search for.
|
|
284
312
|
* @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
|
|
313
|
+
* @param {Document|Element} elem - Target element.
|
|
285
314
|
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
|
|
286
315
|
*/
|
|
287
|
-
static getByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml[];
|
|
316
|
+
static getByTagNameNS(localName: string, namespaceURI?: string | null, elem?: Document | Element): TinyHtml[];
|
|
288
317
|
/**
|
|
289
318
|
* @param {TinyElement|EventTarget|null|(TinyElement|EventTarget|null)[]} elems
|
|
290
319
|
* @param {string} where
|
|
@@ -434,6 +463,26 @@ declare class TinyHtml {
|
|
|
434
463
|
* @readonly
|
|
435
464
|
*/
|
|
436
465
|
static readonly _preElemAndWindow(elems: TinyElementAndWindow | TinyElementAndWindow[], where: string): ElementAndWindow;
|
|
466
|
+
/**
|
|
467
|
+
* Ensures the input is returned as an array.
|
|
468
|
+
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
469
|
+
*
|
|
470
|
+
* @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
|
|
471
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
472
|
+
* @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
|
|
473
|
+
* @readonly
|
|
474
|
+
*/
|
|
475
|
+
static readonly _preElemsAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow[];
|
|
476
|
+
/**
|
|
477
|
+
* Ensures the input is returned as an single element/window/document element.
|
|
478
|
+
* Useful to normalize operations across multiple or single element/window/document elements.
|
|
479
|
+
*
|
|
480
|
+
* @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
|
|
481
|
+
* @param {string} where - The method or context name where validation is being called.
|
|
482
|
+
* @returns {ElementAndWindow} - Always returns an single element/window element.
|
|
483
|
+
* @readonly
|
|
484
|
+
*/
|
|
485
|
+
static readonly _preElemAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow;
|
|
437
486
|
/**
|
|
438
487
|
* Normalizes and converts one or more DOM elements (or TinyHtml instances)
|
|
439
488
|
* into an array of `TinyHtml` instances.
|
|
@@ -568,9 +617,9 @@ declare class TinyHtml {
|
|
|
568
617
|
* @param {string} key - The key under which the data will be stored.
|
|
569
618
|
* @param {any} value - The value to store.
|
|
570
619
|
* @param {boolean} [isPrivate=false] - Whether to store the data in the private store.
|
|
571
|
-
* @returns {
|
|
620
|
+
* @returns {TinyElement}
|
|
572
621
|
*/
|
|
573
|
-
static setData(el: TinyElement, key: string, value: any, isPrivate?: boolean):
|
|
622
|
+
static setData(el: TinyElement, key: string, value: any, isPrivate?: boolean): TinyElement;
|
|
574
623
|
/**
|
|
575
624
|
* Get the sibling element in a given direction.
|
|
576
625
|
*
|
|
@@ -691,76 +740,86 @@ declare class TinyHtml {
|
|
|
691
740
|
/**
|
|
692
741
|
* Appends child elements or strings to the end of the target element(s).
|
|
693
742
|
*
|
|
694
|
-
* @param {TinyElement
|
|
743
|
+
* @param {TinyElement} el - The target element(s) to receive children.
|
|
695
744
|
* @param {...(TinyNode | TinyNode[] | string)} children - The child elements or text to append.
|
|
745
|
+
* @returns {TinyElement}
|
|
696
746
|
*/
|
|
697
|
-
static append(el: TinyElement
|
|
747
|
+
static append(el: TinyElement, ...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
698
748
|
/**
|
|
699
749
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
700
750
|
*
|
|
701
|
-
* @param {TinyElement
|
|
751
|
+
* @param {TinyElement} el - The target element(s) to receive children.
|
|
702
752
|
* @param {...(TinyNode | TinyNode[] | string)} children - The child elements or text to prepend.
|
|
753
|
+
* @returns {TinyElement}
|
|
703
754
|
*/
|
|
704
|
-
static prepend(el: TinyElement
|
|
755
|
+
static prepend(el: TinyElement, ...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
705
756
|
/**
|
|
706
757
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
707
758
|
*
|
|
708
|
-
* @param {TinyElement
|
|
759
|
+
* @param {TinyElement} el - The target element(s) before which new content is inserted.
|
|
709
760
|
* @param {...(TinyNode | TinyNode[] | string)} children - Elements or text to insert before the target.
|
|
761
|
+
* @returns {TinyElement}
|
|
710
762
|
*/
|
|
711
|
-
static before(el: TinyElement
|
|
763
|
+
static before(el: TinyElement, ...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
712
764
|
/**
|
|
713
765
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
714
766
|
*
|
|
715
|
-
* @param {TinyElement
|
|
767
|
+
* @param {TinyElement} el - The target element(s) after which new content is inserted.
|
|
716
768
|
* @param {...(TinyNode | TinyNode[] | string)} children - Elements or text to insert after the target.
|
|
769
|
+
* @returns {TinyElement}
|
|
717
770
|
*/
|
|
718
|
-
static after(el: TinyElement
|
|
771
|
+
static after(el: TinyElement, ...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
719
772
|
/**
|
|
720
773
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
721
774
|
*
|
|
722
|
-
* @param {TinyElement
|
|
775
|
+
* @param {TinyElement} el - The element(s) to be replaced.
|
|
723
776
|
* @param {...(TinyNode | TinyNode[] | string)} newNodes - New elements or text to replace the target.
|
|
777
|
+
* @returns {TinyElement}
|
|
724
778
|
*/
|
|
725
|
-
static replaceWith(el: TinyElement
|
|
779
|
+
static replaceWith(el: TinyElement, ...newNodes: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
726
780
|
/**
|
|
727
781
|
* Appends the given element(s) to each target element in sequence.
|
|
728
782
|
*
|
|
729
783
|
* @param {TinyNode | TinyNode[]} el - The element(s) to append.
|
|
730
784
|
* @param {TinyNode | TinyNode[]} targets - Target element(s) where content will be appended.
|
|
785
|
+
* @returns {TinyNode|TinyNode[]}
|
|
731
786
|
*/
|
|
732
|
-
static appendTo(el: TinyNode | TinyNode[], targets: TinyNode | TinyNode[]):
|
|
787
|
+
static appendTo(el: TinyNode | TinyNode[], targets: TinyNode | TinyNode[]): TinyNode | TinyNode[];
|
|
733
788
|
/**
|
|
734
789
|
* Prepends the given element(s) to each target element in sequence.
|
|
735
790
|
*
|
|
736
791
|
* @param {TinyElement | TinyElement[]} el - The element(s) to prepend.
|
|
737
792
|
* @param {TinyElement | TinyElement[]} targets - Target element(s) where content will be prepended.
|
|
793
|
+
* @returns {TinyElement|TinyElement[]}
|
|
738
794
|
*/
|
|
739
|
-
static prependTo(el: TinyElement | TinyElement[], targets: TinyElement | TinyElement[]):
|
|
795
|
+
static prependTo(el: TinyElement | TinyElement[], targets: TinyElement | TinyElement[]): TinyElement | TinyElement[];
|
|
740
796
|
/**
|
|
741
797
|
* Inserts the element before a child of a given target, or before the target itself.
|
|
742
798
|
*
|
|
743
799
|
* @param {TinyNode | TinyNode[]} el - The element(s) to insert.
|
|
744
800
|
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
745
801
|
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert before, defaults to target.
|
|
802
|
+
* @returns {TinyNode|TinyNode[]}
|
|
746
803
|
*/
|
|
747
|
-
static insertBefore(el: TinyNode | TinyNode[], target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null):
|
|
804
|
+
static insertBefore(el: TinyNode | TinyNode[], target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): TinyNode | TinyNode[];
|
|
748
805
|
/**
|
|
749
806
|
* Inserts the element after a child of a given target, or after the target itself.
|
|
750
807
|
*
|
|
751
808
|
* @param {TinyNode | TinyNode[]} el - The element(s) to insert.
|
|
752
809
|
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
753
810
|
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert after, defaults to target.
|
|
811
|
+
* @returns {TinyNode|TinyNode[]}
|
|
754
812
|
*/
|
|
755
|
-
static insertAfter(el: TinyNode | TinyNode[], target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null):
|
|
813
|
+
static insertAfter(el: TinyNode | TinyNode[], target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): TinyNode | TinyNode[];
|
|
756
814
|
/**
|
|
757
815
|
* Replaces all target elements with the provided element(s).
|
|
758
816
|
* If multiple targets exist, the inserted elements are cloned accordingly.
|
|
759
817
|
*
|
|
760
818
|
* @param {TinyNode | TinyNode[]} el - The new element(s) to insert.
|
|
761
819
|
* @param {TinyNode | TinyNode[]} targets - The elements to be replaced.
|
|
820
|
+
* @returns {TinyNode|TinyNode[]}
|
|
762
821
|
*/
|
|
763
|
-
static replaceAll(el: TinyNode | TinyNode[], targets: TinyNode | TinyNode[]):
|
|
822
|
+
static replaceAll(el: TinyNode | TinyNode[], targets: TinyNode | TinyNode[]): TinyNode | TinyNode[];
|
|
764
823
|
/**
|
|
765
824
|
* Checks whether the given object is a window.
|
|
766
825
|
* @param {*} obj - The object to test.
|
|
@@ -847,8 +906,9 @@ declare class TinyHtml {
|
|
|
847
906
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el - The element to inspect.
|
|
848
907
|
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
849
908
|
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
909
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
850
910
|
*/
|
|
851
|
-
static setStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string | Object, value?: string | null):
|
|
911
|
+
static setStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string | Object, value?: string | null): TinyHtmlElement | TinyHtmlElement[];
|
|
852
912
|
/**
|
|
853
913
|
* Gets the value of a specific inline style property.
|
|
854
914
|
*
|
|
@@ -881,8 +941,9 @@ declare class TinyHtml {
|
|
|
881
941
|
*
|
|
882
942
|
* @param {TinyHtmlElement|TinyHtmlElement[]} el - A single element or an array of elements.
|
|
883
943
|
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
944
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
884
945
|
*/
|
|
885
|
-
static removeStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string | string[]):
|
|
946
|
+
static removeStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string | string[]): TinyHtmlElement | TinyHtmlElement[];
|
|
886
947
|
/**
|
|
887
948
|
* Toggles a CSS property value between two given values.
|
|
888
949
|
*
|
|
@@ -892,26 +953,40 @@ declare class TinyHtml {
|
|
|
892
953
|
* @param {string} prop - The CSS property to toggle.
|
|
893
954
|
* @param {string} val1 - The first value (used as "current" check).
|
|
894
955
|
* @param {string} val2 - The second value (used as the "alternative").
|
|
956
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
895
957
|
*/
|
|
896
|
-
static toggleStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string, val1: string, val2: string):
|
|
958
|
+
static toggleStyle(el: TinyHtmlElement | TinyHtmlElement[], prop: string, val1: string, val2: string): TinyHtmlElement | TinyHtmlElement[];
|
|
897
959
|
/**
|
|
898
960
|
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
899
961
|
*
|
|
900
962
|
* @param {TinyElement|TinyElement[]} el - A single element or an array of elements.
|
|
963
|
+
* @returns {TinyElement|TinyElement[]}
|
|
901
964
|
*/
|
|
902
|
-
static clearStyle(el: TinyElement | TinyElement[]):
|
|
965
|
+
static clearStyle(el: TinyElement | TinyElement[]): TinyElement | TinyElement[];
|
|
903
966
|
/**
|
|
904
967
|
* Focus the element.
|
|
905
968
|
*
|
|
906
969
|
* @param {TinyHtmlElement} el - The element or a selector string.
|
|
970
|
+
* @returns {TinyHtmlElement}
|
|
907
971
|
*/
|
|
908
|
-
static focus(el: TinyHtmlElement):
|
|
972
|
+
static focus(el: TinyHtmlElement): TinyHtmlElement;
|
|
909
973
|
/**
|
|
910
974
|
* Blur the element.
|
|
911
975
|
*
|
|
912
976
|
* @param {TinyHtmlElement} el - The element or a selector string.
|
|
977
|
+
* @returns {TinyHtmlElement}
|
|
913
978
|
*/
|
|
914
|
-
static blur(el: TinyHtmlElement):
|
|
979
|
+
static blur(el: TinyHtmlElement): TinyHtmlElement;
|
|
980
|
+
/**
|
|
981
|
+
* Interprets a value as a boolean `true` if it matches a common truthy representation.
|
|
982
|
+
*
|
|
983
|
+
* This method checks if the input is any of the common forms used to represent `true`,
|
|
984
|
+
* such as the string `'true'`, `'1'`, `'on'`, the boolean `true`, or the number `1`.
|
|
985
|
+
*
|
|
986
|
+
* @param {string|boolean|number} [value] - The value to interpret as boolean.
|
|
987
|
+
* @returns {boolean} `true` if the value represents a truthy state, otherwise `false`.
|
|
988
|
+
*/
|
|
989
|
+
static boolCheck(value?: string | boolean | number): boolean;
|
|
915
990
|
/**
|
|
916
991
|
* Sets the vertical scroll position of the window.
|
|
917
992
|
* @param {number} value - Sets the scroll position.
|
|
@@ -942,67 +1017,96 @@ declare class TinyHtml {
|
|
|
942
1017
|
* @returns {number} - Viewport width in pixels.
|
|
943
1018
|
*/
|
|
944
1019
|
static winInnerWidth(): number;
|
|
1020
|
+
/**
|
|
1021
|
+
* Checks if the page is currently scrolled to the very top.
|
|
1022
|
+
*
|
|
1023
|
+
* This method compares the current vertical scroll position with the total document height.
|
|
1024
|
+
* It's useful for detecting if the user has reached the top of the page.
|
|
1025
|
+
*
|
|
1026
|
+
* @returns {boolean} `true` if the page is scrolled to the top, otherwise `false`.
|
|
1027
|
+
*/
|
|
1028
|
+
static isPageTop(): boolean;
|
|
1029
|
+
/**
|
|
1030
|
+
* Checks if the page is currently scrolled to the very bottom.
|
|
1031
|
+
*
|
|
1032
|
+
* This method uses the `scrollY` and `innerHeight` properties to determine if the
|
|
1033
|
+
* user has reached the end of the document.
|
|
1034
|
+
*
|
|
1035
|
+
* @returns {boolean} `true` if the page is scrolled to the bottom, otherwise `false`.
|
|
1036
|
+
*/
|
|
1037
|
+
static isPageBottom(): boolean;
|
|
945
1038
|
/**
|
|
946
1039
|
* Gets the width or height of an element based on the box model.
|
|
947
|
-
* @param {
|
|
1040
|
+
* @param {TinyElementAndWinAndDoc} el - The element or window.
|
|
948
1041
|
* @param {"width"|"height"} type - Dimension type.
|
|
949
1042
|
* @param {"content"|"padding"|"border"|"margin"} [extra='content'] - Box model context.
|
|
950
1043
|
* @returns {number} - Computed dimension.
|
|
951
1044
|
* @throws {TypeError} If `type` or `extra` is not a string.
|
|
952
1045
|
*/
|
|
953
|
-
static getDimension(el:
|
|
1046
|
+
static getDimension(el: TinyElementAndWinAndDoc, type: "width" | "height", extra?: "content" | "padding" | "border" | "margin"): number;
|
|
954
1047
|
/**
|
|
955
1048
|
* Sets the height of the element.
|
|
956
1049
|
* @param {TinyHtmlElement} el - Target element.
|
|
957
1050
|
* @param {string|number} value - Height value.
|
|
958
1051
|
* @throws {TypeError} If `value` is neither a string nor number.
|
|
1052
|
+
* @returns {TinyHtmlElement}
|
|
959
1053
|
*/
|
|
960
|
-
static setHeight(el: TinyHtmlElement, value: string | number):
|
|
1054
|
+
static setHeight(el: TinyHtmlElement, value: string | number): TinyHtmlElement;
|
|
961
1055
|
/**
|
|
962
1056
|
* Sets the width of the element.
|
|
963
1057
|
* @param {TinyHtmlElement} el - Target element.
|
|
964
1058
|
* @param {string|number} value - Width value.
|
|
965
1059
|
* @throws {TypeError} If `value` is neither a string nor number.
|
|
1060
|
+
* @returns {TinyHtmlElement}
|
|
966
1061
|
*/
|
|
967
|
-
static setWidth(el: TinyHtmlElement, value: string | number):
|
|
1062
|
+
static setWidth(el: TinyHtmlElement, value: string | number): TinyHtmlElement;
|
|
968
1063
|
/**
|
|
969
1064
|
* Returns content box height.
|
|
970
|
-
* @param {
|
|
1065
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
971
1066
|
* @returns {number}
|
|
972
1067
|
*/
|
|
973
|
-
static height(el:
|
|
1068
|
+
static height(el: TinyElementAndWinAndDoc): number;
|
|
974
1069
|
/**
|
|
975
1070
|
* Returns content box width.
|
|
976
|
-
* @param {
|
|
1071
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
977
1072
|
* @returns {number}
|
|
978
1073
|
*/
|
|
979
|
-
static width(el:
|
|
1074
|
+
static width(el: TinyElementAndWinAndDoc): number;
|
|
980
1075
|
/**
|
|
981
1076
|
* Returns padding box height.
|
|
982
|
-
* @param {
|
|
1077
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
983
1078
|
* @returns {number}
|
|
984
1079
|
*/
|
|
985
|
-
static innerHeight(el:
|
|
1080
|
+
static innerHeight(el: TinyElementAndWinAndDoc): number;
|
|
986
1081
|
/**
|
|
987
1082
|
* Returns padding box width.
|
|
988
|
-
* @param {
|
|
1083
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
989
1084
|
* @returns {number}
|
|
990
1085
|
*/
|
|
991
|
-
static innerWidth(el:
|
|
1086
|
+
static innerWidth(el: TinyElementAndWinAndDoc): number;
|
|
992
1087
|
/**
|
|
993
1088
|
* Returns outer height of the element, optionally including margin.
|
|
994
|
-
* @param {
|
|
1089
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
995
1090
|
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
996
1091
|
* @returns {number}
|
|
997
1092
|
*/
|
|
998
|
-
static outerHeight(el:
|
|
1093
|
+
static outerHeight(el: TinyElementAndWinAndDoc, includeMargin?: boolean): number;
|
|
999
1094
|
/**
|
|
1000
1095
|
* Returns outer width of the element, optionally including margin.
|
|
1001
|
-
* @param {
|
|
1096
|
+
* @param {TinyElementAndWinAndDoc} el - Target element.
|
|
1002
1097
|
* @param {boolean} [includeMargin=false] - Whether to include margin.
|
|
1003
1098
|
* @returns {number}
|
|
1004
1099
|
*/
|
|
1005
|
-
static outerWidth(el:
|
|
1100
|
+
static outerWidth(el: TinyElementAndWinAndDoc, includeMargin?: boolean): number;
|
|
1101
|
+
/**
|
|
1102
|
+
* Applies an animation to one or multiple TinyElement instances.
|
|
1103
|
+
*
|
|
1104
|
+
* @param {TinyElement|TinyElement[]} el - A single TinyElement or an array of TinyElements to animate.
|
|
1105
|
+
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - The keyframes used to define the animation.
|
|
1106
|
+
* @param {number | KeyframeAnimationOptions} [ops] - Timing or configuration options for the animation.
|
|
1107
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1108
|
+
*/
|
|
1109
|
+
static animate(el: TinyElement | TinyElement[], keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions): TinyElement | TinyElement[];
|
|
1006
1110
|
/**
|
|
1007
1111
|
* Gets the offset of the element relative to the document.
|
|
1008
1112
|
* @param {TinyElement} el - Target element.
|
|
@@ -1039,18 +1143,55 @@ declare class TinyHtml {
|
|
|
1039
1143
|
* @returns {number}
|
|
1040
1144
|
*/
|
|
1041
1145
|
static scrollLeft(el: TinyElementAndWindow): number;
|
|
1146
|
+
/**
|
|
1147
|
+
* Collection of easing functions used for scroll and animation calculations.
|
|
1148
|
+
* Each function receives a normalized time value (`t` from 0 to 1) and returns the eased progress.
|
|
1149
|
+
*
|
|
1150
|
+
* @type {Record<string, (t: number) => number>}
|
|
1151
|
+
*/
|
|
1152
|
+
static easings: Record<string, (t: number) => number>;
|
|
1153
|
+
/**
|
|
1154
|
+
* Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
|
|
1155
|
+
* using a custom duration and easing function.
|
|
1156
|
+
*
|
|
1157
|
+
* If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
|
|
1158
|
+
*
|
|
1159
|
+
* @param {TinyElementAndWindow | TinyElementAndWindow[]} el - A single element, array of elements, or the window to scroll.
|
|
1160
|
+
* @param {Object} [settings={}] - Configuration object for the scroll animation.
|
|
1161
|
+
* @param {number} [settings.targetX] - The horizontal scroll target in pixels.
|
|
1162
|
+
* @param {number} [settings.targetY] - The vertical scroll target in pixels.
|
|
1163
|
+
* @param {number} [settings.duration] - The duration of the animation in milliseconds.
|
|
1164
|
+
* @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
|
|
1165
|
+
* @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
|
|
1166
|
+
* frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
|
|
1167
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
1168
|
+
* @throws {TypeError} If `el` is not a valid element, array, or window.
|
|
1169
|
+
* @throws {TypeError} If `targetX` or `targetY` is defined but not a number.
|
|
1170
|
+
* @throws {TypeError} If `duration` is defined but not a number.
|
|
1171
|
+
* @throws {TypeError} If `easing` is defined but not a valid easing function name.
|
|
1172
|
+
* @throws {TypeError} If `onAnimation` is defined but not a function.
|
|
1173
|
+
*/
|
|
1174
|
+
static scrollToXY(el: TinyElementAndWindow | TinyElementAndWindow[], { targetX, targetY, duration, easing, onAnimation }?: {
|
|
1175
|
+
targetX?: number | undefined;
|
|
1176
|
+
targetY?: number | undefined;
|
|
1177
|
+
duration?: number | undefined;
|
|
1178
|
+
easing?: Easings | undefined;
|
|
1179
|
+
onAnimation?: OnScrollAnimation | undefined;
|
|
1180
|
+
}): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1042
1181
|
/**
|
|
1043
1182
|
* Sets the vertical scroll position.
|
|
1044
1183
|
* @param {TinyElementAndWindow|TinyElementAndWindow[]} el - Element or window.
|
|
1045
1184
|
* @param {number} value - Scroll top value.
|
|
1185
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
1046
1186
|
*/
|
|
1047
|
-
static setScrollTop(el: TinyElementAndWindow | TinyElementAndWindow[], value: number):
|
|
1187
|
+
static setScrollTop(el: TinyElementAndWindow | TinyElementAndWindow[], value: number): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1048
1188
|
/**
|
|
1049
1189
|
* Sets the horizontal scroll position.
|
|
1050
1190
|
* @param {TinyElementAndWindow|TinyElementAndWindow[]} el - Element or window.
|
|
1051
1191
|
* @param {number} value - Scroll left value.
|
|
1192
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
1052
1193
|
*/
|
|
1053
|
-
static setScrollLeft(el: TinyElementAndWindow | TinyElementAndWindow[], value: number):
|
|
1194
|
+
static setScrollLeft(el: TinyElementAndWindow | TinyElementAndWindow[], value: number): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1054
1195
|
/**
|
|
1055
1196
|
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
1056
1197
|
*
|
|
@@ -1079,8 +1220,8 @@ declare class TinyHtml {
|
|
|
1079
1220
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
1080
1221
|
*/
|
|
1081
1222
|
static padding(el: TinyElement): HtmlElBoxSides;
|
|
1082
|
-
static addClass(el: TinyElement | TinyElement[], ...tokens: string[]):
|
|
1083
|
-
static removeClass(el: TinyElement | TinyElement[], ...tokens: string[]):
|
|
1223
|
+
static addClass(el: TinyElement | TinyElement[], ...tokens: string[]): (TinyElement | TinyElement[]);
|
|
1224
|
+
static removeClass(el: TinyElement | TinyElement[], ...tokens: string[]): (TinyElement | TinyElement[]);
|
|
1084
1225
|
/**
|
|
1085
1226
|
* Replaces an existing class name with a new one.
|
|
1086
1227
|
* @param {TinyElement|TinyElement[]} el - Target element.
|
|
@@ -1149,25 +1290,29 @@ declare class TinyHtml {
|
|
|
1149
1290
|
* Set text content of elements.
|
|
1150
1291
|
* @param {TinyElement|TinyElement[]} el
|
|
1151
1292
|
* @param {string} value
|
|
1293
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1152
1294
|
*/
|
|
1153
|
-
static setText(el: TinyElement | TinyElement[], value: string):
|
|
1295
|
+
static setText(el: TinyElement | TinyElement[], value: string): TinyElement | TinyElement[];
|
|
1154
1296
|
/**
|
|
1155
1297
|
* Remove all child nodes from each element.
|
|
1156
1298
|
* @param {TinyElement|TinyElement[]} el
|
|
1299
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1157
1300
|
*/
|
|
1158
|
-
static empty(el: TinyElement | TinyElement[]):
|
|
1301
|
+
static empty(el: TinyElement | TinyElement[]): TinyElement | TinyElement[];
|
|
1159
1302
|
/**
|
|
1160
1303
|
* Get the innerHTML of the element.
|
|
1161
|
-
* @param {TinyElement
|
|
1304
|
+
* @param {TinyElement} el
|
|
1305
|
+
* @param {GetHTMLOptions} [ops]
|
|
1162
1306
|
* @returns {string}
|
|
1163
1307
|
*/
|
|
1164
|
-
static html(el: TinyElement
|
|
1308
|
+
static html(el: TinyElement, ops?: GetHTMLOptions): string;
|
|
1165
1309
|
/**
|
|
1166
1310
|
* Set the innerHTML of each element.
|
|
1167
1311
|
* @param {TinyElement|TinyElement[]} el
|
|
1168
1312
|
* @param {string} value
|
|
1313
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1169
1314
|
*/
|
|
1170
|
-
static setHtml(el: TinyElement | TinyElement[], value: string):
|
|
1315
|
+
static setHtml(el: TinyElement | TinyElement[], value: string): TinyElement | TinyElement[];
|
|
1171
1316
|
/** @readonly */
|
|
1172
1317
|
static readonly _valHooks: {
|
|
1173
1318
|
option: {
|
|
@@ -1221,8 +1366,9 @@ declare class TinyHtml {
|
|
|
1221
1366
|
* @param {TinyInputElement|TinyInputElement[]} el - Target element.
|
|
1222
1367
|
* @param {SetValueList|((el: InputElement, val: SetValueList) => SetValueList)} value - The value to assign or a function that returns it.
|
|
1223
1368
|
* @throws {Error} If the computed value is not a valid string or boolean.
|
|
1369
|
+
* @returns {TinyInputElement|TinyInputElement[]}
|
|
1224
1370
|
*/
|
|
1225
|
-
static setVal(el: TinyInputElement | TinyInputElement[], value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)):
|
|
1371
|
+
static setVal(el: TinyInputElement | TinyInputElement[], value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)): TinyInputElement | TinyInputElement[];
|
|
1226
1372
|
/**
|
|
1227
1373
|
* Maps value types to their corresponding getter functions.
|
|
1228
1374
|
* Each function extracts a value of a specific type from a compatible HTMLInputElement.
|
|
@@ -1340,8 +1486,9 @@ declare class TinyHtml {
|
|
|
1340
1486
|
* @param {string} event - The event type (e.g. 'click', 'keydown').
|
|
1341
1487
|
* @param {EventRegistryHandle} handler - The callback function to run on event.
|
|
1342
1488
|
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
1489
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1343
1490
|
*/
|
|
1344
|
-
static on(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions):
|
|
1491
|
+
static on(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
|
|
1345
1492
|
/**
|
|
1346
1493
|
* Registers an event listener that runs only once, then is removed.
|
|
1347
1494
|
*
|
|
@@ -1349,8 +1496,9 @@ declare class TinyHtml {
|
|
|
1349
1496
|
* @param {string} event - The event type (e.g. 'click', 'keydown').
|
|
1350
1497
|
* @param {EventRegistryHandle} handler - The callback function to run on event.
|
|
1351
1498
|
* @param {EventRegistryOptions} [options={}] - Optional event listener options.
|
|
1499
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1352
1500
|
*/
|
|
1353
|
-
static once(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions):
|
|
1501
|
+
static once(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
|
|
1354
1502
|
/**
|
|
1355
1503
|
* Removes a specific event listener from an element.
|
|
1356
1504
|
*
|
|
@@ -1358,31 +1506,35 @@ declare class TinyHtml {
|
|
|
1358
1506
|
* @param {string} event - The event type.
|
|
1359
1507
|
* @param {EventRegistryHandle} handler - The function originally bound to the event.
|
|
1360
1508
|
* @param {boolean|EventListenerOptions} [options] - Optional listener options.
|
|
1509
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1361
1510
|
*/
|
|
1362
|
-
static off(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions):
|
|
1511
|
+
static off(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
|
|
1363
1512
|
/**
|
|
1364
1513
|
* Removes all event listeners of a specific type from the element.
|
|
1365
1514
|
*
|
|
1366
1515
|
* @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
|
|
1367
1516
|
* @param {string} event - The event type to remove (e.g. 'click').
|
|
1517
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1368
1518
|
*/
|
|
1369
|
-
static offAll(el: TinyEventTarget | TinyEventTarget[], event: string):
|
|
1519
|
+
static offAll(el: TinyEventTarget | TinyEventTarget[], event: string): TinyEventTarget | TinyEventTarget[];
|
|
1370
1520
|
/**
|
|
1371
1521
|
* Removes all event listeners of all types from the element.
|
|
1372
1522
|
*
|
|
1373
1523
|
* @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
|
|
1374
1524
|
* @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
|
|
1375
1525
|
* Optional filter function to selectively remove specific handlers.
|
|
1526
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1376
1527
|
*/
|
|
1377
|
-
static offAllTypes(el: TinyEventTarget | TinyEventTarget[], filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null):
|
|
1528
|
+
static offAllTypes(el: TinyEventTarget | TinyEventTarget[], filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
|
|
1378
1529
|
/**
|
|
1379
1530
|
* Triggers all handlers associated with a specific event on the given element.
|
|
1380
1531
|
*
|
|
1381
1532
|
* @param {TinyEventTarget|TinyEventTarget[]} el - Target element where the event should be triggered.
|
|
1382
1533
|
* @param {string} event - Name of the event to trigger.
|
|
1383
1534
|
* @param {Event|CustomEvent|CustomEventInit} [payload] - Optional event object or data to pass.
|
|
1535
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
1384
1536
|
*/
|
|
1385
|
-
static trigger(el: TinyEventTarget | TinyEventTarget[], event: string, payload?: Event | CustomEvent | CustomEventInit):
|
|
1537
|
+
static trigger(el: TinyEventTarget | TinyEventTarget[], event: string, payload?: Event | CustomEvent | CustomEventInit): TinyEventTarget | TinyEventTarget[];
|
|
1386
1538
|
/**
|
|
1387
1539
|
* Property name normalization similar to jQuery's propFix.
|
|
1388
1540
|
* @readonly
|
|
@@ -1403,14 +1555,16 @@ declare class TinyHtml {
|
|
|
1403
1555
|
* @param {TinyElement|TinyElement[]} el
|
|
1404
1556
|
* @param {string} name
|
|
1405
1557
|
* @param {string|null} [value=null]
|
|
1558
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1406
1559
|
*/
|
|
1407
|
-
static setAttr(el: TinyElement | TinyElement[], name: string, value?: string | null):
|
|
1560
|
+
static setAttr(el: TinyElement | TinyElement[], name: string, value?: string | null): TinyElement | TinyElement[];
|
|
1408
1561
|
/**
|
|
1409
1562
|
* Remove attribute(s) from an element.
|
|
1410
1563
|
* @param {TinyElement|TinyElement[]} el
|
|
1411
1564
|
* @param {string} name Space-separated list of attributes.
|
|
1565
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1412
1566
|
*/
|
|
1413
|
-
static removeAttr(el: TinyElement | TinyElement[], name: string):
|
|
1567
|
+
static removeAttr(el: TinyElement | TinyElement[], name: string): TinyElement | TinyElement[];
|
|
1414
1568
|
/**
|
|
1415
1569
|
* Check if an attribute exists on an element.
|
|
1416
1570
|
* @param {TinyElement} el
|
|
@@ -1429,14 +1583,16 @@ declare class TinyHtml {
|
|
|
1429
1583
|
* Set a property on an element.
|
|
1430
1584
|
* @param {TinyElement|TinyElement[]} el
|
|
1431
1585
|
* @param {string} name
|
|
1586
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1432
1587
|
*/
|
|
1433
|
-
static addProp(el: TinyElement | TinyElement[], name: string):
|
|
1588
|
+
static addProp(el: TinyElement | TinyElement[], name: string): TinyElement | TinyElement[];
|
|
1434
1589
|
/**
|
|
1435
1590
|
* Remove a property from an element.
|
|
1436
1591
|
* @param {TinyElement|TinyElement[]} el
|
|
1437
1592
|
* @param {string} name
|
|
1593
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1438
1594
|
*/
|
|
1439
|
-
static removeProp(el: TinyElement | TinyElement[], name: string):
|
|
1595
|
+
static removeProp(el: TinyElement | TinyElement[], name: string): TinyElement | TinyElement[];
|
|
1440
1596
|
/**
|
|
1441
1597
|
* Toggle a boolean property.
|
|
1442
1598
|
* @param {TinyElement|TinyElement[]} el
|
|
@@ -1447,8 +1603,9 @@ declare class TinyHtml {
|
|
|
1447
1603
|
/**
|
|
1448
1604
|
* Removes an element from the DOM.
|
|
1449
1605
|
* @param {TinyElement|TinyElement[]} el - The DOM element or selector to remove.
|
|
1606
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1450
1607
|
*/
|
|
1451
|
-
static remove(el: TinyElement | TinyElement[]):
|
|
1608
|
+
static remove(el: TinyElement | TinyElement[]): TinyElement | TinyElement[];
|
|
1452
1609
|
/**
|
|
1453
1610
|
* Returns the index of the first element within its parent or relative to a selector/element.
|
|
1454
1611
|
*
|
|
@@ -1554,12 +1711,68 @@ declare class TinyHtml {
|
|
|
1554
1711
|
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
1555
1712
|
*/
|
|
1556
1713
|
static isScrolledIntoView(el: TinyElement): boolean;
|
|
1714
|
+
/**
|
|
1715
|
+
* Checks if the given element is at least partially visible within the boundaries of a container.
|
|
1716
|
+
*
|
|
1717
|
+
* @param {TinyElement} el - The DOM element to check.
|
|
1718
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
1719
|
+
* @returns {boolean} True if the element is partially visible within the container, false otherwise.
|
|
1720
|
+
*/
|
|
1721
|
+
static isInContainer(el: TinyElement, cont: TinyElement): boolean;
|
|
1722
|
+
/**
|
|
1723
|
+
* Checks if the given element is fully visible within the boundaries of a container (top and bottom).
|
|
1724
|
+
*
|
|
1725
|
+
* @param {TinyElement} el - The DOM element to check.
|
|
1726
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
1727
|
+
* @returns {boolean} True if the element is fully visible within the container, false otherwise.
|
|
1728
|
+
*/
|
|
1729
|
+
static isFullyInContainer(el: TinyElement, cont: TinyElement): boolean;
|
|
1730
|
+
/**
|
|
1731
|
+
* Checks if an element has scrollable content.
|
|
1732
|
+
*
|
|
1733
|
+
* @param {TinyElement} el - The DOM element to check.
|
|
1734
|
+
* @returns {{ v: boolean, h: boolean }} - True if scroll is needed in that direction.
|
|
1735
|
+
*/
|
|
1736
|
+
static hasScroll(el: TinyElement): {
|
|
1737
|
+
v: boolean;
|
|
1738
|
+
h: boolean;
|
|
1739
|
+
};
|
|
1557
1740
|
/**
|
|
1558
1741
|
* Creates an instance of TinyHtml for a specific Element.
|
|
1559
1742
|
* Useful when you want to operate repeatedly on the same element using instance methods.
|
|
1560
1743
|
* @param {ConstructorElValues} el - The element to wrap and manipulate.
|
|
1561
1744
|
*/
|
|
1562
1745
|
constructor(el: ConstructorElValues);
|
|
1746
|
+
/**
|
|
1747
|
+
* Queries the element for the first element matching the CSS selector and wraps it in a TinyHtml instance.
|
|
1748
|
+
*
|
|
1749
|
+
* @param {string} selector - A valid CSS selector string.
|
|
1750
|
+
* @returns {TinyHtml|null} A TinyHtml instance wrapping the matched element.
|
|
1751
|
+
*/
|
|
1752
|
+
querySelector(selector: string): TinyHtml | null;
|
|
1753
|
+
/**
|
|
1754
|
+
* Queries the element for all elements matching the CSS selector and wraps them in TinyHtml instances.
|
|
1755
|
+
*
|
|
1756
|
+
* @param {string} selector - A valid CSS selector string.
|
|
1757
|
+
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the matched elements.
|
|
1758
|
+
*/
|
|
1759
|
+
querySelectorAll(selector: string): TinyHtml[];
|
|
1760
|
+
/**
|
|
1761
|
+
* Retrieves all elements with the specified class name and wraps them in TinyHtml instances.
|
|
1762
|
+
*
|
|
1763
|
+
* @param {string} selector - The class name to search for.
|
|
1764
|
+
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
|
|
1765
|
+
*/
|
|
1766
|
+
getElementsByClassName(selector: string): TinyHtml[];
|
|
1767
|
+
/**
|
|
1768
|
+
* Retrieves all elements with the specified local tag name within the given namespace URI,
|
|
1769
|
+
* and wraps them in TinyHtml instances.
|
|
1770
|
+
*
|
|
1771
|
+
* @param {string} localName - The local name (tag) of the elements to search for.
|
|
1772
|
+
* @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
|
|
1773
|
+
* @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
|
|
1774
|
+
*/
|
|
1775
|
+
getElementsByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml[];
|
|
1563
1776
|
/**
|
|
1564
1777
|
* Returns the current target held by this instance.
|
|
1565
1778
|
*
|
|
@@ -1637,9 +1850,9 @@ declare class TinyHtml {
|
|
|
1637
1850
|
* @param {string} key - The key under which the data will be stored.
|
|
1638
1851
|
* @param {any} value - The value to store.
|
|
1639
1852
|
* @param {boolean} [isPrivate=false] - Whether to store the data in the private store.
|
|
1640
|
-
* @returns {
|
|
1853
|
+
* @returns {TinyElement}
|
|
1641
1854
|
*/
|
|
1642
|
-
setData(key: string, value: any, isPrivate?: boolean):
|
|
1855
|
+
setData(key: string, value: any, isPrivate?: boolean): TinyElement;
|
|
1643
1856
|
/**
|
|
1644
1857
|
* Returns the direct parent node of the given element, excluding document fragments.
|
|
1645
1858
|
*
|
|
@@ -1719,65 +1932,75 @@ declare class TinyHtml {
|
|
|
1719
1932
|
* Appends child elements or strings to the end of the target element(s).
|
|
1720
1933
|
*
|
|
1721
1934
|
* @param {...(TinyNode | TinyNode[] | string)} children - The child elements or text to append.
|
|
1935
|
+
* @returns {TinyElement}
|
|
1722
1936
|
*/
|
|
1723
|
-
append(...children: (TinyNode | TinyNode[] | string)[]):
|
|
1937
|
+
append(...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
1724
1938
|
/**
|
|
1725
1939
|
* Prepends child elements or strings to the beginning of the target element(s).
|
|
1726
1940
|
*
|
|
1727
1941
|
* @param {...(TinyNode | TinyNode[] | string)} children - The child elements or text to prepend.
|
|
1942
|
+
* @returns {TinyElement}
|
|
1728
1943
|
*/
|
|
1729
|
-
prepend(...children: (TinyNode | TinyNode[] | string)[]):
|
|
1944
|
+
prepend(...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
1730
1945
|
/**
|
|
1731
1946
|
* Inserts elements or strings immediately before the target element(s) in the DOM.
|
|
1732
1947
|
*
|
|
1733
1948
|
* @param {...(TinyNode | TinyNode[] | string)} children - Elements or text to insert before the target.
|
|
1949
|
+
* @returns {TinyElement}
|
|
1734
1950
|
*/
|
|
1735
|
-
before(...children: (TinyNode | TinyNode[] | string)[]):
|
|
1951
|
+
before(...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
1736
1952
|
/**
|
|
1737
1953
|
* Inserts elements or strings immediately after the target element(s) in the DOM.
|
|
1738
1954
|
*
|
|
1739
1955
|
* @param {...(TinyNode | TinyNode[] | string)} children - Elements or text to insert after the target.
|
|
1956
|
+
* @returns {TinyElement}
|
|
1740
1957
|
*/
|
|
1741
|
-
after(...children: (TinyNode | TinyNode[] | string)[]):
|
|
1958
|
+
after(...children: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
1742
1959
|
/**
|
|
1743
1960
|
* Replaces the target element(s) in the DOM with new elements or text.
|
|
1744
1961
|
*
|
|
1745
1962
|
* @param {...(TinyNode | TinyNode[] | string)} newNodes - New elements or text to replace the target.
|
|
1963
|
+
* @returns {TinyElement}
|
|
1746
1964
|
*/
|
|
1747
|
-
replaceWith(...newNodes: (TinyNode | TinyNode[] | string)[]):
|
|
1965
|
+
replaceWith(...newNodes: (TinyNode | TinyNode[] | string)[]): TinyElement;
|
|
1748
1966
|
/**
|
|
1749
1967
|
* Appends the given element(s) to each target element in sequence.
|
|
1750
1968
|
*
|
|
1751
1969
|
* @param {TinyNode | TinyNode[]} targets - Target element(s) where content will be appended.
|
|
1970
|
+
* @returns {TinyNode|TinyNode[]}
|
|
1752
1971
|
*/
|
|
1753
|
-
appendTo(targets: TinyNode | TinyNode[]):
|
|
1972
|
+
appendTo(targets: TinyNode | TinyNode[]): TinyNode | TinyNode[];
|
|
1754
1973
|
/**
|
|
1755
1974
|
* Prepends the given element(s) to each target element in sequence.
|
|
1756
1975
|
*
|
|
1757
1976
|
* @param {TinyElement | TinyElement[]} targets - Target element(s) where content will be prepended.
|
|
1977
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1758
1978
|
*/
|
|
1759
|
-
prependTo(targets: TinyElement | TinyElement[]):
|
|
1979
|
+
prependTo(targets: TinyElement | TinyElement[]): TinyElement | TinyElement[];
|
|
1760
1980
|
/**
|
|
1761
1981
|
* Inserts the element before a child of a given target, or before the target itself.
|
|
1762
1982
|
*
|
|
1763
1983
|
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
1764
1984
|
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert before, defaults to target.
|
|
1985
|
+
* @returns {TinyNode|TinyNode[]}
|
|
1765
1986
|
*/
|
|
1766
|
-
insertBefore(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null):
|
|
1987
|
+
insertBefore(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): TinyNode | TinyNode[];
|
|
1767
1988
|
/**
|
|
1768
1989
|
* Inserts the element after a child of a given target, or after the target itself.
|
|
1769
1990
|
*
|
|
1770
1991
|
* @param {TinyNode | TinyNode[]} target - The reference element where insertion happens.
|
|
1771
1992
|
* @param {TinyNode | TinyNode[] | null} [child=null] - Optional child to insert after, defaults to target.
|
|
1993
|
+
* @returns {TinyNode|TinyNode[]}
|
|
1772
1994
|
*/
|
|
1773
|
-
insertAfter(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null):
|
|
1995
|
+
insertAfter(target: TinyNode | TinyNode[], child?: TinyNode | TinyNode[] | null): TinyNode | TinyNode[];
|
|
1774
1996
|
/**
|
|
1775
1997
|
* Replaces all target elements with the provided element(s).
|
|
1776
1998
|
* If multiple targets exist, the inserted elements are cloned accordingly.
|
|
1777
1999
|
*
|
|
1778
2000
|
* @param {TinyNode | TinyNode[]} targets - The elements to be replaced.
|
|
2001
|
+
* @returns {TinyNode|TinyNode[]}
|
|
1779
2002
|
*/
|
|
1780
|
-
replaceAll(targets: TinyNode | TinyNode[]):
|
|
2003
|
+
replaceAll(targets: TinyNode | TinyNode[]): TinyNode | TinyNode[];
|
|
1781
2004
|
/**
|
|
1782
2005
|
* Returns the full computed CSS styles for the given element.
|
|
1783
2006
|
*
|
|
@@ -1818,8 +2041,9 @@ declare class TinyHtml {
|
|
|
1818
2041
|
*
|
|
1819
2042
|
* @param {string|Object} prop - The property name or an object with key-value pairs
|
|
1820
2043
|
* @param {string|null} [value=null] - The value to set (if `prop` is a string)
|
|
2044
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
1821
2045
|
*/
|
|
1822
|
-
setStyle(prop: string | Object, value?: string | null):
|
|
2046
|
+
setStyle(prop: string | Object, value?: string | null): TinyHtmlElement | TinyHtmlElement[];
|
|
1823
2047
|
/**
|
|
1824
2048
|
* Gets the value of a specific inline style property.
|
|
1825
2049
|
*
|
|
@@ -1847,8 +2071,9 @@ declare class TinyHtml {
|
|
|
1847
2071
|
* Removes one or more inline CSS properties from the given element(s).
|
|
1848
2072
|
*
|
|
1849
2073
|
* @param {string|string[]} prop - A property name or an array of property names to remove.
|
|
2074
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
1850
2075
|
*/
|
|
1851
|
-
removeStyle(prop: string | string[]):
|
|
2076
|
+
removeStyle(prop: string | string[]): TinyHtmlElement | TinyHtmlElement[];
|
|
1852
2077
|
/**
|
|
1853
2078
|
* Toggles a CSS property value between two given values.
|
|
1854
2079
|
*
|
|
@@ -1857,21 +2082,24 @@ declare class TinyHtml {
|
|
|
1857
2082
|
* @param {string} prop - The CSS property to toggle.
|
|
1858
2083
|
* @param {string} val1 - The first value (used as "current" check).
|
|
1859
2084
|
* @param {string} val2 - The second value (used as the "alternative").
|
|
2085
|
+
* @returns {TinyHtmlElement|TinyHtmlElement[]}
|
|
1860
2086
|
*/
|
|
1861
|
-
toggleStyle(prop: string, val1: string, val2: string):
|
|
2087
|
+
toggleStyle(prop: string, val1: string, val2: string): TinyHtmlElement | TinyHtmlElement[];
|
|
1862
2088
|
/**
|
|
1863
2089
|
* Removes all inline styles (`style` attribute) from the given element(s).
|
|
1864
|
-
*
|
|
2090
|
+
* @returns {TinyElement|TinyElement[]}
|
|
1865
2091
|
*/
|
|
1866
|
-
clearStyle():
|
|
2092
|
+
clearStyle(): TinyElement | TinyElement[];
|
|
1867
2093
|
/**
|
|
1868
2094
|
* Focus the element.
|
|
2095
|
+
* @returns {TinyHtmlElement}
|
|
1869
2096
|
*/
|
|
1870
|
-
focus():
|
|
2097
|
+
focus(): TinyHtmlElement;
|
|
1871
2098
|
/**
|
|
1872
2099
|
* Blur the element.
|
|
2100
|
+
* @returns {TinyHtmlElement}
|
|
1873
2101
|
*/
|
|
1874
|
-
blur():
|
|
2102
|
+
blur(): TinyHtmlElement;
|
|
1875
2103
|
/**
|
|
1876
2104
|
* Gets the width or height of an element based on the box model.
|
|
1877
2105
|
* @param {"width"|"height"} type - Dimension type.
|
|
@@ -1882,13 +2110,15 @@ declare class TinyHtml {
|
|
|
1882
2110
|
/**
|
|
1883
2111
|
* Sets the height of the element.
|
|
1884
2112
|
* @param {string|number} value - Height value.
|
|
2113
|
+
* @returns {TinyHtmlElement}
|
|
1885
2114
|
*/
|
|
1886
|
-
setHeight(value: string | number):
|
|
2115
|
+
setHeight(value: string | number): TinyHtmlElement;
|
|
1887
2116
|
/**
|
|
1888
2117
|
* Sets the width of the element.
|
|
1889
2118
|
* @param {string|number} value - Width value.
|
|
2119
|
+
* @returns {TinyHtmlElement}
|
|
1890
2120
|
*/
|
|
1891
|
-
setWidth(value: string | number):
|
|
2121
|
+
setWidth(value: string | number): TinyHtmlElement;
|
|
1892
2122
|
/**
|
|
1893
2123
|
* Returns content box height.
|
|
1894
2124
|
* @returns {number}
|
|
@@ -1921,6 +2151,14 @@ declare class TinyHtml {
|
|
|
1921
2151
|
* @returns {number}
|
|
1922
2152
|
*/
|
|
1923
2153
|
outerWidth(includeMargin?: boolean): number;
|
|
2154
|
+
/**
|
|
2155
|
+
* Applies an animation to one or multiple TinyElement instances.
|
|
2156
|
+
*
|
|
2157
|
+
* @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes - The keyframes used to define the animation.
|
|
2158
|
+
* @param {number | KeyframeAnimationOptions} [ops] - Timing or configuration options for the animation.
|
|
2159
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2160
|
+
*/
|
|
2161
|
+
animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, ops?: number | KeyframeAnimationOptions): TinyElement | TinyElement[];
|
|
1924
2162
|
/**
|
|
1925
2163
|
* Gets the offset of the element relative to the document.
|
|
1926
2164
|
* @returns {{top: number, left: number}}
|
|
@@ -1952,16 +2190,40 @@ declare class TinyHtml {
|
|
|
1952
2190
|
* @returns {number}
|
|
1953
2191
|
*/
|
|
1954
2192
|
scrollLeft(): number;
|
|
2193
|
+
/**
|
|
2194
|
+
* Smoothly scrolls one or more elements (or the window) to the specified X and Y coordinates
|
|
2195
|
+
* using a custom duration and easing function.
|
|
2196
|
+
*
|
|
2197
|
+
* If `duration` or a valid `easing` is not provided, the scroll will be performed immediately.
|
|
2198
|
+
*
|
|
2199
|
+
* @param {Object} [settings={}] - Configuration object for the scroll animation.
|
|
2200
|
+
* @param {number} [settings.targetX] - The horizontal scroll target in pixels.
|
|
2201
|
+
* @param {number} [settings.targetY] - The vertical scroll target in pixels.
|
|
2202
|
+
* @param {number} [settings.duration] - The duration of the animation in milliseconds.
|
|
2203
|
+
* @param {Easings} [settings.easing] - The easing function name to use for the scroll animation.
|
|
2204
|
+
* @param {OnScrollAnimation} [settings.onAnimation] - Optional callback invoked on each animation
|
|
2205
|
+
* frame with the current scroll position, normalized animation time (`0` to `1`), and a completion flag.
|
|
2206
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
2207
|
+
*/
|
|
2208
|
+
scrollToXY({ targetX, targetY, duration, easing, onAnimation }?: {
|
|
2209
|
+
targetX?: number | undefined;
|
|
2210
|
+
targetY?: number | undefined;
|
|
2211
|
+
duration?: number | undefined;
|
|
2212
|
+
easing?: Easings | undefined;
|
|
2213
|
+
onAnimation?: OnScrollAnimation | undefined;
|
|
2214
|
+
}): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1955
2215
|
/**
|
|
1956
2216
|
* Sets the vertical scroll position.
|
|
1957
2217
|
* @param {number} value - Scroll top value.
|
|
2218
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
1958
2219
|
*/
|
|
1959
|
-
setScrollTop(value: number):
|
|
2220
|
+
setScrollTop(value: number): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1960
2221
|
/**
|
|
1961
2222
|
* Sets the horizontal scroll position.
|
|
1962
2223
|
* @param {number} value - Scroll left value.
|
|
2224
|
+
* @returns {TinyElementAndWindow|TinyElementAndWindow[]}
|
|
1963
2225
|
*/
|
|
1964
|
-
setScrollLeft(value: number):
|
|
2226
|
+
setScrollLeft(value: number): TinyElementAndWindow | TinyElementAndWindow[];
|
|
1965
2227
|
/**
|
|
1966
2228
|
* Returns the total border width and individual sides from `border{Side}Width` CSS properties.
|
|
1967
2229
|
*
|
|
@@ -1986,8 +2248,8 @@ declare class TinyHtml {
|
|
|
1986
2248
|
* @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
|
|
1987
2249
|
*/
|
|
1988
2250
|
padding(): HtmlElBoxSides;
|
|
1989
|
-
addClass(...tokens: string[]):
|
|
1990
|
-
removeClass(...tokens: string[]):
|
|
2251
|
+
addClass(...tokens: string[]): (TinyElement | TinyElement[]);
|
|
2252
|
+
removeClass(...tokens: string[]): (TinyElement | TinyElement[]);
|
|
1991
2253
|
/**
|
|
1992
2254
|
* Replaces an existing class name with a new one.
|
|
1993
2255
|
* @param {string} token - The class name to be replaced.
|
|
@@ -2046,30 +2308,35 @@ declare class TinyHtml {
|
|
|
2046
2308
|
/**
|
|
2047
2309
|
* Set text content of the element.
|
|
2048
2310
|
* @param {string} value
|
|
2311
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2049
2312
|
*/
|
|
2050
|
-
setText(value: string):
|
|
2313
|
+
setText(value: string): TinyElement | TinyElement[];
|
|
2051
2314
|
/**
|
|
2052
2315
|
* Remove all child nodes of the element.
|
|
2316
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2053
2317
|
*/
|
|
2054
|
-
empty():
|
|
2318
|
+
empty(): TinyElement | TinyElement[];
|
|
2055
2319
|
/**
|
|
2056
2320
|
* Get the innerHTML of the element.
|
|
2321
|
+
* @param {GetHTMLOptions} [ops]
|
|
2057
2322
|
* @returns {string}
|
|
2058
2323
|
*/
|
|
2059
|
-
html(): string;
|
|
2324
|
+
html(ops?: GetHTMLOptions): string;
|
|
2060
2325
|
/**
|
|
2061
2326
|
* Set the innerHTML of the element.
|
|
2062
2327
|
* @param {string} value
|
|
2328
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2063
2329
|
*/
|
|
2064
|
-
setHtml(value: string):
|
|
2330
|
+
setHtml(value: string): TinyElement | TinyElement[];
|
|
2065
2331
|
/**
|
|
2066
2332
|
* Sets the value of the current HTML value element (input, select, textarea, etc.).
|
|
2067
2333
|
* Accepts strings, numbers, booleans or arrays of these values, or a callback function that computes them.
|
|
2068
2334
|
*
|
|
2069
2335
|
* @param {SetValueList|((el: InputElement, val: SetValueList) => SetValueList)} value - The value to assign or a function that returns it.
|
|
2336
|
+
* @returns {TinyInputElement|TinyInputElement[]}
|
|
2070
2337
|
* @throws {Error} If the computed value is not a valid string or boolean.
|
|
2071
2338
|
*/
|
|
2072
|
-
setVal(value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)):
|
|
2339
|
+
setVal(value: SetValueList | ((el: InputElement, val: SetValueList) => SetValueList)): TinyInputElement | TinyInputElement[];
|
|
2073
2340
|
/**
|
|
2074
2341
|
* Retrieves the raw value from the HTML input element.
|
|
2075
2342
|
* If a custom value hook exists, it will be used first.
|
|
@@ -2137,44 +2404,50 @@ declare class TinyHtml {
|
|
|
2137
2404
|
* @param {string} event - The event type (e.g. 'click', 'keydown').
|
|
2138
2405
|
* @param {EventRegistryHandle} handler - The callback function to run on event.
|
|
2139
2406
|
* @param {EventRegistryOptions} [options] - Optional event listener options.
|
|
2407
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2140
2408
|
*/
|
|
2141
|
-
on(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions):
|
|
2409
|
+
on(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
|
|
2142
2410
|
/**
|
|
2143
2411
|
* Registers an event listener that runs only once, then is removed.
|
|
2144
2412
|
*
|
|
2145
2413
|
* @param {string} event - The event type (e.g. 'click', 'keydown').
|
|
2146
2414
|
* @param {EventRegistryHandle} handler - The callback function to run on event.
|
|
2147
2415
|
* @param {EventRegistryOptions} [options={}] - Optional event listener options.
|
|
2416
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2148
2417
|
*/
|
|
2149
|
-
once(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions):
|
|
2418
|
+
once(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
|
|
2150
2419
|
/**
|
|
2151
2420
|
* Removes a specific event listener from an element.
|
|
2152
2421
|
*
|
|
2153
2422
|
* @param {string} event - The event type.
|
|
2154
2423
|
* @param {EventRegistryHandle} handler - The function originally bound to the event.
|
|
2155
2424
|
* @param {boolean|EventListenerOptions} [options] - Optional listener options.
|
|
2425
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2156
2426
|
*/
|
|
2157
|
-
off(event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions):
|
|
2427
|
+
off(event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
|
|
2158
2428
|
/**
|
|
2159
2429
|
* Removes all event listeners of a specific type from the element.
|
|
2160
2430
|
*
|
|
2161
2431
|
* @param {string} event - The event type to remove (e.g. 'click').
|
|
2432
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2162
2433
|
*/
|
|
2163
|
-
offAll(event: string):
|
|
2434
|
+
offAll(event: string): TinyEventTarget | TinyEventTarget[];
|
|
2164
2435
|
/**
|
|
2165
2436
|
* Removes all event listeners of all types from the element.
|
|
2166
2437
|
*
|
|
2167
2438
|
* @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
|
|
2168
2439
|
* Optional filter function to selectively remove specific handlers.
|
|
2440
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2169
2441
|
*/
|
|
2170
|
-
offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null):
|
|
2442
|
+
offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
|
|
2171
2443
|
/**
|
|
2172
2444
|
* Triggers all handlers associated with a specific event on the given element.
|
|
2173
2445
|
*
|
|
2174
2446
|
* @param {string} event - Name of the event to trigger.
|
|
2175
2447
|
* @param {Event|CustomEvent|CustomEventInit} [payload] - Optional event object or data to pass.
|
|
2448
|
+
* @returns {TinyEventTarget|TinyEventTarget[]}
|
|
2176
2449
|
*/
|
|
2177
|
-
trigger(event: string, payload?: Event | CustomEvent | CustomEventInit):
|
|
2450
|
+
trigger(event: string, payload?: Event | CustomEvent | CustomEventInit): TinyEventTarget | TinyEventTarget[];
|
|
2178
2451
|
/**
|
|
2179
2452
|
* Get an attribute on an element.
|
|
2180
2453
|
* @param {string} name
|
|
@@ -2185,13 +2458,15 @@ declare class TinyHtml {
|
|
|
2185
2458
|
* Set an attribute on an element.
|
|
2186
2459
|
* @param {string} name
|
|
2187
2460
|
* @param {string|null} [value=null]
|
|
2461
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2188
2462
|
*/
|
|
2189
|
-
setAttr(name: string, value?: string | null):
|
|
2463
|
+
setAttr(name: string, value?: string | null): TinyElement | TinyElement[];
|
|
2190
2464
|
/**
|
|
2191
2465
|
* Remove attribute(s) from an element.
|
|
2192
2466
|
* @param {string} name Space-separated list of attributes.
|
|
2467
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2193
2468
|
*/
|
|
2194
|
-
removeAttr(name: string):
|
|
2469
|
+
removeAttr(name: string): TinyElement | TinyElement[];
|
|
2195
2470
|
/**
|
|
2196
2471
|
* Check if an attribute exists on an element.
|
|
2197
2472
|
* @param {string} name
|
|
@@ -2207,13 +2482,15 @@ declare class TinyHtml {
|
|
|
2207
2482
|
/**
|
|
2208
2483
|
* Set a property on an element.
|
|
2209
2484
|
* @param {string} name
|
|
2485
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2210
2486
|
*/
|
|
2211
|
-
addProp(name: string):
|
|
2487
|
+
addProp(name: string): TinyElement | TinyElement[];
|
|
2212
2488
|
/**
|
|
2213
2489
|
* Remove a property from an element.
|
|
2214
2490
|
* @param {string} name
|
|
2491
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2215
2492
|
*/
|
|
2216
|
-
removeProp(name: string):
|
|
2493
|
+
removeProp(name: string): TinyElement | TinyElement[];
|
|
2217
2494
|
/**
|
|
2218
2495
|
* Toggle a boolean property.
|
|
2219
2496
|
* @param {string} name
|
|
@@ -2222,8 +2499,9 @@ declare class TinyHtml {
|
|
|
2222
2499
|
toggleProp(name: string, force?: boolean): void;
|
|
2223
2500
|
/**
|
|
2224
2501
|
* Removes the element from the DOM.
|
|
2502
|
+
* @returns {TinyElement|TinyElement[]}
|
|
2225
2503
|
*/
|
|
2226
|
-
remove():
|
|
2504
|
+
remove(): TinyElement | TinyElement[];
|
|
2227
2505
|
/**
|
|
2228
2506
|
* Returns the index of the first element within its parent or relative to a selector/element.
|
|
2229
2507
|
*
|
|
@@ -2295,6 +2573,29 @@ declare class TinyHtml {
|
|
|
2295
2573
|
* @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
|
|
2296
2574
|
*/
|
|
2297
2575
|
isScrolledIntoView(): boolean;
|
|
2576
|
+
/**
|
|
2577
|
+
* Checks if the given element is at least partially visible within the boundaries of a container.
|
|
2578
|
+
*
|
|
2579
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
2580
|
+
* @returns {boolean} True if the element is partially visible within the container, false otherwise.
|
|
2581
|
+
*/
|
|
2582
|
+
isInContainer(cont: TinyElement): boolean;
|
|
2583
|
+
/**
|
|
2584
|
+
* Checks if the given element is fully visible within the boundaries of a container (top and bottom).
|
|
2585
|
+
*
|
|
2586
|
+
* @param {TinyElement} cont - The container element acting as the viewport.
|
|
2587
|
+
* @returns {boolean} True if the element is fully visible within the container, false otherwise.
|
|
2588
|
+
*/
|
|
2589
|
+
isFullyInContainer(cont: TinyElement): boolean;
|
|
2590
|
+
/**
|
|
2591
|
+
* Checks if an element has scrollable content.
|
|
2592
|
+
*
|
|
2593
|
+
* @returns {{ v: boolean, h: boolean }} - True if scroll is needed in that direction.
|
|
2594
|
+
*/
|
|
2595
|
+
hasScroll(): {
|
|
2596
|
+
v: boolean;
|
|
2597
|
+
h: boolean;
|
|
2598
|
+
};
|
|
2298
2599
|
#private;
|
|
2299
2600
|
}
|
|
2300
2601
|
import * as TinyCollision from '../basics/collision.mjs';
|