tiny-essentials 1.20.3 → 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 (114) 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/TinyToastNotify.min.js +1 -1
  19. package/dist/v1/TinyUploadClicker.min.js +1 -1
  20. package/dist/v1/basics/array.cjs +21 -0
  21. package/dist/v1/basics/array.d.mts +8 -0
  22. package/dist/v1/basics/array.mjs +18 -0
  23. package/dist/v1/basics/index.cjs +2 -8
  24. package/dist/v1/basics/index.d.mts +3 -8
  25. package/dist/v1/basics/index.mjs +2 -3
  26. package/dist/v1/basics/simpleMath.cjs +46 -0
  27. package/dist/v1/basics/simpleMath.d.mts +27 -0
  28. package/dist/v1/basics/simpleMath.mjs +42 -0
  29. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  30. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  31. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  32. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  33. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  34. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  35. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  36. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  37. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  38. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  39. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  40. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  41. package/dist/v1/build/TinyGamepad.cjs +7 -0
  42. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  43. package/dist/v1/build/TinyGamepad.mjs +2 -0
  44. package/dist/v1/build/TinyI18.cjs +7 -0
  45. package/dist/v1/build/TinyI18.d.mts +3 -0
  46. package/dist/v1/build/TinyI18.mjs +2 -0
  47. package/dist/v1/build/TinyInventory.cjs +7 -0
  48. package/dist/v1/build/TinyInventory.d.mts +3 -0
  49. package/dist/v1/build/TinyInventory.mjs +2 -0
  50. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  51. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  52. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  53. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  54. package/dist/v1/index.cjs +18 -8
  55. package/dist/v1/index.d.mts +11 -8
  56. package/dist/v1/index.mjs +10 -3
  57. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  58. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  59. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  60. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  61. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  62. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  63. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  64. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  65. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  66. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  67. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  68. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  69. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  70. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  71. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  72. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  73. package/dist/v1/libs/TinyI18.cjs +946 -0
  74. package/dist/v1/libs/TinyI18.d.mts +418 -0
  75. package/dist/v1/libs/TinyI18.mjs +873 -0
  76. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  77. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  78. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  79. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  80. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  81. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  82. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  83. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  84. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  85. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  86. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  87. package/dist/v1/libs/TinySmartScroller.cjs +0 -51
  88. package/dist/v1/libs/TinySmartScroller.d.mts +0 -36
  89. package/dist/v1/libs/TinySmartScroller.mjs +0 -46
  90. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  91. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  92. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  93. package/docs/v1/Ai-Tips.md +51 -0
  94. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  95. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  96. package/docs/v1/README.md +23 -0
  97. package/docs/v1/basics/array.md +17 -0
  98. package/docs/v1/basics/simpleMath.md +73 -0
  99. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  100. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  101. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  102. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  103. package/docs/v1/libs/TinyGamepad.md +980 -0
  104. package/docs/v1/libs/TinyI18.md +515 -0
  105. package/docs/v1/libs/TinyInventory.md +777 -0
  106. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  107. package/package.json +7 -5
  108. package/dist/v1/basics/html_deprecated.cjs +0 -124
  109. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  110. package/dist/v1/basics/html_deprecated.mjs +0 -97
  111. package/dist/v1/css/TinyDraggerExample.css +0 -21
  112. package/dist/v1/css/TinyNotify.css +0 -350
  113. package/dist/v1/css/aiMarker.css +0 -4
  114. 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.20.3",
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
- }