tiny-essentials 1.18.0 โ†’ 1.19.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 (93) hide show
  1. package/README.md +17 -3
  2. package/dist/legacy/get/countObj.cjs +2 -2
  3. package/dist/legacy/get/countObj.d.mts +1 -1
  4. package/dist/legacy/get/countObj.mjs +1 -1
  5. package/dist/legacy/index.cjs +2 -1
  6. package/dist/node_modules/firebase-functions/lib/common/trace.cjs +0 -1
  7. package/dist/node_modules/firebase-functions/lib/logger/index.cjs +1 -0
  8. package/dist/v1/ColorSafeStringify.min.js +1 -1
  9. package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
  10. package/dist/v1/TinyBasicsEs.js +402 -390
  11. package/dist/v1/TinyBasicsEs.min.js +1 -1
  12. package/dist/v1/TinyClipboard.min.js +1 -1
  13. package/dist/v1/TinyColorConverter.js +617 -0
  14. package/dist/v1/TinyColorConverter.min.js +1 -0
  15. package/dist/v1/TinyDomReadyManager.min.js +1 -1
  16. package/dist/v1/TinyDragger.js +6 -2433
  17. package/dist/v1/TinyDragger.min.js +1 -2
  18. package/dist/v1/TinyEssentials.js +3546 -1388
  19. package/dist/v1/TinyEssentials.min.js +1 -1
  20. package/dist/v1/TinyEvents.js +402 -0
  21. package/dist/v1/TinyEvents.min.js +1 -0
  22. package/dist/v1/TinyHtml.min.js +1 -1
  23. package/dist/v1/TinyLocalStorage.js +1292 -0
  24. package/dist/v1/TinyLocalStorage.min.js +1 -0
  25. package/dist/v1/TinyNotifications.min.js +1 -1
  26. package/dist/v1/TinyNotifyCenter.min.js +1 -1
  27. package/dist/v1/TinyPromiseQueue.min.js +1 -1
  28. package/dist/v1/TinyRateLimiter.js +2 -1
  29. package/dist/v1/TinyRateLimiter.min.js +1 -1
  30. package/dist/v1/TinySmartScroller.js +570 -52
  31. package/dist/v1/TinySmartScroller.min.js +1 -1
  32. package/dist/v1/TinyTextRangeEditor.min.js +1 -1
  33. package/dist/v1/TinyTimeout.js +233 -0
  34. package/dist/v1/TinyTimeout.min.js +1 -0
  35. package/dist/v1/TinyToastNotify.min.js +1 -1
  36. package/dist/v1/TinyUploadClicker.js +2087 -1129
  37. package/dist/v1/TinyUploadClicker.min.js +1 -1
  38. package/dist/v1/UltraRandomMsgGen.min.js +1 -1
  39. package/dist/v1/basics/html.cjs +16 -9
  40. package/dist/v1/basics/html.d.mts +12 -4
  41. package/dist/v1/basics/html.mjs +14 -7
  42. package/dist/v1/basics/index.cjs +3 -2
  43. package/dist/v1/basics/index.d.mts +2 -2
  44. package/dist/v1/basics/index.mjs +2 -1
  45. package/dist/v1/basics/objChecker.cjs +46 -0
  46. package/dist/v1/basics/objChecker.d.mts +29 -0
  47. package/dist/v1/basics/objChecker.mjs +45 -0
  48. package/dist/v1/basics/objFilter.cjs +4 -45
  49. package/dist/v1/basics/objFilter.d.mts +3 -28
  50. package/dist/v1/basics/objFilter.mjs +2 -45
  51. package/dist/v1/build/TinyColorConverter.cjs +7 -0
  52. package/dist/v1/build/TinyColorConverter.d.mts +3 -0
  53. package/dist/v1/build/TinyColorConverter.mjs +2 -0
  54. package/dist/v1/build/TinyEvents.cjs +7 -0
  55. package/dist/v1/build/TinyEvents.d.mts +3 -0
  56. package/dist/v1/build/TinyEvents.mjs +2 -0
  57. package/dist/v1/build/TinyLocalStorage.cjs +7 -0
  58. package/dist/v1/build/TinyLocalStorage.d.mts +3 -0
  59. package/dist/v1/build/TinyLocalStorage.mjs +2 -0
  60. package/dist/v1/build/TinyTimeout.cjs +7 -0
  61. package/dist/v1/build/TinyTimeout.d.mts +3 -0
  62. package/dist/v1/build/TinyTimeout.mjs +2 -0
  63. package/dist/v1/index.cjs +11 -2
  64. package/dist/v1/index.d.mts +7 -3
  65. package/dist/v1/index.mjs +7 -2
  66. package/dist/v1/libs/TinyColorConverter.cjs +578 -0
  67. package/dist/v1/libs/TinyColorConverter.d.mts +396 -0
  68. package/dist/v1/libs/TinyColorConverter.mjs +520 -0
  69. package/dist/v1/libs/TinyDragger.cjs +3 -3
  70. package/dist/v1/libs/TinyDragger.mjs +1 -1
  71. package/dist/v1/libs/TinyEvents.cjs +363 -0
  72. package/dist/v1/libs/TinyEvents.d.mts +160 -0
  73. package/dist/v1/libs/TinyEvents.mjs +328 -0
  74. package/dist/v1/libs/TinyLocalStorage.cjs +847 -0
  75. package/dist/v1/libs/TinyLocalStorage.d.mts +407 -0
  76. package/dist/v1/libs/TinyLocalStorage.mjs +740 -0
  77. package/dist/v1/libs/TinySmartScroller.cjs +207 -52
  78. package/dist/v1/libs/TinySmartScroller.d.mts +164 -16
  79. package/dist/v1/libs/TinySmartScroller.mjs +181 -52
  80. package/dist/v1/libs/TinyTimeout.cjs +194 -0
  81. package/dist/v1/libs/TinyTimeout.d.mts +89 -0
  82. package/dist/v1/libs/TinyTimeout.mjs +179 -0
  83. package/dist/v1/libs/TinyUploadClicker.cjs +6 -4
  84. package/docs/v1/README.md +5 -0
  85. package/docs/v1/basics/objChecker.md +47 -0
  86. package/docs/v1/basics/objFilter.md +0 -40
  87. package/docs/v1/libs/TinyColorConverter.md +220 -0
  88. package/docs/v1/libs/TinyEvents.md +199 -0
  89. package/docs/v1/libs/TinyLocalStorage.md +350 -0
  90. package/docs/v1/libs/TinyRateLimiter.md +0 -3
  91. package/docs/v1/libs/TinyTimeout.md +190 -0
  92. package/package.json +28 -5
  93. package/dist/v1/TinyDragger.min.js.LICENSE.txt +0 -8
