tiny-essentials 1.15.0 β†’ 1.16.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 (47) hide show
  1. package/dist/v1/TinyAfterScrollWatcher.js +196 -0
  2. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -0
  3. package/dist/v1/TinyBasicsEs.js +5058 -745
  4. package/dist/v1/TinyBasicsEs.min.js +1 -1
  5. package/dist/v1/TinyDragger.js +4874 -546
  6. package/dist/v1/TinyDragger.min.js +1 -1
  7. package/dist/v1/TinyEssentials.js +5299 -750
  8. package/dist/v1/TinyEssentials.min.js +1 -1
  9. package/dist/v1/TinyHtml.js +4815 -0
  10. package/dist/v1/TinyHtml.min.js +1 -0
  11. package/dist/v1/TinyUploadClicker.js +5093 -298
  12. package/dist/v1/TinyUploadClicker.min.js +1 -1
  13. package/dist/v1/basics/html.cjs +5 -187
  14. package/dist/v1/basics/html.d.mts +2 -53
  15. package/dist/v1/basics/html.mjs +5 -161
  16. package/dist/v1/basics/html_deprecated.cjs +124 -0
  17. package/dist/v1/basics/html_deprecated.d.mts +40 -0
  18. package/dist/v1/basics/html_deprecated.mjs +97 -0
  19. package/dist/v1/basics/index.cjs +8 -7
  20. package/dist/v1/basics/index.d.mts +7 -7
  21. package/dist/v1/basics/index.mjs +2 -1
  22. package/dist/v1/build/TinyAfterScrollWatcher.cjs +7 -0
  23. package/dist/v1/build/TinyAfterScrollWatcher.d.mts +3 -0
  24. package/dist/v1/build/TinyAfterScrollWatcher.mjs +2 -0
  25. package/dist/v1/build/TinyHtml.cjs +7 -0
  26. package/dist/v1/build/TinyHtml.d.mts +3 -0
  27. package/dist/v1/build/TinyHtml.mjs +2 -0
  28. package/dist/v1/index.cjs +12 -7
  29. package/dist/v1/index.d.mts +10 -8
  30. package/dist/v1/index.mjs +5 -2
  31. package/dist/v1/libs/TinyAfterScrollWatcher.cjs +157 -0
  32. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +86 -0
  33. package/dist/v1/libs/TinyAfterScrollWatcher.mjs +138 -0
  34. package/dist/v1/libs/TinyDragger.cjs +91 -16
  35. package/dist/v1/libs/TinyDragger.d.mts +78 -2
  36. package/dist/v1/libs/TinyDragger.mjs +93 -17
  37. package/dist/v1/libs/TinyHtml.cjs +4347 -0
  38. package/dist/v1/libs/TinyHtml.d.mts +2301 -0
  39. package/dist/v1/libs/TinyHtml.mjs +3926 -0
  40. package/dist/v1/libs/TinyUploadClicker.cjs +1 -0
  41. package/docs/v1/README.md +11 -10
  42. package/docs/v1/basics/html.md +0 -130
  43. package/docs/v1/basics/html_deprecated.md +127 -0
  44. package/docs/v1/libs/TinyAfterScrollWatcher.md +181 -0
  45. package/docs/v1/libs/TinyDragger.md +45 -15
  46. package/docs/v1/libs/TinyHtml.md +1658 -0
  47. package/package.json +4 -1
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var objFilter = require('../basics/objFilter.cjs');
4
+ require('./TinyHtml.cjs');
4
5
  require('fs');
5
6
  require('path');
6
7
  require('fs/promises');
package/docs/v1/README.md CHANGED
@@ -12,15 +12,15 @@ Here, you can navigate through different sections of the project. Below are the
12
12
 
13
13
  This folder contains the core scripts we have worked on so far. Each file is a module focused on specific functionality.
14
14
 
