tiny-essentials 1.20.2 → 1.21.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 (123) hide show
  1. package/README.md +13 -11
  2. package/dist/_/numbers.cjs +136 -0
  3. package/dist/_/numbers.d.mts +24 -0
  4. package/dist/_/numbers.mjs +102 -0
  5. package/dist/v1/TinyAdvancedRaffle.min.js +1 -0
  6. package/dist/v1/TinyArrayPaginator.min.js +1 -0
  7. package/dist/v1/TinyBasicsEs.min.js +1 -1
  8. package/dist/v1/TinyCookieConsent.min.js +1 -0
  9. package/dist/v1/TinyDayNightCycle.min.js +1 -0
  10. package/dist/v1/TinyEssentials.min.js +1 -1
  11. package/dist/v1/TinyGamepad.min.js +1 -0
  12. package/dist/v1/TinyI18.min.js +1 -0
  13. package/dist/v1/TinyInventory.min.js +1 -0
  14. package/dist/v1/TinyInventoryTrader.min.js +1 -0
  15. package/dist/v1/TinyLocalStorage.min.js +1 -1
  16. package/dist/v1/TinyRateLimiter.min.js +1 -1
  17. package/dist/v1/TinySmartScroller.min.js +1 -1
  18. package/dist/v1/TinyTextarea.min.js +1 -0
  19. package/dist/v1/TinyToastNotify.min.js +1 -1
  20. package/dist/v1/TinyUploadClicker.min.js +1 -1
  21. package/dist/v1/basics/array.cjs +21 -0
  22. package/dist/v1/basics/array.d.mts +8 -0
  23. package/dist/v1/basics/array.mjs +18 -0
  24. package/dist/v1/basics/index.cjs +2 -8
  25. package/dist/v1/basics/index.d.mts +3 -8
  26. package/dist/v1/basics/index.mjs +2 -3
  27. package/dist/v1/basics/simpleMath.cjs +46 -0
  28. package/dist/v1/basics/simpleMath.d.mts +27 -0
  29. package/dist/v1/basics/simpleMath.mjs +42 -0
  30. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  31. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  32. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  33. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  34. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  35. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  36. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  37. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  38. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  39. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  40. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  41. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  42. package/dist/v1/build/TinyGamepad.cjs +7 -0
  43. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  44. package/dist/v1/build/TinyGamepad.mjs +2 -0
  45. package/dist/v1/build/TinyI18.cjs +7 -0
  46. package/dist/v1/build/TinyI18.d.mts +3 -0
  47. package/dist/v1/build/TinyI18.mjs +2 -0
  48. package/dist/v1/build/TinyInventory.cjs +7 -0
  49. package/dist/v1/build/TinyInventory.d.mts +3 -0
  50. package/dist/v1/build/TinyInventory.mjs +2 -0
  51. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  52. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  53. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  54. package/dist/v1/build/TinyTextarea.cjs +7 -0
  55. package/dist/v1/build/TinyTextarea.d.mts +3 -0
  56. package/dist/v1/build/TinyTextarea.mjs +2 -0
  57. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  58. package/dist/v1/index.cjs +20 -8
  59. package/dist/v1/index.d.mts +12 -8
  60. package/dist/v1/index.mjs +11 -3
  61. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  62. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  63. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  64. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  65. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  66. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  67. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  68. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  69. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  70. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  71. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  72. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  73. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  74. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  75. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  76. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  77. package/dist/v1/libs/TinyI18.cjs +946 -0
  78. package/dist/v1/libs/TinyI18.d.mts +418 -0
  79. package/dist/v1/libs/TinyI18.mjs +873 -0
  80. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  81. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  82. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  83. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  84. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  85. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  86. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  87. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  88. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  89. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  90. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  91. package/dist/v1/libs/TinySmartScroller.cjs +51 -15
  92. package/dist/v1/libs/TinySmartScroller.d.mts +28 -12
  93. package/dist/v1/libs/TinySmartScroller.mjs +44 -14
  94. package/dist/v1/libs/TinyTextarea.cjs +230 -0
  95. package/dist/v1/libs/TinyTextarea.d.mts +128 -0
  96. package/dist/v1/libs/TinyTextarea.mjs +198 -0
  97. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  98. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  99. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  100. package/docs/v1/Ai-Tips.md +51 -0
  101. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  102. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  103. package/docs/v1/README.md +24 -0
  104. package/docs/v1/basics/array.md +17 -0
  105. package/docs/v1/basics/simpleMath.md +73 -0
  106. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  107. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  108. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  109. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  110. package/docs/v1/libs/TinyGamepad.md +980 -0
  111. package/docs/v1/libs/TinyI18.md +515 -0
  112. package/docs/v1/libs/TinyInventory.md +777 -0
  113. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  114. package/docs/v1/libs/TinySmartScroller.md +4 -4
  115. package/docs/v1/libs/TinyTextarea.md +156 -0
  116. package/package.json +7 -5
  117. package/dist/v1/basics/html_deprecated.cjs +0 -124
  118. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  119. package/dist/v1/basics/html_deprecated.mjs +0 -97
  120. package/dist/v1/css/TinyDraggerExample.css +0 -21
  121. package/dist/v1/css/TinyNotify.css +0 -350
  122. package/dist/v1/css/aiMarker.css +0 -4
  123. package/docs/v1/basics/html_deprecated.md +0 -127
@@ -0,0 +1,114 @@
1
+ # 📦 TinyInventoryTrader
2
+
3
+ `TinyInventoryTrader` is a helper class designed to manage item transfers between two [`TinyInventory`](./TinyInventory.mjs) instances.
4
+ It ensures safe and configurable trading with support for strict validation, slot targeting, and batch operations.
5
+
6
+ ---
7
+
8
+ ## 🔖 Typedefs
9
+
10
+ ### `TransferItemCfg`
11
+
12
+ Configuration object for a single transfer.
13
+
14
+ | Property | Type | Default | Description |
15
+ | ------------------- | --------- | ------- | ---------------------------------------------------------------------------- |
16
+ | `slotIndex` | `number` | — | Sender slot index. |
17
+ | `receiverSlotIndex` | `number` | — | Receiver slot index (optional). |
18
+ | `specialSlot` | `string` | — | Sender special slot ID. |
19
+ | `quantity` | `number` | `1` | Quantity to transfer. |
20
+ | `forceSpace` | `boolean` | `false` | Whether to force addition even if space is limited. |
21
+ | `strict` | `boolean` | `false` | If `true`, transfer will throw if the receiver cannot fully fit the item(s). |
22
+
23
+ ---
24
+
25
+ ## 🏗️ Class: `TinyInventoryTrader`
26
+
27
+ Manages item transfers between two `TinyInventory` instances.
28
+
29
+ ### 🔑 Private Fields
30
+
31
+ * `#sender` → `TinyInventory|null`
32
+ * `#receiver` → `TinyInventory|null`
33
+
34
+ ---
35
+
36
+ ### 📥 Constructor
37
+
38
+ ```js
39
+ new TinyInventoryTrader(sender?, receiver?)
40
+ ```
41
+
42
+ * **Parameters:**
43
+
44
+ * `sender` (`TinyInventory`) → Inventory to remove items from.
45
+ * `receiver` (`TinyInventory`) → Inventory to add items to.
46
+ * **Throws:** If either argument is not a valid `TinyInventory`.
47
+
48
+ ---
49
+
50
+ ### 📌 Properties
51
+
52
+ * `sender` → `TinyInventory|null`
53
+ Current sender inventory. Setting it requires the receiver to also be a valid `TinyInventory`.
54
+
55
+ * `receiver` → `TinyInventory|null`
56
+ Current receiver inventory. Setting it requires the sender to also be a valid `TinyInventory`.
57
+
58
+ ---
59
+
60
+ ### 🔧 Methods
61
+
62
+ #### `connect(sender, receiver)`
63
+
64
+ Connects the sender and receiver inventories.
65
+
66
+ * **Parameters:**
67
+
68
+ * `sender` (`TinyInventory`) → Inventory to remove items from.
69
+ * `receiver` (`TinyInventory`) → Inventory to add items to.
70
+ * **Throws:** If arguments are not `TinyInventory`.
71
+
72
+ ---
73
+
74
+ #### `disconnect()`
75
+
76
+ Disconnects both sender and receiver, preventing transfers.
77
+
78
+ ---
79
+
80
+ #### `invert()`
81
+
82
+ Swaps sender and receiver roles.
83
+ Useful for bidirectional trading.
84
+
85
+ ---
86
+
87
+ #### `transferItem(options)`
88
+
89
+ Transfers an item from sender to receiver.
90
+
91
+ * **Parameters:**
92
+
93
+ * `options` (`TransferItemCfg`) → Transfer configuration.
94
+ * **Returns:** `Partial<AddItemResult>` → Remaining quantity that could not be transferred.
95
+ * **Throws:**
96
+
97
+ * If sender or receiver is not connected.
98
+ * If item does not exist in sender.
99
+ * If `strict` is `true` and the receiver cannot fully fit the item.
100
+
101
+ ---
102
+
103
+ #### `transferMultiple(items)`
104
+
105
+ Transfers multiple items at once.
106
+
107
+ * **Parameters:**
108
+
109
+ * `items` (`TransferItemCfg[]`) → Array of transfer configurations.
110
+ * **Returns:** `Partial<AddItemResult>[]` → Array of remaining quantities per transfer.
111
+
112
+ ---
113
+
114
+ ✨ With this class, you can safely move items between inventories with flexible rules, slot targeting, strict enforcement, and even batch transfers.
@@ -442,19 +442,19 @@ Scrolls the target all the way to the top immediately.
442
442
 
443
443
  ## 🧭 Scroll Position Status
444
444
 
445
- ### 🔚 `isUserAtCustomBottom()`
445
+ ### 🔚 `isAtCustomBottom()`
446
446
 
447
447
  Returns `true` if the user is within the custom boundary of the bottom.
448
448
 
449
- ### 🔝 `isUserAtCustomTop()`
449
+ ### 🔝 `isAtCustomTop()`
450
450
 
451
451
  Returns `true` if the user is within the custom boundary of the top.
452
452
 
453
- ### 🧨 `isUserAtBottom()`
453
+ ### 🧨 `isAtBottom()`
454
454
 
455
455
  Returns `true` if user is currently scrolled to the actual bottom.
456
456
 
457
- ### 🧷 `isUserAtTop()`
457
+ ### 🧷 `isAtTop()`
458
458
 
459
459
  Returns `true` if user is currently scrolled to the actual top.
460
460
 
@@ -0,0 +1,156 @@
1
+ # ✨ `TinyTextarea`
2
+
3
+ A lightweight JavaScript utility for automatically resizing `<textarea>` elements as users type — without ugly scrollbars!
4
+
5
+ ---
6
+
7
+ ## 📦 Features
8
+
9
+ * 🔁 **Auto-resizing**: Grows or shrinks with the content
10
+ * 🚫 **No scrollbars** (until limit): Prevents `overflow-y` unless needed
11
+ * 🔧 **Configurable**: Set `maxRows`, `extraHeight`, and hooks
12
+ * 📡 **Live events**: Hooks for `onInput` and `onResize`
13
+ * 🧼 **Clean lifecycle**: Includes `.refresh()` and `.destroy()`
14
+
15
+ ---
16
+
17
+ ## 🚀 Usage
18
+
19
+ ```js
20
+ import TinyTextarea from './TinyTextarea.js';
21
+
22
+ const textarea = document.querySelector('textarea');
23
+
24
+ const autoResize = new TinyTextarea(textarea, {
25
+ maxRows: 8,
26
+ extraHeight: 0,
27
+ onResize: (info) => console.log('Resized:', info),
28
+ onInput: (info) => console.log('Input event:', info),
29
+ });
30
+ ```
31
+
32
+ To stop behavior and clean up:
33
+
34
+ ```js
35
+ autoResize.destroy();
36
+ ```
37
+
38
+ ---
39
+
40
+ ## 🔧 Constructor
41
+
42
+ ```js
43
+ new TinyTextarea(textarea, options?);
44
+ ```
45
+
46
+ ### Parameters
47
+
48
+ | Name | Type | Description |
49
+ | --------------------- | ----------------------------- | ----------------------------------------------------- |
50
+ | `textarea` | `HTMLTextAreaElement` | The `<textarea>` element to be managed. |
51
+ | `options` | `Object` *(optional)* | Configuration options. |
52
+ | `options.maxRows` | `number` | Max number of visible rows before scrollbars appear. |
53
+ | `options.extraHeight` | `number` | Extra height (in px) to add on top of computed value. |
54
+ | `options.onResize` | `(info: OnInputInfo) => void` | Called when number of visible rows changes. |
55
+ | `options.onInput` | `(info: OnInputInfo) => void` | Called on every `input` event. |
56
+
57
+ ---
58
+
59
+ ## 📚 API
60
+
61
+ ### `.getData() → { height, rows }`
62
+
63
+ Returns the last known height and number of visible rows.
64
+
65
+ ```js
66
+ const { height, rows } = autoResize.getData();
67
+ ```
68
+
69
+ ---
70
+
71
+ ### `.refresh()`
72
+
73
+ Forces a manual recalculation and resize of the `<textarea>`.
74
+
75
+ ```js
76
+ autoResize.refresh();
77
+ ```
78
+
79
+ ---
80
+
81
+ ### `.destroy()`
82
+
83
+ Cleans up listeners and disables resizing behavior. Use this if you remove the element or want to stop automatic behavior.
84
+
85
+ ```js
86
+ autoResize.destroy();
87
+ ```
88
+
89
+ ---
90
+
91
+ ### 🔍 Getters
92
+
93
+ TinyTextarea exposes several readonly properties to let you inspect the current configuration and state of the managed `<textarea>`.
94
+
95
+ #### 📏 `lineHeight: number`
96
+
97
+ Returns the height in pixels of a single line of text in the textarea, computed from its current CSS styles.
98
+ Useful for calculating exact space usage or aligning UI elements.
99
+
100
+ ---
101
+
102
+ #### 📐 `maxRows: number`
103
+
104
+ Returns the maximum number of visible text rows allowed before the textarea begins to scroll.
105
+ This value reflects the limit set via `options.maxRows`.
106
+
107
+ ---
108
+
109
+ #### ➕ `extraHeight: number`
110
+
111
+ Returns the number of extra pixels added to the calculated height of the textarea.
112
+ This is useful for custom padding or visual adjustments.
113
+
114
+ ---
115
+
116
+ #### 📏 `currentHeight: number`
117
+
118
+ Returns the most recently applied height (in pixels) that was set on the `<textarea>` after resizing.
119
+
120
+ ---
121
+
122
+ #### 📊 `currentRows: number`
123
+
124
+ Returns the most recent number of visible text rows that the textarea is currently using.
125
+ This value is calculated dynamically and may change as the user types.
126
+
127
+ ---
128
+
129
+ #### 🧩 `textarea: HTMLTextAreaElement`
130
+
131
+ Returns the original `<textarea>` DOM element that was enhanced by this instance.
132
+ You can use this for direct styling, value changes, or other DOM-level operations.
133
+
134
+ ---
135
+
136
+ ## 📤 Event Payload: `OnInputInfo`
137
+
138
+ Whenever `onResize` or `onInput` is triggered, the following object is passed:
139
+
140
+ ```ts
141
+ {
142
+ breakLines: number; // Total number of '\n' in the textarea
143
+ height: number; // Final computed height (px)
144
+ scrollHeight: number; // Natural scrollHeight of textarea
145
+ maxHeight: number; // Max height before scrollbars show
146
+ lineHeight: number; // Height of one line of text
147
+ maxRows: number; // Maximum number of visible rows allowed
148
+ rows: number; // Final calculated number of rows used
149
+ }
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 🧪 Beta Notice
155
+
156
+ > 🧪 This library is currently marked as `@beta`. The API is stable but may be adjusted slightly during updates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.20.2",
3
+ "version": "1.21.0",
4
4
  "description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
5
5
  "scripts": {
6
6
  "test": "npm run test:mjs && npm run test:cjs && npm run test:js",
@@ -14,6 +14,7 @@
14
14
  "test:mjs:ratelimit": "node test/index.mjs rateLimit",
15
15
  "test:mjs:levelup": "node test/index.mjs levelUp",
16
16
  "test:mjs:filemanager": "node test/index.mjs fileManager",
17
+ "test:mjs:i18": "node test/index.mjs i18",
17
18
  "fix:prettier": "npm run fix:prettier:src && npm run fix:prettier:test && npm run fix:prettier:rollup.config && npm run fix:prettier:webpack.config",
18
19
  "fix:prettier:src": "prettier --write ./src/*",
19
20
  "fix:prettier:test": "prettier --write ./test/*",
@@ -24,10 +25,11 @@
24
25
  "build:js": "tsc -p tsconfig.json && rollup -c && webpack --mode production",
25
26
  "build-clean": "npm run clean && npm run build",
26
27
  "build-dist": "npm run build",
27
- "build:css": "npm run build:css:aimaker && npm run build:css:tinynotify && npm run build:css:tinydragger:example",
28
- "build:css:tinydragger:example": "sass src/v1/scss/TinyDraggerExample.scss dist/v1/css/TinyDraggerExample.css --no-source-map && sass src/v1/scss/TinyDraggerExample.scss dist/v1/css/TinyDraggerExample.min.css --no-source-map --style=compressed",
29
- "build:css:aimaker": "sass src/v1/scss/aiMarker.scss dist/v1/css/aiMarker.css --no-source-map && sass src/v1/scss/aiMarker.scss dist/v1/css/aiMarker.min.css --no-source-map --style=compressed",
30
- "build:css:tinynotify": "sass src/v1/scss/TinyNotify.scss dist/v1/css/TinyNotify.css --no-source-map && sass src/v1/scss/TinyNotify.scss dist/v1/css/TinyNotify.min.css --no-source-map --style=compressed",
28
+ "build:css": "npm run build:css:aimaker && npm run build:css:tinynotify && npm run build:css:tinydragger:example && npm run build:css:tinycookieconsent",
29
+ "build:css:tinydragger:example": "sass src/v1/scss/TinyDraggerExample.scss dist/v1/css/TinyDraggerExample.min.css --no-source-map --style=compressed",
30
+ "build:css:aimaker": "sass src/v1/scss/aiMarker.scss dist/v1/css/aiMarker.min.css --no-source-map --style=compressed",
31
+ "build:css:tinynotify": "sass src/v1/scss/TinyNotify.scss dist/v1/css/TinyNotify.min.css --no-source-map --style=compressed",
32
+ "build:css:tinycookieconsent": "sass src/v1/scss/TinyCookieConsent.scss dist/v1/css/TinyCookieConsent.min.css --no-source-map --style=compressed",
31
33
  "clean": "rm -rf dist",
32
34
  "prepublishOnly": "npm run build"
33
35
  },
@@ -1,124 +0,0 @@
1
- 'use strict';
2
-
3
- var TinyHtml = require('../libs/TinyHtml.cjs');
4
-
5
- /**
6
- * Checks if two DOM elements are colliding on the screen.
7
- *
8
- * @param {Element} elem1 - First DOM element.
9
- * @param {Element} elem2 - Second DOM element.
10
- * @returns {boolean} - Returns true if the elements are colliding.
11
- * @deprecated - Use TinyHtml.isCollWith instead.
12
- */
13
- function areHtmlElsColliding(elem1, elem2) {
14
- return TinyHtml.isCollWith(elem1, elem2);
15
- }
16
-
17
- /**
18
- * Checks if two DOM elements are colliding on the screen.
19
- *
20
- * @param {Element} elem1 - First DOM element.
21
- * @param {Element} elem2 - Second DOM element.
22
- * @returns {boolean} - Returns true if the elements are colliding.
23
- * @deprecated - Use TinyHtml.isCollPerfWith instead.
24
- */
25
- function areHtmlElsPerfColliding(elem1, elem2) {
26
- return TinyHtml.isCollPerfWith(elem1, elem2);
27
- }
28
-
29
- ///////////////////////////////////////////////////////////////////////////
30
-
31
- /**
32
- * @typedef {import('../libs/TinyHtml.mjs').HtmlElBoxSides} HtmlElBoxSides
33
- */
34
-
35
- /**
36
- * Returns the total border width and individual sides from `border{Side}Width` CSS properties.
37
- *
38
- * @param {Element} el - The target DOM element.
39
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
40
- * @deprecated - Use TinyHtml.borderWidth instead.
41
- */
42
- const getHtmlElBordersWidth = (el) => {
43
- return TinyHtml.borderWidth(el);
44
- };
45
-
46
- /**
47
- * Returns the total border size and individual sides from `border{Side}` CSS properties.
48
- *
49
- * @param {Element} el - The target DOM element.
50
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
51
- * @deprecated - Use TinyHtml.border instead.
52
- */
53
- const getHtmlElBorders = (el) => {
54
- return TinyHtml.border(el);
55
- };
56
-
57
- /**
58
- * Returns the total margin and individual sides from `margin{Side}` CSS properties.
59
- *
60
- * @param {Element} el - The target DOM element.
61
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
62
- * @deprecated - Use TinyHtml.margin instead.
63
- */
64
- const getHtmlElMargin = (el) => {
65
- return TinyHtml.margin(el);
66
- };
67
-
68
- /**
69
- * Returns the total padding and individual sides from `padding{Side}` CSS properties.
70
- *
71
- * @param {Element} el - The target DOM element.
72
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
73
- * @deprecated - Use TinyHtml.padding instead.
74
- */
75
- const getHtmlElPadding = (el) => {
76
- return TinyHtml.padding(el);
77
- };
78
-
79
- /////////////////////////////////////////////////////////////
80
-
81
- // The new version will receive great modifications, the deprecated code has been preserved for non-glitch designs that are using the original code.
82
-
83
- /**
84
- * Checks if the given element is at least partially visible in the viewport.
85
- *
86
- * @param {HTMLElement} element - The DOM element to check.
87
- * @returns {boolean} True if the element is partially in the viewport, false otherwise.
88
- * @deprecated - Use TinyHtml.isInViewport instead.
89
- */
90
- function isInViewport(element) {
91
- const elementTop = element.offsetTop;
92
- const elementBottom = elementTop + element.offsetHeight;
93
-
94
- const viewportTop = window.scrollY;
95
- const viewportBottom = viewportTop + window.innerHeight;
96
-
97
- return elementBottom > viewportTop && elementTop < viewportBottom;
98
- }
99
-
100
- /**
101
- * Checks if the given element is fully visible in the viewport (top and bottom).
102
- *
103
- * @param {HTMLElement} element - The DOM element to check.
104
- * @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
105
- * @deprecated - Use TinyHtml.isScrolledIntoView instead.
106
- */
107
- function isScrolledIntoView(element) {
108
- const viewportTop = window.scrollY;
109
- const viewportBottom = viewportTop + window.innerHeight;
110
-
111
- const elemTop = element.offsetTop;
112
- const elemBottom = elemTop + element.offsetHeight;
113
-
114
- return elemBottom <= viewportBottom && elemTop >= viewportTop;
115
- }
116
-
117
- exports.areHtmlElsColliding = areHtmlElsColliding;
118
- exports.areHtmlElsPerfColliding = areHtmlElsPerfColliding;
119
- exports.getHtmlElBorders = getHtmlElBorders;
120
- exports.getHtmlElBordersWidth = getHtmlElBordersWidth;
121
- exports.getHtmlElMargin = getHtmlElMargin;
122
- exports.getHtmlElPadding = getHtmlElPadding;
123
- exports.isInViewport = isInViewport;
124
- exports.isScrolledIntoView = isScrolledIntoView;
@@ -1,40 +0,0 @@
1
- /**
2
- * Checks if two DOM elements are colliding on the screen.
3
- *
4
- * @param {Element} elem1 - First DOM element.
5
- * @param {Element} elem2 - Second DOM element.
6
- * @returns {boolean} - Returns true if the elements are colliding.
7
- * @deprecated - Use TinyHtml.isCollWith instead.
8
- */
9
- export function areHtmlElsColliding(elem1: Element, elem2: Element): boolean;
10
- /**
11
- * Checks if two DOM elements are colliding on the screen.
12
- *
13
- * @param {Element} elem1 - First DOM element.
14
- * @param {Element} elem2 - Second DOM element.
15
- * @returns {boolean} - Returns true if the elements are colliding.
16
- * @deprecated - Use TinyHtml.isCollPerfWith instead.
17
- */
18
- export function areHtmlElsPerfColliding(elem1: Element, elem2: Element): boolean;
19
- /**
20
- * Checks if the given element is at least partially visible in the viewport.
21
- *
22
- * @param {HTMLElement} element - The DOM element to check.
23
- * @returns {boolean} True if the element is partially in the viewport, false otherwise.
24
- * @deprecated - Use TinyHtml.isInViewport instead.
25
- */
26
- export function isInViewport(element: HTMLElement): boolean;
27
- /**
28
- * Checks if the given element is fully visible in the viewport (top and bottom).
29
- *
30
- * @param {HTMLElement} element - The DOM element to check.
31
- * @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
32
- * @deprecated - Use TinyHtml.isScrolledIntoView instead.
33
- */
34
- export function isScrolledIntoView(element: HTMLElement): boolean;
35
- export function getHtmlElBordersWidth(el: Element): HtmlElBoxSides;
36
- export function getHtmlElBorders(el: Element): HtmlElBoxSides;
37
- export function getHtmlElMargin(el: Element): HtmlElBoxSides;
38
- export function getHtmlElPadding(el: Element): HtmlElBoxSides;
39
- export type HtmlElBoxSides = import("../libs/TinyHtml.mjs").HtmlElBoxSides;
40
- //# sourceMappingURL=html_deprecated.d.mts.map
@@ -1,97 +0,0 @@
1
- import TinyHtml from '../libs/TinyHtml.mjs';
2
- /**
3
- * Checks if two DOM elements are colliding on the screen.
4
- *
5
- * @param {Element} elem1 - First DOM element.
6
- * @param {Element} elem2 - Second DOM element.
7
- * @returns {boolean} - Returns true if the elements are colliding.
8
- * @deprecated - Use TinyHtml.isCollWith instead.
9
- */
10
- export function areHtmlElsColliding(elem1, elem2) {
11
- return TinyHtml.isCollWith(elem1, elem2);
12
- }
13
- /**
14
- * Checks if two DOM elements are colliding on the screen.
15
- *
16
- * @param {Element} elem1 - First DOM element.
17
- * @param {Element} elem2 - Second DOM element.
18
- * @returns {boolean} - Returns true if the elements are colliding.
19
- * @deprecated - Use TinyHtml.isCollPerfWith instead.
20
- */
21
- export function areHtmlElsPerfColliding(elem1, elem2) {
22
- return TinyHtml.isCollPerfWith(elem1, elem2);
23
- }
24
- ///////////////////////////////////////////////////////////////////////////
25
- /**
26
- * @typedef {import('../libs/TinyHtml.mjs').HtmlElBoxSides} HtmlElBoxSides
27
- */
28
- /**
29
- * Returns the total border width and individual sides from `border{Side}Width` CSS properties.
30
- *
31
- * @param {Element} el - The target DOM element.
32
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border widths, and each side individually.
33
- * @deprecated - Use TinyHtml.borderWidth instead.
34
- */
35
- export const getHtmlElBordersWidth = (el) => {
36
- return TinyHtml.borderWidth(el);
37
- };
38
- /**
39
- * Returns the total border size and individual sides from `border{Side}` CSS properties.
40
- *
41
- * @param {Element} el - The target DOM element.
42
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) border sizes, and each side individually.
43
- * @deprecated - Use TinyHtml.border instead.
44
- */
45
- export const getHtmlElBorders = (el) => {
46
- return TinyHtml.border(el);
47
- };
48
- /**
49
- * Returns the total margin and individual sides from `margin{Side}` CSS properties.
50
- *
51
- * @param {Element} el - The target DOM element.
52
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) margins, and each side individually.
53
- * @deprecated - Use TinyHtml.margin instead.
54
- */
55
- export const getHtmlElMargin = (el) => {
56
- return TinyHtml.margin(el);
57
- };
58
- /**
59
- * Returns the total padding and individual sides from `padding{Side}` CSS properties.
60
- *
61
- * @param {Element} el - The target DOM element.
62
- * @returns {HtmlElBoxSides} - Total horizontal (x) and vertical (y) paddings, and each side individually.
63
- * @deprecated - Use TinyHtml.padding instead.
64
- */
65
- export const getHtmlElPadding = (el) => {
66
- return TinyHtml.padding(el);
67
- };
68
- /////////////////////////////////////////////////////////////
69
- // The new version will receive great modifications, the deprecated code has been preserved for non-glitch designs that are using the original code.
70
- /**
71
- * Checks if the given element is at least partially visible in the viewport.
72
- *
73
- * @param {HTMLElement} element - The DOM element to check.
74
- * @returns {boolean} True if the element is partially in the viewport, false otherwise.
75
- * @deprecated - Use TinyHtml.isInViewport instead.
76
- */
77
- export function isInViewport(element) {
78
- const elementTop = element.offsetTop;
79
- const elementBottom = elementTop + element.offsetHeight;
80
- const viewportTop = window.scrollY;
81
- const viewportBottom = viewportTop + window.innerHeight;
82
- return elementBottom > viewportTop && elementTop < viewportBottom;
83
- }
84
- /**
85
- * Checks if the given element is fully visible in the viewport (top and bottom).
86
- *
87
- * @param {HTMLElement} element - The DOM element to check.
88
- * @returns {boolean} True if the element is fully visible in the viewport, false otherwise.
89
- * @deprecated - Use TinyHtml.isScrolledIntoView instead.
90
- */
91
- export function isScrolledIntoView(element) {
92
- const viewportTop = window.scrollY;
93
- const viewportBottom = viewportTop + window.innerHeight;
94
- const elemTop = element.offsetTop;
95
- const elemBottom = elemTop + element.offsetHeight;
96
- return elemBottom <= viewportBottom && elemTop >= viewportTop;
97
- }
@@ -1,21 +0,0 @@
1
- .dragging {
2
- opacity: 0.7;
3
- outline: 2px dashed #3aa;
4
- z-index: 9999;
5
- }
6
-
7
- .dragging-collision {
8
- outline: 2px dashed rgb(51, 170, 67);
9
- }
10
-
11
- body.drag-active {
12
- cursor: grabbing !important;
13
- }
14
-
15
- .jail-drag-active {
16
- outline: 2px dashed #f90;
17
- }
18
-
19
- .drag-hidden {
20
- opacity: 0 !important;
21
- }