@@ -0,0 +1,190 @@
1
+ # ๐Ÿ•’ TinyTimeout
2
+
3
+ `TinyTimeout` is a smart utility class designed to help manage dynamically scaled `setTimeout` calls based on how frequently a given ID is triggered. It also supports condition polling (`waitForTrue`) for asynchronous workflows. This is especially useful for cooldown systems, progressive delays, or throttling logic.
4
+
5
+ ---
6
+
7
+ ## โœจ Features
8
+
9
+ * โฑ๏ธ **Dynamic Timeout Scaling** based on trigger frequency
10
+ * ๐Ÿ” **Auto-decrement cooldowns** over time
11
+ * โš™๏ธ Optional **value override support** per ID
12
+ * ๐Ÿ” **Polling Support** with `waitForTrue`
13
+ * ๐Ÿงผ Easy cleanup with `destroy()`
14
+
15
+ ---
16
+
17
+ ## ๐Ÿš€ Usage
18
+
19
+ ```js
20
+ const timeout = new TinyTimeout();
21
+
22
+ // Schedule a timeout with ID tracking and increasing delay
23
+ timeout.set('example-id', () => {
24
+ console.log('Triggered after dynamic delay!');
25
+ }, 200); // 200ms base multiplier
26
+
27
+ // Optional limit
28
+ timeout.set('example-id', () => {
29
+ console.log('Max delay limited to 2000ms');
30
+ }, 500, 2000);
31
+
32
+ // Wait until some condition becomes true
33
+ await timeout.waitForTrue(() => document.readyState === 'complete');
34
+ ```
35
+
36
+ ---
37
+
38
+ ## ๐Ÿ”ง Constructor
39
+
40
+ ```ts
41
+ new TinyTimeout(options?: {
42
+ cooldownWatcherTime?: number;
43
+ allowAutoConfigChange?: boolean;
44
+ });
45
+ ```
46
+
47
+ | Option | Type | Default | Description |
48
+ | ----------------------- | --------- | ------- | -------------------------------------------------------- |
49
+ | `cooldownWatcherTime` | `number` | `5000` | Interval (ms) to decrease cooldown counters. |
50
+ | `allowAutoConfigChange` | `boolean` | `false` | Whether to auto update the base value of an existing ID. |
51
+
52
+ ---
53
+
54
+ ## ๐Ÿ“˜ Methods
55
+
56
+ ### ๐Ÿง  `set(id, callback, value, limit?)`
57
+
58
+ Schedules a timeout using a delay based on how frequently the ID has been triggered.
59
+
60
+ ```ts
61
+ set(id: string, callback: Function, value: number, limit?: number | null): number;
62
+ ```
63
+
64
+ | Parameter | Type | Required | Description |
65
+ | ---------- | ---------------- | --------- | --------------------------------------------------------------------------- |
66
+ | `id` | `string` | โœ… | Unique identifier for the timeout logic. |
67
+ | `callback` | `Function` | โœ… | Function to execute after the delay. |
68
+ | `value` | `number` | โœ… | Base multiplier for delay in milliseconds. |
69
+ | `limit` | `number \| null` | โŒ | Optional maximum delay in milliseconds to cap the calculated timeout. |
70
+
71
+ ๐Ÿ“Œ **Returns:**
72
+ A numeric ID returned by `setTimeout`, which can be manually canceled later using `clearTimeout(id)` if necessary.
73
+
74
+ ๐Ÿ› ๏ธ **Behavior:**
75
+ - The more often an `id` is used consecutively, the longer the timeout becomes.
76
+ - This delay is calculated as `value * now`, where `now` increases each time the `id` is triggered.
77
+ - The delay will never exceed `limit` if itโ€™s provided.
78
+
79
+ ---
80
+
81
+ ### ๐Ÿ” `waitForTrue(getValue, checkInterval = 100)`
82
+
83
+ Waits until a provided function returns `true`, polling periodically.
84
+
85
+ ```ts
86
+ static waitForTrue(getValue: () => boolean, checkInterval?: number): Promise<void>
87
+ ```
88
+
89
+ * `getValue`: Function that returns `true` when the wait should end.
90
+ * `checkInterval`: Polling interval in milliseconds.
91
+
92
+ ---
93
+
94
+ ### ๐Ÿงฉ `waitForTrue(getValue, checkInterval?)` *(instance version)*
95
+
96
+ Same as `waitForTrue`, but uses the instance's `cooldownWatcherTime` as the default if `checkInterval` is `null`.
97
+
98
+ ```ts
99
+ waitForTrue(getValue: () => boolean, checkInterval?: number | null): Promise<void>
100
+ ```
101
+
102
+ ---
103
+
104
+ ### ๐Ÿ› ๏ธ `setCooldownWatcherTime(value)`
105
+
106
+ Updates the cooldown decrement interval. Automatically restarts the internal timer.
107
+
108
+ ```ts
109
+ setCooldownWatcherTime(value: number): void
110
+ ```
111
+
112
+ ---
113
+
114
+ ### โš™๏ธ `setAllowAutoConfigChange(value)`
115
+
116
+ Enables or disables automatic value reconfiguration for known IDs.
117
+
118
+ ```ts
119
+ setAllowAutoConfigChange(value: boolean): void
120
+ ```
121
+
122
+ ---
123
+
124
+ ### โ“ `getCooldownWatcherTime()`
125
+
126
+ Returns the current interval used for decrementing cooldowns.
127
+
128
+ ```ts
129
+ getCooldownWatcherTime(): number
130
+ ```
131
+
132
+ ---
133
+
134
+ ### โ“ `getAllowAutoConfigChange()`
135
+
136
+ Returns whether auto-config change is enabled.
137
+
138
+ ```ts
139
+ getAllowAutoConfigChange(): boolean
140
+ ```
141
+
142
+ ---
143
+
144
+ ### ๐Ÿ”ฅ `destroy()`
145
+
146
+ Cleans up all internals, clears intervals, and invalidates the instance.
147
+
148
+ ```ts
149
+ destroy(): void
150
+ ```
151
+
152
+ ---
153
+
154
+ ### โœ… `isDestroyed()`
155
+
156
+ Checks if the instance has already been destroyed.
157
+
158
+ ```ts
159
+ isDestroyed(): boolean
160
+ ```
161
+
162
+ ---
163
+
164
+ ## ๐Ÿงผ Best Practices
165
+
166
+ * Use meaningful `id`s to separate timeout logic across components or users.
167
+ * Consider enabling `allowAutoConfigChange` if base delays change dynamically in your app.
168
+ * Always call `destroy()` when you're done to avoid memory leaks!
169
+
170
+ ---
171
+
172
+ ## ๐Ÿงช Example
173
+
174
+ ```js
175
+ const t = new TinyTimeout({ cooldownWatcherTime: 3000 });
176
+
177
+ t.set('search', () => console.log('Search triggered'), 100);
178
+ t.set('search', () => console.log('Slower search due to spamming'), 100);
179
+ t.set('search', () => console.log('Even slower!'), 100, 500);
180
+
181
+ await t.waitForTrue(() => myAsyncCondition === true);
182
+
183
+ t.destroy();
184
+ ```
185
+
186
+ ---
187
+
188
+ ## ๐Ÿง  Why use TinyTimeout?
189
+
190
+ Sometimes `setTimeout` isn't enough when you need backoff, throttling, or async condition checks. TinyTimeout handles usage frequency and time-based cooldown logic all in one place, and its polling function is perfect for complex reactive UIs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-essentials",
3
- "version": "1.18.0",
3
+ "version": "1.19.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",
@@ -62,18 +62,41 @@
62
62
  "@tinypudding/discord-oauth2",
