tiny-essentials 1.20.0 → 1.20.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.
Files changed (55) hide show
  1. package/README.md +5 -0
  2. package/dist/v1/TinyBasicsEs.min.js +1 -1
  3. package/dist/v1/TinyDragger.min.js +1 -1
  4. package/dist/v1/TinyEssentials.min.js +1 -1
  5. package/dist/v1/TinyHtml.min.js +1 -1
  6. package/dist/v1/TinySmartScroller.min.js +1 -1
  7. package/dist/v1/TinyUploadClicker.min.js +1 -1
  8. package/dist/v1/basics/html.cjs +33 -2
  9. package/dist/v1/basics/html.d.mts +14 -4
  10. package/dist/v1/basics/html.mjs +27 -2
  11. package/dist/v1/basics/index.cjs +2 -0
  12. package/dist/v1/basics/index.d.mts +3 -1
  13. package/dist/v1/basics/index.mjs +3 -3
  14. package/dist/v1/basics/simpleMath.cjs +23 -4
  15. package/dist/v1/basics/simpleMath.d.mts +18 -4
  16. package/dist/v1/basics/simpleMath.mjs +22 -4
  17. package/dist/v1/index.cjs +2 -0
  18. package/dist/v1/index.d.mts +3 -1
  19. package/dist/v1/index.mjs +3 -3
  20. package/dist/v1/libs/TinyDragger.cjs +1 -1
  21. package/dist/v1/libs/TinyDragger.mjs +1 -1
  22. package/dist/v1/libs/TinyHtml.cjs +500 -105
  23. package/dist/v1/libs/TinyHtml.d.mts +251 -42
  24. package/dist/v1/libs/TinyHtml.mjs +448 -96
  25. package/dist/v1/libs/TinyIframeEvents.cjs +2 -1
  26. package/dist/v1/libs/TinyNewWinEvents.cjs +4 -2
  27. package/docs/v1/basics/html.md +78 -22
  28. package/docs/v1/basics/simpleMath.md +22 -4
  29. package/docs/v1/libs/TinyHtml.md +268 -6
  30. package/package.json +1 -1
  31. package/dist/v1/ColorSafeStringify.js +0 -235
  32. package/dist/v1/TinyAfterScrollWatcher.js +0 -219
  33. package/dist/v1/TinyBasicsEs.js +0 -9334
  34. package/dist/v1/TinyClipboard.js +0 -459
  35. package/dist/v1/TinyColorConverter.js +0 -617
  36. package/dist/v1/TinyDomReadyManager.js +0 -213
  37. package/dist/v1/TinyDragDropDetector.js +0 -307
  38. package/dist/v1/TinyDragger.js +0 -6569
  39. package/dist/v1/TinyEssentials.js +0 -20792
  40. package/dist/v1/TinyEvents.js +0 -402
  41. package/dist/v1/TinyHtml.js +0 -5545
  42. package/dist/v1/TinyIframeEvents.js +0 -854
  43. package/dist/v1/TinyLevelUp.js +0 -291
  44. package/dist/v1/TinyLocalStorage.js +0 -1440
  45. package/dist/v1/TinyNewWinEvents.js +0 -888
  46. package/dist/v1/TinyNotifications.js +0 -408
  47. package/dist/v1/TinyNotifyCenter.js +0 -493
  48. package/dist/v1/TinyPromiseQueue.js +0 -299
  49. package/dist/v1/TinyRateLimiter.js +0 -611
  50. package/dist/v1/TinySmartScroller.js +0 -7039
  51. package/dist/v1/TinyTextRangeEditor.js +0 -497
  52. package/dist/v1/TinyTimeout.js +0 -233
  53. package/dist/v1/TinyToastNotify.js +0 -441
  54. package/dist/v1/TinyUploadClicker.js +0 -14353
  55. package/dist/v1/UltraRandomMsgGen.js +0 -995
@@ -153,6 +153,12 @@ export type SetValueList = SetValueBase | SetValueBase[];
153
153
  * Includes common input types used in forms.
154
154
  */
155
155
  export type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLOptionElement;
156
+ /**
157
+ * Represents a parsed HTML element in JSON-like array form.
158
+ */
159
+ export type HtmlParsed = [tagName: string, // The tag name of the element (e.g., 'div', 'img')
160
+ attributes: Record<string, string>, // All element attributes as key-value pairs
161
+ ...children: (string | HtmlParsed)[]];
156
162
  /**
157
163
  * Possible directions from which a collision was detected and locked.
158
164
  *
@@ -183,6 +189,15 @@ export type InputElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaEl
183
189
  *
184
190
  * @typedef {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLOptionElement} InputElement
185
191
  */
192
+ /**
193
+ * Represents a parsed HTML element in JSON-like array form.
194
+ *
195
+ * @typedef {[
196
+ * tagName: string, // The tag name of the element (e.g., 'div', 'img')
197
+ * attributes: Record<string, string>, // All element attributes as key-value pairs
198
+ * ...children: (string | HtmlParsed)[] // Text or nested elements
199
+ * ]} HtmlParsed
200
+ */
186
201
  /**
187
202
  * TinyHtml is a utility class that provides static and instance-level methods
188
203
  * for precise dimension and position computations on HTML elements.
@@ -236,6 +251,15 @@ declare class TinyHtml {
236
251
  *
237
252
  * @typedef {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLOptionElement} InputElement
238
253
  */
254
+ /**
255
+ * Represents a parsed HTML element in JSON-like array form.
256
+ *
257
+ * @typedef {[
258
+ * tagName: string, // The tag name of the element (e.g., 'div', 'img')
259
+ * attributes: Record<string, string>, // All element attributes as key-value pairs
260
+ * ...children: (string | HtmlParsed)[] // Text or nested elements
261
+ * ]} HtmlParsed
262
+ */
239
263
  /**
240
264
  * TinyHtml is a utility class that provides static and instance-level methods
241
265
  * for precise dimension and position computations on HTML elements.
@@ -248,6 +272,15 @@ declare class TinyHtml {
248
272
  */
249
273
  rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
250
274
  getElsPerfColliding: (rect1: TinyCollision.ObjRect /**
275
+ * Represents a parsed HTML element in JSON-like array form.
276
+ *
277
+ * @typedef {[
278
+ * tagName: string, // The tag name of the element (e.g., 'div', 'img')
279
+ * attributes: Record<string, string>, // All element attributes as key-value pairs
280
+ * ...children: (string | HtmlParsed)[] // Text or nested elements
281
+ * ]} HtmlParsed
282
+ */
283
+ /**
251
284
  * TinyHtml is a utility class that provides static and instance-level methods
252
285
  * for precise dimension and position computations on HTML elements.
253
286
  * It mimics some jQuery functionalities while using native browser APIs.
@@ -256,7 +289,8 @@ declare class TinyHtml {
256
289
  * and offset utilities. This class serves as a lightweight alternative using modern DOM APIs.
257
290
  *
258
291
  * @class
259
- */, rect2: TinyCollision.ObjRect) => "top" | "bottom" | "left" | "right" | null;
292
+ */
293
+ , rect2: TinyCollision.ObjRect) => "top" | "bottom" | "left" | "right" | null;
260
294
  getElsCollOverlap: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => {
261
295
  overlapLeft: number;
262
296
  overlapRight: number;
@@ -277,15 +311,97 @@ declare class TinyHtml {
277
311
  y: number;
278
312
  };
279
313
  };
314
+ /**
315
+ * Fetches an HTML file from the given URL, parses it to JSON.
316
+ *
317
+ * @param {string | URL | globalThis.Request} url - The URL of the HTML file.
318
+ * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc).
319
+ * @returns {Promise<HtmlParsed[]>} A promise that resolves with the parsed JSON representation of the HTML structure.
320
+ */
321
+ static fetchHtmlFile(url: string | URL | globalThis.Request, ops?: RequestInit): Promise<HtmlParsed[]>;
322
+ /**
323
+ * Fetches an HTML file from the given URL, parses it to JSON, then converts it to DOM nodes.
324
+ *
325
+ * @param {string} url - The URL of the HTML file.
326
+ * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc).
327
+ * @returns {Promise<(HTMLElement|Text)[]>} A promise that resolves with the DOM nodes.
328
+ */
329
+ static fetchHtmlNodes(url: string, ops?: RequestInit): Promise<(HTMLElement | Text)[]>;
330
+ /**
331
+ * Fetches an HTML file from the given URL, parses it to JSON, then converts it to TinyHtml instances.
332
+ *
333
+ * @param {string} url - The URL of the HTML file.
334
+ * @param {RequestInit} [ops] - Optional fetch configuration (e.g., method, headers, cache, etc).
335
+ * @returns {Promise<TinyHtml[]>} A promise that resolves with the TinyHtml instances.
336
+ */
337
+ static fetchHtmlTinyElems(url: string, ops?: RequestInit): Promise<TinyHtml[]>;
338
+ /**
339
+ * Converts the content of a <template> to an array of HtmlParsed.
340
+ *
341
+ * @param {HTMLTemplateElement} nodes
342
+ * @returns {HtmlParsed[]}
343
+ */
344
+ static templateToJson(nodes: HTMLTemplateElement): HtmlParsed[];
345
+ /**
346
+ * Converts the content of a <template> to real DOM nodes.
347
+ *
348
+ * @param {HTMLTemplateElement} nodes
349
+ * @returns {(Element|Text)[]}
350
+ */
351
+ static templateToNodes(nodes: HTMLTemplateElement): (Element | Text)[];
352
+ /**
353
+ * Converts the content of a <template> to an array of TinyHtml elements.
354
+ *
355
+ * @param {HTMLTemplateElement} nodes
356
+ * @returns {TinyHtml[]}
357
+ */
358
+ static templateToTinyElems(nodes: HTMLTemplateElement): TinyHtml[];
359
+ /**
360
+ * Parses a full HTML string into a JSON-like structure.
361
+ *
362
+ * @param {string} htmlString - Full HTML markup as a string.
363
+ * @returns {HtmlParsed[]} An array of parsed HTML elements in structured format.
364
+ */
365
+ static htmlToJson(htmlString: string): HtmlParsed[];
366
+ /**
367
+ * Converts a JSON-like HTML structure back to DOM Elements.
368
+ *
369
+ * @param {HtmlParsed[]} jsonArray - Parsed JSON format of HTML.
370
+ * @returns {(HTMLElement|Text)[]} List of DOM nodes.
371
+ */
372
+ static jsonToNodes(jsonArray: HtmlParsed[]): (HTMLElement | Text)[];
373
+ /**
374
+ * Converts a JSON-like HTML structure back to TinyHtml instances.
375
+ *
376
+ * @param {HtmlParsed[]} jsonArray - Parsed JSON format of HTML.
377
+ * @returns {TinyHtml[]} List of TinyHtml instances.
378
+ */
379
+ static jsonToTinyElems(jsonArray: HtmlParsed[]): TinyHtml[];
380
+ /**
381
+ * Creates a new TinyHtml element from a tag name and optional attributes.
382
+ *
383
+ * You can alias this method for convenience:
384
+ * ```js
385
+ * const createElement = TinyHtml.createFrom;
386
+ * const myDiv = createElement('div', { class: 'box' });
387
+ * ```
388
+ *
389
+ * @param {string} tagName - The HTML tag name (e.g., 'div', 'span', 'button').
390
+ * @param {Record<string, string|null>} [attrs] - Optional key-value pairs representing HTML attributes.
391
+ * If the value is `null`, the attribute will still be set with an empty value.
392
+ * @returns {TinyHtml} - A new instance of TinyHtml representing the created element.
393
+ * @throws {TypeError} - If `tagName` is not a string, or `attrs` is not a plain object when defined.
394
+ */
395
+ static createFrom(tagName: string, attrs?: Record<string, string | null>): TinyHtml;
280
396
  /**
281
397
  * Creates a new DOM element with the specified tag name and options, then wraps it in a TinyHtml instance.
282
398
  *
283
399
  * @param {string} tagName - The tag name of the element to create (e.g., 'div', 'span').
284
- * @param {ElementCreationOptions} ops - Optional settings for creating the element.
400
+ * @param {ElementCreationOptions} [ops] - Optional settings for creating the element.
285
401
  * @returns {TinyHtml} A TinyHtml instance wrapping the newly created DOM element.
286
402
  * @throws {TypeError} If tagName is not a string or ops is not an object.
287
403
  */
288
- static createElement(tagName: string, ops: ElementCreationOptions): TinyHtml;
404
+ static createElement(tagName: string, ops?: ElementCreationOptions): TinyHtml;
289
405
  /**
290
406
  * Creates a new TinyHtml instance that wraps a DOM TextNode.
291
407
  *
@@ -319,9 +435,9 @@ declare class TinyHtml {
319
435
  *
320
436
  * @param {string} selector - A valid CSS selector string.
321
437
  * @param {Document|Element} elem - Target element.
322
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the matched elements.
438
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the matched elements.
323
439
  */
324
- static queryAll(selector: string, elem?: Document | Element): TinyHtml[];
440
+ static queryAll(selector: string, elem?: Document | Element): TinyHtml;
325
441
  /**
326
442
  * Retrieves an element by its ID and wraps it in a TinyHtml instance.
327
443
  *
@@ -334,16 +450,16 @@ declare class TinyHtml {
334
450
  *
335
451
  * @param {string} selector - The class name to search for.
336
452
  * @param {Document|Element} elem - Target element.
337
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
453
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the found elements.
338
454
  */
339
- static getByClassName(selector: string, elem?: Document | Element): TinyHtml[];
455
+ static getByClassName(selector: string, elem?: Document | Element): TinyHtml;
340
456
  /**
341
457
  * Retrieves all elements with the specified name attribute and wraps them in TinyHtml instances.
342
458
  *
343
459
  * @param {string} selector - The name attribute to search for.
344
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
460
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the found elements.
345
461
  */
346
- static getByName(selector: string): TinyHtml[];
462
+ static getByName(selector: string): TinyHtml;
347
463
  /**
348
464
  * Retrieves all elements with the specified local tag name within the given namespace URI,
349
465
  * and wraps them in TinyHtml instances.
@@ -351,25 +467,31 @@ declare class TinyHtml {
351
467
  * @param {string} localName - The local name (tag) of the elements to search for.
352
468
  * @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
353
469
  * @param {Document|Element} elem - Target element.
354
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
470
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the found elements.
355
471
  */
356
- static getByTagNameNS(localName: string, namespaceURI?: string | null, elem?: Document | Element): TinyHtml[];
472
+ static getByTagNameNS(localName: string, namespaceURI?: string | null, elem?: Document | Element): TinyHtml;
357
473
  /**
358
- * @param {TinyElement|EventTarget|null|(TinyElement|EventTarget|null)[]} elems
359
- * @param {string} where
360
- * @param {any[]} TheTinyElements
361
- * @param {string[]} elemName
362
- * @returns {any[]}
474
+ * Prepares and validates multiple elements against allowed types.
475
+ *
476
+ * @param {TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[]} elems - The input elements to validate.
477
+ * @param {string} where - The method name or context calling this.
478
+ * @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
479
+ * @param {string[]} elemName - The list of expected element names for error reporting.
480
+ * @returns {any[]} - A flat array of validated elements.
481
+ * @throws {Error} - If any element is not an instance of one of the allowed types.
363
482
  * @readonly
364
483
  */
365
484
  static readonly _preElemsTemplate(elems: TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[], where: string, TheTinyElements: any[], elemName: string[]): any[];
366
485
  /**
367
- * @param {TinyElement|EventTarget|null|(TinyElement|EventTarget|null)[]} elems
368
- * @param {string} where
369
- * @param {any[]} TheTinyElements
370
- * @param {string[]} elemName
371
- * @param {boolean} [canNull=false]
372
- * @returns {any}
486
+ * Prepares and validates a single element against allowed types.
487
+ *
488
+ * @param {TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[]} elems - The input element or list to validate.
489
+ * @param {string} where - The method name or context calling this.
490
+ * @param {any[]} TheTinyElements - The list of allowed constructors (e.g., Element, Document).
491
+ * @param {string[]} elemName - The list of expected element names for error reporting.
492
+ * @param {boolean} [canNull=false] - Whether `null` is allowed as a valid value.
493
+ * @returns {any} - The validated element or `null` if allowed.
494
+ * @throws {Error} - If the element is not valid or if multiple elements are provided.
373
495
  * @readonly
374
496
  */
375
497
  static readonly _preElemTemplate(elems: TinyElement | EventTarget | null | (TinyElement | EventTarget | null)[], where: string, TheTinyElements: any[], elemName: string[], canNull?: boolean): any;
@@ -554,10 +676,10 @@ declare class TinyHtml {
554
676
  * This ensures consistent access to methods of the `TinyHtml` class regardless
555
677
  * of the input form.
556
678
  *
557
- * @param {TinyElement|TinyElement[]} elems - A single element or an array of elements (DOM or TinyHtml).
679
+ * @param {TinyElement|Text|(TinyElement|Text)[]} elems - A single element or an array of elements (DOM or TinyHtml).
558
680
  * @returns {TinyHtml[]} An array of TinyHtml instances corresponding to the input elements.
559
681
  */
560
- static toTinyElm(elems: TinyElement | TinyElement[]): TinyHtml[];
682
+ static toTinyElm(elems: TinyElement | Text | (TinyElement | Text)[]): TinyHtml[];
561
683
  /**
562
684
  * Extracts native `Element` instances from one or more elements,
563
685
  * which can be either raw DOM elements or wrapped in `TinyHtml`.
@@ -941,9 +1063,21 @@ declare class TinyHtml {
941
1063
  * @type {Record<string | symbol, string>}
942
1064
  */
943
1065
  static "__#6@#cssPropAliases": Record<string | symbol, string>;
944
- /** @type {Record<string | symbol, string>} */
1066
+ /**
1067
+ * Public proxy to manage camelCase ➝ kebab-case CSS property aliasing.
1068
+ *
1069
+ * Modifying this object ensures that the reverse mapping in `cssPropRevAliases` is updated accordingly.
1070
+ *
1071
+ * @type {Record<string | symbol, string>}
1072
+ */
945
1073
  static cssPropAliases: Record<string | symbol, string>;
946
- /** @type {Record<string | symbol, string>} */
1074
+ /**
1075
+ * Reverse map of `cssPropAliases`, mapping kebab-case back to camelCase CSS property names.
1076
+ *
1077
+ * This enables consistent bidirectional lookups of style properties.
1078
+ *
1079
+ * @type {Record<string | symbol, string>}
1080
+ */
947
1081
  static cssPropRevAliases: Record<string | symbol, string>;
948
1082
  /**
949
1083
  * Converts a camelCase string to kebab-case
@@ -1629,13 +1763,52 @@ declare class TinyHtml {
1629
1763
  */
1630
1764
  static trigger(el: TinyEventTarget | TinyEventTarget[], event: string, payload?: Event | CustomEvent | CustomEventInit): TinyEventTarget | TinyEventTarget[];
1631
1765
  /**
1632
- * Property name normalization similar to jQuery's propFix.
1633
- * @readonly
1766
+ * Internal property name normalization map (similar to jQuery's `propFix`).
1767
+ * Maps attribute-like names to their JavaScript DOM property equivalents.
1768
+ *
1769
+ * Example: `'for'` ➝ `'htmlFor'`, `'class'` ➝ `'className'`.
1770
+ *
1771
+ * ⚠️ Do not modify this object directly. Use `TinyHtml.propFix` to ensure reverse mapping (`attrFix`) remains in sync.
1772
+ *
1773
+ * @type {Record<string | symbol, string>}
1634
1774
  */
1635
- static readonly _propFix: {
1636
- for: string;
1637
- class: string;
1638
- };
1775
+ static "__#6@#propFix": Record<string | symbol, string>;
1776
+ /**
1777
+ * Public proxy for normalized DOM property names.
1778
+ *
1779
+ * Setting a new entry here will also automatically update the reverse map in `TinyHtml.attrFix`.
1780
+ *
1781
+ * @type {Record<string | symbol, string>}
1782
+ */
1783
+ static propFix: Record<string | symbol, string>;
1784
+ /**
1785
+ * Reverse map of `propFix`, mapping property names back to their attribute equivalents.
1786
+ *
1787
+ * Used when converting DOM property names into HTML attribute names.
1788
+ *
1789
+ * @type {Record<string | symbol, string>}
1790
+ */
1791
+ static attrFix: Record<string | symbol, string>;
1792
+ /**
1793
+ * Normalizes an attribute name to its corresponding DOM property name.
1794
+ *
1795
+ * Example: `'class'` ➝ `'className'`, `'for'` ➝ `'htmlFor'`.
1796
+ * If the name is not mapped, it returns the original name.
1797
+ *
1798
+ * @param {string} name - The attribute name to normalize.
1799
+ * @returns {string} - The corresponding property name.
1800
+ */
1801
+ static getPropName(name: string): string;
1802
+ /**
1803
+ * Converts a DOM property name back to its corresponding attribute name.
1804
+ *
1805
+ * Example: `'className'` ➝ `'class'`, `'htmlFor'` ➝ `'for'`.
1806
+ * If the name is not mapped, it returns the original name.
1807
+ *
1808
+ * @param {string} name - The property name to convert.
1809
+ * @returns {string} - The corresponding attribute name.
1810
+ */
1811
+ static getAttrName(name: string): string;
1639
1812
  /**
1640
1813
  * Get an attribute on an element.
1641
1814
  * @param {TinyElement} el
@@ -1833,9 +2006,9 @@ declare class TinyHtml {
1833
2006
  /**
1834
2007
  * Creates an instance of TinyHtml for a specific Element.
1835
2008
  * Useful when you want to operate repeatedly on the same element using instance methods.
1836
- * @param {ConstructorElValues} el - The element to wrap and manipulate.
2009
+ * @param {ConstructorElValues|ConstructorElValues[]|NodeListOf<Element>|HTMLCollectionOf<Element>|NodeListOf<HTMLElement>} el - The element to wrap and manipulate.
1837
2010
  */
1838
- constructor(el: ConstructorElValues);
2011
+ constructor(el: ConstructorElValues | ConstructorElValues[] | NodeListOf<Element> | HTMLCollectionOf<Element> | NodeListOf<HTMLElement>);
1839
2012
  /**
1840
2013
  * Queries the element for the first element matching the CSS selector and wraps it in a TinyHtml instance.
1841
2014
  *
@@ -1847,39 +2020,69 @@ declare class TinyHtml {
1847
2020
  * Queries the element for all elements matching the CSS selector and wraps them in TinyHtml instances.
1848
2021
  *
1849
2022
  * @param {string} selector - A valid CSS selector string.
1850
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the matched elements.
2023
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the matched elements.
1851
2024
  */
1852
- querySelectorAll(selector: string): TinyHtml[];
2025
+ querySelectorAll(selector: string): TinyHtml;
1853
2026
  /**
1854
2027
  * Retrieves all elements with the specified class name and wraps them in TinyHtml instances.
1855
2028
  *
1856
2029
  * @param {string} selector - The class name to search for.
1857
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
2030
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the found elements.
1858
2031
  */
1859
- getElementsByClassName(selector: string): TinyHtml[];
2032
+ getElementsByClassName(selector: string): TinyHtml;
1860
2033
  /**
1861
2034
  * Retrieves all elements with the specified local tag name within the given namespace URI,
1862
2035
  * and wraps them in TinyHtml instances.
1863
2036
  *
1864
2037
  * @param {string} localName - The local name (tag) of the elements to search for.
1865
2038
  * @param {string|null} [namespaceURI='http://www.w3.org/1999/xhtml'] - The namespace URI to search within.
1866
- * @returns {TinyHtml[]} An array of TinyHtml instances wrapping the found elements.
2039
+ * @returns {TinyHtml} An array of TinyHtml instances wrapping the found elements.
1867
2040
  */
1868
- getElementsByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml[];
2041
+ getElementsByTagNameNS(localName: string, namespaceURI?: string | null): TinyHtml;
1869
2042
  /**
1870
2043
  * Returns the current target held by this instance.
1871
2044
  *
2045
+ * @param {number} index - The index of the element to retrieve.
1872
2046
  * @returns {ConstructorElValues} - The instance's target element.
1873
2047
  */
1874
- get(): ConstructorElValues;
2048
+ get(index: number): ConstructorElValues;
2049
+ /**
2050
+ * Extracts a single DOM element from the internal list at the specified index.
2051
+ *
2052
+ * @param {number} index - The index of the element to extract.
2053
+ * @returns {TinyHtml} A new TinyHtml instance wrapping the extracted element.
2054
+ */
2055
+ extract(index: number): TinyHtml;
2056
+ /**
2057
+ * Checks whether the element exists at the given index.
2058
+ *
2059
+ * @param {number} index - The index to check.
2060
+ * @returns {boolean} - True if the element exists; otherwise, false.
2061
+ */
2062
+ exists(index: number): boolean;
2063
+ /**
2064
+ * Returns the current targets held by this instance.
2065
+ *
2066
+ * @returns {ConstructorElValues[]} - The instance's targets element.
2067
+ */
2068
+ getAll(): ConstructorElValues[];
1875
2069
  /**
1876
2070
  * Returns the current Element held by this instance.
1877
2071
  *
1878
2072
  * @param {string} where - The method name or context calling this.
2073
+ * @param {number} index - The index of the element to retrieve.
1879
2074
  * @returns {ConstructorElValues} - The instance's element.
1880
2075
  * @readonly
1881
2076
  */
1882
- readonly _getElement(where: string): ConstructorElValues;
2077
+ readonly _getElement(where: string, index: number): ConstructorElValues;
2078
+ /**
2079
+ * Returns the current Elements held by this instance.
2080
+ *
2081
+ * @param {string} where - The method name or context calling this.
2082
+ * @returns {ConstructorElValues[]} - The instance's elements.
2083
+ * @readonly
2084
+ */
2085
+ readonly _getElements(where: string): ConstructorElValues[];
1883
2086
  /**
1884
2087
  * Returns only the elements **not** matching the given selector or function.
1885
2088
  *
@@ -2094,6 +2297,12 @@ declare class TinyHtml {
2094
2297
  * @returns {TinyNode|TinyNode[]}
2095
2298
  */
2096
2299
  replaceAll(targets: TinyNode | TinyNode[]): TinyNode | TinyNode[];
2300
+ /**
2301
+ * Returns the number of elements currently stored in the internal element list.
2302
+ *
2303
+ * @returns {number} The total count of elements.
2304
+ */
2305
+ get size(): number;
2097
2306
  /**
2098
2307
  * Returns the full computed CSS styles for the given element.
2099
2308
  *