15
- - πŸ“¦ **[array](./basics/array.md)** β€” A tiny utility for shuffling arrays using the Fisher–Yates algorithm.
16
- - ⏰ **[clock](./basics/clock.md)** β€” A versatile time utility module for calculating and formatting time durations.
17
- - 🧠 **[objFilter](./basics/objFilter.md)** β€” Type detection, extension, and analysis made easy with simple and extensible type validation.
18
- - πŸ”’ **[simpleMath](./basics/simpleMath.md)** β€” A collection of simple math utilities for calculations like the Rule of Three and percentages.
19
- - ✍️ **[text](./basics/text.md)** β€” A utility for transforming text into title case formats, with multiple options for capitalization.
20
- - πŸ”„ **[asyncReplace](./basics/asyncReplace.md)** β€” Asynchronously replaces matches in a string using a regex and an async function.
21
- - πŸ–ΌοΈ **[html](./basics/html.md)** β€” Utilities for handling DOM element interactions like collision detection and basic element manipulation.
22
- - πŸ“Ί **[fullScreen](./basics/fullScreen.md)** β€” A complete fullscreen API manager with detection, event handling, and cross-browser compatibility.
23
- - 🧱 **[collision](./basics/collision.md)** β€” Full-featured rectangle collision detection system with directional analysis, depth calculation, and center offset metrics.
15
+ - πŸ“¦ **[Array](./basics/array.md)** β€” A tiny utility for shuffling arrays using the Fisher–Yates algorithm.
16
+ - ⏰ **[Clock](./basics/clock.md)** β€” A versatile time utility module for calculating and formatting time durations.
17
+ - 🧠 **[ObjFilter](./basics/objFilter.md)** β€” Type detection, extension, and analysis made easy with simple and extensible type validation.
18
+ - πŸ”’ **[SimpleMath](./basics/simpleMath.md)** β€” A collection of simple math utilities for calculations like the Rule of Three and percentages.
19
+ - ✍️ **[Text](./basics/text.md)** β€” A utility for transforming text into title case formats, with multiple options for capitalization.
20
+ - πŸ”„ **[AsyncReplace](./basics/asyncReplace.md)** β€” Asynchronously replaces matches in a string using a regex and an async function.
21
+ - πŸ–ΌοΈ **[Html](./basics/html.md)** β€” Utilities for handling DOM element interactions like collision detection and basic element manipulation.
22
+ - πŸ“Ί **[FullScreen](./basics/fullScreen.md)** β€” A complete fullscreen API manager with detection, event handling, and cross-browser compatibility.
23
+ - 🧱 **[Collision](./basics/collision.md)** β€” Full-featured rectangle collision detection system with directional analysis, depth calculation, and center offset metrics.
24
24
 
25
25
  ### 2. **`libs/`**
26
26
  - πŸ—‚οΈ **[TinyPromiseQueue](./libs/TinyPromiseQueue.md)** β€” A class that allows sequential execution of asynchronous tasks, supporting task delays, cancellation, and queue management.
@@ -34,9 +34,10 @@ This folder contains the core scripts we have worked on so far. Each file is a m
34
34
  - 🧲 **[TinyDragger](./libs/TinyDragger.md)** β€” A flexible drag-and-drop manager with collision detection, jail constraints, vibration feedback, visual proxies, revert-on-drop, and full custom event support.
35
35
  - πŸ•’ **[TinyDomReadyManager](./libs/TinyDomReadyManager.md)** β€” A readiness manager for DOM and async conditions, supporting prioritized callbacks, custom filters, and event-based or promise-based bootstrapping.
36
36
  - πŸ“£ **[TinyNotifications](./libs/TinyNotifications.md)** β€” A browser notification utility with sound support, permission management, truncation logic, default icons, and enforced validation to ensure safe and predictable usage.
37
+ - 🧱 **[TinyHtml](./libs/TinyHtml.md)** β€” A minimalist DOM utility class that offers jQuery-like methods in pure JavaScript for querying, styling, traversing, event handling, collision detection, and visibility logic β€” all in a lightweight and chainable interface.
37
38
 
38
39
  ### 3. **`fileManager/`**
39
- * πŸ“ **[main](./fileManager/main.md)** β€” A Node.js file/directory utility module with support for JSON, backups, renaming, size analysis, and more.
40
+ * πŸ“ **[Main](./fileManager/main.md)** β€” A Node.js file/directory utility module with support for JSON, backups, renaming, size analysis, and more.
40
41
 
41
42
  ---
42
43
 
@@ -1,55 +1,3 @@
1
- ### πŸš€ `areHtmlElsColliding()`
2
-
3
- Check if two DOM elements are **colliding on the screen**! Perfect for games, draggable elements, UI interactions, and more.
4
-
5
- This function checks whether **two HTML elements are overlapping** (colliding) within the viewport. It uses their bounding boxes (`getBoundingClientRect()`) to perform a simple AABB (Axis-Aligned Bounding Box) collision detection.
6
-
7
- Combine it with `mousemove`, `drag`, or animation listeners for dynamic collision detection in real-time!
8
-
9
- It compares the bounding rectangles of both elements:
10
-
11
- * βœ… Checks if **rect1** is NOT entirely to the left, right, above, or below **rect2**.
12
- * βœ… If none of these are true, then the elements are overlapping.
13
-
14
- #### 🧠 Syntax
15
-
16
- ```javascript
17
- areHtmlElsColliding(elem1, elem2);
18
- ```
19
-
20
- #### 🎯 Parameters
21
-
22
- | Parameter | Type | Description |
23
- | --------- | --------- | ----------------------- |
24
- | `elem1` | `Element` | The first DOM element. |
25
- | `elem2` | `Element` | The second DOM element. |
26
-
27
- #### πŸ” Return
28
-
29
- | Type | Description |
30
- | --------- | ------------------------------------------------------------------ |
31
- | `boolean` | βœ… `true` if elements are colliding. <br>❌ `false` if they are not. |
32
-
33
- #### πŸ“¦ Example
34
-
35
- ```javascript
36
- const box1 = document.getElementById('box1');
37
- const box2 = document.getElementById('box2');
38
-
39
- if (areHtmlElsColliding(box1, box2)) {
40
- console.log('🎯 Collision detected!');
41
- } else {
42
- console.log('❌ No collision.');
43
- }
44
- ```
45
-
46
- #### 🚧 Limitations
47
-
48
- * Only works with **axis-aligned elements** (rectangular shapes).
49
- * Does not handle rotated elements or complex shapes.
50
-
51
- ---
52
-
53
1
  ### πŸ“– `readBase64Blob(file: File, isDataUrl?: boolean | string): Promise<string>`
54
2
 
55
3
  Reads a file and returns its Base64 content using the FileReader API, with optional formatting as a full Data URL.
@@ -266,84 +214,6 @@ A common return format used to describe the box model dimensions (borders, paddi
266
214
 
267
215
  ---
268
216
 
269
- ### πŸ”² `getHtmlElBordersWidth(el)`
270
-
271
- πŸ“ Returns the total **border width** of an element using `border{Side}Width` values from computed styles.
272
-
273
- ```js
274
- getHtmlElBordersWidth(el: Element): HtmlElBoxSides
275
- ```
276
-
277
- * `el`: The target DOM element.
278
- * **Returns**: An object containing total horizontal/vertical border widths, and each side individually.
279
-
280
- ---
281
-
282
- ### πŸ‘οΈ `isInViewport(element)`
283
-
284
- πŸ” Checks if an element is **partially visible** in the current viewport.
285
-
286
- ```js
287
- isInViewport(element: HTMLElement): boolean
288
- ```
289
-
290
- * `element`: The DOM element to check.
291
- * **Returns**: `true` if the element is at least partially visible; `false` otherwise.
292
-
293
- ---
294
-
295
- ### βœ… `isScrolledIntoView(element)`
296
-
297
- πŸ“¦ Checks if an element is **fully visible** (top and bottom) within the viewport.
298
-
299
- ```js
300
- isScrolledIntoView(element: HTMLElement): boolean
301
- ```
302
-
303
- * `element`: The DOM element to check.
304
- * **Returns**: `true` if the entire element is within the viewport; `false` otherwise.
305
-
306
- ---
307
-
308
- ### πŸ”³ `getHtmlElBorders(el)`
309
-
310
- πŸ“ Returns the total **border size** of an element using `border{Side}` shorthand values from computed styles.
311
-
312
- ```js
313
- getHtmlElBorders(el: Element): HtmlElBoxSides
314
- ```
315
-
316
- * `el`: The target DOM element.
317
- * **Returns**: An object with total horizontal/vertical border sizes and all four sides.
318
-
319
- ---
320
-
321
- ### βž– `getHtmlElMargin(el)`
322
-
323
- πŸ“ Returns the total **margin** of an element using `margin{Side}` from computed styles.
324
-
325
- ```js
326
- getHtmlElMargin(el: Element): HtmlElBoxSides
327
- ```
328
-
329
- * `el`: The target DOM element.
330
- * **Returns**: An object containing margin values for each side and totals for horizontal (`x`) and vertical (`y`).
331
-
332
- ---
333
-
334
- ### βž• `getHtmlElPadding(el)`
335
-
336
- 🧩 Returns the total **padding** of an element using `padding{Side}` from computed styles.
337
-
338
- ```js
339
- getHtmlElPadding(el: Element): HtmlElBoxSides
340
- ```
341
-
342
- * `el`: The target DOM element.
343
- * **Returns**: Padding values for all sides and summed horizontal (`x`) and vertical (`y`) values.
344
-
345
- ---
346
-
347
217
  ### πŸ“„ `installWindowHiddenScript`
348
218
 
349
219
  Automatically toggles CSS classes on a given element based on the browser window or tab **visibility** and **focus** state.
@@ -0,0 +1,127 @@
1
+ ### πŸš€ `areHtmlElsColliding()`
2
+
3
+ Check if two DOM elements are **colliding on the screen**! Perfect for games, draggable elements, UI interactions, and more.
4
+
5
+ This function checks whether **two HTML elements are overlapping** (colliding) within the viewport. It uses their bounding boxes (`getBoundingClientRect()`) to perform a simple AABB (Axis-Aligned Bounding Box) collision detection.
6
+
7
+ Combine it with `mousemove`, `drag`, or animation listeners for dynamic collision detection in real-time!
8
+
9
+ It compares the bounding rectangles of both elements:
10
+
11
+ * βœ… Checks if **rect1** is NOT entirely to the left, right, above, or below **rect2**.
12
+ * βœ… If none of these are true, then the elements are overlapping.
13
+
14
+ #### 🧠 Syntax
15
+
16
+ ```javascript
17
+ areHtmlElsColliding(elem1, elem2);
18
+ ```
19
+
20
+ #### 🎯 Parameters
21
+
22
+ | Parameter | Type | Description |
23
+ | --------- | --------- | ----------------------- |
24
+ | `elem1` | `Element` | The first DOM element. |
25
+ | `elem2` | `Element` | The second DOM element. |
26
+
27
+ #### πŸ” Return
28
+
29
+ | Type | Description |
30
+ | --------- | ------------------------------------------------------------------ |
31
+ | `boolean` | βœ… `true` if elements are colliding. <br>❌ `false` if they are not. |
32
+
33
+ #### πŸ“¦ Example
34
+
35
+ ```javascript
36
+ const box1 = document.getElementById('box1');
37
+ const box2 = document.getElementById('box2');
38
+
39
+ if (areHtmlElsColliding(box1, box2)) {
40
+ console.log('🎯 Collision detected!');
41
+ } else {
42
+ console.log('❌ No collision.');
43
+ }
44
+ ```
45
+
46
+ #### 🚧 Limitations
47
+
48
+ * Only works with **axis-aligned elements** (rectangular shapes).
49
+ * Does not handle rotated elements or complex shapes.
50
+
51
+ ---
52
+
53
+ ### πŸ”² `getHtmlElBordersWidth(el)`
54
+
55
+ πŸ“ Returns the total **border width** of an element using `border{Side}Width` values from computed styles.
56
+
57
+ ```js
58
+ getHtmlElBordersWidth(el: Element): HtmlElBoxSides
59
+ ```
60
+
61
+ * `el`: The target DOM element.
62
+ * **Returns**: An object containing total horizontal/vertical border widths, and each side individually.
63
+
64
+ ---
65
+
66
+ ### πŸ”³ `getHtmlElBorders(el)`
67
+
68
+ πŸ“ Returns the total **border size** of an element using `border{Side}` shorthand values from computed styles.
69
+
70
+ ```js
71
+ getHtmlElBorders(el: Element): HtmlElBoxSides
72
+ ```
73
+
74
+ * `el`: The target DOM element.
75
+ * **Returns**: An object with total horizontal/vertical border sizes and all four sides.
76
+
77
+ ---
78
+
79
+ ### βž– `getHtmlElMargin(el)`
80
+
81
+ πŸ“ Returns the total **margin** of an element using `margin{Side}` from computed styles.
82
+
83
+ ```js
84
+ getHtmlElMargin(el: Element): HtmlElBoxSides
85
+ ```
86
+
87
+ * `el`: The target DOM element.
88
+ * **Returns**: An object containing margin values for each side and totals for horizontal (`x`) and vertical (`y`).
89
+
90
+ ---
91
+
92
+ ### βž• `getHtmlElPadding(el)`
93
+
94
+ 🧩 Returns the total **padding** of an element using `padding{Side}` from computed styles.
95
+
96
+ ```js
97
+ getHtmlElPadding(el: Element): HtmlElBoxSides
98
+ ```
99
+
100
+ * `el`: The target DOM element.
101
+ * **Returns**: Padding values for all sides and summed horizontal (`x`) and vertical (`y`) values.
102
+
103
+ ---
104
+
105
+ ### πŸ‘οΈ `isInViewport(element)`
106
+
107
+ πŸ” Checks if an element is **partially visible** in the current viewport.
108
+
109
+ ```js
110
+ isInViewport(element: HTMLElement): boolean
111
+ ```
112
+
113
+ * `element`: The DOM element to check.
114
+ * **Returns**: `true` if the element is at least partially visible; `false` otherwise.
115
+
116
+ ---
117
+
118
+ ### βœ… `isScrolledIntoView(element)`
119
+
120
+ πŸ“¦ Checks if an element is **fully visible** (top and bottom) within the viewport.
121
+
122
+ ```js
123
+ isScrolledIntoView(element: HTMLElement): boolean
124
+ ```
125
+
126
+ * `element`: The DOM element to check.
127
+ * **Returns**: `true` if the entire element is within the viewport; `false` otherwise.
@@ -0,0 +1,181 @@
1
+ # πŸ“œ TinyAfterScrollWatcher
2
+
3
+ A minimalistic scroll watcher that queues and executes functions **after scrolling has stopped** on a given element or the window.
4
+ Perfect for optimizing logic that should only run **after** the user has finished scrolling.
5
+
6
+ ---
7
+
8
+ ## πŸš€ Features
9
+
10
+ * βœ… Works on any scrollable element or the window
11
+ * ⏱️ Customizable "inactivity timeout" (default: `100ms`)
12
+ * 🧠 Executes queued callbacks after scroll ends
13
+ * 🧩 Add/remove your own scroll listeners easily (`onScroll` / `offScroll`)
14
+ * 🧹 Cleanly destroy the instance when no longer needed
15
+
16
+ ---
17
+
18
+ ## πŸ“¦ Import
19
+
20
+ ```js
21
+ import TinyAfterScrollWatcher from './TinyAfterScrollWatcher.mjs';
22
+ ```
23
+
24
+ ---
25
+
26
+ ## πŸ§ͺ Example
27
+
28
+ ```js
29
+ const watcher = new TinyAfterScrollWatcher(window);
30
+
31
+ // Optional: set a custom delay (in ms)
32
+ watcher.inactivityTime = 300;
33
+
34
+ // Add a function to run after scroll has stopped
35
+ watcher.doAfterScroll(() => {
36
+ console.log('Scroll has stopped for 300ms!');
37
+ });
38
+
39
+ // Add a custom scroll listener
40
+ const myScrollHandler = () => console.log('Scrolling...');
41
+ watcher.onScroll(myScrollHandler);
42
+
43
+ // Remove it later
44
+ watcher.offScroll(myScrollHandler);
45
+
46
+ // Fully destroy the watcher
47
+ watcher.destroy();
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 🧠 Class: `TinyAfterScrollWatcher`
53
+
54
+ ### πŸ”§ Constructor
55
+
56
+ ```ts
57
+ new TinyAfterScrollWatcher(scrollTarget?: Element | Window, inactivityTime?: number)
58
+ ```
59
+
60
+ #### Parameters:
61
+
62
+ | Name | Type | Default | Description |
63
+ | ---------------- | ------------------- | -------- | ---------------------------------------------------------------------- |
64
+ | `scrollTarget` | `Element \| Window` | `window` | The scrollable element to watch. Can also be the global `window`. |
65
+ | `inactivityTime` | `number` | `100` | Milliseconds to wait after the last scroll before executing the queue. |
66
+
67
+ ---
68
+
69
+ ### ⏲️ Property: `inactivityTime`
70
+
71
+ * **Type:** `number`
72
+ * **Getter/Setter**
73
+
74
+ Defines how many milliseconds to wait after scroll stops before executing the queue.
75
+
76
+ #### Example:
77
+
78
+ ```js
79
+ watcher.inactivityTime = 500;
80
+ console.log(watcher.inactivityTime); // 500
81
+ ```
82
+
83
+ #### Throws:
84
+
85
+ * `TypeError` if the value is not a finite positive number.
86
+
87
+ ---
88
+
89
+ ### 🧩 Method: `doAfterScroll(fn)`
90
+
91
+ Adds a function to the queue that runs once scroll has stopped for the configured delay.
92
+
93
+ ```ts
94
+ doAfterScroll(fn: FnData): void
95
+ ```
96
+
97
+ #### Parameters:
98
+
99
+ | Name | Type | Description |
100
+ | ---- | -------- | ------------------------------------ |
101
+ | `fn` | `FnData` | Function to run after scrolling ends |
102
+
103
+ #### Throws:
104
+
105
+ * `TypeError` if the argument is not a function.
106
+
107
+ ---
108
+
109
+ ### 🧷 Method: `onScroll(fn)`
110
+
111
+ Registers a custom scroll listener on the tracked element.
112
+
113
+ ```ts
114
+ onScroll(fn: OnScrollFunc): void
115
+ ```
116
+
117
+ #### Parameters:
118
+
119
+ | Name | Type | Description |
120
+ | ---- | -------------- | --------------------------------------- |
121
+ | `fn` | `OnScrollFunc` | The listener function for scroll events |
122
+
123
+ #### Throws:
124
+
125
+ * `TypeError` if the argument is not a function.
126
+
127
+ ---
128
+
129
+ ### πŸ—‘οΈ Method: `offScroll(fn)`
130
+
131
+ Removes a previously registered scroll listener.
132
+
133
+ ```ts
134
+ offScroll(fn: OnScrollFunc): void
135
+ ```
136
+
137
+ #### Parameters:
138
+
139
+ | Name | Type | Description |
140
+ | ---- | -------------- | ----------------------------- |
141
+ | `fn` | `OnScrollFunc` | The scroll listener to remove |
142
+
143
+ #### Throws:
144
+
145
+ * `TypeError` if the argument is not a function.
146
+
147
+ ---
148
+
149
+ ### πŸ’£ Method: `destroy()`
150
+
151
+ Cleans up all internal and external listeners.
152
+ Once destroyed, the instance stops functioning and cannot be reused.
153
+
154
+ ```ts
155
+ destroy(): void
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 🧾 Typedefs
161
+
162
+ ```ts
163
+ /**
164
+ * A function with no parameters and no return value.
165
+ */
166
+ type FnData = () => void;
167
+
168
+ /**
169
+ * A function that handles a scroll event.
170
+ * It receives a standard `Event` object when a scroll occurs.
171
+ */
172
+ type OnScrollFunc = (ev: Event) => void;
173
+ ```
174
+
175
+ ---
176
+
177
+ ## πŸ“ Notes
178
+
179
+ * The scroll queue is **LIFO** (last-in, first-out)
180
+ * The internal check loop uses `requestAnimationFrame`, so it's efficient
181
+ * Setting `inactivityTime` to a lower value makes it more sensitive
@@ -42,21 +42,23 @@ new TinyDragger(targetElement, options?)
42
42
 
43
43
  ### Options:
44
44
 
45
- | Option | Type | Default | Description |
46
- | ----------------------- | ------------------------------ | ---------------------- | -------------------------------------------------------- |
47
- | `jail` | `HTMLElement` | `null` | Optional container that restricts movement |
48
- | `collisionByMouse` | `boolean` | `false` | Use mouse position instead of bounding box for collision |
49
- | `classDragging` | `string` | `'dragging'` | Class applied to the clone element |
50
- | `classBodyDragging` | `string` | `'drag-active'` | Class applied to the `<body>` during dragging |
51
- | `classJailDragging` | `string` | `'jail-drag-active'` | Class applied to jail while dragging |
52
- | `classJailDragDisabled` | `string` | `'jail-drag-disabled'` | Class applied to jail when dragging is disabled |
53
- | `classDragCollision` | `string` | `'dragging-collision'` | Class applied to elements when collision is detected |
54
- | `classHidden` | `string` | `'drag-hidden'` | Class used to hide the original element while dragging |
55
- | `lockInsideJail` | `boolean` | `false` | Prevent drag from exceeding jail bounds |
56
- | `dropInJailOnly` | `boolean` | `false` | Prevent drop outside the jail area |
57
- | `multiCollision` | `boolean` | `false` | Enables returning multiple collided elements |
58
- | `vibration` | `VibrationPatterns` or `false` | `false` | Vibration feedback configuration |
59
- | `revertOnDrop` | `boolean` | `false` | Return to original position after dropping |
45
+ | Option | Type | Default | Description |
46
+ | ----------------------- | ------------------------------ | ---------------------- | ----------------------------------------------------------- |
47
+ | `jail` | `HTMLElement` | `null` | Optional container that restricts movement |
48
+ | `collisionByMouse` | `boolean` | `false` | Use mouse position instead of bounding box for collision |
49
+ | `classDragging` | `string` | `'dragging'` | Class applied to the clone element |
50
+ | `classBodyDragging` | `string` | `'drag-active'` | Class applied to the `<body>` during dragging |
51
+ | `classJailDragging` | `string` | `'jail-drag-active'` | Class applied to jail while dragging |
52
+ | `classJailDragDisabled` | `string` | `'jail-drag-disabled'` | Class applied to jail when dragging is disabled |
53
+ | `classDragCollision` | `string` | `'dragging-collision'` | Class applied to elements when collision is detected |
54
+ | `classHidden` | `string` | `'drag-hidden'` | Class used to hide the original element while dragging |
55
+ | `lockInsideJail` | `boolean` | `false` | Prevent drag from exceeding jail bounds |
56
+ | `dropInJailOnly` | `boolean` | `false` | Prevent drop outside the jail area |
57
+ | `multiCollision` | `boolean` | `false` | Enables returning multiple collided elements |
58
+ | `vibration` | `VibrationPatterns` or `false` | `false` | Vibration feedback configuration |
59
+ | `revertOnDrop` | `boolean` | `false` | Return to original position after dropping |
60
+ | `mirrorElem` | `boolean` | `true` | Use a visual clone instead of dragging the original element |
61
+ | `defaultZIndex` | `number` | `9999` | Sets the z-index value applied when dragging starts |
60
62
 
61
63
  ---
62
64
 
@@ -334,6 +336,34 @@ Returns `null` if no proxy is active.
334
336
 
335
337
  ---
336
338
 
339
+ ### `getDefaultZIndex(): number`
340
+
341
+ 🎯 Returns the current default `z-index` used when a draggable item is picked up.
342
+
343
+ ---
344
+
345
+ ### `setDefaultZIndex(newZIndex: number): void`
346
+
347
+ πŸ› οΈ Sets a new default `z-index` to be used during drag operations.
348
+
349
+ > Throws `TypeError` if `newZIndex` is not a finite number.
350
+
351
+ ---
352
+
353
+ ### `isMirrorEnabled(): boolean`
354
+
355
+ 🎯 Returns whether the draggable element uses a **mirror** (`true`) or the **original element** (`false`) during dragging.
356
+
357
+ ---
358
+
359
+ ### `setMirrorEnabled(useMirror: boolean): void`
360
+
361
+ πŸ› οΈ Defines whether the draggable element should use a **mirror clone** or move the **original element**.
362
+
363
+ > Throws `TypeError` if `useMirror` is not a boolean.
364
+
365
+ ---
366
+
337
367
  ## πŸ” Events
338
368
 
339
369
  The target element will emit these events: