tiny-essentials 1.28.1 → 1.28.3

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 (218) hide show
  1. package/changelog/1/28/2.md +43 -0
  2. package/changelog/1/28/3.md +9 -0
  3. package/dist/_/numbers.d.mts +91 -16
  4. package/dist/v1/TinyBasicsEs.min.js +1 -1
  5. package/dist/v1/TinyEssentials.min.js +1 -1
  6. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  7. package/dist/v1/TinyRadioFm.min.js +1 -1
  8. package/dist/v1/basics/array.d.mts +14 -14
  9. package/dist/v1/basics/clock.cjs +15 -15
  10. package/dist/v1/basics/clock.d.mts +21 -21
  11. package/dist/v1/basics/clock.mjs +15 -15
  12. package/dist/v1/basics/collision.d.mts +245 -104
  13. package/dist/v1/basics/deprecated/html.d.mts +33 -33
  14. package/dist/v1/basics/extendObjType/Buffer.d.mts +1 -1
  15. package/dist/v1/basics/fullScreen.d.mts +47 -7
  16. package/dist/v1/basics/html.d.mts +52 -61
  17. package/dist/v1/basics/index.cjs +2 -0
  18. package/dist/v1/basics/index.d.mts +11 -67
  19. package/dist/v1/basics/index.mjs +2 -2
  20. package/dist/v1/basics/mediaContent.cjs +65 -23
  21. package/dist/v1/basics/mediaContent.d.mts +144 -73
  22. package/dist/v1/basics/mediaContent.mjs +65 -23
  23. package/dist/v1/basics/objChecker.d.mts +2 -2
  24. package/dist/v1/basics/objFilter.cjs +50 -16
  25. package/dist/v1/basics/objFilter.d.mts +34 -13
  26. package/dist/v1/basics/objFilter.mjs +48 -16
  27. package/dist/v1/basics/simpleMath.d.mts +21 -21
  28. package/dist/v1/basics/text.d.mts +34 -46
  29. package/dist/v1/build/ColorSafeStringify.d.mts +1 -1
  30. package/dist/v1/build/TinyAdvancedRaffle.d.mts +1 -1
  31. package/dist/v1/build/TinyAfterScrollWatcher.d.mts +1 -1
  32. package/dist/v1/build/TinyAnalogClock.d.mts +1 -1
  33. package/dist/v1/build/TinyArrayComparator.d.mts +1 -1
  34. package/dist/v1/build/TinyArrayPaginator.d.mts +1 -1
  35. package/dist/v1/build/TinyClassManager.d.mts +1 -1
  36. package/dist/v1/build/TinyClipboard.d.mts +1 -1
  37. package/dist/v1/build/TinyColorConverter.d.mts +1 -1
  38. package/dist/v1/build/TinyColorValidator.d.mts +1 -1
  39. package/dist/v1/build/TinyCookieConsent.d.mts +1 -1
  40. package/dist/v1/build/TinyDayNightCycle.d.mts +1 -1
  41. package/dist/v1/build/TinyDomReadyManager.d.mts +1 -1
  42. package/dist/v1/build/TinyDragDropDetector.d.mts +1 -1
  43. package/dist/v1/build/TinyDragger.d.mts +1 -1
  44. package/dist/v1/build/TinyElementObserver.d.mts +1 -1
  45. package/dist/v1/build/TinyGamepad.d.mts +1 -1
  46. package/dist/v1/build/TinyHtml.d.mts +1 -1
  47. package/dist/v1/build/TinyI18.d.mts +1 -1
  48. package/dist/v1/build/TinyIframeEvents.d.mts +1 -1
  49. package/dist/v1/build/TinyInventory.d.mts +1 -1
  50. package/dist/v1/build/TinyInventoryTrader.d.mts +1 -1
  51. package/dist/v1/build/TinyLevelUp.d.mts +1 -1
  52. package/dist/v1/build/TinyLoadingScreen.d.mts +1 -1
  53. package/dist/v1/build/TinyLocalStorage.d.mts +1 -1
  54. package/dist/v1/build/TinyMediaPlayer.d.mts +1 -1
  55. package/dist/v1/build/TinyNeedBar.d.mts +1 -1
  56. package/dist/v1/build/TinyNewWinEvents.d.mts +1 -1
  57. package/dist/v1/build/TinyNotifications.d.mts +1 -1
  58. package/dist/v1/build/TinyNotifyCenter.d.mts +1 -1
  59. package/dist/v1/build/TinyPromiseQueue.d.mts +1 -1
  60. package/dist/v1/build/TinyRadioFm.d.mts +1 -1
  61. package/dist/v1/build/TinyRateLimiter.d.mts +1 -1
  62. package/dist/v1/build/TinySimpleDice.d.mts +1 -1
  63. package/dist/v1/build/TinySmartScroller.d.mts +1 -1
  64. package/dist/v1/build/TinyTextDiffer.d.mts +1 -1
  65. package/dist/v1/build/TinyTextRangeEditor.d.mts +1 -1
  66. package/dist/v1/build/TinyTextarea.d.mts +1 -1
  67. package/dist/v1/build/TinyTimeout.d.mts +1 -1
  68. package/dist/v1/build/TinyToastNotify.d.mts +1 -1
  69. package/dist/v1/build/TinyUploadClicker.d.mts +1 -1
  70. package/dist/v1/build/UltraRandomMsgGen.d.mts +1 -1
  71. package/dist/v1/fileManager/asyncFuncs.d.mts +13 -13
  72. package/dist/v1/fileManager/index.d.mts +3 -29
  73. package/dist/v1/fileManager/normalFuncs.d.mts +22 -22
  74. package/dist/v1/index.cjs +2 -0
  75. package/dist/v1/index.d.mts +53 -139
  76. package/dist/v1/index.mjs +2 -2
  77. package/dist/v1/libs/ColorSafeStringify.d.mts +3 -12
  78. package/dist/v1/libs/TinyAdvancedRaffle.d.mts +60 -103
  79. package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +11 -18
  80. package/dist/v1/libs/TinyAnalogClock.d.mts +8 -11
  81. package/dist/v1/libs/TinyArrayComparator.d.mts +14 -20
  82. package/dist/v1/libs/TinyArrayPaginator.d.mts +22 -26
  83. package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +8 -8
  84. package/dist/v1/libs/TinyClassManager.cjs +5 -7
  85. package/dist/v1/libs/TinyClassManager.d.mts +16 -16
  86. package/dist/v1/libs/TinyClassManager.mjs +5 -6
  87. package/dist/v1/libs/TinyClipboard.d.mts +8 -3
  88. package/dist/v1/libs/TinyColorConverter.d.mts +8 -31
  89. package/dist/v1/libs/TinyColorValidator.d.mts +145 -184
  90. package/dist/v1/libs/TinyCookieConsent.d.mts +17 -17
  91. package/dist/v1/libs/TinyDayNightCycle.d.mts +85 -110
  92. package/dist/v1/libs/TinyDomReadyManager.d.mts +8 -16
  93. package/dist/v1/libs/TinyDragDropDetector.d.mts +30 -30
  94. package/dist/v1/libs/TinyDragger.d.mts +82 -81
  95. package/dist/v1/libs/TinyElementObserver.d.mts +25 -28
  96. package/dist/v1/libs/TinyGamepad.cjs +0 -1
  97. package/dist/v1/libs/TinyGamepad.d.mts +50 -122
  98. package/dist/v1/libs/TinyGamepad.mjs +0 -1
  99. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.cjs +2 -25
  100. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.d.mts +19 -25
  101. package/dist/v1/libs/TinyHtml/TinyHtmlAnchor.mjs +3 -27
  102. package/dist/v1/libs/TinyHtml/TinyHtmlButton.cjs +2 -1
  103. package/dist/v1/libs/TinyHtml/TinyHtmlButton.d.mts +55 -55
  104. package/dist/v1/libs/TinyHtml/TinyHtmlButton.mjs +2 -1
  105. package/dist/v1/libs/TinyHtml/TinyHtmlCanvas.d.mts +6 -6
  106. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.cjs +8 -4
  107. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.d.mts +19 -21
  108. package/dist/v1/libs/TinyHtml/TinyHtmlDatalist.mjs +7 -4
  109. package/dist/v1/libs/TinyHtml/TinyHtmlEmbed.d.mts +8 -8
  110. package/dist/v1/libs/TinyHtml/TinyHtmlForm.d.mts +18 -18
  111. package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +5 -6
  112. package/dist/v1/libs/TinyHtml/TinyHtmlIframe.d.mts +19 -19
  113. package/dist/v1/libs/TinyHtml/TinyHtmlImage.cjs +0 -28
  114. package/dist/v1/libs/TinyHtml/TinyHtmlImage.d.mts +22 -28
  115. package/dist/v1/libs/TinyHtml/TinyHtmlImage.mjs +1 -27
  116. package/dist/v1/libs/TinyHtml/TinyHtmlInput.d.mts +11 -11
  117. package/dist/v1/libs/TinyHtml/TinyHtmlLink.d.mts +23 -23
  118. package/dist/v1/libs/TinyHtml/TinyHtmlMedia.d.mts +26 -26
  119. package/dist/v1/libs/TinyHtml/TinyHtmlScript.cjs +4 -30
  120. package/dist/v1/libs/TinyHtml/TinyHtmlScript.d.mts +20 -26
  121. package/dist/v1/libs/TinyHtml/TinyHtmlScript.mjs +5 -32
  122. package/dist/v1/libs/TinyHtml/TinyHtmlSelect.d.mts +19 -19
  123. package/dist/v1/libs/TinyHtml/TinyHtmlStyle.d.mts +8 -8
  124. package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +26 -28
  125. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.cjs +14 -15
  126. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +32 -32
  127. package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.mjs +15 -15
  128. package/dist/v1/libs/TinyHtml/index.d.mts +102 -45
  129. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.cjs +11 -9
  130. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.d.mts +21 -21
  131. package/dist/v1/libs/TinyHtml/input/TinyHtmlColorInput.mjs +11 -9
  132. package/dist/v1/libs/TinyHtml/input/TinyHtmlFileInput.d.mts +11 -11
  133. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.cjs +4 -4
  134. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.d.mts +17 -13
  135. package/dist/v1/libs/TinyHtml/input/TinyHtmlHiddenInput.mjs +4 -4
  136. package/dist/v1/libs/TinyHtml/input/TinyHtmlImageInput.d.mts +21 -21
  137. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.cjs +5 -4
  138. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.d.mts +14 -14
  139. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlButtonInput.mjs +5 -4
  140. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.cjs +4 -3
  141. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.d.mts +10 -10
  142. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlResetInput.mjs +4 -3
  143. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.cjs +4 -3
  144. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.d.mts +19 -19
  145. package/dist/v1/libs/TinyHtml/input/button/TinyHtmlSubmitInput.mjs +4 -3
  146. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.cjs +5 -4
  147. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.d.mts +11 -11
  148. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlCheckboxInput.mjs +5 -4
  149. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.cjs +4 -3
  150. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.d.mts +15 -11
  151. package/dist/v1/libs/TinyHtml/input/check/TinyHtmlRadioInput.mjs +4 -3
  152. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.cjs +49 -21
  153. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.d.mts +34 -20
  154. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateInput.mjs +45 -20
  155. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.cjs +1 -1
  156. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.d.mts +14 -14
  157. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlDateTimeInput.mjs +1 -1
  158. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.cjs +1 -1
  159. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.d.mts +14 -14
  160. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlMonthInput.mjs +1 -1
  161. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.cjs +48 -25
  162. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.d.mts +27 -21
  163. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlTimeInput.mjs +40 -27
  164. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.cjs +1 -1
  165. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.d.mts +14 -14
  166. package/dist/v1/libs/TinyHtml/input/date/TinyHtmlWeekInput.mjs +1 -1
  167. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlNumberInput.d.mts +14 -14
  168. package/dist/v1/libs/TinyHtml/input/number/TinyHtmlRangeInput.d.mts +14 -14
  169. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlEmailInput.d.mts +25 -21
  170. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlPasswordInput.d.mts +18 -18
  171. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlSearchInput.d.mts +33 -29
  172. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTelInput.d.mts +22 -22
  173. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlTextInput.d.mts +18 -18
  174. package/dist/v1/libs/TinyHtml/input/text/TinyHtmlUrlInput.d.mts +31 -27
  175. package/dist/v1/libs/TinyHtml/media/TinyHtmlAudio.d.mts +35 -11
  176. package/dist/v1/libs/TinyHtml/media/TinyHtmlObject.d.mts +10 -10
  177. package/dist/v1/libs/TinyHtml/media/TinyHtmlSource.d.mts +12 -12
  178. package/dist/v1/libs/TinyHtml/media/TinyHtmlVideo.d.mts +35 -27
  179. package/dist/v1/libs/TinyHtml.cjs +3 -4
  180. package/dist/v1/libs/TinyHtml.d.mts +1503 -1731
  181. package/dist/v1/libs/TinyHtml.mjs +3 -4
  182. package/dist/v1/libs/TinyI18.d.mts +23 -61
  183. package/dist/v1/libs/TinyIframeEvents.cjs +1 -1
  184. package/dist/v1/libs/TinyIframeEvents.d.mts +29 -38
  185. package/dist/v1/libs/TinyIframeEvents.mjs +1 -1
  186. package/dist/v1/libs/TinyInventory.d.mts +78 -141
  187. package/dist/v1/libs/TinyInventoryTrader.d.mts +19 -22
  188. package/dist/v1/libs/TinyLevelUp.d.mts +10 -13
  189. package/dist/v1/libs/TinyLoadingScreen.d.mts +21 -31
  190. package/dist/v1/libs/TinyLocalStorage.d.mts +11 -36
  191. package/dist/v1/libs/TinyMamdaniInferenceSystem.d.mts +37 -23
  192. package/dist/v1/libs/TinyMediaPlayer.cjs +5 -3
  193. package/dist/v1/libs/TinyMediaPlayer.d.mts +102 -109
  194. package/dist/v1/libs/TinyMediaPlayer.mjs +5 -3
  195. package/dist/v1/libs/TinyNeedBar.d.mts +25 -37
  196. package/dist/v1/libs/TinyNewWinEvents.d.mts +29 -32
  197. package/dist/v1/libs/TinyNotifications.d.mts +6 -6
  198. package/dist/v1/libs/TinyNotifyCenter.d.mts +15 -21
  199. package/dist/v1/libs/TinyPromiseQueue.d.mts +11 -11
  200. package/dist/v1/libs/TinyRadioFm.cjs +32 -12
  201. package/dist/v1/libs/TinyRadioFm.d.mts +44 -80
  202. package/dist/v1/libs/TinyRadioFm.mjs +29 -12
  203. package/dist/v1/libs/TinyRateLimiter.d.mts +26 -39
  204. package/dist/v1/libs/TinySimpleDice.d.mts +17 -36
  205. package/dist/v1/libs/TinySmartScroller.d.mts +50 -60
  206. package/dist/v1/libs/TinyTextDiffer.d.mts +11 -14
  207. package/dist/v1/libs/TinyTextRangeEditor.d.mts +8 -8
  208. package/dist/v1/libs/TinyTextarea.d.mts +31 -31
  209. package/dist/v1/libs/TinyTimeout.d.mts +14 -14
  210. package/dist/v1/libs/TinyToastNotify.cjs +1 -1
  211. package/dist/v1/libs/TinyToastNotify.d.mts +15 -23
  212. package/dist/v1/libs/TinyToastNotify.mjs +1 -1
  213. package/dist/v1/libs/TinyUploadClicker.d.mts +38 -14
  214. package/dist/v1/libs/UltraRandomMsgGen.d.mts +44 -84
  215. package/dist/v1/libs/utils.d.mts +5 -1
  216. package/docs/v1/basics/deprecated/objFilter.md +14 -0
  217. package/docs/v1/basics/objFilter.md +31 -17
  218. package/package.json +2 -2
@@ -1,6 +1,13 @@
1
- export default TinyInventory;
2
1
  /**
3
2
  * Represents a registered item definition in the global registry.
3
+ *
4
+ * @typedef {Object} ItemDef
5
+ * @property {string} id - Unique identifier for the item.
6
+ * @property {number} weight - Weight of a single unit of the item.
7
+ * @property {InventoryMetadata} metadata - Default metadata for the item type.
8
+ * @property {number} maxStack - Maximum quantity per stack.
9
+ * @property {OnUseEvent|null} onUse - Callback triggered when the item is used.
10
+ * @property {string|null} type - Optional category/type identifier.
4
11
  */
5
12
  export type ItemDef = {
6
13
  /**
@@ -28,9 +35,6 @@ export type ItemDef = {
28
35
  */
29
36
  type: string | null;
30
37
  };
31
- /**
32
- * Represents an individual stored item instance in the inventory.
33
- */
34
38
  export type InventoryItem = {
35
39
  /**
36
40
  * - Unique identifier for the item.
@@ -45,17 +49,8 @@ export type InventoryItem = {
45
49
  */
46
50
  quantity: number;
47
51
  };
48
- /**
49
- * A collection of item stacks stored in the inventory.
50
- */
51
52
  export type InvSlots = (InventoryItem | null)[];
52
- /**
53
- * Metadata object used to store arbitrary key-value pairs for an item.
54
- */
55
53
  export type InventoryMetadata = Record<string | number | symbol, any>;
56
- /**
57
- * Represents a special slot (e.g., equipment) in the inventory.
58
- */
59
54
  export type SpecialSlot = {
60
55
  /**
61
56
  * - Optional slot category/type.
@@ -66,53 +61,20 @@ export type SpecialSlot = {
66
61
  */
67
62
  item: InventoryItem | null;
68
63
  };
69
- /**
70
- * Generic event callback triggered by inventory actions.
71
- */
72
64
  export type OnEvent = (payload: EventPayload) => void;
73
- /**
74
- * Event fired when an item is added to the inventory.
75
- */
76
65
  export type AddItemEvent = OnEvent;
77
- /**
78
- * Event fired when an item is setted to the inventory.
79
- */
80
66
  export type SetItemEvent = OnEvent;
81
- /**
82
- * Event fired when an item is removed from the inventory.
83
- */
84
67
  export type RemoveItemEvent = OnEvent;
85
- /**
86
- * Event fired when an item is used.
87
- */
88
68
  export type UseItemEvent = OnEvent;
89
- /**
90
- * A function executed when an inventory item is used.
91
- * Can be assigned to handle custom "on use" behavior.
92
- */
93
69
  export type OnUseEvent = OnEvent;
94
- /**
95
- * Represents the supported event types for inventory actions.
96
- */
97
- export type EventsType = "add" | "remove" | "use" | "set";
98
- /**
99
- * Callback used to filter items by matching metadata.
100
- */
70
+ export type EventsType = 'add' | 'remove' | 'use' | 'set';
101
71
  export type GetItemsByMetadataCallback = (metadata: InventoryMetadata, item: InventoryItem) => boolean;
102
- /**
103
- * Callback used when searching for an item in an inventory collection.
104
- * Works similarly to `Array.prototype.find()` conditions.
105
- */
106
72
  export type FindItemCallback = (value: InventoryItem, index: number, items: InventoryItem[]) => boolean;
107
- /**
108
- * Represents the fully serialized structure of a TinyInventory instance.
109
- * Intended for pure JSON storage and transmission.
110
- */
111
73
  export type SerializedInventory = {
112
74
  /**
113
75
  * - Schema identifier for validation.
114
76
  */
115
- __schema: "TinyInventory";
77
+ __schema: 'TinyInventory';
116
78
  /**
117
79
  * - Serialized format version.
118
80
  */
@@ -142,13 +104,7 @@ export type SerializedInventory = {
142
104
  */
143
105
  specialSlots: Record<string, SpecialSlot>;
144
106
  };
145
- /**
146
- * Represents an entry from the inventory as a pair containing the item and its index in the collection.
147
- */
148
107
  export type ItemListData = [InventoryItem, number];
149
- /**
150
- * Payload data dispatched when an inventory event occurs (e.g., add, remove, equip, unequip).
151
- */
152
108
  export type EventPayload = {
153
109
  /**
154
110
  * - Index of the item in its collection (null if not applicable).
@@ -171,9 +127,6 @@ export type EventPayload = {
171
127
  */
172
128
  remove: (forceSpace: boolean) => void;
173
129
  };
174
- /**
175
- * Result of adding items to an inventory.
176
- */
177
130
  export type AddItemResult = {
178
131
  /**
179
132
  * - Quantity of the item that could NOT be added due to space/stack limits.
@@ -187,17 +140,6 @@ export type AddItemResult = {
187
140
  quantity: number;
188
141
  }[];
189
142
  };
190
- /**
191
- * Represents a registered item definition in the global registry.
192
- *
193
- * @typedef {Object} ItemDef
194
- * @property {string} id - Unique identifier for the item.
195
- * @property {number} weight - Weight of a single unit of the item.
196
- * @property {InventoryMetadata} metadata - Default metadata for the item type.
197
- * @property {number} maxStack - Maximum quantity per stack.
198
- * @property {OnUseEvent|null} onUse - Callback triggered when the item is used.
199
- * @property {string|null} type - Optional category/type identifier.
200
- */
201
143
  /**
202
144
  * Represents an individual stored item instance in the inventory.
203
145
  *
@@ -323,12 +265,7 @@ export type AddItemResult = {
323
265
  * @beta
324
266
  */
325
267
  declare class TinyInventory {
326
- /**
327
- * Registry of all item definitions available in TinyInventory.
328
- * Keys are item IDs, values are configuration objects created with {@link TinyInventory.defineItem}.
329
- * @type {Map<string, ItemDef>}
330
- */
331
- static #ItemRegistry: Map<string, ItemDef>;
268
+ #private;
332
269
  /**
333
270
  * Returns a deep-cloned snapshot of all registered items.
334
271
  * Ensures the caller cannot mutate the internal registry.
@@ -351,11 +288,11 @@ declare class TinyInventory {
351
288
  */
352
289
  static defineItem(config: {
353
290
  id: string;
354
- weight?: number | undefined;
355
- metadata?: InventoryMetadata | undefined;
356
- maxStack?: number | undefined;
357
- onUse?: OnEvent | null | undefined;
358
- type?: string | null | undefined;
291
+ weight?: number;
292
+ metadata?: InventoryMetadata;
293
+ maxStack?: number;
294
+ onUse?: OnUseEvent | null;
295
+ type?: string | null;
359
296
  }): void;
360
297
  /**
361
298
  * Removes an item definition from the global registry.
@@ -380,39 +317,10 @@ declare class TinyInventory {
380
317
  */
381
318
  static getItem(itemId: string): ItemDef;
382
319
  /**
383
- * Rebuilds a TinyInventory from a plain object created by {@link TinyInventory.toObject}.
384
- * Item definitions (ItemRegistry) must be already defined externally; this method only restores state.
385
- *
386
- * @param {SerializedInventory} obj - Parsed JSON object.
387
- * @returns {TinyInventory} A new TinyInventory instance populated with the saved state.
388
- * @throws {Error} If validation fails and `validate` is true.
389
- */
390
- static fromObject(obj: SerializedInventory): TinyInventory;
391
- /**
392
- * Rebuilds a TinyInventory from a JSON string produced by {@link TinyInventory.toJSON}.
393
- * @param {string} json - JSON string.
394
- * @returns {TinyInventory} A new TinyInventory instance.
395
- */
396
- static fromJSON(json: string): TinyInventory;
397
- /**
398
- * Creates a new TinyInventory instance.
399
- *
400
- * @param {Object} [options={}] - Configuration options for the inventory.
401
- * @param {number|null} [options.maxWeight=null] - Maximum allowed total weight (null for no limit).
402
- * @param {number|null} [options.maxSlots=null] - Maximum number of item slots (null for no limit).
403
- * @param {number|null} [options.maxSize=null] - Maximum number of total item amount (null for no limit).
404
- * @param {number} [options.maxStack=Infinity] - Global maximum stack size (per slot).
405
- * @param {Record<string, { type: string | null; }>} [options.specialSlots] - IDs for special slots (e.g., "helmet", "weapon").
320
+ * Gets the maximum stack size allowed per item.
321
+ * @returns {number}
406
322
  */
407
- constructor(options?: {
408
- maxWeight?: number | null | undefined;
409
- maxSlots?: number | null | undefined;
410
- maxSize?: number | null | undefined;
411
- maxStack?: number | undefined;
412
- specialSlots?: Record<string, {
413
- type: string | null;
414
- }> | undefined;
415
- });
323
+ get maxStack(): number;
416
324
  /**
417
325
  * Sets the maximum stack size per item.
418
326
  * @param {number} value - Must be a positive integer.
@@ -420,10 +328,10 @@ declare class TinyInventory {
420
328
  */
421
329
  set maxStack(value: number);
422
330
  /**
423
- * Gets the maximum stack size allowed per item.
424
- * @returns {number}
331
+ * Gets the maximum item size allowed.
332
+ * @returns {number|null}
425
333
  */
426
- get maxStack(): number;
334
+ get maxSize(): number | null;
427
335
  /**
428
336
  * Sets the maximum item size.
429
337
  * @param {number|null} value - Must be a positive integer or null.
@@ -431,10 +339,10 @@ declare class TinyInventory {
431
339
  */
432
340
  set maxSize(value: number | null);
433
341
  /**
434
- * Gets the maximum item size allowed.
342
+ * Gets the maximum number of slots allowed.
435
343
  * @returns {number|null}
436
344
  */
437
- get maxSize(): number | null;
345
+ get maxSlots(): number | null;
438
346
  /**
439
347
  * Sets the maximum number of slots.
440
348
  * @param {number|null} value - Must be a positive integer or null.
@@ -442,21 +350,16 @@ declare class TinyInventory {
442
350
  */
443
351
  set maxSlots(value: number | null);
444
352
  /**
445
- * Gets the maximum number of slots allowed.
353
+ * Gets the maximum inventory weight allowed.
446
354
  * @returns {number|null}
447
355
  */
448
- get maxSlots(): number | null;
356
+ get maxWeight(): number | null;
449
357
  /**
450
358
  * Sets the maximum inventory weight.
451
359
  * @param {number|null} value - Must be a positive number or null.
452
360
  * @throws {Error} If the value is not null or a positive number.
453
361
  */
454
362
  set maxWeight(value: number | null);
455
- /**
456
- * Gets the maximum inventory weight allowed.
457
- * @returns {number|null}
458
- */
459
- get maxWeight(): number | null;
460
363
  /**
461
364
  * Gets the registered inventory event listeners.
462
365
  * Always returns a clone to prevent external mutation.
@@ -503,6 +406,25 @@ declare class TinyInventory {
503
406
  * @private
504
407
  */
505
408
  private _cleanNulls;
409
+ /**
410
+ * Creates a new TinyInventory instance.
411
+ *
412
+ * @param {Object} [options={}] - Configuration options for the inventory.
413
+ * @param {number|null} [options.maxWeight=null] - Maximum allowed total weight (null for no limit).
414
+ * @param {number|null} [options.maxSlots=null] - Maximum number of item slots (null for no limit).
415
+ * @param {number|null} [options.maxSize=null] - Maximum number of total item amount (null for no limit).
416
+ * @param {number} [options.maxStack=Infinity] - Global maximum stack size (per slot).
417
+ * @param {Record<string, { type: string | null; }>} [options.specialSlots] - IDs for special slots (e.g., "helmet", "weapon").
418
+ */
419
+ constructor(options?: {
420
+ maxWeight?: number | null;
421
+ maxSlots?: number | null;
422
+ maxSize?: number | null;
423
+ maxStack?: number;
424
+ specialSlots?: Record<string, {
425
+ type: string | null;
426
+ }>;
427
+ });
506
428
  /**
507
429
  * Checks if there is available space based on slot and weight limits.
508
430
  * @param {Object} [settings={}] - Optional configuration for the space check.
@@ -512,9 +434,9 @@ declare class TinyInventory {
512
434
  * @returns {boolean} True if there is space; false otherwise.
513
435
  */
514
436
  hasSpace({ weight, sizeLength, slotsLength }?: {
515
- weight?: number | undefined;
516
- sizeLength?: number | undefined;
517
- slotsLength?: number | undefined;
437
+ weight?: number;
438
+ sizeLength?: number;
439
+ slotsLength?: number;
518
440
  }): boolean;
519
441
  /**
520
442
  * Checks if the inventory weight exceeds the maximum allowed limit,
@@ -608,9 +530,9 @@ declare class TinyInventory {
608
530
  */
609
531
  addItem({ itemId, quantity, metadata, forceSpace }: {
610
532
  itemId: string;
611
- forceSpace?: boolean | undefined;
612
- quantity?: number | undefined;
613
- metadata?: InventoryMetadata | undefined;
533
+ forceSpace?: boolean;
534
+ quantity?: number;
535
+ metadata?: InventoryMetadata;
614
536
  }): AddItemResult;
615
537
  /**
616
538
  * Gets the item stored at a specific slot.
@@ -632,7 +554,7 @@ declare class TinyInventory {
632
554
  setItem({ slotIndex, item, forceSpace }: {
633
555
  slotIndex: number;
634
556
  item: InventoryItem | null;
635
- forceSpace?: boolean | undefined;
557
+ forceSpace?: boolean;
636
558
  }): void;
637
559
  /**
638
560
  * Deletes an item from a specific slot by setting it to null.
@@ -660,8 +582,8 @@ declare class TinyInventory {
660
582
  */
661
583
  removeItem({ itemId, metadata, quantity }: {
662
584
  itemId: string;
663
- metadata?: InventoryMetadata | null | undefined;
664
- quantity?: number | undefined;
585
+ metadata?: InventoryMetadata | null;
586
+ quantity?: number;
665
587
  }): boolean;
666
588
  /**
667
589
  * Uses an item from a specific slot, or special slot,
@@ -677,9 +599,9 @@ declare class TinyInventory {
677
599
  * @throws {Error} - If the item is not found in the specified location.
678
600
  */
679
601
  useItem({ slotIndex, specialSlot, forceSpace }: {
680
- slotIndex?: number | undefined;
681
- specialSlot?: string | undefined;
682
- forceSpace?: boolean | undefined;
602
+ slotIndex?: number;
603
+ specialSlot?: string;
604
+ forceSpace?: boolean;
683
605
  }, ...args: any[]): any;
684
606
  /**
685
607
  * Checks if a special slot with the given ID exists in the inventory.
@@ -713,7 +635,7 @@ declare class TinyInventory {
713
635
  setSpecialSlot({ slotId, item, forceSpace }: {
714
636
  slotId: string;
715
637
  item: InventoryItem | null;
716
- forceSpace?: boolean | undefined;
638
+ forceSpace?: boolean;
717
639
  }): void;
718
640
  /**
719
641
  * Deletes an item from a specific special slot by setting it to null.
@@ -743,8 +665,8 @@ declare class TinyInventory {
743
665
  equipItem({ slotId, slotIndex, quantity, forceSpace }: {
744
666
  slotId: string;
745
667
  slotIndex: number;
746
- quantity?: number | undefined;
747
- forceSpace?: boolean | undefined;
668
+ quantity?: number;
669
+ forceSpace?: boolean;
748
670
  }): number;
749
671
  /**
750
672
  * Unequips a specific quantity of an item from a special slot
@@ -761,8 +683,8 @@ declare class TinyInventory {
761
683
  */
762
684
  unequipItem({ slotId, quantity, forceSpace }: {
763
685
  slotId: string;
764
- quantity?: number | null | undefined;
765
- forceSpace?: boolean | undefined;
686
+ quantity?: number | null;
687
+ forceSpace?: boolean;
766
688
  }): boolean;
767
689
  /**
768
690
  * Returns all items from the inventory with their respective indexes.
@@ -866,6 +788,21 @@ declare class TinyInventory {
866
788
  * @returns {string} JSON string.
867
789
  */
868
790
  toJSON(space?: number): string;
869
- #private;
791
+ /**
792
+ * Rebuilds a TinyInventory from a plain object created by {@link TinyInventory.toObject}.
793
+ * Item definitions (ItemRegistry) must be already defined externally; this method only restores state.
794
+ *
795
+ * @param {SerializedInventory} obj - Parsed JSON object.
796
+ * @returns {TinyInventory} A new TinyInventory instance populated with the saved state.
797
+ * @throws {Error} If validation fails and `validate` is true.
798
+ */
799
+ static fromObject(obj: SerializedInventory): TinyInventory;
800
+ /**
801
+ * Rebuilds a TinyInventory from a JSON string produced by {@link TinyInventory.toJSON}.
802
+ * @param {string} json - JSON string.
803
+ * @returns {TinyInventory} A new TinyInventory instance.
804
+ */
805
+ static fromJSON(json: string): TinyInventory;
870
806
  }
807
+ export default TinyInventory;
871
808
  //# sourceMappingURL=TinyInventory.d.mts.map
@@ -1,34 +1,31 @@
1
- export default TinyInventoryTrader;
2
- export type InventoryMetadata = import("./TinyInventory.mjs").InventoryMetadata;
3
- export type AddItemResult = import("./TinyInventory.mjs").AddItemResult;
4
- /**
5
- * - Transfer configuration.
6
- */
1
+ import TinyInventory from './TinyInventory.mjs';
2
+ export type InventoryMetadata = import('./TinyInventory.mjs').InventoryMetadata;
3
+ export type AddItemResult = import('./TinyInventory.mjs').AddItemResult;
7
4
  export type TransferItemCfg = {
8
5
  /**
9
6
  * - Sender slot index.
10
7
  */
11
- slotIndex?: number | undefined;
8
+ slotIndex?: number;
12
9
  /**
13
10
  * - Receiver slot index (optional).
14
11
  */
15
- receiverSlotIndex?: number | undefined;
12
+ receiverSlotIndex?: number;
16
13
  /**
17
14
  * - Sender special slot ID.
18
15
  */
19
- specialSlot?: string | undefined;
16
+ specialSlot?: string;
20
17
  /**
21
18
  * - Quantity to transfer.
22
19
  */
23
- quantity?: number | undefined;
20
+ quantity?: number;
24
21
  /**
25
22
  * - Whether to force addition even if space is limited.
26
23
  */
27
- forceSpace?: boolean | undefined;
24
+ forceSpace?: boolean;
28
25
  /**
29
26
  * - If true, transfer will throw if not all items can fit.
30
27
  */
31
- strict?: boolean | undefined;
28
+ strict?: boolean;
32
29
  };
33
30
  /** @typedef {import('./TinyInventory.mjs').InventoryMetadata} InventoryMetadata */
34
31
  /** @typedef {import('./TinyInventory.mjs').AddItemResult} AddItemResult */
@@ -45,20 +42,21 @@ export type TransferItemCfg = {
45
42
  * Class responsible for managing item transfers between two TinyInventory instances.
46
43
  */
47
44
  declare class TinyInventoryTrader {
45
+ #private;
46
+ /** @returns {TinyInventory|null} The currently connected sender inventory. */
47
+ get sender(): TinyInventory | null;
48
+ /** @returns {TinyInventory|null} The currently connected receiver inventory. */
49
+ get receiver(): TinyInventory | null;
50
+ /** @param {TinyInventory} value Sets the sender inventory. */
51
+ set sender(value: TinyInventory);
52
+ /** @param {TinyInventory} value Sets the receiver inventory. */
53
+ set receiver(value: TinyInventory);
48
54
  /**
49
55
  * Manages item transfers between two TinyInventory instances.
50
56
  * @param {TinyInventory} [sender] - Inventory to remove items from.
51
57
  * @param {TinyInventory} [receiver] - Inventory to add items to.
52
58
  */
53
59
  constructor(sender?: TinyInventory, receiver?: TinyInventory);
54
- /** @param {TinyInventory} value Sets the sender inventory. */
55
- set sender(value: TinyInventory);
56
- /** @returns {TinyInventory|null} The currently connected sender inventory. */
57
- get sender(): TinyInventory | null;
58
- /** @param {TinyInventory} value Sets the receiver inventory. */
59
- set receiver(value: TinyInventory);
60
- /** @returns {TinyInventory|null} The currently connected receiver inventory. */
61
- get receiver(): TinyInventory | null;
62
60
  /**
63
61
  * Connects the sender and receiver inventories for trading.
64
62
  * @param {TinyInventory} sender - Inventory to remove items from.
@@ -89,7 +87,6 @@ declare class TinyInventoryTrader {
89
87
  * @returns {Partial<AddItemResult>[]} Array of remaining quantities for each item.
90
88
  */
91
89
  transferMultiple(items: TransferItemCfg[]): Partial<AddItemResult>[];
92
- #private;
93
90
  }
94
- import TinyInventory from './TinyInventory.mjs';
91
+ export default TinyInventoryTrader;
95
92
  //# sourceMappingURL=TinyInventoryTrader.d.mts.map
@@ -1,6 +1,10 @@
1
- export default TinyLevelUp;
2
1
  /**
3
2
  * Represents a user object used.
3
+ *
4
+ * @typedef {Object} UserEditor
5
+ * @property {number} exp - Current experience points of the user.
6
+ * @property {number} level - Current level of the user.
7
+ * @property {number} totalExp - Total accumulated experience.
4
8
  */
5
9
  export type UserEditor = {
6
10
  /**
@@ -16,26 +20,18 @@ export type UserEditor = {
16
20
  */
17
21
  totalExp: number;
18
22
  };
19
- /**
20
- * Represents a user object used.
21
- *
22
- * @typedef {Object} UserEditor
23
- * @property {number} exp - Current experience points of the user.
24
- * @property {number} level - Current level of the user.
25
- * @property {number} totalExp - Total accumulated experience.
26
- */
27
23
  /**
28
24
  * Class to manage user level-up logic based on experience points.
29
25
  */
30
26
  declare class TinyLevelUp {
27
+ giveExp: number;
28
+ expLevel: number;
31
29
  /**
32
30
  * Constructor
33
31
  * @param {number} giveExp - Base experience value for random experience generation.
34
32
  * @param {number} expLevel - Base experience needed to level up (per level).
35
33
  */
36
34
  constructor(giveExp: number, expLevel: number);
37
- giveExp: number;
38
- expLevel: number;
39
35
  /**
40
36
  * Creates a new user object starting at level 0 with 0 experience.
41
37
  * @returns {UserEditor} A fresh user object.
@@ -128,7 +124,7 @@ declare class TinyLevelUp {
128
124
  * @param {number} [multi] - Multiplier for experience generation.
129
125
  * @returns {UserEditor} The updated user object.
130
126
  */
131
- give(user: UserEditor, extraExp?: number, type?: "add" | "extra", multi?: number): UserEditor;
127
+ give(user: UserEditor, extraExp?: number, type?: 'add' | 'extra', multi?: number): UserEditor;
132
128
  /**
133
129
  * Removes experience from the user, adjusting their level if necessary.
134
130
  * @param {UserEditor} user - The user object.
@@ -137,6 +133,7 @@ declare class TinyLevelUp {
137
133
  * @param {number} [multi] - Multiplier for experience generation.
138
134
  * @returns {UserEditor} The updated user object.
139
135
  */
140
- remove(user: UserEditor, extraExp?: number, type?: "add" | "extra", multi?: number): UserEditor;
136
+ remove(user: UserEditor, extraExp?: number, type?: 'add' | 'extra', multi?: number): UserEditor;
141
137
  }
138
+ export default TinyLevelUp;
142
139
  //# sourceMappingURL=TinyLevelUp.d.mts.map
@@ -1,15 +1,12 @@
1
- export default TinyLoadingScreen;
2
1
  /**
3
2
  * Represents the possible states of the loading screen.
4
3
  * - `'none'` → Not visible
5
4
  * - `'fadeIn'` → Appearing with fade-in animation
6
5
  * - `'active'` → Fully visible and active
7
6
  * - `'fadeOut'` → Disappearing with fade-out animation
7
+ * @typedef {'none'|'active'|'fadeIn'|'fadeOut'} LoadingStatus
8
8
  */
9
- export type LoadingStatus = "none" | "active" | "fadeIn" | "fadeOut";
10
- /**
11
- * Configuration options for the loading screen.
12
- */
9
+ export type LoadingStatus = 'none' | 'active' | 'fadeIn' | 'fadeOut';
13
10
  export type LoadingSettings = {
14
11
  /**
15
12
  * - Duration of fade-in animation in milliseconds, or `null` to disable.
@@ -24,14 +21,6 @@ export type LoadingSettings = {
24
21
  */
25
22
  zIndex: number;
26
23
  };
27
- /**
28
- * Represents the possible states of the loading screen.
29
- * - `'none'` → Not visible
30
- * - `'fadeIn'` → Appearing with fade-in animation
31
- * - `'active'` → Fully visible and active
32
- * - `'fadeOut'` → Disappearing with fade-out animation
33
- * @typedef {'none'|'active'|'fadeIn'|'fadeOut'} LoadingStatus
34
- */
35
24
  /**
36
25
  * Configuration options for the loading screen.
37
26
  * @typedef {Object} LoadingSettings
@@ -53,67 +42,68 @@ export type LoadingSettings = {
53
42
  * @class
54
43
  */
55
44
  declare class TinyLoadingScreen {
56
- /**
57
- * Creates a new TinyLoadingScreen instance.
58
- * @param {HTMLElement} [container=document.body] - The container element where the overlay should be appended.
59
- * @throws {TypeError} If container is not an HTMLElement.
60
- */
61
- constructor(container?: HTMLElement);
45
+ #private;
62
46
  /** @returns {HTMLDivElement|null} The overlay element if active, otherwise `null`. */
63
47
  get overlay(): HTMLDivElement | null;
64
48
  /** @returns {HTMLDivElement|null} The element used to render the message, or `null` if inactive. */
65
49
  get messageElement(): HTMLDivElement | null;
66
50
  /** @returns {HTMLElement} The container element that holds the overlay. */
67
51
  get container(): HTMLElement;
52
+ /** @returns {LoadingSettings} A copy of the current configuration options. */
53
+ get options(): LoadingSettings;
68
54
  /**
69
55
  * Updates the loading screen options.
70
56
  * @param {Partial<LoadingSettings>} value - New configuration values.
71
57
  * @throws {TypeError} If any option has an invalid type or value.
72
58
  */
73
59
  set options(value: Partial<LoadingSettings>);
74
- /** @returns {LoadingSettings} A copy of the current configuration options. */
75
- get options(): LoadingSettings;
76
60
  /** @returns {LoadingStatus} The current loading screen status. */
77
61
  get status(): LoadingStatus;
62
+ /** @returns {string|HTMLElement} The default message. */
63
+ get defaultMessage(): string | HTMLElement;
78
64
  /**
79
65
  * @param {string|HTMLElement} value - New default message.
80
66
  * @throws {TypeError} If the value is neither a string nor an HTMLElement.
81
67
  */
82
68
  set defaultMessage(value: string | HTMLElement);
83
- /** @returns {string|HTMLElement} The default message. */
84
- get defaultMessage(): string | HTMLElement;
85
69
  /** @returns {string|HTMLElement|null} The currently displayed message. */
86
70
  get message(): string | HTMLElement | null;
71
+ /** @returns {boolean} True if HTML is allowed inside string messages. */
72
+ get allowHtmlText(): boolean;
87
73
  /**
88
74
  * Enables or disables HTML rendering in string messages.
89
75
  * @param {boolean} value - Whether to allow HTML.
90
76
  * @throws {TypeError} If value is not a boolean.
91
77
  */
92
78
  set allowHtmlText(value: boolean);
93
- /** @returns {boolean} True if HTML is allowed inside string messages. */
94
- get allowHtmlText(): boolean;
95
79
  /** @returns {boolean} Whether a fadeIn timeout is currently pending. */
96
80
  get fadeInTimeout(): boolean;
97
81
  /** @returns {boolean} Whether a fadeOut timeout is currently pending. */
98
82
  get fadeOutTimeout(): boolean;
99
83
  /** @returns {boolean} True if the overlay is currently visible. */
100
84
  get visible(): boolean;
85
+ /**
86
+ * Returns the current status-change callback.
87
+ * @returns {((status: LoadingStatus) => void) | null}
88
+ */
89
+ get onChange(): ((status: LoadingStatus) => void) | null;
101
90
  /**
102
91
  * Sets the status-change callback.
103
92
  * @param {((status: LoadingStatus) => void) | null} value
104
93
  * @throws {TypeError} If value is neither a function nor null.
105
94
  */
106
95
  set onChange(value: ((status: LoadingStatus) => void) | null);
107
- /**
108
- * Returns the current status-change callback.
109
- * @returns {((status: LoadingStatus) => void) | null}
110
- */
111
- get onChange(): ((status: LoadingStatus) => void) | null;
112
96
  /**
113
97
  * Internal helper to emit the onChange callback.
114
98
  * @private
115
99
  */
116
100
  private _emitChange;
101
+ /**
102
+ * Creates a new TinyLoadingScreen instance.
103
+ * @param {HTMLElement} [container=document.body] - The container element where the overlay should be appended.
104
+ * @throws {TypeError} If container is not an HTMLElement.
105
+ */
106
+ constructor(container?: HTMLElement);
117
107
  /**
118
108
  * Internal helper to update the displayed message.
119
109
  * @param {string|HTMLElement} [message=this.#defaultMessage] - The new message.
@@ -149,6 +139,6 @@ declare class TinyLoadingScreen {
149
139
  * @returns {boolean} `true` if the overlay was removed, `false` if not active.
150
140
  */
151
141
  stop(): boolean;
152
- #private;
153
142
  }
143
+ export default TinyLoadingScreen;
154
144
  //# sourceMappingURL=TinyLoadingScreen.d.mts.map