tiny-essentials 1.26.3 → 1.27.0

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 (128) hide show
  1. package/.github/workflows/node.js.yml +1 -1
  2. package/README.md +0 -1
  3. package/changelog/1/26/4.md +10 -0
  4. package/changelog/1/27/0.md +24 -0
  5. package/dist/v1/ColorSafeStringify.min.js +1 -1
  6. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  7. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  8. package/dist/v1/TinyAnalogClock.min.js +1 -1
  9. package/dist/v1/TinyArrayComparator.min.js +1 -1
  10. package/dist/v1/TinyArrayPaginator.min.js +1 -1
  11. package/dist/v1/TinyBasicsEs.min.js +1 -1
  12. package/dist/v1/TinyClassManager.min.js +1 -1
  13. package/dist/v1/TinyClipboard.min.js +1 -1
  14. package/dist/v1/TinyColorConverter.min.js +1 -1
  15. package/dist/v1/TinyColorValidator.min.js +1 -1
  16. package/dist/v1/TinyCookieConsent.min.js +1 -1
  17. package/dist/v1/TinyDayNightCycle.min.js +1 -1
  18. package/dist/v1/TinyDomReadyManager.min.js +1 -1
  19. package/dist/v1/TinyDragDropDetector.min.js +1 -1
  20. package/dist/v1/TinyDragger.min.js +1 -1
  21. package/dist/v1/TinyElementObserver.min.js +1 -1
  22. package/dist/v1/TinyEssentials.min.js +1 -1
  23. package/dist/v1/TinyEvents.min.js +1 -1
  24. package/dist/v1/TinyGamepad.min.js +1 -1
  25. package/dist/v1/TinyHtml.min.js +1 -1
  26. package/dist/v1/TinyI18.min.js +1 -1
  27. package/dist/v1/TinyIframeEvents.min.js +1 -1
  28. package/dist/v1/TinyInventory.min.js +1 -1
  29. package/dist/v1/TinyInventoryTrader.min.js +1 -1
  30. package/dist/v1/TinyLevelUp.min.js +1 -1
  31. package/dist/v1/TinyLoadingScreen.min.js +1 -1
  32. package/dist/v1/TinyLocalStorage.min.js +1 -1
  33. package/dist/v1/TinyMaInSys.min.js +1 -1
  34. package/dist/v1/TinyMediaPlayer.min.js +1 -0
  35. package/dist/v1/TinyNeedBar.min.js +1 -1
  36. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  37. package/dist/v1/TinyNotifications.min.js +1 -1
  38. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  39. package/dist/v1/TinyPromiseQueue.min.js +1 -1
  40. package/dist/v1/TinyRadioFm.min.js +1 -0
  41. package/dist/v1/TinyRateLimiter.min.js +1 -1
  42. package/dist/v1/TinySimpleDice.min.js +1 -1
  43. package/dist/v1/TinySmartScroller.min.js +1 -1
  44. package/dist/v1/TinyTextDiffer.min.js +1 -1
  45. package/dist/v1/TinyTextRangeEditor.min.js +1 -1
  46. package/dist/v1/TinyTextarea.min.js +1 -1
  47. package/dist/v1/TinyTimeout.min.js +1 -1
  48. package/dist/v1/TinyToastNotify.min.js +1 -1
  49. package/dist/v1/TinyUploadClicker.min.js +1 -1
  50. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  51. package/dist/v1/basics/index.cjs +5 -0
  52. package/dist/v1/basics/index.d.mts +5 -1
  53. package/dist/v1/basics/index.mjs +2 -1
  54. package/dist/v1/basics/mediaContent.cjs +644 -0
  55. package/dist/v1/basics/mediaContent.d.mts +296 -0
  56. package/dist/v1/basics/mediaContent.mjs +557 -0
  57. package/dist/v1/build/TinyMediaPlayer.cjs +7 -0
  58. package/dist/v1/build/TinyMediaPlayer.d.mts +3 -0
  59. package/dist/v1/build/TinyMediaPlayer.mjs +2 -0
  60. package/dist/v1/build/TinyRadioFm.cjs +7 -0
  61. package/dist/v1/build/TinyRadioFm.d.mts +3 -0
  62. package/dist/v1/build/TinyRadioFm.mjs +2 -0
  63. package/dist/v1/index.cjs +9 -0
  64. package/dist/v1/index.d.mts +7 -1
  65. package/dist/v1/index.mjs +5 -2
  66. package/dist/v1/libs/ColorSafeStringify.d.mts +1 -1
  67. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +16 -3
  68. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +7 -3
  69. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +13 -3
  70. package/dist/v1/libs/TinyArrayComparator.cjs +14 -11
  71. package/dist/v1/libs/TinyArrayComparator.d.mts +22 -19
  72. package/dist/v1/libs/TinyArrayComparator.mjs +14 -11
  73. package/dist/v1/libs/TinyArrayPaginator.cjs +23 -16
  74. package/dist/v1/libs/TinyArrayPaginator.d.mts +57 -30
  75. package/dist/v1/libs/TinyArrayPaginator.mjs +22 -16
  76. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs +265 -0
  77. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +92 -0
  78. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs +223 -0
  79. package/dist/v1/libs/TinyClassManager.cjs +124 -23
  80. package/dist/v1/libs/TinyClassManager.d.mts +33 -13
  81. package/dist/v1/libs/TinyClassManager.mjs +108 -23
  82. package/dist/v1/libs/TinyColorValidator.d.mts +16 -16
  83. package/dist/v1/libs/TinyDragDropDetector.cjs +9 -34
  84. package/dist/v1/libs/TinyDragDropDetector.d.mts +7 -21
  85. package/dist/v1/libs/TinyDragDropDetector.mjs +9 -24
  86. package/dist/v1/libs/TinyDragger.cjs +5 -5
  87. package/dist/v1/libs/TinyDragger.d.mts +4 -3
  88. package/dist/v1/libs/TinyDragger.mjs +5 -5
  89. package/dist/v1/libs/TinyElementObserver.cjs +6 -21
  90. package/dist/v1/libs/TinyElementObserver.d.mts +6 -15
  91. package/dist/v1/libs/TinyElementObserver.mjs +6 -20
  92. package/dist/v1/libs/TinyEvents.cjs +7 -0
  93. package/dist/v1/libs/TinyEvents.d.mts +4 -0
  94. package/dist/v1/libs/TinyEvents.mjs +6 -0
  95. package/dist/v1/libs/TinyGamepad.cjs +4 -6
  96. package/dist/v1/libs/TinyGamepad.d.mts +1 -1
  97. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +1 -1
  98. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +1 -1
  99. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +1 -1
  100. package/dist/v1/libs/TinyHtml/index.d.mts +1 -1
  101. package/dist/v1/libs/TinyHtml.cjs +72 -98
  102. package/dist/v1/libs/TinyHtml.d.mts +15 -32
  103. package/dist/v1/libs/TinyHtml.mjs +53 -77
  104. package/dist/v1/libs/TinyInventory.d.mts +1 -1
  105. package/dist/v1/libs/TinyMediaPlayer.cjs +844 -0
  106. package/dist/v1/libs/TinyMediaPlayer.d.mts +306 -0
  107. package/dist/v1/libs/TinyMediaPlayer.mjs +755 -0
  108. package/dist/v1/libs/TinyRadioFm.cjs +1378 -0
  109. package/dist/v1/libs/TinyRadioFm.d.mts +554 -0
  110. package/dist/v1/libs/TinyRadioFm.mjs +1137 -0
  111. package/dist/v1/libs/TinySmartScroller.cjs +39 -26
  112. package/dist/v1/libs/TinySmartScroller.d.mts +16 -62
  113. package/dist/v1/libs/TinySmartScroller.mjs +35 -26
  114. package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
  115. package/dist/v1/libs/examples/TinyClassManager.cjs +43 -41
  116. package/dist/v1/libs/examples/TinyClassManager.mjs +37 -37
  117. package/docs/v1/README.md +6 -0
  118. package/docs/v1/basics/mediaContent.md +131 -0
  119. package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +107 -0
  120. package/docs/v1/libs/TinyClassManager.md +69 -70
  121. package/docs/v1/libs/TinyDragDropDetector.md +5 -9
  122. package/docs/v1/libs/TinyElementObserver.md +3 -6
  123. package/docs/v1/libs/TinyEvents.md +1 -1
  124. package/docs/v1/libs/TinyHtml.md +0 -29
  125. package/docs/v1/libs/TinyMediaPlayer.md +100 -0
  126. package/docs/v1/libs/TinyRadioFm.md +141 -0
  127. package/docs/v1/libs/TinySmartScroller.md +3 -3
  128. package/package.json +40 -22
@@ -1,13 +1,5 @@
1
1
  export default TinyDragDropDetector;
2
2
  export type DragAndDropOptions = {
3
- /**
4
- * - The DOM element where drag listeners will be attached. Defaults to `document.body` if `fullscreen` is true or no target is provided.
5
- */
6
- target?: HTMLElement | undefined;
7
- /**
8
- * - If true, listeners are attached to the entire page (`document.body`). If false, the `target` must be specified.
9
- */
10
- fullscreen?: boolean | undefined;
11
3
  /**
12
4
  * - CSS class applied to the target element while files are being dragged over it.
13
5
  */
@@ -27,8 +19,6 @@ export type DragAndDropOptions = {
27
19
  };
28
20
  /**
29
21
  * @typedef {Object} DragAndDropOptions
30
- * @property {HTMLElement} [target=document.body] - The DOM element where drag listeners will be attached. Defaults to `document.body` if `fullscreen` is true or no target is provided.
31
- * @property {boolean} [fullscreen=true] - If true, listeners are attached to the entire page (`document.body`). If false, the `target` must be specified.
32
22
  * @property {string} [hoverClass="dnd-hover"] - CSS class applied to the target element while files are being dragged over it.
33
23
  * @property {(files: FileList, event: DragEvent) => void} [onDrop] - Callback function executed when files are dropped onto the target.
34
24
  * @property {(event: DragEvent) => void} [onEnter] - Optional callback triggered when dragging enters the target area.
@@ -41,20 +31,21 @@ export type DragAndDropOptions = {
41
31
  * It handles the drag lifecycle (enter, over, leave, drop) and provides hooks for developers to handle file uploads or UI changes.
42
32
  *
43
33
  * @class
34
+ * @template {HTMLElement} HTMLTarget
44
35
  */
45
- declare class TinyDragDropDetector {
36
+ declare class TinyDragDropDetector<HTMLTarget extends HTMLElement> {
46
37
  /**
47
38
  * Creates a new instance of TinyDragDropDetector to handle drag-and-drop file detection.
48
39
  *
49
- * @param {DragAndDropOptions} [options={}] - Configuration options for the detector.
40
+ * @param {HTMLTarget} target - The DOM element where drag listeners will be attached.
41
+ * @param {DragAndDropOptions} options - Configuration options for the detector.
50
42
  * @throws {TypeError} If `target` is not an HTMLElement.
51
- * @throws {TypeError} If `fullscreen` is not a boolean.
52
43
  * @throws {TypeError} If `hoverClass` is not a string.
53
44
  * @throws {TypeError} If `onDrop` is defined but not a function.
54
45
  * @throws {TypeError} If `onEnter` is defined but not a function.
55
46
  * @throws {TypeError} If `onLeave` is defined but not a function.
56
47
  */
57
- constructor(options?: DragAndDropOptions);
48
+ constructor(target: HTMLTarget, options: DragAndDropOptions);
58
49
  /**
59
50
  * Handles the `dragenter` event.
60
51
  * Adds the hover CSS class and triggers the `onEnter` callback if provided.
@@ -89,19 +80,14 @@ declare class TinyDragDropDetector {
89
80
  private _handleDrop;
90
81
  /**
91
82
  * Returns the current target DOM element where the listeners are attached.
92
- * @returns {HTMLElement}
83
+ * @returns {HTMLTarget}
93
84
  */
94
- getTarget(): HTMLElement;
85
+ getTarget(): HTMLTarget;
95
86
  /**
96
87
  * Returns the CSS class applied during drag hover.
97
88
  * @returns {string}
98
89
  */
99
90
  getHoverClass(): string;
100
- /**
101
- * Indicates whether the detector is operating in fullscreen mode.
102
- * @returns {boolean}
103
- */
104
- isFullScreen(): boolean;
105
91
  /**
106
92
  * Returns whether a drag operation is currently active over the target.
107
93
  * @returns {boolean}
@@ -1,7 +1,5 @@
1
1
  /**
2
2
  * @typedef {Object} DragAndDropOptions
3
- * @property {HTMLElement} [target=document.body] - The DOM element where drag listeners will be attached. Defaults to `document.body` if `fullscreen` is true or no target is provided.
4
- * @property {boolean} [fullscreen=true] - If true, listeners are attached to the entire page (`document.body`). If false, the `target` must be specified.
5
3
  * @property {string} [hoverClass="dnd-hover"] - CSS class applied to the target element while files are being dragged over it.
6
4
  * @property {(files: FileList, event: DragEvent) => void} [onDrop] - Callback function executed when files are dropped onto the target.
7
5
  * @property {(event: DragEvent) => void} [onEnter] - Optional callback triggered when dragging enters the target area.
@@ -14,12 +12,11 @@
14
12
  * It handles the drag lifecycle (enter, over, leave, drop) and provides hooks for developers to handle file uploads or UI changes.
15
13
  *
16
14
  * @class
15
+ * @template {HTMLElement} HTMLTarget
17
16
  */
18
17
  class TinyDragDropDetector {
19
- /** @type {HTMLElement} */
18
+ /** @type {HTMLTarget} */
20
19
  #target;
21
- /** @type {boolean} */
22
- #fullscreen;
23
20
  /** @type {string} */
24
21
  #hoverClass;
25
22
  /** @type {(files: FileList, event: DragEvent) => void} */
@@ -35,22 +32,18 @@ class TinyDragDropDetector {
35
32
  /**
36
33
  * Creates a new instance of TinyDragDropDetector to handle drag-and-drop file detection.
37
34
  *
38
- * @param {DragAndDropOptions} [options={}] - Configuration options for the detector.
35
+ * @param {HTMLTarget} target - The DOM element where drag listeners will be attached.
36
+ * @param {DragAndDropOptions} options - Configuration options for the detector.
39
37
  * @throws {TypeError} If `target` is not an HTMLElement.
40
- * @throws {TypeError} If `fullscreen` is not a boolean.
41
38
  * @throws {TypeError} If `hoverClass` is not a string.
42
39
  * @throws {TypeError} If `onDrop` is defined but not a function.
43
40
  * @throws {TypeError} If `onEnter` is defined but not a function.
44
41
  * @throws {TypeError} If `onLeave` is defined but not a function.
45
42
  */
46
- constructor(options = {}) {
47
- const { target, fullscreen = true, hoverClass = 'dnd-hover', onDrop, onEnter, onLeave, } = options;
48
- // Validate fullscreen
49
- if (typeof fullscreen !== 'boolean')
50
- throw new TypeError('The "fullscreen" option must be a boolean.');
43
+ constructor(target, options) {
44
+ const { hoverClass = 'dnd-hover', onDrop, onEnter, onLeave } = options;
51
45
  // Validate target
52
- const resolvedTarget = fullscreen ? document.body : target || document.body;
53
- if (!(resolvedTarget instanceof HTMLElement))
46
+ if (!(target instanceof HTMLElement))
54
47
  throw new TypeError('The "target" option must be an instance of HTMLElement.');
55
48
  // Validate hoverClass
56
49
  if (typeof hoverClass !== 'string')
@@ -65,8 +58,7 @@ class TinyDragDropDetector {
65
58
  if (typeof onLeave !== 'function')
66
59
  throw new TypeError('The "onLeave" option must be a function.');
67
60
  // Store properties
68
- this.#target = resolvedTarget;
69
- this.#fullscreen = fullscreen;
61
+ this.#target = target;
70
62
  this.#hoverClass = hoverClass;
71
63
  this.#onDropCallback = onDrop || (() => { });
72
64
  this.#onEnterCallback = onEnter;
@@ -82,7 +74,7 @@ class TinyDragDropDetector {
82
74
  }
83
75
  /**
84
76
  * Returns the current target DOM element where the listeners are attached.
85
- * @returns {HTMLElement}
77
+ * @returns {HTMLTarget}
86
78
  */
87
79
  getTarget() {
88
80
  return this.#target;
@@ -94,13 +86,6 @@ class TinyDragDropDetector {
94
86
  getHoverClass() {
95
87
  return this.#hoverClass;
96
88
  }
97
- /**
98
- * Indicates whether the detector is operating in fullscreen mode.
99
- * @returns {boolean}
100
- */
101
- isFullScreen() {
102
- return this.#fullscreen;
103
- }
104
89
  /**
105
90
  * Returns whether a drag operation is currently active over the target.
106
91
  * @returns {boolean}
@@ -16,6 +16,7 @@ var objChecker = require('../basics/objChecker.cjs');
16
16
  * TinyDragger enables drag-and-drop functionality for a DOM element.
17
17
  * It supports jail boundaries, optional collision detection, vibration feedback,
18
18
  * automatic reverting, proxy dragging, and event dispatching.
19
+ * @template {HTMLElement} HTMLTarget
19
20
  */
20
21
  class TinyDragger {
21
22
  static Utils = { ...collision, TinyHtml };
@@ -49,7 +50,7 @@ class TinyDragger {
49
50
  /** @type {HTMLElement|null} */
50
51
  #jail = null;
51
52
 
52
- /** @type {HTMLElement} */
53
+ /** @type {HTMLTarget} */
53
54
  #target;
54
55
 
55
56
  #dragHiddenClass = 'drag-hidden';
@@ -63,7 +64,7 @@ class TinyDragger {
63
64
  /** @typedef {(event: TouchEvent) => void} TouchDragEvent */
64
65
 
65
66
  /**
66
- * @param {HTMLElement|TinyHtml<any>} targetElement - The element to make draggable.
67
+ * @param {HTMLTarget} targetElement - The element to make draggable.
67
68
  * @param {Object} [options={}] - Configuration options.
68
69
  * @param {HTMLElement} [options.jail] - Optional container to restrict dragging within.
69
70
  * @param {boolean} [options.mirrorElem=true] - Use a visual clone instead of dragging the original element.
@@ -83,11 +84,10 @@ class TinyDragger {
83
84
  * @throws {Error} If any option has an invalid type.
84
85
  */
85
86
  constructor(targetElement, options = {}) {
86
- const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get(0);
87
- if (!(targetElem instanceof HTMLElement))
87
+ if (!(targetElement instanceof HTMLElement))
88
88
  throw new Error('TinyDragger requires a valid target HTMLElement to initialize.');
89
89
 
90
- this.#target = targetElem;
90
+ this.#target = targetElement;
91
91
 
92
92
  // === Validations ===
93
93
  if (options.jail !== undefined && !(options.jail instanceof HTMLElement))
@@ -28,8 +28,9 @@ export type VibrationPatterns = {
28
28
  * TinyDragger enables drag-and-drop functionality for a DOM element.
29
29
  * It supports jail boundaries, optional collision detection, vibration feedback,
30
30
  * automatic reverting, proxy dragging, and event dispatching.
31
+ * @template {HTMLElement} HTMLTarget
31
32
  */
32
- declare class TinyDragger {
33
+ declare class TinyDragger<HTMLTarget extends HTMLElement> {
33
34
  static Utils: {
34
35
  TinyHtml: typeof TinyHtml;
35
36
  getElsRelativeCenterOffset(rect1: ObjRect, rect2: ObjRect): {
@@ -82,7 +83,7 @@ declare class TinyDragger {
82
83
  };
83
84
  /** @typedef {(event: TouchEvent) => void} TouchDragEvent */
84
85
  /**
85
- * @param {HTMLElement|TinyHtml<any>} targetElement - The element to make draggable.
86
+ * @param {HTMLTarget} targetElement - The element to make draggable.
86
87
  * @param {Object} [options={}] - Configuration options.
87
88
  * @param {HTMLElement} [options.jail] - Optional container to restrict dragging within.
88
89
  * @param {boolean} [options.mirrorElem=true] - Use a visual clone instead of dragging the original element.
@@ -101,7 +102,7 @@ declare class TinyDragger {
101
102
  * @param {string} [options.classHidden='drag-hidden'] - CSS class to hide original element during dragging.
102
103
  * @throws {Error} If any option has an invalid type.
103
104
  */
104
- constructor(targetElement: HTMLElement | TinyHtml<any>, options?: {
105
+ constructor(targetElement: HTMLTarget, options?: {
105
106
  jail?: HTMLElement | undefined;
106
107
  mirrorElem?: boolean | undefined;
107
108
  defaultZIndex?: number | undefined;
@@ -12,6 +12,7 @@ import { isJsonObject } from '../basics/objChecker.mjs';
12
12
  * TinyDragger enables drag-and-drop functionality for a DOM element.
13
13
  * It supports jail boundaries, optional collision detection, vibration feedback,
14
14
  * automatic reverting, proxy dragging, and event dispatching.
15
+ * @template {HTMLElement} HTMLTarget
15
16
  */
16
17
  class TinyDragger {
17
18
  static Utils = { ...TinyCollision, TinyHtml };
@@ -36,7 +37,7 @@ class TinyDragger {
36
37
  #vibration = { start: false, end: false, collide: false, move: false };
37
38
  /** @type {HTMLElement|null} */
38
39
  #jail = null;
39
- /** @type {HTMLElement} */
40
+ /** @type {HTMLTarget} */
40
41
  #target;
41
42
  #dragHiddenClass = 'drag-hidden';
42
43
  #classDragging = 'dragging';
@@ -47,7 +48,7 @@ class TinyDragger {
47
48
  #defaultZIndex = 9999;
48
49
  /** @typedef {(event: TouchEvent) => void} TouchDragEvent */
49
50
  /**
50
- * @param {HTMLElement|TinyHtml<any>} targetElement - The element to make draggable.
51
+ * @param {HTMLTarget} targetElement - The element to make draggable.
51
52
  * @param {Object} [options={}] - Configuration options.
52
53
  * @param {HTMLElement} [options.jail] - Optional container to restrict dragging within.
53
54
  * @param {boolean} [options.mirrorElem=true] - Use a visual clone instead of dragging the original element.
@@ -67,10 +68,9 @@ class TinyDragger {
67
68
  * @throws {Error} If any option has an invalid type.
68
69
  */
69
70
  constructor(targetElement, options = {}) {
70
- const targetElem = !(targetElement instanceof TinyHtml) ? targetElement : targetElement.get(0);
71
- if (!(targetElem instanceof HTMLElement))
71
+ if (!(targetElement instanceof HTMLElement))
72
72
  throw new Error('TinyDragger requires a valid target HTMLElement to initialize.');
73
- this.#target = targetElem;
73
+ this.#target = targetElement;
74
74
  // === Validations ===
75
75
  if (options.jail !== undefined && !(options.jail instanceof HTMLElement))
76
76
  throw new Error('The "jail" option must be an HTMLElement if provided.');
@@ -16,35 +16,20 @@
16
16
  * A utility class for tracking DOM element mutations.
17
17
  * It leverages the native MutationObserver API, providing a higher-level abstraction
18
18
  * with a system of configurable detectors that can dispatch custom events or run custom logic.
19
+ * @template {Element} HTMLElement
19
20
  */
20
21
  class TinyElementObserver {
21
- /** @type {Element|undefined} */
22
+ /** @type {HTMLElement} */
22
23
  #el;
23
24
 
24
25
  /**
25
26
  * Get the current element being observed.
26
- * @returns {Element|undefined} The DOM element being tracked, or `undefined` if none is set.
27
+ * @returns {HTMLElement} The DOM element being tracked, or `undefined` if none is set.
27
28
  */
28
29
  get el() {
29
30
  return this.#el;
30
31
  }
31
32
 
32
- /**
33
- * Set the target element to be observed.
34
- * Can only be set once.
35
- *
36
- * @param {Element|undefined} el - The DOM element to observe.
37
- * @throws {Error} If the element is already defined.
38
- * @throws {TypeError} If the provided value is not an Element.
39
- */
40
- set el(el) {
41
- if (this.#el)
42
- throw new Error('The observed element has already been set and cannot be reassigned.');
43
- if (typeof el !== 'undefined' && !(el instanceof Element))
44
- throw new TypeError('The observed element must be a valid DOM Element.');
45
- this.#el = el;
46
- }
47
-
48
33
  /**
49
34
  * Configuration settings for the MutationObserver instance.
50
35
  *
@@ -140,13 +125,13 @@ class TinyElementObserver {
140
125
  /**
141
126
  * Create a new TinyElementObserver instance.
142
127
  *
128
+ * @param {HTMLElement} el - Set the target element to be observed.
143
129
  * @param {Object} [settings={}] - Configuration object.
144
- * @param {Element} [settings.el] - Optional DOM element to observe from the start.
145
130
  * @param {Array<[string, ElementDetectorsFn]>} [settings.initDetectors=[]] - Optional initial detectors to register.
146
131
  * @param {MutationObserverInit} [settings.initCfg] - Optional MutationObserver configuration.
147
132
  */
148
- constructor({ el, initDetectors = [], initCfg = {} } = {}) {
149
- this.el = el;
133
+ constructor(el, { initDetectors = [], initCfg = {} } = {}) {
134
+ this.#el = el;
150
135
  if (initDetectors.length) this.detectors = initDetectors;
151
136
  if (initCfg) this.settings = initCfg;
152
137
  }
@@ -18,35 +18,26 @@ export type ElementDetectorsFn = (mutation: MutationRecord, index: number, mutat
18
18
  * A utility class for tracking DOM element mutations.
19
19
  * It leverages the native MutationObserver API, providing a higher-level abstraction
20
20
  * with a system of configurable detectors that can dispatch custom events or run custom logic.
21
+ * @template {Element} HTMLElement
21
22
  */
22
- declare class TinyElementObserver {
23
+ declare class TinyElementObserver<HTMLElement extends Element> {
23
24
  /**
24
25
  * Create a new TinyElementObserver instance.
25
26
  *
27
+ * @param {HTMLElement} el - Set the target element to be observed.
26
28
  * @param {Object} [settings={}] - Configuration object.
27
- * @param {Element} [settings.el] - Optional DOM element to observe from the start.
28
29
  * @param {Array<[string, ElementDetectorsFn]>} [settings.initDetectors=[]] - Optional initial detectors to register.
29
30
  * @param {MutationObserverInit} [settings.initCfg] - Optional MutationObserver configuration.
30
31
  */
31
- constructor({ el, initDetectors, initCfg }?: {
32
- el?: Element | undefined;
32
+ constructor(el: HTMLElement, { initDetectors, initCfg }?: {
33
33
  initDetectors?: [string, ElementDetectorsFn][] | undefined;
34
34
  initCfg?: MutationObserverInit | undefined;
35
35
  });
36
- /**
37
- * Set the target element to be observed.
38
- * Can only be set once.
39
- *
40
- * @param {Element|undefined} el - The DOM element to observe.
41
- * @throws {Error} If the element is already defined.
42
- * @throws {TypeError} If the provided value is not an Element.
43
- */
44
- set el(el: Element | undefined);
45
36
  /**
46
37
  * Get the current element being observed.
47
- * @returns {Element|undefined} The DOM element being tracked, or `undefined` if none is set.
38
+ * @returns {HTMLElement} The DOM element being tracked, or `undefined` if none is set.
48
39
  */
49
- get el(): Element | undefined;
40
+ get el(): HTMLElement;
50
41
  /**
51
42
  * Set the observer settings.
52
43
  * @param {MutationObserverInit} settings
@@ -13,32 +13,18 @@
13
13
  * A utility class for tracking DOM element mutations.
14
14
  * It leverages the native MutationObserver API, providing a higher-level abstraction
15
15
  * with a system of configurable detectors that can dispatch custom events or run custom logic.
16
+ * @template {Element} HTMLElement
16
17
  */
17
18
  class TinyElementObserver {
18
- /** @type {Element|undefined} */
19
+ /** @type {HTMLElement} */
19
20
  #el;
20
21
  /**
21
22
  * Get the current element being observed.
22
- * @returns {Element|undefined} The DOM element being tracked, or `undefined` if none is set.
23
+ * @returns {HTMLElement} The DOM element being tracked, or `undefined` if none is set.
23
24
  */
24
25
  get el() {
25
26
  return this.#el;
26
27
  }
27
- /**
28
- * Set the target element to be observed.
29
- * Can only be set once.
30
- *
31
- * @param {Element|undefined} el - The DOM element to observe.
32
- * @throws {Error} If the element is already defined.
33
- * @throws {TypeError} If the provided value is not an Element.
34
- */
35
- set el(el) {
36
- if (this.#el)
37
- throw new Error('The observed element has already been set and cannot be reassigned.');
38
- if (typeof el !== 'undefined' && !(el instanceof Element))
39
- throw new TypeError('The observed element must be a valid DOM Element.');
40
- this.#el = el;
41
- }
42
28
  /**
43
29
  * Configuration settings for the MutationObserver instance.
44
30
  *
@@ -125,13 +111,13 @@ class TinyElementObserver {
125
111
  /**
126
112
  * Create a new TinyElementObserver instance.
127
113
  *
114
+ * @param {HTMLElement} el - Set the target element to be observed.
128
115
  * @param {Object} [settings={}] - Configuration object.
129
- * @param {Element} [settings.el] - Optional DOM element to observe from the start.
130
116
  * @param {Array<[string, ElementDetectorsFn]>} [settings.initDetectors=[]] - Optional initial detectors to register.
131
117
  * @param {MutationObserverInit} [settings.initCfg] - Optional MutationObserver configuration.
132
118
  */
133
- constructor({ el, initDetectors = [], initCfg = {} } = {}) {
134
- this.el = el;
119
+ constructor(el, { initDetectors = [], initCfg = {} } = {}) {
120
+ this.#el = el;
135
121
  if (initDetectors.length)
136
122
  this.detectors = initDetectors;
137
123
  if (initCfg)
@@ -264,6 +264,13 @@ class TinyEvents {
264
264
  this.#listeners.clear();
265
265
  }
266
266
 
267
+ /**
268
+ * Removes all event listeners of all types from the element.
269
+ */
270
+ removeAllListeners() {
271
+ return this.offAllTypes();
272
+ }
273
+
267
274
  /////////////////////////////////////////////
268
275
 
269
276
  /**
@@ -101,6 +101,10 @@ declare class TinyEvents {
101
101
  * Removes all event listeners of all types from the element.
102
102
  */
103
103
  offAllTypes(): void;
104
+ /**
105
+ * Removes all event listeners of all types from the element.
106
+ */
107
+ removeAllListeners(): void;
104
108
  /**
105
109
  * Returns the number of listeners for a given event.
106
110
  *
@@ -244,6 +244,12 @@ class TinyEvents {
244
244
  offAllTypes() {
245
245
  this.#listeners.clear();
246
246
  }
247
+ /**
248
+ * Removes all event listeners of all types from the element.
249
+ */
250
+ removeAllListeners() {
251
+ return this.offAllTypes();
252
+ }
247
253
  /////////////////////////////////////////////
248
254
  /**
249
255
  * Returns the number of listeners for a given event.
@@ -1267,12 +1267,10 @@ class TinyGamepad {
1267
1267
  mapInput(logicalName, physicalInput) {
1268
1268
  if (typeof logicalName !== 'string' || !logicalName.trim())
1269
1269
  throw new TypeError(`Invalid "logicalName": expected a non-empty string, got ${logicalName}`);
1270
- if (
1271
- !(
1272
- typeof physicalInput === 'string' ||
1273
- (Array.isArray(physicalInput) && physicalInput.every((p) => typeof p === 'string'))
1274
- )
1275
- )
1270
+ if (!(
1271
+ typeof physicalInput === 'string' ||
1272
+ (Array.isArray(physicalInput) && physicalInput.every((p) => typeof p === 'string'))
1273
+ ))
1276
1274
  throw new TypeError(
1277
1275
  `Invalid "physicalInput": expected string or array of strings, got ${JSON.stringify(physicalInput)}`,
1278
1276
  );
@@ -493,7 +493,7 @@ export type ExportedConfig = {
493
493
  */
494
494
  declare class TinyGamepad {
495
495
  /** @type {Record<string, string>} */
496
- static "__#private@#specialMap": Record<string, string>;
496
+ static #specialMap: Record<string, string>;
497
497
  /**
498
498
  * Add or update a special key mapping.
499
499
  * @param {string} char - The character to map.
@@ -8,7 +8,7 @@ export default TinyHtmlIcon;
8
8
  */
9
9
  declare class TinyHtmlIcon extends TinyHtmlTemplate<HTMLElement> {
10
10
  /** @type {string} */
11
- static "__#private@#defaultTag": string;
11
+ static #defaultTag: string;
12
12
  /** @param {string} value */
13
13
  static set defaultTag(value: string);
14
14
  /** @returns {string} */
@@ -34,7 +34,7 @@ declare class TinyHtmlTemplate<TinyHtmlT extends Element> extends TinyHtml<TinyH
34
34
  * @param {ClassSetter} value
35
35
  * @returns {Set<string>}
36
36
  */
37
- static "__#private@#normalizeClasses"(value: ClassSetter): Set<string>;
37
+ static #normalizeClasses(value: ClassSetter): Set<string>;
38
38
  /**
39
39
  * Creates a new TinyHtmlTemplate instance.
40
40
  * @param {TinyHtmlT} tag - The HTML tag name to create (e.g., 'div', 'span').
@@ -57,7 +57,7 @@ declare class TinyHtmlTextarea extends TinyHtmlTemplate<HTMLTextAreaElement> {
57
57
  name?: string | undefined;
58
58
  readonly?: boolean | undefined;
59
59
  required?: boolean | undefined;
60
- spellcheck?: boolean | "false" | "true" | "default" | undefined;
60
+ spellcheck?: boolean | "false" | "default" | "true" | undefined;
61
61
  wrap?: "off" | "soft" | "hard" | undefined;
62
62
  tags?: string | string[] | Set<string> | undefined;
63
63
  mainClass?: string | undefined;
@@ -4,7 +4,7 @@ export default TinyHtmlElems;
4
4
  * @beta
5
5
  */
6
6
  declare class TinyHtmlElems {
7
- static "__#private@#list": (typeof TinyHtmlTemplate | typeof TinyHtmlAnchor | typeof TinyHtmlButton | typeof TinyHtmlCanvas | typeof TinyHtmlDatalist | typeof TinyHtmlEmbed | typeof TinyHtmlForm | typeof TinyHtmlIcon | typeof TinyHtmlIframe | typeof TinyHtmlImage | typeof TinyHtmlInput | typeof TinyHtmlLink | typeof TinyHtmlMedia | typeof TinyHtmlScript | typeof TinyHtmlSelect | typeof TinyHtmlStyle | typeof TinyHtmlTextarea | typeof TinyHtmlResetInput | typeof TinyHtmlNumberInput | typeof TinyHtmlFileInput | typeof TinyHtmlHiddenInput | typeof TinyHtmlImageInput | typeof TinyHtmlAudio | typeof TinyHtmlObject | typeof TinyHtmlSource)[];
7
+ static #list: (typeof TinyHtmlTemplate | typeof TinyHtmlAnchor | typeof TinyHtmlButton | typeof TinyHtmlCanvas | typeof TinyHtmlDatalist | typeof TinyHtmlEmbed | typeof TinyHtmlForm | typeof TinyHtmlIcon | typeof TinyHtmlIframe | typeof TinyHtmlImage | typeof TinyHtmlInput | typeof TinyHtmlLink | typeof TinyHtmlMedia | typeof TinyHtmlScript | typeof TinyHtmlSelect | typeof TinyHtmlStyle | typeof TinyHtmlTextarea | typeof TinyHtmlResetInput | typeof TinyHtmlNumberInput | typeof TinyHtmlFileInput | typeof TinyHtmlHiddenInput | typeof TinyHtmlImageInput | typeof TinyHtmlAudio | typeof TinyHtmlObject | typeof TinyHtmlSource)[];
8
8
  static get list(): (typeof TinyHtmlTemplate | typeof TinyHtmlAnchor | typeof TinyHtmlButton | typeof TinyHtmlCanvas | typeof TinyHtmlDatalist | typeof TinyHtmlEmbed | typeof TinyHtmlForm | typeof TinyHtmlIcon | typeof TinyHtmlIframe | typeof TinyHtmlImage | typeof TinyHtmlInput | typeof TinyHtmlLink | typeof TinyHtmlMedia | typeof TinyHtmlScript | typeof TinyHtmlSelect | typeof TinyHtmlStyle | typeof TinyHtmlTextarea | typeof TinyHtmlResetInput | typeof TinyHtmlNumberInput | typeof TinyHtmlFileInput | typeof TinyHtmlHiddenInput | typeof TinyHtmlImageInput | typeof TinyHtmlAudio | typeof TinyHtmlObject | typeof TinyHtmlSource)[];
9
9
  static ButtonInput: typeof TinyHtmlButtonInput;
10
10
  static ResetInput: typeof TinyHtmlResetInput;