tiny-essentials 1.20.3 → 1.21.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 (126) 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/TinyNeedBar.min.js +1 -0
  17. package/dist/v1/TinyRateLimiter.min.js +1 -1
  18. package/dist/v1/TinySmartScroller.min.js +1 -1
  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/clock.cjs +127 -11
  25. package/dist/v1/basics/clock.d.mts +26 -0
  26. package/dist/v1/basics/clock.mjs +96 -1
  27. package/dist/v1/basics/index.cjs +2 -8
  28. package/dist/v1/basics/index.d.mts +3 -8
  29. package/dist/v1/basics/index.mjs +2 -3
  30. package/dist/v1/basics/simpleMath.cjs +46 -0
  31. package/dist/v1/basics/simpleMath.d.mts +27 -0
  32. package/dist/v1/basics/simpleMath.mjs +42 -0
  33. package/dist/v1/build/TinyAdvancedRaffle.cjs +7 -0
  34. package/dist/v1/build/TinyAdvancedRaffle.d.mts +3 -0
  35. package/dist/v1/build/TinyAdvancedRaffle.mjs +2 -0
  36. package/dist/v1/build/TinyArrayPaginator.cjs +7 -0
  37. package/dist/v1/build/TinyArrayPaginator.d.mts +3 -0
  38. package/dist/v1/build/TinyArrayPaginator.mjs +2 -0
  39. package/dist/v1/build/TinyCookieConsent.cjs +7 -0
  40. package/dist/v1/build/TinyCookieConsent.d.mts +3 -0
  41. package/dist/v1/build/TinyCookieConsent.mjs +2 -0
  42. package/dist/v1/build/TinyDayNightCycle.cjs +7 -0
  43. package/dist/v1/build/TinyDayNightCycle.d.mts +3 -0
  44. package/dist/v1/build/TinyDayNightCycle.mjs +2 -0
  45. package/dist/v1/build/TinyGamepad.cjs +7 -0
  46. package/dist/v1/build/TinyGamepad.d.mts +3 -0
  47. package/dist/v1/build/TinyGamepad.mjs +2 -0
  48. package/dist/v1/build/TinyI18.cjs +7 -0
  49. package/dist/v1/build/TinyI18.d.mts +3 -0
  50. package/dist/v1/build/TinyI18.mjs +2 -0
  51. package/dist/v1/build/TinyInventory.cjs +7 -0
  52. package/dist/v1/build/TinyInventory.d.mts +3 -0
  53. package/dist/v1/build/TinyInventory.mjs +2 -0
  54. package/dist/v1/build/TinyInventoryTrader.cjs +7 -0
  55. package/dist/v1/build/TinyInventoryTrader.d.mts +3 -0
  56. package/dist/v1/build/TinyInventoryTrader.mjs +2 -0
  57. package/dist/v1/build/TinyNeedBar.cjs +7 -0
  58. package/dist/v1/build/TinyNeedBar.d.mts +3 -0
  59. package/dist/v1/build/TinyNeedBar.mjs +2 -0
  60. package/dist/v1/css/TinyCookieConsent.min.css +1 -0
  61. package/dist/v1/index.cjs +20 -8
  62. package/dist/v1/index.d.mts +12 -8
  63. package/dist/v1/index.mjs +11 -3
  64. package/dist/v1/libs/TinyAdvancedRaffle.cjs +1654 -0
  65. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +851 -0
  66. package/dist/v1/libs/TinyAdvancedRaffle.mjs +1477 -0
  67. package/dist/v1/libs/TinyArrayPaginator.cjs +132 -0
  68. package/dist/v1/libs/TinyArrayPaginator.d.mts +78 -0
  69. package/dist/v1/libs/TinyArrayPaginator.mjs +119 -0
  70. package/dist/v1/libs/TinyCookieConsent.cjs +278 -0
  71. package/dist/v1/libs/TinyCookieConsent.d.mts +142 -0
  72. package/dist/v1/libs/TinyCookieConsent.mjs +248 -0
  73. package/dist/v1/libs/TinyDayNightCycle.cjs +1389 -0
  74. package/dist/v1/libs/TinyDayNightCycle.d.mts +673 -0
  75. package/dist/v1/libs/TinyDayNightCycle.mjs +1232 -0
  76. package/dist/v1/libs/TinyGamepad.cjs +2690 -0
  77. package/dist/v1/libs/TinyGamepad.d.mts +1286 -0
  78. package/dist/v1/libs/TinyGamepad.mjs +2386 -0
  79. package/dist/v1/libs/TinyHtml.d.mts +2 -2
  80. package/dist/v1/libs/TinyI18.cjs +946 -0
  81. package/dist/v1/libs/TinyI18.d.mts +418 -0
  82. package/dist/v1/libs/TinyI18.mjs +873 -0
  83. package/dist/v1/libs/TinyInventory.cjs +1788 -0
  84. package/dist/v1/libs/TinyInventory.d.mts +871 -0
  85. package/dist/v1/libs/TinyInventory.mjs +1650 -0
  86. package/dist/v1/libs/TinyInventoryTrader.cjs +242 -0
  87. package/dist/v1/libs/TinyInventoryTrader.d.mts +95 -0
  88. package/dist/v1/libs/TinyInventoryTrader.mjs +212 -0
  89. package/dist/v1/libs/TinyLocalStorage.cjs +14 -1
  90. package/dist/v1/libs/TinyLocalStorage.mjs +8 -1
  91. package/dist/v1/libs/TinyNeedBar.cjs +272 -0
  92. package/dist/v1/libs/TinyNeedBar.d.mts +223 -0
  93. package/dist/v1/libs/TinyNeedBar.mjs +241 -0
  94. package/dist/v1/libs/TinyRateLimiter.cjs +0 -13
  95. package/dist/v1/libs/TinyRateLimiter.d.mts +0 -8
  96. package/dist/v1/libs/TinyRateLimiter.mjs +0 -12
  97. package/dist/v1/libs/TinySmartScroller.cjs +0 -51
  98. package/dist/v1/libs/TinySmartScroller.d.mts +0 -36
  99. package/dist/v1/libs/TinySmartScroller.mjs +0 -46
  100. package/dist/v1/libs/TinyToastNotify.cjs +2 -2
  101. package/dist/v1/libs/TinyToastNotify.mjs +2 -2
  102. package/dist/v1/libs/TinyUploadClicker.cjs +1 -1
  103. package/docs/v1/Ai-Tips.md +51 -0
  104. package/docs/v1/Personal-Ai-Prompts(portuguese).md +134 -0
  105. package/docs/v1/Personal-Ai-Prompts.md +113 -0
  106. package/docs/v1/README.md +24 -0
  107. package/docs/v1/basics/array.md +17 -0
  108. package/docs/v1/basics/clock.md +51 -11
  109. package/docs/v1/basics/simpleMath.md +73 -0
  110. package/docs/v1/libs/TinyAdvancedRaffle.md +674 -0
  111. package/docs/v1/libs/TinyArrayPaginator.md +150 -0
  112. package/docs/v1/libs/TinyCookieConsent.md +152 -0
  113. package/docs/v1/libs/TinyDayNightCycle.md +711 -0
  114. package/docs/v1/libs/TinyGamepad.md +980 -0
  115. package/docs/v1/libs/TinyI18.md +515 -0
  116. package/docs/v1/libs/TinyInventory.md +777 -0
  117. package/docs/v1/libs/TinyInventoryTrader.md +114 -0
  118. package/docs/v1/libs/TinyNeedBar.md +226 -0
  119. package/package.json +7 -5
  120. package/dist/v1/basics/html_deprecated.cjs +0 -124
  121. package/dist/v1/basics/html_deprecated.d.mts +0 -40
  122. package/dist/v1/basics/html_deprecated.mjs +0 -97
  123. package/dist/v1/css/TinyDraggerExample.css +0 -21
  124. package/dist/v1/css/TinyNotify.css +0 -350
  125. package/dist/v1/css/aiMarker.css +0 -4
  126. package/docs/v1/basics/html_deprecated.md +0 -127
@@ -0,0 +1,272 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @typedef {Object} TickResult
5
+ * @property {number} prevValue - Infinite value before applying decay.
6
+ * @property {number} removedTotal - Total amount removed this tick.
7
+ * @property {number} removedPercent - Percentage of max removed this tick.
8
+ * @property {number} currentPercent - Current percentage relative to max.
9
+ * @property {number} remainingValue - Current clamped value (≥ 0).
10
+ * @property {number} infiniteRemaining - Current infinite value (can be negative).
11
+ */
12
+
13
+ /**
14
+ * Represents a decay factor applied to the need bar.
15
+ *
16
+ * - `amount`: base value reduced per tick.
17
+ * - `multiplier`: multiplier applied to the amount.
18
+ *
19
+ * @typedef {Object} BarFactor
20
+ * @property {number} amount - Base reduction value per tick.
21
+ * @property {number} multiplier - Multiplier applied to the amount.
22
+ */
23
+
24
+ /**
25
+ * Represents the serialized state of a TinyNeedBar instance.
26
+ *
27
+ * This object is typically produced by {@link TinyNeedBar#toJSON} and
28
+ * can be used to recreate an instance via {@link TinyNeedBar.fromJSON}.
29
+ *
30
+ * @typedef {Object} SerializedData
31
+ * @property {number} maxValue - Maximum value of the bar at the moment of serialization.
32
+ * @property {number} currentValue - Current clamped value (never below 0).
33
+ * @property {number} infiniteValue - Infinite value (can go negative).
34
+ * @property {Record<string, BarFactor>} factors - Active decay factors indexed by their keys.
35
+ */
36
+
37
+ /**
38
+ * A utility class to simulate a "need bar" system.
39
+ *
40
+ * The bar decreases over time according to defined factors (each with an amount and multiplier).
41
+ * - The **main factor** controls the base decay per tick.
42
+ * - Additional factors can be added dynamically.
43
+ *
44
+ * The system tracks two values:
45
+ * - `currentValue` → cannot go below zero.
46
+ * - `infiniteValue` → can decrease infinitely into negative numbers.
47
+ */
48
+ class TinyNeedBar {
49
+ /**
50
+ * Stores all factors that influence decay.
51
+ * Each entry contains an amount and a multiplier.
52
+ * @type {Map<string, BarFactor>}
53
+ */
54
+ #factors = new Map();
55
+
56
+ /** Maximum value of the bar. @type {number} */
57
+ #maxValue;
58
+
59
+ /** Current clamped value of the bar (never below 0). @type {number} */
60
+ #currentValue;
61
+
62
+ /** Current "infinite" value of the bar (can go negative). @type {number} */
63
+ #infiniteValue;
64
+
65
+ /**
66
+ * Returns a snapshot of all currently active factors.
67
+ * Each factor is returned as a plain object to prevent direct mutation of the internal map.
68
+ *
69
+ * @returns {Record<string, BarFactor>} A record of all factors indexed by their key.
70
+ */
71
+ get factors() {
72
+ /** @type {Record<string, BarFactor>} */
73
+ const factors = {};
74
+ for (let [name, factor] of this.#factors.entries()) {
75
+ factors[name] = { ...factor };
76
+ }
77
+ return factors;
78
+ }
79
+
80
+ /**
81
+ * Returns the current percentage of the bar relative to the maximum value.
82
+ *
83
+ * @returns {number} Percentage from `0` to `100`.
84
+ */
85
+ get currentPercent() {
86
+ return (this.#currentValue / this.#maxValue) * 100;
87
+ }
88
+
89
+ /**
90
+ * Updates the maximum possible value of the bar.
91
+ * Ensures `currentValue` never exceeds the new maximum.
92
+ *
93
+ * @param {number} value - New maximum value.
94
+ */
95
+ set maxValue(value) {
96
+ this.#maxValue = value;
97
+ this.#currentValue = Math.min(this.#currentValue, value);
98
+ }
99
+
100
+ /**
101
+ * Returns the maximum possible value of the bar.
102
+ *
103
+ * @returns {number} The maximum value.
104
+ */
105
+ get maxValue() {
106
+ return this.#maxValue;
107
+ }
108
+
109
+ /**
110
+ * Returns the current clamped value of the bar.
111
+ * This value will never be below `0`.
112
+ *
113
+ * @returns {number} Current value (≥ 0).
114
+ */
115
+ get currentValue() {
116
+ return this.#currentValue;
117
+ }
118
+
119
+ /**
120
+ * Updates the infinite value of the bar.
121
+ * Automatically recalculates the `currentValue` (never below 0).
122
+ *
123
+ * @param {number} value - New infinite value.
124
+ */
125
+ set infiniteValue(value) {
126
+ this.#infiniteValue = value;
127
+ this.#currentValue = Math.max(0, value);
128
+ this.#currentValue = Math.min(this.#currentValue, this.#maxValue);
129
+ }
130
+
131
+ /**
132
+ * Returns the current infinite value of the bar.
133
+ * Unlike `currentValue`, this one can go below zero.
134
+ *
135
+ * @returns {number} Current infinite value.
136
+ */
137
+ get infiniteValue() {
138
+ return this.#infiniteValue;
139
+ }
140
+
141
+ /**
142
+ * Creates a new need bar instance.
143
+ *
144
+ * @param {number} [maxValue=100] - Maximum value of the bar.
145
+ * @param {number} [baseDecay=1] - Base amount reduced each tick.
146
+ * @param {number} [baseDecayMulti=1] - Multiplier applied to the base decay.
147
+ */
148
+ constructor(maxValue = 100, baseDecay = 1, baseDecayMulti = 1) {
149
+ this.#maxValue = maxValue;
150
+ this.setFactor('main', baseDecay, baseDecayMulti);
151
+
152
+ this.#currentValue = maxValue;
153
+ this.#infiniteValue = maxValue;
154
+ }
155
+
156
+ /**
157
+ * Retrieves a specific factor by its key.
158
+ *
159
+ * @param {string} key - The unique key of the factor.
160
+ * @returns {BarFactor} The requested factor object.
161
+ * @throws {Error} If the factor does not exist.
162
+ */
163
+ getFactor(key) {
164
+ const result = this.#factors.get(key);
165
+ if (!result) throw new Error(`Factor with key "${key}" not found.`);
166
+ return { ...result };
167
+ }
168
+
169
+ /**
170
+ * Checks if a specific factor exists by key.
171
+ *
172
+ * @param {string} key - The factor key to check.
173
+ * @returns {boolean} `true` if the factor exists, otherwise `false`.
174
+ */
175
+ hasFactor(key) {
176
+ return this.#factors.has(key);
177
+ }
178
+
179
+ /**
180
+ * Defines or updates a decay factor.
181
+ *
182
+ * @param {string} key - Unique identifier for the factor.
183
+ * @param {number} amount - Amount reduced per tick.
184
+ * @param {number} [multiplier=1] - Multiplier applied to the amount.
185
+ */
186
+ setFactor(key, amount, multiplier = 1) {
187
+ this.#factors.set(key, { amount, multiplier });
188
+ }
189
+
190
+ /**
191
+ * Removes a decay factor by its key.
192
+ *
193
+ * @param {string} key - The factor key to remove.
194
+ */
195
+ removeFactor(key) {
196
+ this.#factors.delete(key);
197
+ }
198
+
199
+ /**
200
+ * Executes one tick of decay, applying all active factors.
201
+ *
202
+ * @returns {TickResult}
203
+ */
204
+ tick() {
205
+ let removedTotal = 0;
206
+
207
+ for (let [_, factor] of this.#factors.entries()) {
208
+ removedTotal += factor.amount * factor.multiplier;
209
+ }
210
+
211
+ const prevValue = this.#infiniteValue;
212
+ this.#infiniteValue -= removedTotal;
213
+ this.#currentValue = Math.max(0, this.#currentValue - removedTotal);
214
+
215
+ const removedPercent = (removedTotal / this.#maxValue) * 100;
216
+
217
+ return {
218
+ prevValue,
219
+ removedTotal,
220
+ removedPercent,
221
+ currentPercent: this.currentPercent,
222
+ remainingValue: this.#currentValue,
223
+ infiniteRemaining: this.#infiniteValue,
224
+ };
225
+ }
226
+
227
+ /**
228
+ * Serializes the current state of the need bar.
229
+ * @returns {SerializedData}
230
+ */
231
+ toJSON() {
232
+ return {
233
+ maxValue: this.#maxValue,
234
+ currentValue: this.#currentValue,
235
+ infiniteValue: this.#infiniteValue,
236
+ factors: this.factors,
237
+ };
238
+ }
239
+
240
+ /**
241
+ * Restores a need bar from a serialized object.
242
+ * @param {SerializedData} data
243
+ * @returns {TinyNeedBar}
244
+ */
245
+ static fromJSON(data) {
246
+ const bar = new TinyNeedBar(data.maxValue, 0, 0);
247
+ bar.infiniteValue = data.infiniteValue;
248
+ bar.#factors.clear();
249
+ for (const [key, factor] of Object.entries(data.factors)) {
250
+ bar.setFactor(key, factor.amount, factor.multiplier);
251
+ }
252
+
253
+ return bar;
254
+ }
255
+
256
+ /**
257
+ * Creates a deep clone of this need bar.
258
+ * @returns {TinyNeedBar}
259
+ */
260
+ clone() {
261
+ return TinyNeedBar.fromJSON(this.toJSON());
262
+ }
263
+
264
+ /**
265
+ * Clear the factors map, clearing all factor data.
266
+ */
267
+ clearFactors() {
268
+ this.#factors.clear();
269
+ }
270
+ }
271
+
272
+ module.exports = TinyNeedBar;
@@ -0,0 +1,223 @@
1
+ export default TinyNeedBar;
2
+ export type TickResult = {
3
+ /**
4
+ * - Infinite value before applying decay.
5
+ */
6
+ prevValue: number;
7
+ /**
8
+ * - Total amount removed this tick.
9
+ */
10
+ removedTotal: number;
11
+ /**
12
+ * - Percentage of max removed this tick.
13
+ */
14
+ removedPercent: number;
15
+ /**
16
+ * - Current percentage relative to max.
17
+ */
18
+ currentPercent: number;
19
+ /**
20
+ * - Current clamped value (≥ 0).
21
+ */
22
+ remainingValue: number;
23
+ /**
24
+ * - Current infinite value (can be negative).
25
+ */
26
+ infiniteRemaining: number;
27
+ };
28
+ /**
29
+ * Represents a decay factor applied to the need bar.
30
+ *
31
+ * - `amount`: base value reduced per tick.
32
+ * - `multiplier`: multiplier applied to the amount.
33
+ */
34
+ export type BarFactor = {
35
+ /**
36
+ * - Base reduction value per tick.
37
+ */
38
+ amount: number;
39
+ /**
40
+ * - Multiplier applied to the amount.
41
+ */
42
+ multiplier: number;
43
+ };
44
+ /**
45
+ * Represents the serialized state of a TinyNeedBar instance.
46
+ *
47
+ * This object is typically produced by {@link TinyNeedBar#toJSON} and
48
+ * can be used to recreate an instance via {@link TinyNeedBar.fromJSON}.
49
+ */
50
+ export type SerializedData = {
51
+ /**
52
+ * - Maximum value of the bar at the moment of serialization.
53
+ */
54
+ maxValue: number;
55
+ /**
56
+ * - Current clamped value (never below 0).
57
+ */
58
+ currentValue: number;
59
+ /**
60
+ * - Infinite value (can go negative).
61
+ */
62
+ infiniteValue: number;
63
+ /**
64
+ * - Active decay factors indexed by their keys.
65
+ */
66
+ factors: Record<string, BarFactor>;
67
+ };
68
+ /**
69
+ * @typedef {Object} TickResult
70
+ * @property {number} prevValue - Infinite value before applying decay.
71
+ * @property {number} removedTotal - Total amount removed this tick.
72
+ * @property {number} removedPercent - Percentage of max removed this tick.
73
+ * @property {number} currentPercent - Current percentage relative to max.
74
+ * @property {number} remainingValue - Current clamped value (≥ 0).
75
+ * @property {number} infiniteRemaining - Current infinite value (can be negative).
76
+ */
77
+ /**
78
+ * Represents a decay factor applied to the need bar.
79
+ *
80
+ * - `amount`: base value reduced per tick.
81
+ * - `multiplier`: multiplier applied to the amount.
82
+ *
83
+ * @typedef {Object} BarFactor
84
+ * @property {number} amount - Base reduction value per tick.
85
+ * @property {number} multiplier - Multiplier applied to the amount.
86
+ */
87
+ /**
88
+ * Represents the serialized state of a TinyNeedBar instance.
89
+ *
90
+ * This object is typically produced by {@link TinyNeedBar#toJSON} and
91
+ * can be used to recreate an instance via {@link TinyNeedBar.fromJSON}.
92
+ *
93
+ * @typedef {Object} SerializedData
94
+ * @property {number} maxValue - Maximum value of the bar at the moment of serialization.
95
+ * @property {number} currentValue - Current clamped value (never below 0).
96
+ * @property {number} infiniteValue - Infinite value (can go negative).
97
+ * @property {Record<string, BarFactor>} factors - Active decay factors indexed by their keys.
98
+ */
99
+ /**
100
+ * A utility class to simulate a "need bar" system.
101
+ *
102
+ * The bar decreases over time according to defined factors (each with an amount and multiplier).
103
+ * - The **main factor** controls the base decay per tick.
104
+ * - Additional factors can be added dynamically.
105
+ *
106
+ * The system tracks two values:
107
+ * - `currentValue` → cannot go below zero.
108
+ * - `infiniteValue` → can decrease infinitely into negative numbers.
109
+ */
110
+ declare class TinyNeedBar {
111
+ /**
112
+ * Restores a need bar from a serialized object.
113
+ * @param {SerializedData} data
114
+ * @returns {TinyNeedBar}
115
+ */
116
+ static fromJSON(data: SerializedData): TinyNeedBar;
117
+ /**
118
+ * Creates a new need bar instance.
119
+ *
120
+ * @param {number} [maxValue=100] - Maximum value of the bar.
121
+ * @param {number} [baseDecay=1] - Base amount reduced each tick.
122
+ * @param {number} [baseDecayMulti=1] - Multiplier applied to the base decay.
123
+ */
124
+ constructor(maxValue?: number, baseDecay?: number, baseDecayMulti?: number);
125
+ /**
126
+ * Returns a snapshot of all currently active factors.
127
+ * Each factor is returned as a plain object to prevent direct mutation of the internal map.
128
+ *
129
+ * @returns {Record<string, BarFactor>} A record of all factors indexed by their key.
130
+ */
131
+ get factors(): Record<string, BarFactor>;
132
+ /**
133
+ * Returns the current percentage of the bar relative to the maximum value.
134
+ *
135
+ * @returns {number} Percentage from `0` to `100`.
136
+ */
137
+ get currentPercent(): number;
138
+ /**
139
+ * Updates the maximum possible value of the bar.
140
+ * Ensures `currentValue` never exceeds the new maximum.
141
+ *
142
+ * @param {number} value - New maximum value.
143
+ */
144
+ set maxValue(value: number);
145
+ /**
146
+ * Returns the maximum possible value of the bar.
147
+ *
148
+ * @returns {number} The maximum value.
149
+ */
150
+ get maxValue(): number;
151
+ /**
152
+ * Returns the current clamped value of the bar.
153
+ * This value will never be below `0`.
154
+ *
155
+ * @returns {number} Current value (≥ 0).
156
+ */
157
+ get currentValue(): number;
158
+ /**
159
+ * Updates the infinite value of the bar.
160
+ * Automatically recalculates the `currentValue` (never below 0).
161
+ *
162
+ * @param {number} value - New infinite value.
163
+ */
164
+ set infiniteValue(value: number);
165
+ /**
166
+ * Returns the current infinite value of the bar.
167
+ * Unlike `currentValue`, this one can go below zero.
168
+ *
169
+ * @returns {number} Current infinite value.
170
+ */
171
+ get infiniteValue(): number;
172
+ /**
173
+ * Retrieves a specific factor by its key.
174
+ *
175
+ * @param {string} key - The unique key of the factor.
176
+ * @returns {BarFactor} The requested factor object.
177
+ * @throws {Error} If the factor does not exist.
178
+ */
179
+ getFactor(key: string): BarFactor;
180
+ /**
181
+ * Checks if a specific factor exists by key.
182
+ *
183
+ * @param {string} key - The factor key to check.
184
+ * @returns {boolean} `true` if the factor exists, otherwise `false`.
185
+ */
186
+ hasFactor(key: string): boolean;
187
+ /**
188
+ * Defines or updates a decay factor.
189
+ *
190
+ * @param {string} key - Unique identifier for the factor.
191
+ * @param {number} amount - Amount reduced per tick.
192
+ * @param {number} [multiplier=1] - Multiplier applied to the amount.
193
+ */
194
+ setFactor(key: string, amount: number, multiplier?: number): void;
195
+ /**
196
+ * Removes a decay factor by its key.
197
+ *
198
+ * @param {string} key - The factor key to remove.
199
+ */
200
+ removeFactor(key: string): void;
201
+ /**
202
+ * Executes one tick of decay, applying all active factors.
203
+ *
204
+ * @returns {TickResult}
205
+ */
206
+ tick(): TickResult;
207
+ /**
208
+ * Serializes the current state of the need bar.
209
+ * @returns {SerializedData}
210
+ */
211
+ toJSON(): SerializedData;
212
+ /**
213
+ * Creates a deep clone of this need bar.
214
+ * @returns {TinyNeedBar}
215
+ */
216
+ clone(): TinyNeedBar;
217
+ /**
218
+ * Clear the factors map, clearing all factor data.
219
+ */
220
+ clearFactors(): void;
221
+ #private;
222
+ }
223
+ //# sourceMappingURL=TinyNeedBar.d.mts.map