63
63
  "@tinypudding/mysql-connector",
64
64
  "@tinypudding/puddy-lib",
65
+ "tiny-essentials",
66
+ "timeout",
67
+ "storage",
68
+ "text-editor",
69
+ "color-converter",
65
70
  "clock",
71
+ "time",
72
+ "text",
73
+ "text-range",
74
+ "input-editor",
75
+ "string-utils",
76
+ "string-manipulation",
66
77
  "obj-type",
78
+ "type-checker",
67
79
  "simple-math",
68
- "text",
69
- "lib",
70
- "time",
80
+ "math-utils",
71
81
  "shuffle-array",
82
+ "array-utils",
83
+ "json",
84
+ "json-utils",
72
85
  "json-color",
86
+ "json-highlight",
87
+ "json-viewer",
73
88
  "terminal-color",
89
+ "cli-color",
74
90
  "cli-output",
91
+ "pretty-print-json",
75
92
  "colorize-json",
76
- "pretty-print-json"
93
+ "lib",
94
+ "utility",
95
+ "utils",
96
+ "toolkit",
97
+ "frontend-utils",
98
+ "backend-utils",
99
+ "nodejs-utils"
77
100
  ],
78
101
  "author": "Yasmin Seidel (Jasmin Dreasond)",
79
102
  "license": "GPL-3.0-only",
@@ -1,8 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */