tiny-essentials 1.17.1 → 1.18.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.
Files changed (60) hide show
  1. package/dist/legacy/get/countObj.cjs +2 -2
  2. package/dist/legacy/get/countObj.d.mts +1 -1
  3. package/dist/legacy/get/countObj.mjs +1 -1
  4. package/dist/legacy/index.cjs +2 -1
  5. package/dist/v1/TinyBasicsEs.js +559 -411
  6. package/dist/v1/TinyBasicsEs.min.js +1 -1
  7. package/dist/v1/TinyClipboard.js +459 -0
  8. package/dist/v1/TinyClipboard.min.js +1 -0
  9. package/dist/v1/TinyDragger.js +170 -2454
  10. package/dist/v1/TinyDragger.min.js +1 -2
  11. package/dist/v1/TinyEssentials.js +1093 -63
  12. package/dist/v1/TinyEssentials.min.js +1 -1
  13. package/dist/v1/TinyHtml.js +164 -21
  14. package/dist/v1/TinyHtml.min.js +1 -1
  15. package/dist/v1/TinySmartScroller.js +164 -21
  16. package/dist/v1/TinySmartScroller.min.js +1 -1
  17. package/dist/v1/TinyTextRangeEditor.js +497 -0
  18. package/dist/v1/TinyTextRangeEditor.min.js +1 -0
  19. package/dist/v1/TinyUploadClicker.js +219 -467
  20. package/dist/v1/TinyUploadClicker.min.js +1 -1
  21. package/dist/v1/basics/html.cjs +3 -3
  22. package/dist/v1/basics/html.mjs +1 -1
  23. package/dist/v1/basics/index.cjs +3 -2
  24. package/dist/v1/basics/index.d.mts +2 -2
  25. package/dist/v1/basics/index.mjs +2 -1
  26. package/dist/v1/basics/objChecker.cjs +46 -0
  27. package/dist/v1/basics/objChecker.d.mts +29 -0
  28. package/dist/v1/basics/objChecker.mjs +45 -0
  29. package/dist/v1/basics/objFilter.cjs +4 -45
  30. package/dist/v1/basics/objFilter.d.mts +3 -28
  31. package/dist/v1/basics/objFilter.mjs +2 -45
  32. package/dist/v1/build/TinyClipboard.cjs +7 -0
  33. package/dist/v1/build/TinyClipboard.d.mts +3 -0
  34. package/dist/v1/build/TinyClipboard.mjs +2 -0
  35. package/dist/v1/build/TinyTextRangeEditor.cjs +7 -0
  36. package/dist/v1/build/TinyTextRangeEditor.d.mts +3 -0
  37. package/dist/v1/build/TinyTextRangeEditor.mjs +2 -0
  38. package/dist/v1/index.cjs +7 -2
  39. package/dist/v1/index.d.mts +5 -3
  40. package/dist/v1/index.mjs +5 -2
  41. package/dist/v1/libs/TinyClipboard.cjs +420 -0
  42. package/dist/v1/libs/TinyClipboard.d.mts +155 -0
  43. package/dist/v1/libs/TinyClipboard.mjs +398 -0
  44. package/dist/v1/libs/TinyDragger.cjs +3 -3
  45. package/dist/v1/libs/TinyDragger.mjs +1 -1
  46. package/dist/v1/libs/TinyHtml.cjs +164 -21
  47. package/dist/v1/libs/TinyHtml.d.mts +150 -27
  48. package/dist/v1/libs/TinyHtml.mjs +158 -20
  49. package/dist/v1/libs/TinyTextRangeEditor.cjs +458 -0
  50. package/dist/v1/libs/TinyTextRangeEditor.d.mts +200 -0
  51. package/dist/v1/libs/TinyTextRangeEditor.mjs +424 -0
  52. package/dist/v1/libs/TinyUploadClicker.cjs +5 -4
  53. package/docs/v1/README.md +3 -0
  54. package/docs/v1/basics/objChecker.md +47 -0
  55. package/docs/v1/basics/objFilter.md +0 -40
  56. package/docs/v1/libs/TinyClipboard.md +213 -0
  57. package/docs/v1/libs/TinyHtml.md +112 -15
  58. package/docs/v1/libs/TinyTextRangeEditor.md +208 -0
  59. package/package.json +1 -1
  60. package/dist/v1/TinyDragger.min.js.LICENSE.txt +0 -8
@@ -94,6 +94,21 @@ const {
94
94
  * @typedef {Element|Window|Document} ElementAndWinAndDoc
95
95
  */
96
96
 
97
+ /**
98
+ * Represents a raw DOM element with document or an instance of TinyHtml.
99
+ * This type is used to abstract interactions with both plain elements
100
+ * and wrapped elements via the TinyHtml class.
101
+ *
102
+ * @typedef {ElementWithDoc|TinyHtml} TinyElementWithDoc
103
+ */
104
+
105
+ /**
106
+ * Represents a value that can be either a DOM Element, or the document object.
107
+ * Useful for functions that operate generically on measurable targets.
108
+ *
109
+ * @typedef {Element|Document} ElementWithDoc
110
+ */
111
+
97
112
  /**
98
113
  * A parameter type used for filtering or matching elements.
99
114
  * It can be:
@@ -113,12 +128,6 @@ const {
113
128
  * @typedef {Window|Element|Document|Text} ConstructorElValues
114
129
  */
115
130
 
116
- /**
117
- * The handler function used in event listeners.
118
- *
119
- * @typedef {(e: Event) => any} EventRegistryHandle
120
- */
121
-
122
131
  /**
123
132
  * Options passed to `addEventListener` or `removeEventListener`.
124
133
  * Can be a boolean or an object of type `AddEventListenerOptions`.
@@ -130,7 +139,7 @@ const {
130
139
  * Structure describing a registered event callback and its options.
131
140
  *
132
141
  * @typedef {Object} EventRegistryItem
133
- * @property {EventRegistryHandle} handler - The function to be executed when the event is triggered.
142
+ * @property {EventListenerOrEventListenerObject|null} handler - The function to be executed when the event is triggered.
134
143
  * @property {EventRegistryOptions} [options] - Optional configuration passed to the listener.
135
144
  */
136
145
 
@@ -689,9 +698,9 @@ class TinyHtml {
689
698
  * Ensures the input is returned as an array.
690
699
  * Useful to normalize operations across multiple or single element/window/document elements.
691
700
  *
692
- * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
701
+ * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/document/window element or array of html elements.
693
702
  * @param {string} where - The method or context name where validation is being called.
694
- * @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
703
+ * @returns {ElementAndWindow[]} - Always returns an array of element/document/window elements.
695
704
  * @readonly
696
705
  */
697
706
  static _preElemsAndWinAndDoc(elems, where) {
@@ -708,9 +717,9 @@ class TinyHtml {
708
717
  * Ensures the input is returned as an single element/window/document element.
709
718
  * Useful to normalize operations across multiple or single element/window/document elements.
710
719
  *
711
- * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
720
+ * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/document/window element or array of html elements.
712
721
  * @param {string} where - The method or context name where validation is being called.
713
- * @returns {ElementAndWindow} - Always returns an single element/window element.
722
+ * @returns {ElementAndWindow} - Always returns an single element/document/window element.
714
723
  * @readonly
715
724
  */
716
725
  static _preElemAndWinAndDoc(elems, where) {
@@ -724,6 +733,32 @@ class TinyHtml {
724
733
  return result;
725
734
  }
726
735
 
736
+ /**
737
+ * Ensures the input is returned as an array.
738
+ * Useful to normalize operations across multiple or single element with document elements.
739
+ *
740
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} elems - A single element with document element or array of html elements.
741
+ * @param {string} where - The method or context name where validation is being called.
742
+ * @returns {ElementWithDoc[]} - Always returns an array of element with document elements.
743
+ * @readonly
744
+ */
745
+ static _preElemsWithDoc(elems, where) {
746
+ return TinyHtml._preElemsTemplate(elems, where, [Element, Document], ['Element', 'Document']);
747
+ }
748
+
749
+ /**
750
+ * Ensures the input is returned as an single element with document element.
751
+ * Useful to normalize operations across multiple or single element with document elements.
752
+ *
753
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} elems - A single element/window element or array of html elements.
754
+ * @param {string} where - The method or context name where validation is being called.
755
+ * @returns {ElementWithDoc} - Always returns an single element/window element.
756
+ * @readonly
757
+ */
758
+ static _preElemWithDoc(elems, where) {
759
+ return TinyHtml._preElemTemplate(elems, where, [Element, Document], ['Element', 'Document']);
760
+ }
761
+
727
762
  /**
728
763
  * Normalizes and converts one or more DOM elements (or TinyHtml instances)
729
764
  * into an array of `TinyHtml` instances.
@@ -3983,12 +4018,120 @@ class TinyHtml {
3983
4018
 
3984
4019
  ////////////////////////////////////////////
3985
4020
 
4021
+ /**
4022
+ * Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
4023
+ *
4024
+ * This method allows reacting to pasted content by providing separate callbacks for files and plain text.
4025
+ * Useful for building file upload areas, rich-text editors, or input enhancements.
4026
+ *
4027
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} el - The target element(s) where the "paste" event will be listened.
4028
+ * @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
4029
+ * @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
4030
+ * @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
4031
+ * @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
4032
+ */
4033
+ static listenForPaste(el, { onFilePaste, onTextPaste } = {}) {
4034
+ if (typeof onFilePaste !== 'undefined' && typeof onFilePaste !== 'function')
4035
+ throw new TypeError('onFilePaste must be a function.');
4036
+ if (typeof onTextPaste !== 'undefined' && typeof onTextPaste !== 'function')
4037
+ throw new TypeError('onTextPaste must be a function.');
4038
+
4039
+ /** @type {EventListenerOrEventListenerObject} */
4040
+ const pasteEvent = (event) => {
4041
+ if (!(event instanceof ClipboardEvent)) return;
4042
+ const items = event.clipboardData?.items || [];
4043
+ for (const item of items) {
4044
+ if (item.kind === 'file') {
4045
+ if (typeof onFilePaste === 'function') {
4046
+ const file = item.getAsFile();
4047
+ if (file) onFilePaste(item, file);
4048
+ }
4049
+ } else if (item.kind === 'string') {
4050
+ if (typeof onTextPaste === 'function')
4051
+ item.getAsString((text) => onTextPaste(item, text));
4052
+ }
4053
+ }
4054
+ };
4055
+
4056
+ TinyHtml._preElemsWithDoc(el, 'listenForPaste').forEach((elem) =>
4057
+ TinyHtml.on(elem, 'paste', pasteEvent),
4058
+ );
4059
+ return pasteEvent;
4060
+ }
4061
+
4062
+ /**
4063
+ * Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
4064
+ *
4065
+ * This method allows reacting to pasted content by providing separate callbacks for files and plain text.
4066
+ * Useful for building file upload areas, rich-text editors, or input enhancements.
4067
+ *
4068
+ * @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
4069
+ * @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
4070
+ * @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
4071
+ * @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
4072
+ */
4073
+ listenForPaste({ onFilePaste, onTextPaste } = {}) {
4074
+ return TinyHtml.listenForPaste(this, { onFilePaste, onTextPaste });
4075
+ }
4076
+
4077
+ /**
4078
+ * Checks if the element has a listener for a specific event.
4079
+ *
4080
+ * @param {TinyEventTarget} el - The element to check.
4081
+ * @param {string} event - The event name to check.
4082
+ * @returns {boolean}
4083
+ */
4084
+ static hasEventListener(el, event) {
4085
+ const elem = TinyHtml._preEventTargetElem(el, 'hasEventListener');
4086
+ if (!__eventRegistry.has(elem)) return false;
4087
+ const events = __eventRegistry.get(elem);
4088
+ return !!(events && Array.isArray(events[event]) && events[event].length > 0);
4089
+ }
4090
+
4091
+ /**
4092
+ * Checks if the element has a listener for a specific event.
4093
+ *
4094
+ * @param {string} event - The event name to check.
4095
+ * @returns {boolean}
4096
+ */
4097
+ hasEventListener(event) {
4098
+ return TinyHtml.hasEventListener(this, event);
4099
+ }
4100
+
4101
+ /**
4102
+ * Checks if the element has the exact handler registered for a specific event.
4103
+ *
4104
+ * @param {TinyEventTarget} el - The element to check.
4105
+ * @param {string} event - The event name to check.
4106
+ * @param {EventListenerOrEventListenerObject} handler - The handler function to check.
4107
+ * @returns {boolean}
4108
+ */
4109
+ static hasExactEventListener(el, event, handler) {
4110
+ const elem = TinyHtml._preEventTargetElem(el, 'hasExactEventListener');
4111
+ if (typeof handler !== 'function') throw new TypeError('The "handler" must be a function.');
4112
+ if (!__eventRegistry.has(elem)) return false;
4113
+ const events = __eventRegistry.get(elem);
4114
+ if (!events || !Array.isArray(events[event])) return false;
4115
+ return events[event].some((item) => item.handler === handler);
4116
+ }
4117
+
4118
+ /**
4119
+ * Checks if the element has the exact handler registered for a specific event.
4120
+ *
4121
+ * @param {string} event - The event name to check.
4122
+ * @param {EventListenerOrEventListenerObject} handler - The handler function to check.
4123
+ * @returns {boolean}
4124
+ */
4125
+ hasExactEventListener(event, handler) {
4126
+ return TinyHtml.hasExactEventListener(this, event, handler);
4127
+ }
4128
+
3986
4129
  /**
3987
4130
  * Registers an event listener on the specified element.
3988
4131
  *
3989
4132
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target to listen on.
3990
4133
  * @param {string} event - The event type (e.g. 'click', 'keydown').
3991
- * @param {EventRegistryHandle} handler - The callback function to run on event.
4134
+ * @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
3992
4135
  * @param {EventRegistryOptions} [options] - Optional event listener options.
3993
4136
  * @returns {TinyEventTarget|TinyEventTarget[]}
3994
4137
  */
@@ -4010,7 +4153,7 @@ class TinyHtml {
4010
4153
  * Registers an event listener on the specified element.
4011
4154
  *
4012
4155
  * @param {string} event - The event type (e.g. 'click', 'keydown').
4013
- * @param {EventRegistryHandle} handler - The callback function to run on event.
4156
+ * @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
4014
4157
  * @param {EventRegistryOptions} [options] - Optional event listener options.
4015
4158
  * @returns {TinyEventTarget|TinyEventTarget[]}
4016
4159
  */
@@ -4023,17 +4166,17 @@ class TinyHtml {
4023
4166
  *
4024
4167
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target to listen on.
4025
4168
  * @param {string} event - The event type (e.g. 'click', 'keydown').
4026
- * @param {EventRegistryHandle} handler - The callback function to run on event.
4169
+ * @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
4027
4170
  * @param {EventRegistryOptions} [options={}] - Optional event listener options.
4028
4171
  * @returns {TinyEventTarget|TinyEventTarget[]}
4029
4172
  */
4030
4173
  static once(el, event, handler, options = {}) {
4031
4174
  if (typeof event !== 'string') throw new TypeError('The event name must be a string.');
4032
4175
  TinyHtml._preEventTargetElems(el, 'once').forEach((elem) => {
4033
- /** @type {EventRegistryHandle} e */
4176
+ /** @type {EventListenerOrEventListenerObject} */
4034
4177
  const wrapped = (e) => {
4035
4178
  TinyHtml.off(elem, event, wrapped);
4036
- handler(e);
4179
+ if (typeof handler === 'function') handler(e);
4037
4180
  };
4038
4181
 
4039
4182
  TinyHtml.on(
@@ -4050,7 +4193,7 @@ class TinyHtml {
4050
4193
  * Registers an event listener that runs only once, then is removed.
4051
4194
  *
4052
4195
  * @param {string} event - The event type (e.g. 'click', 'keydown').
4053
- * @param {EventRegistryHandle} handler - The callback function to run on event.
4196
+ * @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
4054
4197
  * @param {EventRegistryOptions} [options={}] - Optional event listener options.
4055
4198
  * @returns {TinyEventTarget|TinyEventTarget[]}
4056
4199
  */
@@ -4063,7 +4206,7 @@ class TinyHtml {
4063
4206
  *
4064
4207
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
4065
4208
  * @param {string} event - The event type.
4066
- * @param {EventRegistryHandle} handler - The function originally bound to the event.
4209
+ * @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
4067
4210
  * @param {boolean|EventListenerOptions} [options] - Optional listener options.
4068
4211
  * @returns {TinyEventTarget|TinyEventTarget[]}
4069
4212
  */
@@ -4085,7 +4228,7 @@ class TinyHtml {
4085
4228
  * Removes a specific event listener from an element.
4086
4229
  *
4087
4230
  * @param {string} event - The event type.
4088
- * @param {EventRegistryHandle} handler - The function originally bound to the event.
4231
+ * @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
4089
4232
  * @param {boolean|EventListenerOptions} [options] - Optional listener options.
4090
4233
  * @returns {TinyEventTarget|TinyEventTarget[]}
4091
4234
  */
@@ -4128,7 +4271,7 @@ class TinyHtml {
4128
4271
  * Removes all event listeners of all types from the element.
4129
4272
  *
4130
4273
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
4131
- * @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
4274
+ * @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
4132
4275
  * Optional filter function to selectively remove specific handlers.
4133
4276
  * @returns {TinyEventTarget|TinyEventTarget[]}
4134
4277
  */
@@ -4155,7 +4298,7 @@ class TinyHtml {
4155
4298
  /**
4156
4299
  * Removes all event listeners of all types from the element.
4157
4300
  *
4158
- * @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
4301
+ * @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
4159
4302
  * Optional filter function to selectively remove specific handlers.
4160
4303
  * @returns {TinyEventTarget|TinyEventTarget[]}
4161
4304
  */
@@ -65,6 +65,17 @@ export type TinyElementAndWinAndDoc = ElementAndWinAndDoc | TinyHtml;
65
65
  * Useful for functions that operate generically on scrollable or measurable targets.
66
66
  */
67
67
  export type ElementAndWinAndDoc = Element | Window | Document;
68
+ /**
69
+ * Represents a raw DOM element with document or an instance of TinyHtml.
70
+ * This type is used to abstract interactions with both plain elements
71
+ * and wrapped elements via the TinyHtml class.
72
+ */
73
+ export type TinyElementWithDoc = ElementWithDoc | TinyHtml;
74
+ /**
75
+ * Represents a value that can be either a DOM Element, or the document object.
76
+ * Useful for functions that operate generically on measurable targets.
77
+ */
78
+ export type ElementWithDoc = Element | Document;
68
79
  /**
69
80
  * A parameter type used for filtering or matching elements.
70
81
  * It can be:
@@ -80,10 +91,6 @@ export type WinnowRequest = string | Element | Element[] | ((index: number, el:
80
91
  * These include common DOM elements and root containers.
81
92
  */
82
93
  export type ConstructorElValues = Window | Element | Document | Text;
83
- /**
84
- * The handler function used in event listeners.
85
- */
86
- export type EventRegistryHandle = (e: Event) => any;
87
94
  /**
88
95
  * Options passed to `addEventListener` or `removeEventListener`.
89
96
  * Can be a boolean or an object of type `AddEventListenerOptions`.
@@ -96,7 +103,7 @@ export type EventRegistryItem = {
96
103
  /**
97
104
  * - The function to be executed when the event is triggered.
98
105
  */
99
- handler: EventRegistryHandle;
106
+ handler: EventListenerOrEventListenerObject | null;
100
107
  /**
101
108
  * - Optional configuration passed to the listener.
102
109
  */
@@ -215,8 +222,41 @@ declare class TinyHtml {
215
222
  areElsCollPerfRight: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
216
223
  areElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
217
224
  areElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => boolean;
218
- getElsColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
219
- getElsPerfColliding: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => "top" | "bottom" | "left" | "right" | null;
225
+ getElsColliding: (
226
+ /**
227
+ * @typedef {'string' | 'date' | 'number'} GetValueTypes
228
+ * Types of value extractors supported by TinyHtml._valTypes.
229
+ */
230
+ /**
231
+ * @typedef {SetValueBase|SetValueBase[]} SetValueList - A single value or an array of values to be assigned to the input element.
232
+ */
233
+ /**
234
+ * A list of HTML form elements that can have a `.value` property used by TinyHtml.
235
+ * Includes common input types used in forms.
236
+ *
237
+ * @typedef {HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLOptionElement} InputElement
238
+ */
239
+ /**
240
+ * TinyHtml is a utility class that provides static and instance-level methods
241
+ * for precise dimension and position computations on HTML elements.
242
+ * It mimics some jQuery functionalities while using native browser APIs.
243
+ *
244
+ * Inspired by the jQuery project's open source implementations of element dimension
245
+ * and offset utilities. This class serves as a lightweight alternative using modern DOM APIs.
246
+ *
247
+ * @class
248
+ */
249
+ rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => string | null;
250
+ getElsPerfColliding: (rect1: TinyCollision.ObjRect /**
251
+ * TinyHtml is a utility class that provides static and instance-level methods
252
+ * for precise dimension and position computations on HTML elements.
253
+ * It mimics some jQuery functionalities while using native browser APIs.
254
+ *
255
+ * Inspired by the jQuery project's open source implementations of element dimension
256
+ * and offset utilities. This class serves as a lightweight alternative using modern DOM APIs.
257
+ *
258
+ * @class
259
+ */, rect2: TinyCollision.ObjRect) => "top" | "bottom" | "left" | "right" | null;
220
260
  getElsCollOverlap: (rect1: TinyCollision.ObjRect, rect2: TinyCollision.ObjRect) => {
221
261
  overlapLeft: number;
222
262
  overlapRight: number;
@@ -467,9 +507,9 @@ declare class TinyHtml {
467
507
  * Ensures the input is returned as an array.
468
508
  * Useful to normalize operations across multiple or single element/window/document elements.
469
509
  *
470
- * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
510
+ * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/document/window element or array of html elements.
471
511
  * @param {string} where - The method or context name where validation is being called.
472
- * @returns {ElementAndWindow[]} - Always returns an array of element/window elements.
512
+ * @returns {ElementAndWindow[]} - Always returns an array of element/document/window elements.
473
513
  * @readonly
474
514
  */
475
515
  static readonly _preElemsAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow[];
@@ -477,12 +517,32 @@ declare class TinyHtml {
477
517
  * Ensures the input is returned as an single element/window/document element.
478
518
  * Useful to normalize operations across multiple or single element/window/document elements.
479
519
  *
480
- * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/window element or array of html elements.
520
+ * @param {TinyElementAndWinAndDoc|TinyElementAndWinAndDoc[]} elems - A single element/document/window element or array of html elements.
481
521
  * @param {string} where - The method or context name where validation is being called.
482
- * @returns {ElementAndWindow} - Always returns an single element/window element.
522
+ * @returns {ElementAndWindow} - Always returns an single element/document/window element.
483
523
  * @readonly
484
524
  */
485
525
  static readonly _preElemAndWinAndDoc(elems: TinyElementAndWinAndDoc | TinyElementAndWinAndDoc[], where: string): ElementAndWindow;
526
+ /**
527
+ * Ensures the input is returned as an array.
528
+ * Useful to normalize operations across multiple or single element with document elements.
529
+ *
530
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} elems - A single element with document element or array of html elements.
531
+ * @param {string} where - The method or context name where validation is being called.
532
+ * @returns {ElementWithDoc[]} - Always returns an array of element with document elements.
533
+ * @readonly
534
+ */
535
+ static readonly _preElemsWithDoc(elems: TinyElementWithDoc | TinyElementWithDoc[], where: string): ElementWithDoc[];
536
+ /**
537
+ * Ensures the input is returned as an single element with document element.
538
+ * Useful to normalize operations across multiple or single element with document elements.
539
+ *
540
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} elems - A single element/window element or array of html elements.
541
+ * @param {string} where - The method or context name where validation is being called.
542
+ * @returns {ElementWithDoc} - Always returns an single element/window element.
543
+ * @readonly
544
+ */
545
+ static readonly _preElemWithDoc(elems: TinyElementWithDoc | TinyElementWithDoc[], where: string): ElementWithDoc;
486
546
  /**
487
547
  * Normalizes and converts one or more DOM elements (or TinyHtml instances)
488
548
  * into an array of `TinyHtml` instances.
@@ -1479,36 +1539,69 @@ declare class TinyHtml {
1479
1539
  * @throws {Error} If the element is not a checkbox/radio input.
1480
1540
  */
1481
1541
  static valBool(el: TinyInputElement): boolean;
1542
+ /**
1543
+ * Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
1544
+ *
1545
+ * This method allows reacting to pasted content by providing separate callbacks for files and plain text.
1546
+ * Useful for building file upload areas, rich-text editors, or input enhancements.
1547
+ *
1548
+ * @param {TinyElementWithDoc|TinyElementWithDoc[]} el - The target element(s) where the "paste" event will be listened.
1549
+ * @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
1550
+ * @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
1551
+ * @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
1552
+ * @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
1553
+ */
1554
+ static listenForPaste(el: TinyElementWithDoc | TinyElementWithDoc[], { onFilePaste, onTextPaste }?: {
1555
+ onFilePaste?: ((data: DataTransferItem, file: File) => void) | undefined;
1556
+ onTextPaste?: ((data: DataTransferItem, text: string) => void) | undefined;
1557
+ }): EventListenerOrEventListenerObject;
1558
+ /**
1559
+ * Checks if the element has a listener for a specific event.
1560
+ *
1561
+ * @param {TinyEventTarget} el - The element to check.
1562
+ * @param {string} event - The event name to check.
1563
+ * @returns {boolean}
1564
+ */
1565
+ static hasEventListener(el: TinyEventTarget, event: string): boolean;
1566
+ /**
1567
+ * Checks if the element has the exact handler registered for a specific event.
1568
+ *
1569
+ * @param {TinyEventTarget} el - The element to check.
1570
+ * @param {string} event - The event name to check.
1571
+ * @param {EventListenerOrEventListenerObject} handler - The handler function to check.
1572
+ * @returns {boolean}
1573
+ */
1574
+ static hasExactEventListener(el: TinyEventTarget, event: string, handler: EventListenerOrEventListenerObject): boolean;
1482
1575
  /**
1483
1576
  * Registers an event listener on the specified element.
1484
1577
  *
1485
1578
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target to listen on.
1486
1579
  * @param {string} event - The event type (e.g. 'click', 'keydown').
1487
- * @param {EventRegistryHandle} handler - The callback function to run on event.
1580
+ * @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
1488
1581
  * @param {EventRegistryOptions} [options] - Optional event listener options.
1489
1582
  * @returns {TinyEventTarget|TinyEventTarget[]}
1490
1583
  */
1491
- static on(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
1584
+ static on(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventListenerOrEventListenerObject | null, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
1492
1585
  /**
1493
1586
  * Registers an event listener that runs only once, then is removed.
1494
1587
  *
1495
1588
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target to listen on.
1496
1589
  * @param {string} event - The event type (e.g. 'click', 'keydown').
1497
- * @param {EventRegistryHandle} handler - The callback function to run on event.
1590
+ * @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
1498
1591
  * @param {EventRegistryOptions} [options={}] - Optional event listener options.
1499
1592
  * @returns {TinyEventTarget|TinyEventTarget[]}
1500
1593
  */
1501
- static once(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
1594
+ static once(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventListenerOrEventListenerObject, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
1502
1595
  /**
1503
1596
  * Removes a specific event listener from an element.
1504
1597
  *
1505
1598
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
1506
1599
  * @param {string} event - The event type.
1507
- * @param {EventRegistryHandle} handler - The function originally bound to the event.
1600
+ * @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
1508
1601
  * @param {boolean|EventListenerOptions} [options] - Optional listener options.
1509
1602
  * @returns {TinyEventTarget|TinyEventTarget[]}
1510
1603
  */
1511
- static off(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
1604
+ static off(el: TinyEventTarget | TinyEventTarget[], event: string, handler: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
1512
1605
  /**
1513
1606
  * Removes all event listeners of a specific type from the element.
1514
1607
  *
@@ -1521,11 +1614,11 @@ declare class TinyHtml {
1521
1614
  * Removes all event listeners of all types from the element.
1522
1615
  *
1523
1616
  * @param {TinyEventTarget|TinyEventTarget[]} el - The target element.
1524
- * @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
1617
+ * @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
1525
1618
  * Optional filter function to selectively remove specific handlers.
1526
1619
  * @returns {TinyEventTarget|TinyEventTarget[]}
1527
1620
  */
1528
- static offAllTypes(el: TinyEventTarget | TinyEventTarget[], filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
1621
+ static offAllTypes(el: TinyEventTarget | TinyEventTarget[], filterFn?: ((handler: EventListenerOrEventListenerObject | null, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
1529
1622
  /**
1530
1623
  * Triggers all handlers associated with a specific event on the given element.
1531
1624
  *
@@ -2398,33 +2491,63 @@ declare class TinyHtml {
2398
2491
  * @throws {Error} If the element is not a checkbox/radio input.
2399
2492
  */
2400
2493
  valBool(): boolean;
2494
+ /**
2495
+ * Registers a listener for the "paste" event to extract files and text from the clipboard (e.g., when the user presses Ctrl+V).
2496
+ *
2497
+ * This method allows reacting to pasted content by providing separate callbacks for files and plain text.
2498
+ * Useful for building file upload areas, rich-text editors, or input enhancements.
2499
+ *
2500
+ * @param {Object} [settings={}] - Optional callbacks to handle clipboard content.
2501
+ * @param {(data: DataTransferItem, file: File) => void} [settings.onFilePaste] - Called for each file pasted from the clipboard (e.g., images).
2502
+ * @param {(data: DataTransferItem, text: string) => void} [settings.onTextPaste] - Called when plain text is pasted from the clipboard.
2503
+ * @returns {EventListenerOrEventListenerObject} The internal "paste" event handler used.
2504
+ */
2505
+ listenForPaste({ onFilePaste, onTextPaste }?: {
2506
+ onFilePaste?: ((data: DataTransferItem, file: File) => void) | undefined;
2507
+ onTextPaste?: ((data: DataTransferItem, text: string) => void) | undefined;
2508
+ }): EventListenerOrEventListenerObject;
2509
+ /**
2510
+ * Checks if the element has a listener for a specific event.
2511
+ *
2512
+ * @param {string} event - The event name to check.
2513
+ * @returns {boolean}
2514
+ */
2515
+ hasEventListener(event: string): boolean;
2516
+ /**
2517
+ * Checks if the element has the exact handler registered for a specific event.
2518
+ *
2519
+ * @param {string} event - The event name to check.
2520
+ * @param {EventListenerOrEventListenerObject} handler - The handler function to check.
2521
+ * @returns {boolean}
2522
+ */
2523
+ hasExactEventListener(event: string, handler: EventListenerOrEventListenerObject): boolean;
2401
2524
  /**
2402
2525
  * Registers an event listener on the specified element.
2403
2526
  *
2404
2527
  * @param {string} event - The event type (e.g. 'click', 'keydown').
2405
- * @param {EventRegistryHandle} handler - The callback function to run on event.
2528
+ * @param {EventListenerOrEventListenerObject|null} handler - The callback function to run on event.
2406
2529
  * @param {EventRegistryOptions} [options] - Optional event listener options.
2407
2530
  * @returns {TinyEventTarget|TinyEventTarget[]}
2408
2531
  */
2409
- on(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
2532
+ on(event: string, handler: EventListenerOrEventListenerObject | null, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
2410
2533
  /**
2411
2534
  * Registers an event listener that runs only once, then is removed.
2412
2535
  *
2413
2536
  * @param {string} event - The event type (e.g. 'click', 'keydown').
2414
- * @param {EventRegistryHandle} handler - The callback function to run on event.
2537
+ * @param {EventListenerOrEventListenerObject} handler - The callback function to run on event.
2415
2538
  * @param {EventRegistryOptions} [options={}] - Optional event listener options.
2416
2539
  * @returns {TinyEventTarget|TinyEventTarget[]}
2417
2540
  */
2418
- once(event: string, handler: EventRegistryHandle, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
2541
+ once(event: string, handler: EventListenerOrEventListenerObject, options?: EventRegistryOptions): TinyEventTarget | TinyEventTarget[];
2419
2542
  /**
2420
2543
  * Removes a specific event listener from an element.
2421
2544
  *
2422
2545
  * @param {string} event - The event type.
2423
- * @param {EventRegistryHandle} handler - The function originally bound to the event.
2546
+ * @param {EventListenerOrEventListenerObject|null} handler - The function originally bound to the event.
2424
2547
  * @param {boolean|EventListenerOptions} [options] - Optional listener options.
2425
2548
  * @returns {TinyEventTarget|TinyEventTarget[]}
2426
2549
  */
2427
- off(event: string, handler: EventRegistryHandle, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
2550
+ off(event: string, handler: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): TinyEventTarget | TinyEventTarget[];
2428
2551
  /**
2429
2552
  * Removes all event listeners of a specific type from the element.
2430
2553
  *
@@ -2435,11 +2558,11 @@ declare class TinyHtml {
2435
2558
  /**
2436
2559
  * Removes all event listeners of all types from the element.
2437
2560
  *
2438
- * @param {((handler: EventListenerOrEventListenerObject, event: string) => boolean)|null} [filterFn=null] -
2561
+ * @param {((handler: EventListenerOrEventListenerObject|null, event: string) => boolean)|null} [filterFn=null] -
2439
2562
  * Optional filter function to selectively remove specific handlers.
2440
2563
  * @returns {TinyEventTarget|TinyEventTarget[]}
2441
2564
  */
2442
- offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
2565
+ offAllTypes(filterFn?: ((handler: EventListenerOrEventListenerObject | null, event: string) => boolean) | null): TinyEventTarget | TinyEventTarget[];
2443
2566
  /**
2444
2567
  * Triggers all handlers associated with a specific event on the given element.
2445
2568
  *